-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
295 lines (253 loc) · 9.57 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
plugins {
id 'com.android.library' version '8.1.0' apply false
}
def coreProjects = [project(':core')]
def desktopProjects = [project(':desktop')]
def androidProjects = [project(':android')]
subprojects {
apply plugin: 'signing'
apply plugin: 'maven-publish'
ext {
libraryName = 'Unrefined'
libraryGroupName = 'unrefined'
libraryPublishGroupName = 'io.github.unrefined-framework'
libraryDescription = 'Cross-platform multimedia application framework written in pure Java.'
libraryUrl = 'https://github.com/unrefined-framework/unrefined'
libraryVersionCode = '92-SNAPSHOT'
libraryVersionName = '0.9.2-SNAPSHOT'
libraryVersionCodeName = 'Claw Hammer'
libraryLicenseName = 'The Apache License, Version 2.0'
libraryLicenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
libraryScmConnection = 'scm:git:[email protected]/unrefined-framework/unrefined.git'
libraryScmDeveloperConnection = libraryScmConnection
libraryScmUrl = libraryUrl
libraryDevelopersId = 'Unrefined'
libraryDevelopersName = 'Unrefined Contributors'
libraryDeveloperId = 'Tianscar'
libraryDeveloperName = 'Karstian Lee'
libraryDeveloperEmail = '[email protected]'
libraryAndroidCompileSdk = 33
libraryAndroidMinSdk = 19
libraryAndroidTargetSdk = 33
libraryCoreSourceCompatibility = JavaVersion.VERSION_1_8
libraryCoreTargetCompatibility = JavaVersion.VERSION_1_8
libraryAndroidSourceCompatibility = JavaVersion.VERSION_1_8
libraryAndroidTargetCompatibility = JavaVersion.VERSION_1_8
libraryDesktopSourceCompatibility = JavaVersion.VERSION_1_8
libraryDesktopTargetCompatibility = JavaVersion.VERSION_1_8
}
group libraryGroupName
version libraryVersionCode
// FIXME cleanup Javadocs from errors
tasks.withType(Javadoc) {
failOnError false
options.addStringOption('Xdoclint:none', '-quiet')
}
}
configure (coreProjects) {
apply plugin: 'java-library'
ext.unrefinedManifestDescription = 'Unrefined Core API'
sourceCompatibility = libraryCoreSourceCompatibility
targetCompatibility = libraryCoreTargetCompatibility
}
configure (desktopProjects) {
apply plugin: 'java-library'
ext.unrefinedManifestDescription = 'Unrefined For Java Standard Edition'
sourceCompatibility = libraryDesktopSourceCompatibility
targetCompatibility = libraryDesktopTargetCompatibility
if (JavaVersion.current().ordinal() >= 21) {
tasks.withType(Test).configureEach {
jvmArgs += '--enable-native-access=ALL-UNNAMED'
}
tasks.withType(JavaExec).configureEach {
jvmArgs += '--enable-native-access=ALL-UNNAMED'
}
}
}
configure (coreProjects + desktopProjects) {
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
dependencies {
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
test {
useJUnitPlatform()
}
java {
withJavadocJar()
withSourcesJar()
}
ext.unrefinedResourcesDir = file("$buildDir/unrefined-resources/main")
ext.unrefinedManifest = file("$unrefinedResourcesDir/META-INF/unrefined/MANIFEST.MF")
tasks.register('generateUnrefinedManifest') {
outputs.file(unrefinedManifest)
doLast {
def tmp = libraryGroupName + '.' + project.name.replaceAll('-', '.')
unrefinedManifest.text =
"""Manifest-Version: 1.0
Specification-Vendor: $libraryDevelopersName
Specification-Title: $unrefinedManifestDescription
Specification-Version: $libraryVersionCodeName
Implementation-Vendor: $libraryDevelopersId
Implementation-Title: $tmp
Implementation-Version: $libraryVersionName
"""
}
}
sourceSets.main.output.dir unrefinedResourcesDir, builtBy: generateUnrefinedManifest
/*
jar {
manifest {
attributes 'Specification-Vendor': libraryDevelopersName
attributes 'Specification-Title': libraryName
attributes 'Specification-Version': libraryVersionCodeName
attributes 'Implementation-Vendor': libraryDevelopersId
attributes 'Implementation-Title': libraryGroupName + '.' + project.name.replaceAll('-', '.')
attributes 'Implementation-Version': libraryVersionName
}
}
*/
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = libraryPublishGroupName
artifactId = "${rootProject.name}-${project.name}"
version = libraryVersionName
from components.java
pom {
name = libraryPublishGroupName
description = libraryDescription
url = libraryUrl
licenses {
license {
name = libraryLicenseName
url = libraryLicenseUrl
}
}
developers {
developer {
id = libraryDeveloperId
name = libraryDeveloperName
email = libraryDeveloperEmail
}
}
scm {
connection = libraryScmConnection
developerConnection = libraryScmDeveloperConnection
url = libraryScmUrl
}
}
}
}
repositories {
maven {
name = "OSSRH"
if (project.version.toString().endsWith("-SNAPSHOT")) {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots"
} else {
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
credentials {
username = findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME")
password = findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD")
}
}
}
}
signing {
sign(publishing.publications.mavenJava)
}
}
configure (androidProjects) {
apply plugin: 'com.android.library'
android {
namespace libraryGroupName + '.' + project.name.replaceAll('-', '.')
compileSdk libraryAndroidCompileSdk
defaultConfig {
minSdk libraryAndroidMinSdk
targetSdk libraryAndroidTargetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility libraryAndroidSourceCompatibility
targetCompatibility libraryAndroidTargetCompatibility
}
}
dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
android {
publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}
}
publishing {
publications {
release(MavenPublication) {
groupId = libraryPublishGroupName
artifactId = "${rootProject.name}-${project.name}"
version = libraryVersionName
afterEvaluate {
from components.release
}
pom {
name = libraryPublishGroupName
description = libraryDescription
url = libraryUrl
licenses {
license {
name = libraryLicenseName
url = libraryLicenseUrl
}
}
developers {
developer {
id = libraryDeveloperId
name = libraryDeveloperName
email = libraryDeveloperEmail
}
}
scm {
connection = libraryScmConnection
developerConnection = libraryScmDeveloperConnection
url = libraryScmUrl
}
}
}
}
repositories {
maven {
name = "OSSRH"
if (project.version.toString().endsWith("-SNAPSHOT")) {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots"
} else {
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
credentials {
username = findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME")
password = findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD")
}
}
}
}
signing {
sign(publishing.publications.release)
}
}