-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
147 lines (127 loc) · 3.77 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
plugins {
id 'java-library'
id 'application'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.0.0'
}
group 'org.quiltmc'
version '1.1.1' + (System.getenv().SNAPSHOTS_URL ? "-SNAPSHOT" : "")
// Target JDK 8
tasks.withType(JavaCompile).configureEach {
if (JavaVersion.current().isJava9Compatible()) {
options.release.set(8)
} else {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
compileJava {
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
}
application {
mainClass = 'org.quiltmc.mappings_hasher.Main'
}
repositories {
mavenCentral()
maven {
name = "Quilt"
url = "https://maven.quiltmc.org/repository/release"
}
}
test {
useJUnitPlatform()
testLogging {
outputs.upToDateWhen {false}
showStandardStreams = true
}
delete 'test'
mkdir 'test'
workingDir 'test'
}
configurations {
implementation {
extendsFrom shadow
}
}
dependencies {
api 'org.cadixdev:lorenz:0.5.7'
shadow 'org.quiltmc:quilt-json5:1.0.0'
shadow 'org.quiltmc:lorenz-tiny:3.0.0'
shadow 'org.cadixdev:lorenz-io-proguard:0.5.7'
shadow 'org.ow2.asm:asm:9.5'
shadow 'info.picocli:picocli:4.6.1'
shadow 'org.quiltmc:launchermeta-parser:1.0.0'
shadow "info.picocli:picocli:4.6.1"
annotationProcessor "info.picocli:picocli-codegen:4.6.1"
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.8.1')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.8.1')
testImplementation 'org.quiltmc:tiny-remapper:0.7.1'
}
if (!versionJsonUrl.isEmpty()) {
tasks.getByName("run").setArgs(["--json", versionJsonUrl])
} else if (!versionZipUrl.isEmpty()) {
tasks.getByName("run").setArgs(["--zip", versionZipUrl])
} else {
tasks.getByName("run").setArgs(["--version", minecraftVersion])
}
task mappingsJar(type: Jar) {
dependsOn run
from "mappings/mappings.tiny"
eachFile {
setName("mappings/mappings.tiny")
}
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allJava
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
task relocatePacakages(type: ConfigureShadowRelocation){
target = tasks.shadowJar
prefix = "org.quiltmc.mappings_hasher"
}
shadowJar {
dependsOn relocatePacakages
archiveClassifier = "all"
configurations = [project.configurations.shadow]
}
publishing {
def ENV = System.getenv()
publications {
if (!project.hasProperty("shouldPublishHasher")) {
mavenHashed(MavenPublication) {
groupId = 'org.quiltmc'
artifactId = 'hashed'
version = minecraftVersion + (System.getenv().SNAPSHOTS_URL ? "-SNAPSHOT" : "")
artifacts = [mappingsJar, file("mappings/mappings.tiny")]
}
}
if (project.hasProperty("shouldPublishHasher") || ENV.SNAPSHOTS_URL) {
mavenHasher(MavenPublication) {
groupId = 'org.quiltmc'
artifactId = 'mappings-hasher'
version = version
artifacts = [jar, shadowJar, sourcesJar]
}
}
}
repositories {
if (ENV.MAVEN_URL) {
maven {
url = ENV.MAVEN_URL
credentials {
username = ENV.MAVEN_USERNAME
password = ENV.MAVEN_PASSWORD
}
}
} else if (ENV.SNAPSHOTS_URL) {
maven {
url = ENV.SNAPSHOTS_URL
credentials {
username = ENV.SNAPSHOTS_USERNAME
password = ENV.SNAPSHOTS_PASSWORD
}
}
}
}
}