From 0f47403d0220757fed189b76e2071e25b1025cb8 Mon Sep 17 00:00:00 2001 From: Runemoro Date: Wed, 3 Jun 2020 13:39:42 -0400 Subject: Split GUI code to separate module (#242) * Split into modules * Post merge compile fixes Co-authored-by: modmuss50 --- build.gradle | 174 ++++++++++++----------------------------------------------- 1 file changed, 34 insertions(+), 140 deletions(-) (limited to 'build.gradle') diff --git a/build.gradle b/build.gradle index ba2d86c4..bd2d99f4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,165 +1,59 @@ plugins { - id 'java' - id 'com.github.johnrengelman.shadow' version '5.2.0' id 'maven-publish' } -group = 'cuchaz' -version = '0.16.1' +subprojects { + apply plugin: 'java' + apply plugin: 'maven-publish' -def generatedSourcesDir = "$buildDir/generated-src" + sourceCompatibility = 1.8 + targetCompatibility = 1.8 -def buildNumber = System.getenv("BUILD_NUMBER") -version = version + "+" + (buildNumber ? "build.$buildNumber" : "local") - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -task generateSources(type: Copy) { - from sourceSets.main.java - into generatedSourcesDir - - filter { String line -> - ("$line".replaceAll('@VERSION@', version)) + repositories { + mavenLocal() + mavenCentral() + maven { url 'https://maven.fabricmc.net/' } } -} -compileJava.source = generatedSourcesDir -compileJava.dependsOn generateSources + dependencies { + implementation 'com.google.guava:guava:28.0-jre' + implementation 'com.google.code.gson:gson:2.8.5' -repositories { - mavenLocal() - mavenCentral() - - maven { - name "Modmuss Repository" - url 'https://maven.modmuss50.me/' + testImplementation 'junit:junit:4.+' + testImplementation 'org.hamcrest:hamcrest-all:1.+' } -} - -configurations { - proGuard -} - -dependencies { - implementation 'com.google.guava:guava:28.0-jre' - implementation 'com.google.code.gson:gson:2.8.5' - implementation 'org.ow2.asm:asm:8.0' - implementation 'org.ow2.asm:asm-commons:8.0' - implementation 'org.ow2.asm:asm-tree:8.0' - implementation 'org.ow2.asm:asm-util:8.0' - implementation 'net.sf.jopt-simple:jopt-simple:6.0-alpha-3' - implementation 'net.fabricmc:procyon-fabric-compilertools:0.5.35.13' - implementation 'net.fabricmc:cfr:0.0.1' - implementation 'com.bulenkov:darcula:1.0.0-bobbylight' - implementation 'de.sciss:syntaxpane:1.2.0' - implementation 'com.github.lukeu:swing-dpi:0.6' - testImplementation 'junit:junit:4.+' - testImplementation 'org.hamcrest:hamcrest-all:1.+' + group = 'cuchaz' + version = '0.17' - proGuard 'net.sf.proguard:proguard-base:6.+' -} - -def libraryJarsArg = JavaVersion.current().java9Compatible ? "/jmods": "/lib/rt.jar" - -// For each set of test inputs, create an output jar and obfuscate it. -file('src/test/java/cuchaz/enigma/inputs').listFiles().each { theFile -> - if (theFile.directory) { - task("${theFile.name}TestJar", type: Jar) { - from(sourceSets.test.output) { - include "cuchaz/enigma/inputs/$theFile.name/**/*.class" - include 'cuchaz/enigma/inputs/Keep.class' - } - - archiveFileName = theFile.name + '.jar' - destinationDirectory = file('build/test-inputs') - } - - task("${theFile.name}TestObf", type: JavaExec, - dependsOn: "${theFile.name}TestJar") { - main 'proguard.ProGuard' - classpath configurations.proGuard - - args '@src/test/resources/proguard-test.conf', '-injars', file('build/test-inputs/' + - "${theFile.name}.jar"), '-libraryjars', libraryJarsArg, - '-outjars', file('build/test-obf/' + "${theFile.name}.jar") - } + def buildNumber = System.getenv("BUILD_NUMBER") + version = version + "+" + (buildNumber ? "build.$buildNumber" : "local") - test.dependsOn "${theFile.name}TestObf" + task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource } -} - -// We also semi-deobfuscate translation.jar to then test it... yeah... oh well. -task('deobfTranslationInput', type: JavaExec, dependsOn: 'translationTestObf') - { - classpath sourceSets.main.runtimeClasspath - main 'cuchaz.enigma.CommandMain' - args 'deobfuscate', file('build/test-obf/translation.jar'), - file('build/test-deobf/translation.jar') - } -test.dependsOn 'deobfTranslationInput' -test { - // Since the Minecraft test is really long (like 10 minutes D:) we turn it - // off by default. - if (!System.getProperty('enableExtremelySlowMinecraftTest', '') - .equalsIgnoreCase('true')) { - exclude 'cuchaz/enigma/TestSourceIndex.class' + java { + withSourcesJar() } - // Allow people to specify a custom path to their Minecraft directory. - // (Example: `gradle build -Denigma.test.minecraftdir=./`) - systemProperties = [ - 'enigma.test.minecraftdir': System.getProperty('test.minecraftdir') - ] -} - -// Set the main class. -jar.manifest.attributes 'Main-Class': 'cuchaz.enigma.Main' - -// Make the "fat" application jar. This is useful to just throw in a classpath -// for tests, though it includes some slightly useless stuff. -shadowJar { - append 'LICENSE' - append 'README.md' -} - -// Create a library jar, containing only the deobfuscation code, for use at -// runtime. This will be deployed to Maven Local with a POM, and can be uploaded -// to a remote server manually (for now anyway). -task libJar (type: Jar) { - classifier = 'lib' - - from(sourceSets.main.output) { - exclude 'cuchaz/enigma/gui/**' - exclude 'cuchaz/enigma/convert/**' - - // Main classes + inner classes (keep CommandMain) - exclude 'cuchaz/enigma/Main.class' - exclude 'cuchaz/enigma/Main.class' + publishing { + publications { + "$project.name"(MavenPublication) { + groupId project.group + artifactId project.name + version project.version + from components.java + } + } } } -task sourcesJar(type: Jar, dependsOn: generateSources) { - classifier = 'sources' - from generatedSourcesDir - from sourceSets.main.resources -} - publishing { - publications { - mavenJava(MavenPublication) { - from components.java - - artifact shadowJar - artifact libJar - artifact sourcesJar - } - } - - // select the repositories you want to publish to repositories { + mavenLocal() + if (project.hasProperty('mavenPass')) { maven { url = "http://mavenupload.modmuss50.me/" -- cgit v1.2.3