-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
162 lines (133 loc) · 3.24 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.guardsquare:proguard-gradle:7.4.0'
}
}
plugins {
id 'java'
id 'maven-publish'
id 'checkstyle'
id 'org.quiltmc.gradle.licenser' version '2.0.1'
}
version '2.3.1'
group 'org.quiltmc'
version = version + (System.getenv("GITHUB_ACTIONS") ? "" : "+local")
sourceSets {
testInputs
}
repositories {
mavenCentral()
maven {
name 'Quilt Repository'
url 'https://maven.quiltmc.org/repository/release/'
}
maven {
name 'Quilt Snapshots'
url 'https://maven.quiltmc.org/repository/snapshot/'
}
mavenLocal()
// Enigma dependencies
maven {
url 'https://maven.fabricmc.net/'
content {
includeModule('net.fabricmc', 'cfr')
}
}
// Test inputs dependencies
maven {
name 'Minecraft Libraries'
url 'https://libraries.minecraft.net'
}
}
configurations {
enigmaRuntime
}
dependencies {
implementation libs.bundles.asm
implementation libs.enigma
implementation libs.quilt.json5
implementation libs.tinylog
implementation libs.annotations
testImplementation libs.junit
testImplementation libs.hamcrest
testRuntimeOnly libs.junit.engine
testImplementation libs.enigma.swing
testInputsImplementation libs.dfu
enigmaRuntime libs.dfu
}
var obfJar = file('build/obf/obf.jar')
var mappings = file('testMappings/')
var profile = file('build/resources/testInputs/profile.json')
task testEnigma(type: JavaExec, dependsOn: ["obfuscateTestInputs", "processTestInputsResources"]) {
mainClass = "org.quiltmc.enigma.gui.Main"
classpath = files(configurations.enigmaRuntime) + sourceSets.test.runtimeClasspath
args('-jar', obfJar, '-mappings', mappings.getAbsolutePath(), '-profile', profile.getAbsolutePath(), '--development')
doFirst {
mappings.mkdirs()
}
}
task testInputsJar(type: Jar) {
from sourceSets.testInputs.output
archiveFileName = "input.jar"
destinationDirectory = file("build/obf")
}
task obfuscateTestInputs(type: proguard.gradle.ProGuardTask) {
dependsOn testInputsJar
verbose
injars testInputsJar
outjars obfJar
libraryjars "${System.getProperty('java.home')}/jmods/java.base.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
libraryjars sourceSets.testInputs.compileClasspath
dontshrink()
dontoptimize()
keepclasseswithmembers 'public class * {\
\t\tpublic static void main(java.lang.String[]);\
\t}'
keepattributes 'SourceFile'
keepattributes '*Annotation*'
keepattributes 'InnerClasses'
keepattributes 'NestMembers'
keepattributes 'EnclosingMethod'
keepattributes 'Deprecated'
keepattributes 'Signature'
keepattributes 'Record'
printmapping 'build/obf/obf.txt'
}
tasks.test.dependsOn obfuscateTestInputs, processTestInputsResources
license {
rule file('codeformat/FABRIC_MODIFIED_HEADER')
rule file('codeformat/HEADER')
include '**/*.java'
exclude 'com/example/**/*.java'
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
}
test {
useJUnitPlatform()
}
publishing {
def ENV = System.getenv()
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
if (ENV.MAVEN_URL) {
maven {
url = ENV.MAVEN_URL
credentials {
username = ENV.MAVEN_USERNAME
password = ENV.MAVEN_PASSWORD
}
}
}
mavenLocal()
}
}