-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
119 lines (99 loc) · 2.76 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
plugins {
id 'java'
id "io.freefair.lombok" version "8.7.1"
id 'com.github.johnrengelman.shadow' version '8.1.1'
id "dev.tocraft.preprocessor" version "1.0"
id 'maven-publish'
id "com.hypherionmc.modutils.orion" version "1.0.+"
}
group = 'dev.firstdark.discordrpc'
orion.setup {
versioning {
identifier("release")
uploadBuild(true)
}
}
repositories {
mavenCentral()
}
configurations {
shade
implementation.extendsFrom shade
}
dependencies {
implementation "com.google.code.gson:gson:${gson}"
implementation "org.jetbrains:annotations:${jetbrains}"
implementation "org.slf4j:slf4j-api:${slf4j}"
shade("com.kohlschutter.junixsocket:junixsocket-common:${junix}")
shade("com.kohlschutter.junixsocket:junixsocket-native-common:${junix}")
runtimeOnly "ch.qos.logback:logback-classic:${logback}"
}
shadowJar {
from sourceSets.main.output
configurations = [project.configurations.shade]
// Remove stuff we don't need from the jar
exclude("**/DEPENDENCIES*")
exclude("**/LICENSE*")
exclude("**/Log4J*")
exclude("logback.xml")
exclude("META-INF/NOTICE*")
exclude("META-INF/maven/**")
exclude("META-INF/versions/**")
exclude("META-INF/native-image/**")
// Remove unneeded/unsupported platforms
exclude("lib/*BSD*/**")
exclude("lib/*Sun*/**")
exclude("lib/*Window*/**")
exclude("lib/aarch64-Linux*/**")
exclude("lib/ppc*/**")
exclude("lib/risc*/**")
exclude("lib/s390x*/**")
exclude("lib/arm*/**")
setArchiveClassifier('dev-shadow')
mergeServiceFiles()
}
tasks.register("compileLegacy", org.gradle.jvm.tasks.Jar) {
setArchiveClassifier("legacy")
compileJava.options.release.set(8)
from(zipTree(shadowJar.archiveFile))
dependsOn(shadowJar)
doLast {
delete(shadowJar.archiveFile)
}
}
tasks.register("compileModern", org.gradle.jvm.tasks.Jar) {
preprocess.vars.put("modernjava", "1")
compileJava.options.release.set(16)
from(sourceSets.main.output)
dependsOn(compileJava)
}
tasks.register("buildAll", DefaultTask) {
dependsOn(compileLegacy, compileModern)
group("build")
}
tasks.register('javadocJar', Jar) {
from javadoc
setArchiveClassifier('javadoc')
}
tasks.register('sourcesJar', Jar) {
from sourceSets.main.allJava
setArchiveClassifier('sources')
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact(compileLegacy) {
builtBy compileLegacy
}
artifact(compileModern) {
builtBy compileModern
}
artifact sourcesJar
artifact javadocJar
}
}
repositories {
maven orion.getPublishingMaven()
}
}
javadoc.enabled = true