Skip to content

Commit 57c1f82

Browse files
authored
Merge pull request #266 from wuseal/fix/#265
🐛 fix #265 by adding custom gradle script to generate JAR file
2 parents 6998355 + 922b4f6 commit 57c1f82

File tree

9 files changed

+33
-7
lines changed

9 files changed

+33
-7
lines changed

LIBRARY.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ We also have a `Java/Kotlin` library. With this you can convert `JSON` to `Kotli
44

55
## Installation
66

7-
Download `jar` file from [here](library/output/JsonToKotlinClassLibrary-v3.5.1.jar) and add it to your project
7+
Download `jar` file from [here](library/output/JsonToKotlinClassLibrary-3.5.1-alpha01.jar) and add it to your project.
8+
9+
10+
If your project is not in `Kotlin`, don't forgot to add kotlin runtime dependency.
11+
12+
```groovy
13+
// replace `1.3.61` with latest kotlin runtime version
14+
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.3.61'
15+
```
816

917
## Usage
1018

library/META-INF/MANIFEST.MF

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Manifest-Version: 1.0
2+
Class-Path: kotlin-stdlib-jdk7-1.3.60.jar JsonToKotlinClass-3.5.1.jar an
3+
notations-13.0.jar gson-2.8.6.jar kotlin-stdlib-common-1.3.60.jar kotli
4+
n-stdlib-1.3.60.jar kotlin-stdlib-jdk8-1.3.60.jar
5+

library/build.gradle

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ plugins {
22
id 'org.jetbrains.kotlin.jvm' version '1.3.60'
33
}
44

5-
group 'org.example'
6-
version '1.0-SNAPSHOT'
5+
group 'wu.seal.jsontokotlin'
6+
version '3.5.1-alpha01'
77

88
repositories {
99
mavenCentral()
1010
}
1111

1212
dependencies {
1313
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
14-
implementation 'com.google.code.gson:gson:2.8.6'
1514
testImplementation "junit:junit:4.12"
1615
testImplementation('com.winterbe:expekt:0.5.0') {
1716
exclude group: "org.jetbrains.kotlin"
@@ -24,4 +23,16 @@ compileKotlin {
2423
}
2524
compileTestKotlin {
2625
kotlinOptions.jvmTarget = "1.8"
27-
}
26+
}
27+
28+
//create a single Jar with all dependencies
29+
task fatJar(type: Jar) {
30+
manifest {
31+
attributes 'Implementation-Title': 'JsonToKotlin Library',
32+
'Implementation-Version': version,
33+
'Main-Class': ''
34+
}
35+
baseName = project.name
36+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
37+
with jar
38+
}

library/libs/gson-2.8.6.jar

235 KB
Binary file not shown.
666 KB
Binary file not shown.
-2.13 MB
Binary file not shown.

library/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
rootProject.name = 'library'
1+
rootProject.name = 'JsonToKotlinClassLibrary'
22

library/src/main/kotlin/wu/seal/jsontokotlin/JsonToKotlinBuilder.kt renamed to library/src/main/kotlin/wu/seal/jsontokotlin/library/JsonToKotlinBuilder.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
package wu.seal.jsontokotlin
1+
package wu.seal.jsontokotlin.library
22

33
import extensions.chen.biao.KeepAnnotationSupport
44
import extensions.jose.han.ParcelableAnnotationSupport
55
import extensions.ted.zeng.PropertyAnnotationLineSupport
66
import extensions.wu.seal.*
77
import extensions.xu.rui.PrimitiveTypeNonNullableSupport
8+
import wu.seal.jsontokotlin.*
89
import wu.seal.jsontokotlin.interceptor.InterceptorManager
910
import wu.seal.jsontokotlin.test.TestConfig
1011
import wu.seal.jsontokotlin.utils.ClassImportDeclaration

library/src/test/kotlin/wu/seal/jsontokotlin/JsonToKotlinBuilderTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package wu.seal.jsontokotlin
22

33
import com.winterbe.expekt.should
44
import org.junit.Test
5+
import wu.seal.jsontokotlin.library.JsonToKotlinBuilder
56

67
class JsonToKotlinBuilderTest {
78

0 commit comments

Comments
 (0)