Skip to content

Commit 2fcf65e

Browse files
committed
update build script
1 parent 3e8d5f1 commit 2fcf65e

File tree

1 file changed

+51
-52
lines changed

1 file changed

+51
-52
lines changed

build.gradle

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
plugins {
2-
id 'java'
2+
id 'java-library'
33
id 'idea'
4-
id 'com.google.osdetector' version '1.4.0'
4+
id 'com.google.osdetector' version '1.6.2'
5+
id 'io.freefair.lombok' version '3.8.4'
6+
id 'maven-publish'
57
}
68

79
group 'org.onedrive'
@@ -10,83 +12,62 @@ version '0.10.0'
1012
compileJava {
1113
sourceCompatibility = 1.7
1214
targetCompatibility = 1.7
13-
14-
options.compilerArgs << "-Xlint:unchecked"
1515
}
1616

1717
compileTestJava {
1818
sourceCompatibility = 1.8
1919
targetCompatibility = 1.8
20-
21-
options.compilerArgs << "-Xlint:unchecked"
2220
}
2321

2422
repositories {
2523
jcenter()
2624
}
2725

26+
ext {
27+
nettyVer = '4.1.38.Final'
28+
jacksonVer = '2.10.0.pr1'
29+
}
30+
2831
dependencies {
29-
compile 'com.fasterxml.jackson.core:jackson-annotations:+'
30-
compile 'com.fasterxml.jackson.core:jackson-core:+'
32+
implementation "com.fasterxml.jackson.core:jackson-annotations:$jacksonVer"
33+
implementation "com.fasterxml.jackson.core:jackson-core:$jacksonVer"
3134

32-
compile 'io.netty:netty-buffer:4.+'
33-
compile 'io.netty:netty-codec:4.+'
34-
compile 'io.netty:netty-codec-http:4.+'
35-
compile 'io.netty:netty-common:4.+'
36-
compile 'io.netty:netty-handler:4.+'
37-
compile 'io.netty:netty-resolver:4.+'
38-
compile 'io.netty:netty-transport:4.+'
35+
api "io.netty:netty-buffer:$nettyVer"
36+
api "io.netty:netty-codec:$nettyVer"
37+
api "io.netty:netty-codec-http:$nettyVer"
38+
api "io.netty:netty-common:$nettyVer"
39+
api "io.netty:netty-handler:$nettyVer"
40+
api "io.netty:netty-resolver:$nettyVer"
41+
api "io.netty:netty-transport:$nettyVer"
3942

4043

41-
if (osdetector.os == 'linux' || osdetector.os == 'osx' || osdetector.os.endsWith('bsd')) {
42-
compile "io.netty:netty-transport-native-epoll:4.+:${osdetector.classifier}"
44+
if (osdetector.os == 'linux') {
45+
implementation "io.netty:netty-transport-native-epoll:4.+:${osdetector.classifier}"
46+
}
47+
else if (osdetector.os == 'osx' || osdetector.os.endsWith('bsd')) {
48+
implementation "io.netty:netty-transport-native-kqueue:4.+:${osdetector.classifier}"
4349
}
4450

51+
api 'org.jetbrains:annotations:+'
4552

46-
compile 'org.projectlombok:lombok:+'
47-
48-
compile 'org.jetbrains:annotations:+'
49-
50-
testCompile 'com.fasterxml.jackson.core:jackson-databind:+'
51-
testCompileOnly 'org.apiguardian:apiguardian-api:+'
53+
testCompile "com.fasterxml.jackson.core:jackson-databind:$jacksonVer"
5254
testCompile 'org.junit.jupiter:junit-jupiter-api:5.+'
5355
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.+'
5456
}
5557

56-
57-
task delombok(dependsOn: compileJava) {
58-
ext.srcDelomboked = file("${buildDir}/delomboked")
59-
outputs.dir(ext.srcDelomboked)
60-
61-
// older version: lombok.delombok.ant.DelombokTask
62-
// recent version: lombok.delombok.ant.Tasks$Delombok
63-
ant.taskdef(name: 'delombok', classname: 'lombok.delombok.ant.Tasks$Delombok',
64-
classpath: configurations.compile.asPath)
65-
66-
sourceSets.main.java.srcDirs.each {
67-
inputs.dir(it)
68-
}
69-
70-
doLast {
71-
sourceSets.main.java.srcDirs.each {
72-
ant.delombok(from: it, to: ext.srcDelomboked, encoding: 'UTF-8', classpath: configurations.compile.asPath)
73-
}
74-
}
75-
}
76-
7758
javadoc {
78-
dependsOn delombok
79-
options.addBooleanOption('html5').setValue(true)
80-
source = delombok.srcDelomboked
59+
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
60+
options.addBooleanOption('html5').setValue(true)
61+
}
8162
}
8263

83-
task sourcesJar(type: Jar, dependsOn: classes) {
84-
classifier = 'sources'
85-
from sourceSets.main.allSource
64+
task sourcesJar(type: Jar) {
65+
archiveClassifier = 'sources'
66+
from sourceSets.main.allJava
8667
}
8768

88-
task javadocJar(type: Jar, dependsOn: javadoc) {
89-
classifier = 'javadoc'
69+
task javadocJar(type: Jar) {
70+
archiveClassifier = 'javadoc'
9071
from javadoc.destinationDir
9172
}
9273

@@ -95,3 +76,21 @@ artifacts {
9576
archives sourcesJar
9677
archives javadocJar
9778
}
79+
80+
publishing {
81+
publications {
82+
myLibrary(MavenPublication) {
83+
from components.java
84+
85+
artifact sourcesJar
86+
artifact javadocJar
87+
}
88+
}
89+
90+
repositories {
91+
maven {
92+
name = 'myRepo'
93+
url = "file://${buildDir}/repo"
94+
}
95+
}
96+
}

0 commit comments

Comments
 (0)