Skip to content

Instantly share code, notes, and snippets.

@HyCraftHD
Created April 13, 2018 18:08
Show Gist options
  • Save HyCraftHD/03b083267d0b3de4cf565c6aa1b3bd07 to your computer and use it in GitHub Desktop.
Save HyCraftHD/03b083267d0b3de4cf565c6aa1b3bd07 to your computer and use it in GitHub Desktop.
Shade dependecies with reobf from minecraft forge (not working for unobfuscated files)
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT"
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.9"
}
}
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.matthewprenger.cursegradle"
repositories {
jcenter()
}
ext.buildProps = file "build.properties"
buildProps.withReader {
def prop = new Properties()
prop.load(it)
ext.config = new ConfigSlurper().parse prop
}
version = config.mod.version
archivesBaseName = config.mod.modid
sourceCompatibility = targetCompatibility = "1.8"
compileJava {
sourceCompatibility = targetCompatibility = "1.8"
}
minecraft {
version = config.forge.version
runDir = "run"
mappings = config.forge.mappings
makeObfSourceJar = false
}
configurations {
shade
compile.extendsFrom shade
}
dependencies {
shade "com.sedmelluq:lavaplayer:1.2.62"
}
reobf {
jar {
extraLines "PK: com/sedmelluq super/asodkfs"
}
deobfJar {
extraLines "PK: com/sedmelluq super/asodkfs"
}
}
jar {
from "LICENSE"
archiveName = archivesBaseName + "-" + minecraft.version + "-v" + version + ".jar"
manifest.mainAttributes(
"Implementation-Title": config.mod.name,
"Implementation-Version": version,
"Built-On": minecraft.version
)
manifest {
attributes("FMLCorePlugin": "info.u_team.u_team_core.intern.libaryloader.LibaryLoader", "FMLCorePluginContainsFMLMod": "true")
}
configurations.shade.each { dep ->
from(project.zipTree(dep)){
exclude 'META-INF', 'META-INF/**'
}
}
}
task deobfJar(type: Jar) {
from sourceSets.main.output
from "LICENSE"
archiveName = archivesBaseName + "-" + minecraft.version + "-v" + version + "-dev.jar"
manifest.mainAttributes(
"Implementation-Title": config.mod.name,
"Implementation-Version": version,
"Built-On": minecraft.version
)
manifest {
attributes("FMLCorePlugin": "info.u_team.u_team_core.intern.libaryloader.LibaryLoader", "FMLCorePluginContainsFMLMod": "true")
}
}
artifacts {
archives deobfJar
archives jar
}
processResources {
from(sourceSets.main.resources.srcDirs) {
exclude "*"
}
}
curseforge {
apiKey = project.properties["token"]
project {
id = config.curse.id
releaseType = config.curse.type
mainArtifact(jar) {
displayName = config.curse.display + "-" + minecraft.version + "-" + version
}
addArtifact(deobfJar) {
displayName = config.curse.display + "-" + minecraft.version + "-" + version + "-dev"
changelog = "Mappings: " + config.forge.mappings
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment