update buildscript

This commit is contained in:
bombcar 2022-01-30 15:01:26 -06:00
parent ab041e20d9
commit d0e760c956
6 changed files with 130 additions and 29 deletions

View File

@ -1,4 +1,4 @@
//version: 1642484596
//version: 1643020202
/*
DO NOT CHANGE THIS FILE!
@ -32,16 +32,18 @@ buildscript {
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.5'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
}
}
plugins {
id 'idea'
id 'eclipse'
id 'scala'
id("org.ajoberstar.grgit") version("3.1.1")
id("com.github.johnrengelman.shadow") version("4.0.4")
id("com.palantir.git-version") version("0.12.3")
id('de.undercouch.download') version('4.1.2')
id("maven-publish")
}
@ -172,6 +174,19 @@ else {
archivesBaseName = modId
}
def arguments = []
def jvmArguments = []
if(usesMixins.toBoolean()) {
arguments += [
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
jvmArguments += [
"-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
]
}
minecraft {
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
runDir = "run"
@ -191,6 +206,20 @@ minecraft {
replace gradleTokenGroupName, modGroup
}
}
clientIntellijRun {
args(arguments)
jvmArgs(jvmArguments)
if(developmentEnvironmentUserName) {
args("--username", developmentEnvironmentUserName)
}
}
serverIntellijRun {
args(arguments)
jvmArgs(jvmArguments)
}
}
if(file("addon.gradle").exists()) {
@ -322,15 +351,6 @@ afterEvaluate {
}
runClient {
def arguments = []
if(usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
if(developmentEnvironmentUserName) {
arguments += [
"--username",
@ -339,19 +359,12 @@ runClient {
}
args(arguments)
jvmArgs(jvmArguments)
}
runServer {
def arguments = []
if (usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
args(arguments)
jvmArgs(jvmArguments)
}
tasks.withType(JavaExec).configureEach {
@ -494,11 +507,21 @@ artifacts {
}
}
// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID),
// and isn't strictly needed with the POM so just disable it.
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
// publishing
publishing {
publications {
maven(MavenPublication) {
artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: ""
from components.java
if(usesShadowedDependencies.toBoolean()) {
artifact source: shadowJar, classifier: ""
}
if(!noPublishedSources) {
artifact source: sourcesJar, classifier: "src"
}
@ -511,6 +534,18 @@ publishing {
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
// Remove all non GTNH deps here.
// Original intention was to remove an invalid forgeBin being generated without a groupId (mandatory), but
// it also removes all of the MC deps
pom.withXml {
Node pomNode = asNode()
pomNode.dependencies.'*'.findAll() {
it.groupId.text() != 'com.github.GTNewHorizons'
}.each() {
it.parent().remove(it)
}
}
}
}
@ -581,6 +616,72 @@ configure(updateBuildScript) {
description = 'Updates the build script to the latest version'
}
// Deobfuscation
def deobf(String sourceURL) {
try {
URL url = new URL(sourceURL)
String fileName = url.getFile()
//get rid of directories:
int lastSlash = fileName.lastIndexOf("/")
if(lastSlash > 0) {
fileName = fileName.substring(lastSlash + 1)
}
//get rid of extension:
if(fileName.endsWith(".jar")) {
fileName = fileName.substring(0, fileName.lastIndexOf("."))
}
String hostName = url.getHost()
if(hostName.startsWith("www.")) {
hostName = hostName.substring(4)
}
List parts = Arrays.asList(hostName.split("\\."))
Collections.reverse(parts)
hostName = String.join(".", parts)
return deobf(sourceURL, hostName + "/" + fileName)
} catch(Exception e) {
return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode()))
}
}
// The method above is to be prefered. Use this method if the filename is not at the end of the URL.
def deobf(String sourceURL, String fileName) {
String cacheDir = System.getProperty("user.home") + "/.gradle/caches/"
String bon2Dir = cacheDir + "forge_gradle/deobf"
String bon2File = bon2Dir + "/BON2-2.5.0.jar"
String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar"
String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar"
if(file(deobfFile).exists()) {
return files(deobfFile)
}
download {
src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar'
dest bon2File
quiet true
overwrite false
}
download {
src sourceURL
dest obfFile
quiet true
overwrite false
}
exec {
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
workingDir bon2Dir
standardOutput = new ByteArrayOutputStream()
}
return files(deobfFile)
}
// Helper methods
def checkPropertyExists(String propertyName) {

View File

@ -12,16 +12,16 @@ dependencies {
compileOnly("com.github.GTNewHorizons:EnderStorage:1.4.11:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.17:dev") {
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.19:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.4:dev") {
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.5:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Railcraft:9.13.5:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.2.3-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev") {
@ -36,7 +36,7 @@ dependencies {
compileOnly("com.github.GTNewHorizons:waila:1.5.18:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Galacticraft:3.0.36-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:Galacticraft:3.0.37-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:TinkersMechworks:0.2.16.2:dev") {
@ -112,10 +112,10 @@ dependencies {
compileOnly("curse.maven:stargatetech-2-226769:2230351") {
transitive = false
}
compileOnly files("dependencies/redlogic-59.1.13.jar")
compileOnly files("dependencies/ic2classic-api.zip")
compileOnly files("dependencies/factorization-api.zip")
compileOnly files("dependencies/ColoredLightsCore-1.3.7.39.jar")
compileOnly(deobf("http://immibis.com/mcmoddl/files/redlogic-59.1.13.jar"))
compileOnly(deobf("https://media.forgecdn.net/files/2799/208/IC2Classic+Version+1.2.2.0.jar")
compileOnly(deobf("https://github.com/purpleposeidon/fz_archive/raw/master/old/Factorization-1.7.10-0.8.108.jar"))
compileOnly(deobf("https://media.forgecdn.net/files/2325/998/ColoredLightsCore-1.3.7.39.jar"))
testCompile("org.mockito:mockito-all:1.10.19")
testCompile("org.scalactic:scalactic_2.11:2.2.6")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.