summaryrefslogtreecommitdiff
path: root/build.gradle
diff options
context:
space:
mode:
authorGravatar Runemoro2020-06-03 13:39:42 -0400
committerGravatar GitHub2020-06-03 18:39:42 +0100
commit0f47403d0220757fed189b76e2071e25b1025cb8 (patch)
tree879bf72c4476f0a5e0d82da99d7ff2b2276bcaca /build.gradle
parentFix search dialog hanging for a short time sometimes (#250) (diff)
downloadenigma-0f47403d0220757fed189b76e2071e25b1025cb8.tar.gz
enigma-0f47403d0220757fed189b76e2071e25b1025cb8.tar.xz
enigma-0f47403d0220757fed189b76e2071e25b1025cb8.zip
Split GUI code to separate module (#242)
* Split into modules * Post merge compile fixes Co-authored-by: modmuss50 <modmuss50@gmail.com>
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle174
1 files changed, 34 insertions, 140 deletions
diff --git a/build.gradle b/build.gradle
index ba2d86c4..bd2d99f4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,165 +1,59 @@
1plugins { 1plugins {
2 id 'java'
3 id 'com.github.johnrengelman.shadow' version '5.2.0'
4 id 'maven-publish' 2 id 'maven-publish'
5} 3}
6 4
7group = 'cuchaz' 5subprojects {
8version = '0.16.1' 6 apply plugin: 'java'
7 apply plugin: 'maven-publish'
9 8
10def generatedSourcesDir = "$buildDir/generated-src" 9 sourceCompatibility = 1.8
10 targetCompatibility = 1.8
11 11
12def buildNumber = System.getenv("BUILD_NUMBER") 12 repositories {
13version = version + "+" + (buildNumber ? "build.$buildNumber" : "local") 13 mavenLocal()
14 14 mavenCentral()
15sourceCompatibility = 1.8 15 maven { url 'https://maven.fabricmc.net/' }
16targetCompatibility = 1.8
17
18task generateSources(type: Copy) {
19 from sourceSets.main.java
20 into generatedSourcesDir
21
22 filter { String line ->
23 ("$line".replaceAll('@VERSION@', version))
24 } 16 }
25}
26 17
27compileJava.source = generatedSourcesDir 18 dependencies {
28compileJava.dependsOn generateSources 19 implementation 'com.google.guava:guava:28.0-jre'
20 implementation 'com.google.code.gson:gson:2.8.5'
29 21
30repositories { 22 testImplementation 'junit:junit:4.+'
31 mavenLocal() 23 testImplementation 'org.hamcrest:hamcrest-all:1.+'
32 mavenCentral()
33
34 maven {
35 name "Modmuss Repository"
36 url 'https://maven.modmuss50.me/'
37 } 24 }
38}
39
40configurations {
41 proGuard
42}
43
44dependencies {
45 implementation 'com.google.guava:guava:28.0-jre'
46 implementation 'com.google.code.gson:gson:2.8.5'
47 implementation 'org.ow2.asm:asm:8.0'
48 implementation 'org.ow2.asm:asm-commons:8.0'
49 implementation 'org.ow2.asm:asm-tree:8.0'
50 implementation 'org.ow2.asm:asm-util:8.0'
51 implementation 'net.sf.jopt-simple:jopt-simple:6.0-alpha-3'
52 implementation 'net.fabricmc:procyon-fabric-compilertools:0.5.35.13'
53 implementation 'net.fabricmc:cfr:0.0.1'
54 implementation 'com.bulenkov:darcula:1.0.0-bobbylight'
55 implementation 'de.sciss:syntaxpane:1.2.0'
56 implementation 'com.github.lukeu:swing-dpi:0.6'
57 25
58 testImplementation 'junit:junit:4.+' 26 group = 'cuchaz'
59 testImplementation 'org.hamcrest:hamcrest-all:1.+' 27 version = '0.17'
60 28
61 proGuard 'net.sf.proguard:proguard-base:6.+' 29 def buildNumber = System.getenv("BUILD_NUMBER")
62} 30 version = version + "+" + (buildNumber ? "build.$buildNumber" : "local")
63
64def libraryJarsArg = JavaVersion.current().java9Compatible ? "<java.home>/jmods": "<java.home>/lib/rt.jar"
65
66// For each set of test inputs, create an output jar and obfuscate it.
67file('src/test/java/cuchaz/enigma/inputs').listFiles().each { theFile ->
68 if (theFile.directory) {
69 task("${theFile.name}TestJar", type: Jar) {
70 from(sourceSets.test.output) {
71 include "cuchaz/enigma/inputs/$theFile.name/**/*.class"
72 include 'cuchaz/enigma/inputs/Keep.class'
73 }
74
75 archiveFileName = theFile.name + '.jar'
76 destinationDirectory = file('build/test-inputs')
77 }
78
79 task("${theFile.name}TestObf", type: JavaExec,
80 dependsOn: "${theFile.name}TestJar") {
81 main 'proguard.ProGuard'
82 classpath configurations.proGuard
83
84 args '@src/test/resources/proguard-test.conf', '-injars', file('build/test-inputs/' +
85 "${theFile.name}.jar"), '-libraryjars', libraryJarsArg,
86 '-outjars', file('build/test-obf/' + "${theFile.name}.jar")
87 }
88 31
89 test.dependsOn "${theFile.name}TestObf" 32 task sourcesJar(type: Jar, dependsOn: classes) {
33 classifier = 'sources'
34 from sourceSets.main.allSource
90 } 35 }
91}
92
93// We also semi-deobfuscate translation.jar to then test it... yeah... oh well.
94task('deobfTranslationInput', type: JavaExec, dependsOn: 'translationTestObf')
95 {
96 classpath sourceSets.main.runtimeClasspath
97 main 'cuchaz.enigma.CommandMain'
98 args 'deobfuscate', file('build/test-obf/translation.jar'),
99 file('build/test-deobf/translation.jar')
100 }
101test.dependsOn 'deobfTranslationInput'
102 36
103test { 37 java {
104 // Since the Minecraft test is really long (like 10 minutes D:) we turn it 38 withSourcesJar()
105 // off by default.
106 if (!System.getProperty('enableExtremelySlowMinecraftTest', '')
107 .equalsIgnoreCase('true')) {
108 exclude 'cuchaz/enigma/TestSourceIndex.class'
109 } 39 }
110 40
111 // Allow people to specify a custom path to their Minecraft directory. 41 publishing {
112 // (Example: `gradle build -Denigma.test.minecraftdir=./`) 42 publications {
113 systemProperties = [ 43 "$project.name"(MavenPublication) {
114 'enigma.test.minecraftdir': System.getProperty('test.minecraftdir') 44 groupId project.group
115 ] 45 artifactId project.name
116} 46 version project.version
117 47 from components.java
118// Set the main class. 48 }
119jar.manifest.attributes 'Main-Class': 'cuchaz.enigma.Main' 49 }
120
121// Make the "fat" application jar. This is useful to just throw in a classpath
122// for tests, though it includes some slightly useless stuff.
123shadowJar {
124 append 'LICENSE'
125 append 'README.md'
126}
127
128// Create a library jar, containing only the deobfuscation code, for use at
129// runtime. This will be deployed to Maven Local with a POM, and can be uploaded
130// to a remote server manually (for now anyway).
131task libJar (type: Jar) {
132 classifier = 'lib'
133
134 from(sourceSets.main.output) {
135 exclude 'cuchaz/enigma/gui/**'
136 exclude 'cuchaz/enigma/convert/**'
137
138 // Main classes + inner classes (keep CommandMain)
139 exclude 'cuchaz/enigma/Main.class'
140 exclude 'cuchaz/enigma/Main.class'
141 } 50 }
142} 51}
143 52
144task sourcesJar(type: Jar, dependsOn: generateSources) {
145 classifier = 'sources'
146 from generatedSourcesDir
147 from sourceSets.main.resources
148}
149
150publishing { 53publishing {
151 publications {
152 mavenJava(MavenPublication) {
153 from components.java
154
155 artifact shadowJar
156 artifact libJar
157 artifact sourcesJar
158 }
159 }
160
161 // select the repositories you want to publish to
162 repositories { 54 repositories {
55 mavenLocal()
56
163 if (project.hasProperty('mavenPass')) { 57 if (project.hasProperty('mavenPass')) {
164 maven { 58 maven {
165 url = "http://mavenupload.modmuss50.me/" 59 url = "http://mavenupload.modmuss50.me/"