diff --git a/build.gradle b/build.gradle index 40ab0aef..59a9ed5a 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } @@ -36,7 +35,7 @@ loom { mods { "${modId}" { sourceSet sourceSets.main - // sourceSet sourceSets.client +// sourceSet sourceSets.client } } // Used to configure existing or new run configurations @@ -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 @@ -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 = [ @@ -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 diff --git a/src/main/java/io/github/cadiboo/nocubes/hooks/trait/package-info.java b/src/main/java/io/github/cadiboo/nocubes/hooks/trait/package-info.java index 5a48e7fd..09d2e1ea 100644 --- a/src/main/java/io/github/cadiboo/nocubes/hooks/trait/package-info.java +++ b/src/main/java/io/github/cadiboo/nocubes/hooks/trait/package-info.java @@ -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; diff --git a/src/main/java/io/github/cadiboo/nocubes/mixin/client/sodium/LevelRendererMixin.java b/src/main/java/io/github/cadiboo/nocubes/mixin/client/sodium/LevelRendererMixin.java index c61d48ff..8ffd9020 100644 --- a/src/main/java/io/github/cadiboo/nocubes/mixin/client/sodium/LevelRendererMixin.java +++ b/src/main/java/io/github/cadiboo/nocubes/mixin/client/sodium/LevelRendererMixin.java @@ -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 { diff --git a/src/main/java/io/github/cadiboo/nocubes/mixin/client/sodium/WorldRendererMixin.java b/src/main/java/io/github/cadiboo/nocubes/mixin/client/sodium/WorldRendererMixin.java index 226e7213..0ca1b31f 100644 --- a/src/main/java/io/github/cadiboo/nocubes/mixin/client/sodium/WorldRendererMixin.java +++ b/src/main/java/io/github/cadiboo/nocubes/mixin/client/sodium/WorldRendererMixin.java @@ -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")