Skip to content

Commit

Permalink
Merge pull request #16 from GTNewHorizons/updatebuild
Browse files Browse the repository at this point in the history
Updatebuild
  • Loading branch information
Dream-Master authored Jan 24, 2022
2 parents 672822b + a32b0c1 commit e3f18c3
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 28 deletions.
100 changes: 75 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1642484596
//version: 1642964305
/*
DO NOT CHANGE THIS FILE!
Expand Down Expand Up @@ -32,16 +32,18 @@ buildscript {
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.5'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.6'
}
}

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")
}

Expand Down Expand Up @@ -320,38 +322,29 @@ afterEvaluate {
}
}
}
def arguments = []
def jvmArguments = []
if(usesMixins.toBoolean()) {
arguments += [
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
jvmArguments += [
"-Dmixin.debug=true", "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
]
}

runClient {
def arguments = []

if(usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}

if(developmentEnvironmentUserName) {
arguments += [
"--username",
developmentEnvironmentUserName
]
arguments += [ "--username", developmentEnvironmentUserName ]
}

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 {
Expand Down Expand Up @@ -494,11 +487,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"
}
Expand All @@ -511,6 +514,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)
}
}
}
}

Expand Down Expand Up @@ -581,6 +596,41 @@ configure(updateBuildScript) {
description = 'Updates the build script to the latest version'
}

// Deobfuscation

def deobf(String sourceURL, String fileName) {
def bon2File = "$projectDir/deobf/BON2-2.5.0.jar"
def cacheFile = "$projectDir/deobf/out/" + fileName + ".jar"
def deobfFile = "$projectDir/deobf/out/" + 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 cacheFile
quiet true
overwrite false
}

exec {
commandLine 'java', '-jar', bon2File, '--inputJar', cacheFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
workingDir "$projectDir/deobf"
standardOutput = new ByteArrayOutputStream()
}

delete(cacheFile)
return files(deobfFile)
}

// Helper methods

def checkPropertyExists(String propertyName) {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ autoUpdateBuildScript = false
minecraftVersion = 1.7.10
forgeVersion = 10.13.4.1614

# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = "Developer"
developmentEnvironmentUserName = Developer

# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
Expand All @@ -37,7 +37,7 @@ gradleTokenGroupName =
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage = api

# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile = ThaumicTinkerer_at.cfg

Expand Down

0 comments on commit e3f18c3

Please sign in to comment.