diff options
author | makamys <makamys@outlook.com> | 2020-03-10 22:54:52 +0100 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2021-05-06 13:54:48 +0200 |
commit | 02a6aa4a24662815664ad86cb81d2a3f167775d7 (patch) | |
tree | 795fab48832fce98ea12790536504f159fb89470 /build.gradle | |
download | Neodymium-02a6aa4a24662815664ad86cb81d2a3f167775d7.tar.gz Neodymium-02a6aa4a24662815664ad86cb81d2a3f167775d7.tar.bz2 Neodymium-02a6aa4a24662815664ad86cb81d2a3f167775d7.zip |
Initial commit (basic Mixin setup)
Diffstat (limited to 'build.gradle')
-rw-r--r-- | build.gradle | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..1536e27 --- /dev/null +++ b/build.gradle @@ -0,0 +1,113 @@ +buildscript { + repositories { + mavenCentral() + jcenter() + maven { + name = "forge" + url = "https://repo.spongepowered.org/repository/forge-proxy/" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + // MixinGradle only works with ForgeGradle 2+, so we need to implement it ourselves. + // (Comments mark the lines where this is done.) + //classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' + } +} + +repositories { + maven { // this has to be here and not in buildscript.repositories, otherwise Gradle won't find mixin <0.8 for some reason + name = 'sponge' + url = 'https://repo.spongepowered.org/maven/' + } +} + +configurations { + embed + compile.extendsFrom(embed) +} + +apply plugin: 'forge' + +version = "0.0" +group= "makamys.lodmod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = "lodmod" + +minecraft { + version = "1.7.10-10.13.4.1614-1.7.10" + runDir = "run" +} + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +dependencies { + embed 'org.spongepowered:mixin:0.7+' + + /* Mixin 0.8 breaks with 1.7.10, but can be made to work by embedding these. However, + doing so overrides the libraries provided by Forge, which will likely result in other mods breaking. */ + //embed 'org.ow2.asm:asm-all:5.2' + //embed 'com.google.guava:guava:21.0' +} + +def outRefMapFile = tasks.compileJava.temporaryDir.toString() + "/lodmod.mixin.refmap.json" // 1.7.10 mixin compatibility + +jar { + manifest { + attributes ( + 'MixinConfigs': 'lodmod.mixin.json', + 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker', + 'TweakOrder': 0, + + // If these two are not set, Forge will not detect the mod, it will only run the mixins + 'FMLCorePluginContainsFMLMod': 'true', + 'ForceLoadAsMod': 'true' + ) + } + + from(sourceSets.main.output); + + from outRefMapFile; // 1.7.10 mixin compatibility + + // embed libraries in jar + from configurations.embed.collect { + exclude '**/LICENSE.txt' + it.isDirectory() ? it : zipTree(it) + } +} + +// 1.7.10 mixin compatibility +def outSrgFile = tasks.compileJava.temporaryDir.toString() + "/outSrg.srg" + +afterEvaluate { + tasks.compileJava.options.compilerArgs += ["-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=${outSrgFile}", "-AoutRefMapFile=${outRefMapFile}"]; +} + +reobf { + addExtraSrgFile outSrgFile +} +// end of mixin stuff + +processResources +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} |