switch to unimined

This commit is contained in:
Wagyourtail
2022-12-01 23:04:40 -07:00
parent 4fa43ce201
commit 85790c0b2f
15 changed files with 202 additions and 351 deletions

View File

@@ -1,111 +1,53 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask
import baritone.gradle.task.TweakerJsonAssembler
architectury {
injectInjectables = false
plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
}
loom {
mixin {
refmapTargetNamespace = "official"
defaultRefmapName = "baritone-common-refmap.json"
}
}
loom.mixin.useLegacyMixinAp = false;
// 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"
}
}
}
tweaker {
compileClasspath += realmain.output + api.output + main.compileClasspath
runtimeClasspath += realmain.output + api.output + main.compileClasspath
}
main {
compileClasspath += realmain.output + api.output + tweaker.output
runtimeClasspath += realmain.output + api.output + tweaker.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
minecraft {
runs.client = {
mainClass = "net.minecraft.launchwrapper.Launch"
args.addAll(["--tweakClass", "baritone.launch.BaritoneTweaker"])
}
}
configurations {
transformProductionTweaker {
canBeConsumed = true
canBeResolved = false
// If you want this configuration to share the same dependencies, otherwise omit this line
extendsFrom implementation, runtimeOnly
}
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
}
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}"
implementation "org.spongepowered:mixin:0.8.5"
// for some reason mixin isn't including these...
implementation "org.ow2.asm:asm:9.3"
implementation "org.ow2.asm:asm-tree:9.3"
implementation "org.ow2.asm:asm-commons:9.3"
implementation "org.ow2.asm:asm-util:9.3"
implementation "org.ow2.asm:asm-analysis:9.3"
// 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:of-2.3') {
exclude module: 'lwjgl'
@@ -114,20 +56,21 @@ dependencies {
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
testImplementation 'junit:junit:4.12'
// because of multiple sourcesets `common project(":")` doesn't work
for (sourceSet in rootProject.sourceSets) {
if (sourceSet == rootProject.sourceSets.test) continue
common sourceSet.output
shadowCommon sourceSet.output
}
}
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
shadowJar {
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}
jar {
classifier "dev"
from sourceSets.main.output, sourceSets.realmain.output, sourceSets.api.output, sourceSets.tweaker.output
preserveFileTimestamps = false
reproducibleFileOrder = true
@@ -143,10 +86,6 @@ jar {
}
}
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'