Skip to content

Commit

Permalink
Mixin module works now I think
Browse files Browse the repository at this point in the history
  • Loading branch information
makamys committed Oct 19, 2023
1 parent ba1f02d commit b589106
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 39 deletions.
19 changes: 3 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ buildscript {
url = "https://jitpack.io"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11'
}
}

plugins {
Expand All @@ -26,18 +23,6 @@ plugins {
id("com.gtnewhorizons.retrofuturagradle") version "1.3.19"
}

// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
// Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64
vendor.set(org.gradle.jvm.toolchain.JvmVendorSpec.AZUL)
}
// Generate sources and javadocs jars when building and publishing
withSourcesJar()
withJavadocJar()
}

allprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'maven-publish'
Expand Down Expand Up @@ -77,6 +62,8 @@ allprojects {
}

if(project.name.startsWith("module-") && project.name != "module-mixin" && project.name != "module-common") {
// TODO rfg: figure out source and dev jars
/*
if(project.name != "module-all") {
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
Expand Down Expand Up @@ -118,7 +105,7 @@ allprojects {
it.dependsOn reobf
}
}
}
}*/
}

// Put license, credits and readme in jar
Expand Down
9 changes: 9 additions & 0 deletions module-common/build.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
apply from: "${rootDir}/module-conventions.gradle"

archivesBaseName = archivesBaseName.replace("-1.7.10", "-common-1.7.10" )

// Shadow considers the shadow jar the output of this subproject when it gets
// shadowed elsewhere, so we have to set it up
shadowJar {
archiveClassifier = 'dev'
configurations = []
}
15 changes: 15 additions & 0 deletions module-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Stuff that should get set in every module. Because putting it in allprojects
// doesn't work for some reason!

// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
// Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64
vendor.set(org.gradle.jvm.toolchain.JvmVendorSpec.AZUL)
}
// TODO rfg: figure out source and dev jars
// Generate sources and javadocs jars when building and publishing
//withSourcesJar()
//withJavadocJar()
}
25 changes: 12 additions & 13 deletions module-mixin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
apply from: "${rootDir}/module-conventions.gradle"

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0'
}
}

def versionBase = version
Expand Down Expand Up @@ -120,11 +119,11 @@ flavors.each {

// We want to *not* relocate ASM in the bridge classes. So we use a multi-step
// build procedure:

// 1. Create relocated Mixin jar, without the bridge classes
task("mixinJar$_flavor", type: ShadowJar) {
destinationDirectory = file("build/tmp")
classifier = "tmpMixin$_flavor"
archiveClassifier = "tmpMixin$_flavor"
configurations = [project.configurations."shadow$_flavor"]

relocate 'org.objectweb.asm', 'org.spongepowered.asm.lib'
Expand Down Expand Up @@ -161,7 +160,7 @@ flavors.each {
// 2. Create Mixin jar without relocation, with *only* the bridge classes
task("bridgeJar$_flavor", type: ShadowJar) {
destinationDirectory = file("build/tmp")
classifier = "tmpBridge$_flavor"
archiveClassifier = "tmpBridge$_flavor"
configurations = [project.configurations."shadowBridge$_flavor"]

include '*.jar'
Expand All @@ -170,7 +169,7 @@ flavors.each {

// 3. Combine the two jars
task("shadowJar$_flavor", type: ShadowJar) {
version = versionBase + "+" + mixinFlavorClassifier
archiveVersion = versionBase + "+" + mixinFlavorClassifier
from(sourceSets.main.output) {
exclude "mcmod.info"
}
Expand Down Expand Up @@ -216,8 +215,8 @@ flavors.each {
exclude "mcmod.info"
}

version = versionBase + "+" + mixinFlavorClassifier
classifier = ''
archiveVersion = versionBase + "+" + mixinFlavorClassifier
archiveClassifier = ''
configurations = [project.configurations."shadow$_flavor"]

relocate 'io.github.legacymoddingmc.unimixins.common', 'io.github.legacymoddingmc.unimixins.mixin.repackage.common'
Expand Down Expand Up @@ -259,8 +258,8 @@ flavors.each {
task("shadowSourcesJar$_flavor", type: ShadowJar) {
from sourceSets.main.allSource

version = versionBase + "+" + mixinFlavorClassifier
classifier = "sources"
archiveVersion = versionBase + "+" + mixinFlavorClassifier
archiveClassifier = "sources"
configurations = [project.configurations."shadowSources$_flavor"]
}

Expand All @@ -273,13 +272,13 @@ flavors.each {
artifact tasks."shadowSourcesJar$_flavor"

artifactId = archivesBaseName.substring(1)
version = tasks."shadowJar$_flavor".version
version = tasks."shadowJar$_flavor".archiveVersion
}
}
}
}

// Obfuscation is useless because we're not compiling code referencing Minecraft classes
reobf.enabled = false
reobfJar.enabled = false

jar.enabled = false
Empty file removed project.gradle
Empty file.
20 changes: 10 additions & 10 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ pluginManagement {
}
}

/*include 'module-mixin'
include 'module-compat'
include 'module-devcompat'
include 'module-mixingasm'
include 'module-spongemixins'
include 'module-mixinbooterlegacy'
include 'module-gasstation'
include 'module-gtnhmixins'
include 'module-mixinextras'
include 'module-all'*/
include 'module-mixin'
// include 'module-compat'
// include 'module-devcompat'
// include 'module-mixingasm'
// include 'module-spongemixins'
// include 'module-mixinbooterlegacy'
// include 'module-gasstation'
// include 'module-gtnhmixins'
// include 'module-mixinextras'
// include 'module-all'
include 'module-common'

0 comments on commit b589106

Please sign in to comment.