forked from QuiltMC/tiny-remapper
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
150 lines (125 loc) · 3.49 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
plugins {
id "java"
id "maven-publish"
id "com.diffplug.spotless" version "5.10.2"
id "com.github.johnrengelman.shadow" version "7.0.0" // Make a fat jar
id "org.asciidoctor.jvm.convert" version "3.1.0" // Make man pages
id "net.kyori.blossom" version "1.2.0" // Better version (again)
// TODO: Apply checkstyle
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
version = "0.7.2"
def ENV = System.getenv()
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")
group = "org.quiltmc"
archivesBaseName = "tiny-remapper"
repositories {
mavenCentral()
}
dependencies {
// ASM
implementation "org.ow2.asm:asm:$asmVersion"
implementation "org.ow2.asm:asm-commons:$asmVersion"
implementation "org.ow2.asm:asm-tree:$asmVersion"
implementation "org.ow2.asm:asm-util:$asmVersion"
// Testing
testImplementation "org.junit.jupiter:junit-jupiter:5.6.2"
// CLI tool
implementation "info.picocli:picocli:$picocliVersion"
annotationProcessor "info.picocli:picocli-codegen:$picocliVersion"
implementation group: "org.fusesource.jansi", name: "jansi", version: "2.3.3"
implementation "info.picocli:picocli-jansi-graalvm:1.2.0"
}
compileJava {
// For PicoCLI annotation processor
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
}
java {
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = 8
}
}
spotless {
java {
// Only apply license changes when files are modified
ratchetFrom "origin/master"
// Use comma separator for openjdk like license headers
licenseHeaderFile(file("HEADER")).yearSeparator(", ")
}
}
blossom {
replaceToken("__TINY_VERSION", project.version)
replaceToken("__ASM_VERSION", asmVersion)
}
test {
useJUnitPlatform()
testLogging {
showStandardStreams = true
exceptionFormat = "full"
events = ["passed", "failed", "skipped"]
}
}
jar {
manifest {
attributes "Implementation-Title": "TinyRemapper",
"Implementation-Version": version,
// TODO: Move to application plugin instead of placing this in the manifest directly
"Main-Class": "net.fabricmc.tinyremapper.Main",
"Automatic-Module-Name": "org.quiltmc.tinyremapper"
}
}
shadowJar {
archiveClassifier.set("fat")
}
build {
dependsOn {
shadowJar
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
if (ENV.MAVEN_URL) {
maven {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}
// Manpage generator (included with PicoCLI)
task generateManpageAsciiDoc(type: JavaExec) {
dependsOn classes
group = "Documentation"
description = "Generate AsciiDoc manpage"
classpath(configurations.runtimeClasspath, configurations.annotationProcessor, sourceSets.main.runtimeClasspath)
mainClass = "picocli.codegen.docgen.manpage.ManPageGenerator"
args "net.fabricmc.tinyremapper.Main", "--outdir=${project.buildDir}/generated-picocli-docs", "-v" //, "--template-dir=src/docs/mantemplates"
}
asciidoctor {
dependsOn generateManpageAsciiDoc
sourceDir = file("${project.buildDir}/generated-picocli-docs")
outputDir = file("${project.buildDir}/docs")
logDocuments = true
outputOptions {
backends = ["manpage", "html5"]
}
}
task githubCMDDocs(type: Copy) {
dependsOn asciidoctor
from "./build/docs/html5/tiny-remapper.html"
into "./docs/cli/"
rename "tiny-remapper.html", "index.html"
}