-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
130 lines (105 loc) · 3.33 KB
/
build.gradle.kts
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
plugins {
`java-library`
`maven-publish`
signing
id("com.github.johnrengelman.shadow") version "7.1.0"
}
group = "io.github.astrarre"
version = "1.0.0-SNAPSHOT"
val shadowJavac by configurations.registering
repositories {
mavenCentral()
maven {
name = "FabricMC"
url = uri("https://maven.fabricmc.net/")
}
}
dependencies {
implementation("net.fabricmc", "mapping-io", "0.3.0")
implementation(files(RepackagedJavacProvider.createJavacJar(buildDir)))
// This doesn't work :suffer:
// "shadowJavac"(files(zipTree("D:\\Programs\\AdoptOpenJDK\\jdk-16.0.1.9-hotspot\\jmods\\jdk.compiler.jmod")))
// This works
// "shadowJavac"("net.fabricmc", "mapping-io", "0.3.0")
// How do I ziptree a single jmod file
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.8.1")
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine")
testRuntimeOnly("org.junit.platform", "junit-platform-launcher")
}
sourceSets {
val main by this
create("console") {
java {
compileClasspath += main.output + main.compileClasspath
runtimeClasspath += main.output + main.runtimeClasspath
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
withSourcesJar()
// withJavadocJar()
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(16)
}
withType<Test> {
useJUnitPlatform()
}
withType<Javadoc> {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
shadowJar {
configurations = listOf(shadowJavac.get())
relocate("com.sun", "io.github.astrarre.sfu.shadow.com.sun")
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifact(tasks.shadowJar) {
classifier = null
}
artifact(tasks["sourcesJar"])
if (signing.signatory != null) {
signing.sign(this)
}
pom {
name.set("Source Fixer Upper")
packaging = "jar"
description.set("A fast remapper for Java source code")
url.set("https://github.com/Astrarre/Source-Fixer-Upper")
licenses {
license {
name.set("MIT License")
url.set("https://spdx.org/licenses/MIT")
}
}
}
}
}
repositories {
mavenLocal()
maven {
val releasesRepoUrl = uri("${buildDir}/repos/releases")
val snapshotsRepoUrl = uri("${buildDir}/repos/snapshots")
name = "Project"
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
}
if (project.hasProperty("maven_url") && project.hasProperty("maven_username") && project.hasProperty(
"maven_password"
)
) {
maven {
url = uri(project.property("maven_url") as String)
credentials {
username = project.property("maven_username") as String
password = project.property("maven_password") as String
}
}
}
}
}