diff --git a/.gitignore b/.gitignore index 16e60bede..50a166bce 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,9 @@ classes/ *.iws /logs/ +tweaker/logs/ +common/logs/ + # Eclipse Files .classpath .project diff --git a/common/build.gradle b/common/build.gradle index 5880988e2..1a4e6ecc6 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -6,6 +6,12 @@ architectury { common() } +//loom { +// mixin { +// legacyRemapToNamespace = "official" +// } +//} + // ignore this jank, it's so I don't have to move the src folder, as that creates unnecessary git conflicts sourceSets { realmain { @@ -130,32 +136,4 @@ jar { 'Implementation-Version': version, ) } -} - -remapJar { - targetNamespace = 'official' -} - -task proguard(type: ProguardTask) { - url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip' - extract 'proguard-7.2.1/lib/proguard.jar' - compType "OFFICIAL" -} - -task createDist(type: CreateDistTask, dependsOn: proguard) - -build.finalizedBy(createDist) - -publishing { - publications { - mavenCommon(MavenPublication) { - artifactId = rootProject.archives_base_name - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } } \ No newline at end of file diff --git a/common/logs/latest.log b/common/logs/latest.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/settings.gradle b/settings.gradle index 15a6e8e89..79018ad7c 100755 --- a/settings.gradle +++ b/settings.gradle @@ -45,3 +45,4 @@ rootProject.name = 'baritone' include("fabric") include("forge") include("common") +include("tweaker") diff --git a/tweaker/build.gradle b/tweaker/build.gradle new file mode 100644 index 000000000..9612b4b8c --- /dev/null +++ b/tweaker/build.gradle @@ -0,0 +1,166 @@ +import baritone.gradle.task.CreateDistTask +import baritone.gradle.task.ProguardTask + +architectury { + injectInjectables = false +} + +loom { + mixin { + legacyRemapToNamespace = "official" + } +} + +// ignore this jank, it's so I don't have to move the src folder, as that creates unnecessary git conflicts +sourceSets { + realmain { + java { + java { + srcDir "$rootDir/src/main/java" + } + resources { + srcDir "$rootDir/src/main/resources" + } + } + } + api { + compileClasspath += main.compileClasspath + runtimeClasspath += main.runtimeClasspath + java { + java { + srcDir "$rootDir/src/api/java" + } + resources { + srcDir "$rootDir/src/api/resources" + } + } + } + realmain { + compileClasspath += main.compileClasspath + api.output + runtimeClasspath += main.runtimeClasspath + api.output + } + test { + compileClasspath += realmain.compileClasspath + realmain.output + runtimeClasspath += realmain.runtimeClasspath + realmain.output + java { + java { + srcDir "$rootDir/src/test/java" + } + resources { + srcDir "$rootDir/src/test/resources" + } + } + } + main { + compileClasspath += realmain.output + api.output + runtimeClasspath += realmain.output + api.output + java { + java { + srcDir "$rootDir/src/launch/java" + } + resources { + srcDir "$rootDir/src/launch/resources" + } + } + } + schematica_api { + compileClasspath += realmain.compileClasspath + runtimeClasspath += realmain.runtimeClasspath + java { + java { + srcDir "$rootDir/src/schematica_api/java" + } + resources { + srcDir "$rootDir/src/schematica_api/resources" + } + } + } + realmain { + compileClasspath += schematica_api.output + runtimeClasspath += schematica_api.output + } +} + +configurations { + transformProductionTweaker { + canBeConsumed = true + canBeResolved = false + // If you want this configuration to share the same dependencies, otherwise omit this line + extendsFrom implementation, runtimeOnly + } +} + +dependencies { + // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies + // Do NOT use other classes from fabric loader + modCompileOnly "net.fabricmc:fabric-loader:${project.fabric_version}" + + // want in the pom but not to compile against as it's also provided by loom + runtimeOnly "org.spongepowered:mixin:0.8.4" + + // this makes it compile with the forge tweak stuff + implementation 'com.github.ImpactDevelopment:SimpleTweaker:1.2' + implementation('net.minecraft:launchwrapper:1.12') { + exclude module: 'lwjgl' + exclude module: 'asm-debug-all' + } + + compileOnly 'com.google.code.findbugs:jsr305:3.0.2' + + testImplementation 'junit:junit:4.12' +} + +javadoc { + options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error + options.linkSource true + options.encoding "UTF-8" // allow emoji in comments :^) + source = sourceSets.api.allJava + classpath += sourceSets.api.compileClasspath +} + +jar { + classifier "dev" + from sourceSets.main.output, sourceSets.realmain.output, sourceSets.api.output + + + preserveFileTimestamps = false + reproducibleFileOrder = true + + manifest { + attributes( + 'MixinConfigs': 'mixins.baritone.json', + "MixinConnector": "baritone.launch.BaritoneMixinConnector", + + 'Implementation-Title': 'Baritone', + 'Implementation-Version': version, + ) + } +} + +remapJar { + targetNamespace = 'official' +} + +task proguard(type: ProguardTask) { + url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip' + extract 'proguard-7.2.1/lib/proguard.jar' + compType "OFFICIAL" +} + +task createDist(type: CreateDistTask, dependsOn: proguard) + +build.finalizedBy(createDist) + +publishing { + publications { + mavenCommon(MavenPublication) { + artifactId = rootProject.archives_base_name + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + } +} \ No newline at end of file