Updated build script and switch to in-house dependencies

This commit is contained in:
Johann Bernhardt committed 2021-11-22 09:12:42 +01:00
1 parent ef3c05f66b
commit 02aad542d6
3 files changed
+74 -97

No files matched your search

+70 -91
View File
@@ -1,4 +1,4 @@
//version: 21647c763d3f6c90d59c900edae1248239c49dfb
//version: eb0b030ab9cb1d0f9a31f11e69e1ceed1dab2c89
/*
DO NOT CHANGE THIS FILE!
@@ -8,15 +8,12 @@ Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradl
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.util.concurrent.TimeUnit
buildscript {
repositories {
maven {
name = "jitpack"
url = "https://jitpack.io"
}
maven {
name = "forge"
url = "https://maven.minecraftforge.net"
@@ -29,25 +26,31 @@ buildscript {
name = "Scala CI dependencies"
url = "https://repo1.maven.org/maven2/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
}
dependencies {
classpath 'com.github.TheElan:ForgeGradle:1.2.2'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
}
}
plugins {
id 'idea'
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")
}
apply plugin: 'scala'
apply plugin: 'forge'
apply plugin: 'idea'
def projectJavaVersion = JavaLanguageVersion.of(8)
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(projectJavaVersion)
}
}
@@ -166,7 +169,7 @@ minecraft {
if(gradleTokenModName) {
replace gradleTokenModName, modName
}
if(gradleTokenModName) {
if(gradleTokenVersion) {
replace gradleTokenVersion, versionDetails().lastTag
}
if(gradleTokenGroupName) {
@@ -186,6 +189,10 @@ configurations {
}
repositories {
maven {
name = "Overmind forge repo mirror"
url = "https://gregtech.overminddl1.com/"
}
if(usesMixins.toBoolean()) {
maven {
name = "sponge"
@@ -218,11 +225,6 @@ dependencies {
apply from: 'dependencies.gradle'
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
}
def mixinConfigJson = "mixins." + modId + ".json"
def mixingConfigRefMap = "mixins." + modId + ".refmap.json"
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
@@ -244,61 +246,24 @@ task generateAssets {
}
}
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
}
shadowJar {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
if(accessTransformersFile) {
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
}
if(coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
if(usesMixins.toBoolean()) {
from refMap
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : mixinConfigJson,
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
manifest {
attributes(manifestAttributes)
attributes(getManifestAttributes())
}
minimize()
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation]
dependsOn(relocateShadowJar)
}
jar {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
if(accessTransformersFile) {
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
}
if(coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
if(usesMixins.toBoolean()) {
from refMap
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : mixinConfigJson,
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
manifest {
attributes(manifestAttributes)
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
@@ -351,7 +316,7 @@ runClient {
runServer {
def arguments = []
if(usesMixins.toBoolean()) {
if (usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
@@ -361,6 +326,14 @@ runServer {
args(arguments)
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion = projectJavaVersion
}
)
}
processResources
{
// this will ensure that this task is redone when the versions change.
@@ -384,11 +357,7 @@ processResources
}
}
task sourcesJar(type: Jar) {
from (sourceSets.main.allJava)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
def getManifestAttributes() {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
@@ -403,45 +372,55 @@ task sourcesJar(type: Jar) {
}
if(usesMixins.toBoolean()) {
from refMap
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : mixinConfigJson,
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
return manifestAttributes
}
task sourcesJar(type: Jar) {
from (sourceSets.main.allJava)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
task shadowDevJar(type: ShadowJar) {
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
attributes(manifestAttributes)
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation]
}
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
target = tasks.shadowDevJar
prefix = modGroup + ".shadow"
}
task circularResolverJar(type: Jar) {
dependsOn(relocateShadowDevJar)
dependsOn(shadowDevJar)
enabled = false
}
task devJar(type: Jar) {
from sourceSets.main.output
getArchiveClassifier().set("dev")
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
if(accessTransformersFile) {
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
}
if(coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
if(usesMixins.toBoolean()) {
from refMap
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : mixinConfigJson,
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
manifest {
attributes(manifestAttributes)
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(circularResolverJar)
enabled = false
}
}
@@ -523,4 +502,4 @@ static String getVersionHash(String buildScriptContent) {
configure(updateBuildScript) {
group = 'forgegradle'
description = 'Updates the build script to the latest version'
}
}
+3 -4
View File
@@ -1,8 +1,7 @@
// Add your dependencies here
dependencies {
compile("codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev")
compile("codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev")
runtime("codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev")
compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev")
compile("com.github.GTNewHorizons:CodeChickenLib:master-SNAPSHOT:dev")
compile("com.github.GTNewHorizons:CodeChickenCore:master-SNAPSHOT:dev")
}
+1 -2
View File
@@ -2,7 +2,6 @@
repositories {
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven"
url = "https://jitpack.io"
}
}