Skip to content

Commit

Permalink
Fix reobf
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadiboo committed Apr 26, 2024
1 parent 3a9007c commit c1d3ac5
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 38 deletions.
127 changes: 92 additions & 35 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
id 'java'
// Shadow jar includes our libraries into our final jar
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'eclipse' // Is this needed?
id 'maven-publish'
id 'fabric-loom' version '1.5-SNAPSHOT'
}
Expand Down Expand Up @@ -36,7 +35,7 @@ loom {
mods {
"${modId}" {
sourceSet sourceSets.main
// sourceSet sourceSets.client
// sourceSet sourceSets.client
}
}
// Used to configure existing or new run configurations
Expand Down Expand Up @@ -155,17 +154,15 @@ tasks.withType(JavaCompile).configureEach {
}

java {
// // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// // if it is present.
// // If you remove this line, sources will not be generated.
// withSourcesJar()
withSourcesJar()
withJavadocJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

jar {
archiveClassifier.set('dev')
setArchiveClassifier('deobf-slim-unsigned')
manifest {
attributes([
// See https://docs.oracle.com/javase/8/docs/technotes/guides/versioning/spec/versioning2.html
Expand All @@ -185,24 +182,45 @@ jar {
])
}
from('LICENSE') {
rename { "${it}_${project.base.archivesName.get()}"}
rename { "${it}_${project.base.archivesName.get()}" }
}
}

// region Dependency bundling
shadowJar {
archiveClassifier.set('')
setArchiveClassifier("${getArchiveClassifier().get()}-deobf-unsigned")
destinationDirectory = file('build/devlibs')

configurations = [project.configurations.shadow]
relocate('org.beryx', 'io.github.cadiboo.nocubes.repackage.org.beryx')
manifest.attributes(jar.manifest.getAttributes())
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
remapJar {
dependsOn(shadowJar)
mustRunAfter(shadowJar)
inputFile = file(shadowJar.archiveFile)
}
// endregion

// region Source code jars
sourcesJar {
setArchiveClassifier("${getArchiveClassifier().get()}-deobf-unsigned")
from sourceSets.main.allSource
destinationDirectory
}
remapSourcesJar {
dependsOn(sourcesJar)
mustRunAfter(sourcesJar)
inputFile = file(sourcesJar.archiveFile)
}
// endregion

// region Documentation jar
javadocJar {
setArchiveClassifier("${getArchiveClassifier().get()}-deobf-unsigned")
destinationDirectory = file('build/devlibs')
from javadoc.destinationDir
}
//task javadocJar(type: Jar, dependsOn: javadoc) {
// archiveClassifier.set('javadoc')
// from javadoc.destinationDir
//}
javadoc {
// Gradle doesn't support Java 8's new tags out of the box
options.tags = [
Expand All @@ -211,40 +229,79 @@ javadoc {
'implNote:a:Implementation Note:',
]
}

artifacts {
archives jar
archives shadowJar
archives sourcesJar
// archives javadocJar
}
// endregion
// endregion

//// region publish
//// TODO: Move this to the publish step, not the build step
//// Sign all the jars
//import net.minecraftforge.gradle.common.tasks.SignJar
//
//[
// jar,
// shadowJar,
// sourcesJar,
// javadocJar,
// remapJar,
// remapSourcesJar,
//].each { jarTask ->
// Task signingTask = tasks.create(name: "sign-${jarTask.name}", type: SignJar, dependsOn: jarTask) {
// def name = "sign-${jarTask.name}"
// tasks.register(name) {
// dependsOn jarTask
// // Skips if the keyStore property is missing.
// onlyIf {
// // findProperty allows us to reference the property without it existing.
// // Using project.propName would cause the script to fail validation if the property did not exist.
// project.hasProperty('keyStore')
// }
// // findProperty allows us to reference the property without it existing.
// // Using project.propName would cause the script to fail validation if the property did not exist.
// keyStore = project.findProperty('keyStore')
// alias = project.findProperty('keyStoreAlias')
// storePass = project.findProperty('keyStorePass')
// keyPass = project.findProperty('keyStoreKeyPass')
// inputFile = jarTask.archiveFile
// outputFile = jarTask.archiveFile
// doLast {
// def javaHome = javaToolchains.launcherFor(java.toolchain).map { it.metadata.installationPath }
//
// println javaHome.get()
//
// def keyStore = project.keyStore
// def alias = project.keyStoreAlias
// def storePass = project.keyStorePass
// def keyPass = project.keyStoreKeyPass
// def inputFile = jarTask.archiveFile
// def outputFile = jarTask.archiveFile.get().getAsFile().getPath().replace('.jar', '-signed.jar')
//
// def output = new ByteArrayOutputStream()
// def result = project.exec {
// commandLine = [
// "\"${javaHome.get()}/bin/jarsigner\"",
// "-keystore",
// "\"${keyStore}\"",
// "-storepass",
// "\"${storePass}\"",
// "-keypass",
// "\"${keyPass}\"",
// "-verbose",
// "\"${inputFile.get().getAsFile().getPath()}\"",
// "\"${alias}\""
// ]
// standardOutput = output
// errorOutput = output
// ignoreExitValue = true
// }
// println output
//// ant.signjar(
//// jar: inputFile,
//// signedjar: outputFile,
//// alias: alias,
//// keystore: keyStore,
//// storepass: storePass,
//// keypass: keyPass,
//// storetype: 'jks',
//// verbose:true,
//// preservelastmodified: 'true',
//// )
//// ant.verifyjar(
//// alias: alias,
//// jar: aarPath,
//// keystore: android.signingConfigs.release.storeFile,
//// storepass: android.signingConfigs.release.storePassword,
//// keypass: android.signingConfigs.release.keyPassword
//// )
// }
// }
// jarTask.finalizedBy(signingTask)
// publish.dependsOn name
//}
//// endregion
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Contains the definitions/specifications of traits/mixins.
* Implementations are done by bytecode modification ({@link io.github.cadiboo.nocubes.mixin Mixins} or {@link io.github.cadiboo.nocubes.hooks.MixinAsm ASM}).
* Implementations are done by bytecode modification ({@link io.github.cadiboo.nocubes.mixin Mixins}).
*/
package io.github.cadiboo.nocubes.hooks.trait;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.spongepowered.asm.mixin.Mixin;

/**
* Same as {@link io.github.cadiboo.nocubes.mixin.client.LevelRendererMixin#noCubes$setBlocksDirty} but for Sodium.
* Same as {@link io.github.cadiboo.nocubes.mixin.client.NonSodiumLevelRendererMixin#noCubes$setBlocksDirty} but for Sodium.
*/
@Mixin(net.minecraft.client.renderer.LevelRenderer.class)
public class LevelRendererMixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.spongepowered.asm.mixin.Pseudo;

/**
* Same as {@link io.github.cadiboo.nocubes.mixin.client.LevelRendererMixin#noCubes$setBlocksDirty} but for Sodium.
* Same as {@link io.github.cadiboo.nocubes.mixin.client.NonSodiumLevelRendererMixin#noCubes$setBlocksDirty} but for Sodium.
*/
@Pseudo // Sodium may not be installed
@Mixin(targets = "me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer")
Expand Down

0 comments on commit c1d3ac5

Please sign in to comment.