Compare commits

..
14 Commits
Author SHA1 Message Date
Martin Robertz e3a9ba324b Merge pull request #9 from boubou19/master
disabled recipe addition when NHCore is present
2022-01-09 14:30:06 +01:00
boubou_19 2e762a04c1 disabled recipe addition when NHCore is present 2022-01-08 14:59:58 +01:00
Martin Robertz 6188bc655d Merge pull request #8 from GTNewHorizons/dependencies
Update dependencies
2021-12-23 17:31:58 +01:00
bombcar 496eb2b3ea update buildscript 2021-12-22 13:48:00 -06:00
bombcar 24aa5f818e fix dependencies to use our github 2021-12-22 13:47:38 -06:00
Martin Robertz aef46a8851 ignore bat files 2021-12-02 23:22:27 +01:00
boubou19 e1e0215080 Merge pull request #5 from GTNewHorizons/update-build-script
Update build script and CI
2021-11-30 15:55:55 +01:00
Johann Bernhardt 54992ccb71 Update build script and CI 2021-11-30 09:58:30 +01:00
Martin Robertz 77c1b603bc Merge pull request #3 from bombcar/master
chmod +x gradlew for mac and linux
2021-11-29 23:30:54 +01:00
Martin Robertz d7bc4873ad Merge pull request #4 from ElNounch/patch-1
Can't call getReturnType on fields
2021-11-27 21:11:18 +01:00
ElNounch 5a36570a35 Can't call getReturnType on fields
Logged this uses :
[Client thread/DEBUG] [CCL ASM/ForgeMultipart]: jDesc = [Lcodechicken/multipart/TMultiPart;
[Client thread/DEBUG] [CCL ASM/ForgeMultipart]: jDesc = Ljava/util/LinkedList;
[Client thread/DEBUG] [CCL ASM/ForgeMultipart]: jDesc = Z

No one else suffered from this ?
2021-11-27 09:05:39 +01:00
Tom Dickson f784161937 chmod +x gradlew for mac and linux 2021-11-22 10:47:38 -06:00
Johann Bernhardt eb24fc8f62 Strip transitive dependencies 2021-11-22 13:49:34 +01:00
Johann Bernhardt 02aad542d6 Updated build script and switch to in-house dependencies 2021-11-22 09:12:42 +01:00
13 changed files with 303 additions and 213 deletions

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
directory="run/crash-reports"
if [ -d $directory ]; then
echo "Crash reports detected:"
cat $directory/*
exit 1
else
echo "No crash reports detected"
exit 0
fi
@@ -1,14 +1,16 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build pull request name: Build and test
on: on:
pull_request: pull_request:
branches: [ master, main ] branches: [ master, main ]
push:
branches: [ master, main ]
jobs: jobs:
build: build-and-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@@ -30,3 +32,14 @@ jobs:
- name: Build the mod - name: Build the mod
run: ./gradlew build run: ./gradlew build
- name: Run server for 1 minute
run: |
mkdir run
echo "eula=true" > run/eula.txt
timeout 10 ./gradlew runServer || true
- name: Test no crashes happend
run: |
chmod +x .github/scripts/test-no-crash-reports.sh
.github/scripts/test-no-crash-reports.sh
+45
View File
@@ -0,0 +1,45 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release tagged build
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Release under current tag
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
prerelease: false
title: "${{ env.RELEASE_VERSION }}"
files: build/libs/*.jar
-41
View File
@@ -1,41 +0,0 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build and release main branch
on:
push:
branches: [ master, main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Latest Development Build"
files: build/libs/*.jar
+1 -1
View File
@@ -21,9 +21,9 @@ server.properties
servers.dat servers.dat
usercache.json usercache.json
whitelist.json whitelist.json
world/
/out/ /out/
*.iml *.iml
*.ipr *.ipr
*.iws *.iws
src/main/resources/mixins.*.json src/main/resources/mixins.*.json
*.bat
+214 -152
View File
@@ -1,4 +1,4 @@
//version: 21647c763d3f6c90d59c900edae1248239c49dfb //version: 8fa7883b6196c1765266f4e6ddf3118d5043aafb
/* /*
DO NOT CHANGE THIS FILE! 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.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
buildscript { buildscript {
repositories { repositories {
maven {
name = "jitpack"
url = "https://jitpack.io"
}
maven { maven {
name = "forge" name = "forge"
url = "https://maven.minecraftforge.net" url = "https://maven.minecraftforge.net"
@@ -29,25 +26,32 @@ buildscript {
name = "Scala CI dependencies" name = "Scala CI dependencies"
url = "https://repo1.maven.org/maven2/" url = "https://repo1.maven.org/maven2/"
} }
maven {
name = "jitpack"
url = "https://jitpack.io"
}
} }
dependencies { dependencies {
classpath 'com.github.TheElan:ForgeGradle:1.2.2' classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
} }
} }
plugins { plugins {
id 'idea'
id 'scala'
id("org.ajoberstar.grgit") version("3.1.1") id("org.ajoberstar.grgit") version("3.1.1")
id("com.github.johnrengelman.shadow") version("4.0.4") id("com.github.johnrengelman.shadow") version("4.0.4")
id("com.palantir.git-version") version("0.12.3") id("com.palantir.git-version") version("0.12.3")
id("maven-publish")
} }
apply plugin: 'scala'
apply plugin: 'forge' apply plugin: 'forge'
apply plugin: 'idea'
def projectJavaVersion = JavaLanguageVersion.of(8)
java { java {
toolchain { toolchain {
languageVersion.set(JavaLanguageVersion.of(8)) languageVersion.set(projectJavaVersion)
} }
} }
@@ -59,6 +63,10 @@ idea {
} }
} }
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}
checkPropertyExists("modName") checkPropertyExists("modName")
checkPropertyExists("modId") checkPropertyExists("modId")
checkPropertyExists("modGroup") checkPropertyExists("modGroup")
@@ -80,33 +88,27 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies") checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName") checkPropertyExists("developmentEnvironmentUserName")
def checkPropertyExists(String propertyName) {
if (project.hasProperty(propertyName) == false) {
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties")
}
}
String javaSourceDir = "src/main/java/" String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/" String scalaSourceDir = "src/main/scala/"
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) { if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
} }
if(apiPackage) { if(apiPackage) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) { if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
} }
} }
if(accessTransformersFile) { if(accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
if(new File(targetFile).exists() == false) { if(getFile(targetFile).exists() == false) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
} }
} }
@@ -118,14 +120,14 @@ if(usesMixins.toBoolean()) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) { if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
} }
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
if((new File(targetFileJava).exists() || new File(targetFileScala).exists() || new File(targetFileScalaJava).exists()) == false) { if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
} }
} }
@@ -134,7 +136,7 @@ if(coreModClass) {
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
if((new File(targetFileJava).exists() || new File(targetFileScala).exists() || new File(targetFileScalaJava).exists()) == false) { if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
} }
} }
@@ -150,9 +152,20 @@ configurations.all {
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version // Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
'git config core.fileMode false'.execute() 'git config core.fileMode false'.execute()
// Pulls version from git tag // Pulls version from git tag
version = minecraftVersion + "-" + gitVersion() try {
version = minecraftVersion + "-" + gitVersion()
}
catch (Exception e) {
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
}
group = modGroup group = modGroup
archivesBaseName = modId if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName
}
else {
archivesBaseName = modId
}
minecraft { minecraft {
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
@@ -166,7 +179,7 @@ minecraft {
if(gradleTokenModName) { if(gradleTokenModName) {
replace gradleTokenModName, modName replace gradleTokenModName, modName
} }
if(gradleTokenModName) { if(gradleTokenVersion) {
replace gradleTokenVersion, versionDetails().lastTag replace gradleTokenVersion, versionDetails().lastTag
} }
if(gradleTokenGroupName) { if(gradleTokenGroupName) {
@@ -182,10 +195,16 @@ if(file("addon.gradle").exists()) {
apply from: 'repositories.gradle' apply from: 'repositories.gradle'
configurations { configurations {
implementation.extendsFrom(shadowImplementation) implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
implementation.extendsFrom(shadowCompile)
implementation.extendsFrom(shadeCompile)
} }
repositories { repositories {
maven {
name = "Overmind forge repo mirror"
url = "https://gregtech.overminddl1.com/"
}
if(usesMixins.toBoolean()) { if(usesMixins.toBoolean()) {
maven { maven {
name = "sponge" name = "sponge"
@@ -218,19 +237,13 @@ dependencies {
apply from: 'dependencies.gradle' 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 mixingConfigRefMap = "mixins." + modId + ".refmap.json"
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
task generateAssets { task generateAssets {
if(usesMixins.toBoolean()) { if(usesMixins.toBoolean()) {
new File(projectDir.toString() + "/src/main/resources/", mixinConfigJson).text = """{ getFile("/src/main/resources/mixins." + modId + ".json").text = """{
"required": true, "required": true,
"minVersion": "0.7.11", "minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}", "package": "${modGroup}.${mixinsPackage}",
@@ -244,61 +257,36 @@ task generateAssets {
} }
} }
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
}
shadowJar { shadowJar {
def manifestAttributes = [:] project.configurations.shadeCompile.each { dep ->
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { from(project.zipTree(dep)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true] exclude 'META-INF', 'META-INF/**'
}
} }
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 { manifest {
attributes(manifestAttributes) attributes(getManifestAttributes())
} }
minimize() minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation] configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
dependsOn(relocateShadowJar) dependsOn(relocateShadowJar)
} }
jar { jar {
def manifestAttributes = [:] project.configurations.shadeCompile.each { dep ->
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { from(project.zipTree(dep)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true] exclude 'META-INF', 'META-INF/**'
}
} }
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 { manifest {
attributes(manifestAttributes) attributes(getManifestAttributes())
} }
if(usesShadowedDependencies.toBoolean()) { if(usesShadowedDependencies.toBoolean()) {
@@ -351,7 +339,7 @@ runClient {
runServer { runServer {
def arguments = [] def arguments = []
if(usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
arguments += [ arguments += [
"--mods=../build/libs/$modId-${version}.jar", "--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker" "--tweakClass org.spongepowered.asm.launch.MixinTweaker"
@@ -361,97 +349,127 @@ runServer {
args(arguments) args(arguments)
} }
tasks.withType(JavaExec).configureEach {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion = projectJavaVersion
}
)
}
processResources processResources
{ {
// this will ensure that this task is redone when the versions change. // this will ensure that this task is redone when the versions change.
inputs.property "version", project.version inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else // replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info' include 'mcmod.info'
// replace version and mcversion // replace version and mcversion
expand "minecraftVersion": project.minecraft.version, expand "minecraftVersion": project.minecraft.version,
"modVersion": versionDetails().lastTag, "modVersion": versionDetails().lastTag,
"modId": modId, "modId": modId,
"modName": modName "modName": modName
} }
// copy everything else, thats not the mcmod.info if(usesMixins.toBoolean()) {
from(sourceSets.main.resources.srcDirs) { from refMap
exclude 'mcmod.info' }
}
} // copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
def getManifestAttributes() {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
if(accessTransformersFile) {
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
}
if(coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
if(usesMixins.toBoolean()) {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json",
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
return manifestAttributes
}
task sourcesJar(type: Jar) { task sourcesJar(type: Jar) {
from (sourceSets.main.allJava) from (sourceSets.main.allJava)
from (file("$projectDir/LICENSE")) from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources') getArchiveClassifier().set('sources')
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)
}
} }
task devJar(type: Jar) { task shadowDevJar(type: ShadowJar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output from sourceSets.main.output
getArchiveClassifier().set("dev") 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 { manifest {
attributes(manifestAttributes) attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
}
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
target = tasks.shadowDevJar
prefix = modGroup + ".shadow"
}
task circularResolverJar(type: Jar) {
dependsOn(relocateShadowDevJar)
dependsOn(shadowDevJar)
enabled = false
}
task devJar(type: Jar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(circularResolverJar)
enabled = false
} }
} }
task apiJar(type: Jar) { task apiJar(type: Jar) {
from (sourceSets.main.allJava) { from (sourceSets.main.allJava) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**' include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
} }
from (sourceSets.main.output) { from (sourceSets.main.output) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**' include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
} }
from (sourceSets.main.resources.srcDirs) { from (sourceSets.main.resources.srcDirs) {
@@ -469,18 +487,50 @@ artifacts {
} }
} }
// publishing
publishing {
publications {
maven(MavenPublication) {
artifact source: jar
artifact source: sourcesJar, classifier: "src"
artifact source: devJar, classifier: "dev"
if (apiPackage) {
artifact source: apiJar, classifier: "api"
}
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
version = System.getenv("ARTIFACT_VERSION") ?: project.version
}
}
repositories {
maven {
String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown"
String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown"
String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName"
name = "GitHubPackages"
url = githubRepositoryUrl
credentials {
username = System.getenv("GITHUB_ACTOR") ?: "NONE"
password = System.getenv("GITHUB_TOKEN") ?: "NONE"
}
}
}
}
// Updating // Updating
task updateBuildScript { task updateBuildScript {
doLast { doLast {
if (updateBuildScript()) return if (performBuildScriptUpdate(projectDir.toString())) return
print("Build script already up-to-date!") print("Build script already up-to-date!")
} }
} }
if (isNewBuildScriptVersionAvailable()) { if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (autoUpdateBuildScript.toBoolean()) { if (autoUpdateBuildScript.toBoolean()) {
updateBuildScript() performBuildScriptUpdate(projectDir.toString())
} else { } else {
println("Build script update available! Run 'gradle updateBuildScript'") println("Build script update available! Run 'gradle updateBuildScript'")
} }
@@ -490,9 +540,9 @@ static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle") new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle")
} }
static boolean updateBuildScript() { boolean performBuildScriptUpdate(String projectDir) {
if (isNewBuildScriptVersionAvailable()) { if (isNewBuildScriptVersionAvailable(projectDir)) {
def buildscriptFile = new File("build.gradle") def buildscriptFile = getFile("build.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
print("Build script updated. Please REIMPORT the project or RESTART your IDE!") print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
return true return true
@@ -500,10 +550,10 @@ static boolean updateBuildScript() {
return false return false
} }
static boolean isNewBuildScriptVersionAvailable() { boolean isNewBuildScriptVersionAvailable(String projectDir) {
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
String currentBuildScript = new File("build.gradle").getText() String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript) String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
String availableBuildScriptHash = getVersionHash(availableBuildScript) String availableBuildScriptHash = getVersionHash(availableBuildScript)
@@ -523,4 +573,16 @@ static String getVersionHash(String buildScriptContent) {
configure(updateBuildScript) { configure(updateBuildScript) {
group = 'forgegradle' group = 'forgegradle'
description = 'Updates the build script to the latest version' description = 'Updates the build script to the latest version'
} }
// Helper methods
def checkPropertyExists(String propertyName) {
if (project.hasProperty(propertyName) == false) {
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties")
}
}
def getFile(String relativePath) {
return new File(projectDir, relativePath)
}
+1 -4
View File
@@ -1,8 +1,5 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
compile("codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev") compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev")
compile("codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev")
runtime("codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev")
} }
+1 -1
View File
@@ -18,7 +18,7 @@ forgeVersion = 10.13.4.1614
# restart Minecraft in development. Choose this dependent on your mod: # 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 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 # 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: # Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION"; # public static final String VERSION = "GRADLETOKEN_VERSION";
Vendored Regular → Executable
View File
File mode changed.
+1 -2
View File
@@ -2,7 +2,6 @@
repositories { repositories {
maven { maven {
name = "chickenbones" url = "https://jitpack.io"
url = "http://chickenbones.net/maven"
} }
} }
+5 -4
View File
@@ -1,6 +1,7 @@
{ {
"repo": "http://files.minecraftforge.net/maven/codechicken/CodeChickenLib/${mc_version}-${ccl_version}/", "repo": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.4.1/",
"file": "CodeChickenLib-${mc_version}-${ccl_version}-universal.jar", "file": "CodeChickenLib-1.7.10-1.1.4.1.jar",
"dev": "CodeChickenLib-${mc_version}-${ccl_version}-dev.jar", "dev": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.4.1/CodeChickenLib-1.7.10-1.1.4.1-dev.jar",
"class": "codechicken.lib.asm.ASMHelper" "class": "codechicken.lib.asm.ASMHelper",
"coreLib": true
} }
@@ -9,16 +9,19 @@ import cpw.mods.fml.relauncher.Side
import net.minecraft.item.crafting.CraftingManager import net.minecraft.item.crafting.CraftingManager
import net.minecraft.item.Item import net.minecraft.item.Item
import net.minecraft.item.crafting.IRecipe import net.minecraft.item.crafting.IRecipe
import java.util.{List => JList} import java.util.{List => JList}
import codechicken.lib.config.ConfigFile import codechicken.lib.config.ConfigFile
import net.minecraftforge.oredict.OreDictionary import net.minecraftforge.oredict.OreDictionary
import net.minecraft.item.ItemStack import net.minecraft.item.ItemStack
import net.minecraftforge.oredict.ShapedOreRecipe import net.minecraftforge.oredict.ShapedOreRecipe
import codechicken.lib.packet.PacketCustom import codechicken.lib.packet.PacketCustom
import cpw.mods.fml.common.Loader
import cpw.mods.fml.common.registry.GameRegistry import cpw.mods.fml.common.registry.GameRegistry
import net.minecraft.client.renderer.RenderBlocks import net.minecraft.client.renderer.RenderBlocks
import net.minecraft.init.{Blocks, Items} import net.minecraft.init.{Blocks, Items}
import org.apache.logging.log4j.Logger import org.apache.logging.log4j.Logger
import scala.collection.mutable import scala.collection.mutable
class MicroblockProxy_serverImpl class MicroblockProxy_serverImpl
@@ -70,10 +73,12 @@ class MicroblockProxy_serverImpl
def init() { def init() {
CraftingManager.getInstance.getRecipeList.asInstanceOf[JList[IRecipe]].add(MicroRecipe) CraftingManager.getInstance.getRecipeList.asInstanceOf[JList[IRecipe]].add(MicroRecipe)
CraftingManager.getInstance.addRecipe(new ItemStack(stoneRod, 4), "s", "s", 's': Character, Blocks.stone) if (!Loader.isModLoaded("dreamcraft")) {
addSawRecipe(sawStone, Items.flint) CraftingManager.getInstance.addRecipe(new ItemStack(stoneRod, 4), "s", "s", 's': Character, Blocks.stone)
addSawRecipe(sawIron, Items.iron_ingot) addSawRecipe(sawStone, Items.flint)
addSawRecipe(sawDiamond, Items.diamond) addSawRecipe(sawIron, Items.iron_ingot)
addSawRecipe(sawDiamond, Items.diamond)
}
} }
def postInit() { def postInit() {
@@ -579,7 +579,7 @@ object ASMMixinCompiler
}) })
} }
else { else {
fields += FieldMixin(sym.name.trim, getReturnType(sym.jDesc).getDescriptor, fields += FieldMixin(sym.name.trim, sym.jDesc,
if (fieldAccessors(sym.name.trim).isPrivate) ACC_PRIVATE else ACC_PUBLIC) if (fieldAccessors(sym.name.trim).isPrivate) ACC_PRIVATE else ACC_PUBLIC)
} }
} }
@@ -588,4 +588,4 @@ object ASMMixinCompiler
mixinMap.put(cnode.name, mixin) mixinMap.put(cnode.name, mixin)
mixin mixin
} }
} }