Last active
June 23, 2017 14:54
-
-
Save Xalcon/62e610f7f913d918f89132caa8fac62a to your computer and use it in GitHub Desktop.
experimental code that moves the "api" subpackage into its own jar which then gets re-packaged with a jar that doesnt have said sub-package. Output is a jar with the qualifier "universal". This concept can be adapted to pacakage a Coremod-only jar into the mainmod.jar to comply to the new forge coremod policy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// at the end of your build.gradle | |
// Create API library zip | |
// Warning: This jar will be reobfuscated! Its only used to package it with the universal jar | |
task apiJar(type: Jar) { | |
from(sourceSets.main.output) { | |
include "**/api/**" | |
} | |
classifier = 'obf-api' | |
includeEmptyDirs = false | |
} | |
// task to create a jar containing all classes from the main sourceSet output and the api.jar | |
// also sets up the manifest attribute 'ContainedDeps' which fml uses to extract the api jar at runtime | |
task packedJar(type: Jar, dependsOn: 'reobfApiJar') { | |
manifest { | |
attributes 'FMLAT': "${modid}_at.cfg" | |
attributes 'ContainedDeps': "${archivesBaseName}-${version}-api.jar" | |
} | |
from(sourceSets.main.output) { | |
exclude('**/api/**') | |
} | |
from("${buildDir}/libs") { | |
include("*-${version}-api.jar") | |
} | |
classifier = 'universal' | |
} | |
// tell gradle to reobfuscate our jars | |
reobf { | |
// jar is done by default | |
// jar { } | |
apiJar { } | |
packedJar { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment