Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #38 from GTNewHorizons/upstream
Browse files Browse the repository at this point in the history
MIT
  • Loading branch information
Dream-Master authored Feb 11, 2022
2 parents 4e5f8f1 + f709147 commit 9302172
Show file tree
Hide file tree
Showing 272 changed files with 9,543 additions and 13,986 deletions.
Empty file added .gitmodules
Empty file.
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017-2022 TecTech

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 3 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,8 @@ https://github.com/Technus/TecTech/blob/master/src/main/java/com/github/technus/
- Required After


# MIT License
# License

Copyright (c) 2017 TecTech
Copyright (c) 2017-2022 TecTech and licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
GTNH changes are under the MIT License to maintain upstream compatibility.
103 changes: 65 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//version: 1643020202
//version: 1644349045
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
*/
*/


import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
Expand Down Expand Up @@ -40,11 +40,16 @@ 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")
id 'maven-publish'
id('org.jetbrains.kotlin.jvm') version ('1.6.10') apply false
id('org.ajoberstar.grgit') version('4.1.1')
id('com.github.johnrengelman.shadow') version('4.0.4')
id('com.palantir.git-version') version('0.13.0') apply false
id('de.undercouch.download') version('5.0.1')
}

if (project.file('.git/HEAD').isFile()) {
apply plugin: 'com.palantir.git-version'
}

apply plugin: 'forge'
Expand Down Expand Up @@ -94,24 +99,27 @@ boolean noPublishedSources = project.findProperty("noPublishedSources") ? projec

String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/"

String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}

if(apiPackage) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
}

if(accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
if(getFile(targetFile).exists() == false) {
if(!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
}
}
Expand All @@ -123,24 +131,27 @@ if(usesMixins.toBoolean()) {

targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}

String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
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)
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
}
}

if(coreModClass) {
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
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)
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
}
}

Expand All @@ -153,17 +164,32 @@ configurations.all {
}

// 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()
try {
'git config core.fileMode false'.execute()
}
catch (Exception e) {
logger.error("\u001B[31mgit isn't installed at all\u001B[0m")
}

// Pulls version first from the VERSION env and then git tag
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
try {
String versionOverride = System.getenv("VERSION") ?: null
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
version = minecraftVersion + "-" + identifiedVersion
}
catch (Exception e) {
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!");
logger.error("\n\u001B[1;31mThis mod must be version controlled by Git AND the repository must provide at least one tag,\n" +
"or the VERSION override must be set! \u001B[32m(Don't download from GitHub using the ZIP option, instead\n" +
"clone the repository, see\u001B[33m https://gtnh.miraheze.org/wiki/Development \u001B[32mfor details.)\u001B[0m\n");
versionOverride = 'NO-GIT-TAG-SET'
identifiedVersion = versionOverride
}
version = minecraftVersion + '-' + identifiedVersion
String modVersion = identifiedVersion

if( identifiedVersion.equals(versionOverride) ) {
logger.error('\u001B[31m\u001B[7mWe hope you know what you\'re doing using\u001B[0m\u001B[1;34m ' + modVersion + '\u001B[0m\n');
logger.error('\7\u001B[31mGoing to blindly try to use\u001B[1;34m ' + modVersion + '\u001B[0m\u001B[31m, this probably won\'t work the way you expect!!\u001B[0m\n');
}

group = modGroup
Expand Down Expand Up @@ -200,7 +226,7 @@ minecraft {
replace gradleTokenModName, modName
}
if(gradleTokenVersion) {
replace gradleTokenVersion, versionDetails().lastTag
replace gradleTokenVersion, modVersion
}
if(gradleTokenGroupName) {
replace gradleTokenGroupName, modGroup
Expand Down Expand Up @@ -380,23 +406,23 @@ processResources
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
// replace modVersion and minecraftVersion
expand "minecraftVersion": project.minecraft.version,
"modVersion": versionDetails().lastTag,
"modId": modId,
"modName": modName
"modVersion": modVersion,
"modId": modId,
"modName": modName
}

if(usesMixins.toBoolean()) {
from refMap
}

// copy everything else, thats not the mcmod.info
// copy everything else that's not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
Expand Down Expand Up @@ -513,8 +539,6 @@ tasks.withType(GenerateModuleMetadata) {
enabled = false
}


// publishing
publishing {
publications {
maven(MavenPublication) {
Expand All @@ -535,13 +559,16 @@ publishing {
// 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
// remove extra garbage from who knows where
pom.withXml {
def badPomGroup = ['net.minecraft', 'com.google.code.findbugs', 'org.ow2.asm', 'com.typesafe.akka', 'com.typesafe', 'org.scala-lang',
'org.scala-lang.plugins', 'net.sf.jopt-simple', 'lzma', 'com.mojang', 'org.apache.commons', 'org.apache.httpcomponents',
'commons-logging', 'java3d', 'net.sf.trove4j', 'com.ibm.icu', 'com.paulscode', 'io.netty', 'com.google.guava',
'commons-io', 'commons-codec', 'net.java.jinput', 'net.java.jutils', 'com.google.code.gson', 'org.apache.logging.log4j',
'org.lwjgl.lwjgl', 'tv.twitch', '']
Node pomNode = asNode()
pomNode.dependencies.'*'.findAll() {
it.groupId.text() != 'com.github.GTNewHorizons'
badPomGroup.contains(it.groupId.text())
}.each() {
it.parent().remove(it)
}
Expand Down Expand Up @@ -647,7 +674,7 @@ def deobf(String sourceURL) {
}
}

// The method above is to be prefered. Use this method if the filename is not at the end of the URL.
// The method above is to be preferred. 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"
Expand All @@ -659,14 +686,14 @@ def deobf(String sourceURL, String fileName) {
return files(deobfFile)
}

download {
download.run {
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 {
download.run {
src sourceURL
dest obfFile
quiet true
Expand Down
43 changes: 15 additions & 28 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,22 @@
// Add your dependencies here

dependencies {
shadowImplementation("com.github.GTNewHorizons:AVRcore:master-SNAPSHOT")
shadowImplementation('com.github.GTNewHorizons:AVRcore:master-SNAPSHOT')

compile("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.26:dev")
compile("com.github.GTNewHorizons:Yamcl:0.5.82:dev")
compile("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev")
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev")
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev")
compile("com.github.GTNewHorizons:StructureLib:1.0.14:dev")
compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.33:dev')
compile('com.github.GTNewHorizons:Yamcl:0.5.82:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.6-GTNH:dev')
compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev')
compile('com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev')
compile('com.github.GTNewHorizons:StructureLib:1.0.15:dev')
compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')

compileOnly("com.github.GTNewHorizons:GTplusplus:1.7.24:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-70-GTNH:dev") {
transitive = false
}
compileOnly('com.github.GTNewHorizons:OpenModularTurrets:2.2.11-247:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.7.5.23-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.27:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-76-GTNH:dev') {transitive=false}

compileOnly("dan200.computercraft:ComputerCraft:1.75") {
transitive = false
}
compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.7.5.1356:dev") {
transitive = false
}
compileOnly("curse.maven:cofh-core-69162:2388751") {
transitive = false
}
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {
transitive = false
}

compileOnly files("dependencies/OpenModularTurrets-1.7.10-2.2.10-237-deobf.jar")
compileOnly('curse.maven:cofh-lib-220333:2388748') {transitive=false}
compileOnly('curse.maven:computercraft-67504:2269339') {transitive=false}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false}
}
Binary file not shown.
Binary file not shown.
Empty file modified gradlew
100644 → 100755
Empty file.
6 changes: 1 addition & 5 deletions repositories.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ repositories {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
name "OpenComputers Repo"
url = "http://maven.cil.li/"
}
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
Expand All @@ -22,7 +18,7 @@ repositories {
}
}
maven {
url "https://cursemaven.com"
url = "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
Expand Down
Loading

0 comments on commit 9302172

Please sign in to comment.