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

Commit

Permalink
maven and publication (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
bombcar authored Feb 11, 2022
1 parent 9302172 commit e181d43
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 50 deletions.
85 changes: 46 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
//version: 1644349045
//version: 1644510936
/*
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 org.gradle.internal.logging.text.StyledTextOutput
import org.gradle.internal.logging.text.StyledTextOutputFactory
import org.gradle.internal.logging.text.StyledTextOutput.Style

import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
Expand All @@ -15,20 +18,20 @@ import java.util.concurrent.TimeUnit
buildscript {
repositories {
maven {
name = "forge"
url = "https://maven.minecraftforge.net"
name 'forge'
url 'https://maven.minecraftforge.net'
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name = "Scala CI dependencies"
url = "https://repo1.maven.org/maven2/"
name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/'
}
maven {
name = "jitpack"
url = "https://jitpack.io"
name 'jitpack'
url 'https://jitpack.io'
}
}
dependencies {
Expand All @@ -37,6 +40,7 @@ buildscript {
}

plugins {
id 'java-library'
id 'idea'
id 'eclipse'
id 'scala'
Expand All @@ -52,6 +56,8 @@ if (project.file('.git/HEAD').isFile()) {
apply plugin: 'com.palantir.git-version'
}

def out = services.get(StyledTextOutputFactory).create("an-output")

apply plugin: 'forge'

def projectJavaVersion = JavaLanguageVersion.of(8)
Expand Down Expand Up @@ -168,7 +174,7 @@ try {
'git config core.fileMode false'.execute()
}
catch (Exception e) {
logger.error("\u001B[31mgit isn't installed at all\u001B[0m")
out.style(Style.Failure).println("git isn't installed at all")
}

// Pulls version first from the VERSION env and then git tag
Expand All @@ -178,18 +184,19 @@ try {
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
}
catch (Exception e) {
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");
out.style(Style.Failure).text(
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
)
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');
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
}

group = modGroup
Expand Down Expand Up @@ -262,36 +269,36 @@ configurations {

repositories {
maven {
name = "Overmind forge repo mirror"
url = "https://gregtech.overminddl1.com/"
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
if(usesMixins.toBoolean()) {
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
name 'sponge'
url 'https://repo.spongepowered.org/repository/maven-public'
}
maven {
url = "https://jitpack.io"
url 'https://jitpack.io'
}
}
}

dependencies {
if(usesMixins.toBoolean()) {
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
annotationProcessor("com.google.guava:guava:24.1.1-jre")
annotationProcessor("com.google.code.gson:gson:2.8.6")
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT')
// using 0.8 to workaround a issue in 0.7 which fails mixin application
compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") {
compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: "launchwrapper"
exclude module: "guava"
exclude module: "gson"
exclude module: "commons-io"
exclude module: "log4j-core"
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
compile("com.github.GTNewHorizons:SpongeMixins:1.5.0")
compile('com.github.GTNewHorizons:SpongeMixins:1.5.0')
}
}

Expand Down Expand Up @@ -406,7 +413,7 @@ 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'
Expand Down Expand Up @@ -558,17 +565,17 @@ 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 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',
'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() {
badPomGroup.contains(it.groupId.text())
badPomGroup.contains(it.groupId.text())
}.each() {
it.parent().remove(it)
}
Expand Down Expand Up @@ -600,7 +607,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (autoUpdateBuildScript.toBoolean()) {
performBuildScriptUpdate(projectDir.toString())
} else {
println("Build script update available! Run 'gradle updateBuildScript'")
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
}
}

Expand All @@ -612,7 +619,7 @@ boolean performBuildScriptUpdate(String projectDir) {
if (isNewBuildScriptVersionAvailable(projectDir)) {
def buildscriptFile = getFile("build.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
return true
}
return false
Expand Down Expand Up @@ -681,7 +688,7 @@ def deobf(String sourceURL, String fileName) {
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)
}
Expand Down
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
dependencies {
shadowImplementation('com.github.GTNewHorizons:AVRcore:master-SNAPSHOT')

compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.33:dev')
compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.34:dev')
compile('com.github.GTNewHorizons:Yamcl:0.5.82:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.6-GTNH:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.7-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:CodeChickenCore:1.1.4:dev')
compile('com.github.GTNewHorizons:StructureLib:1.0.15:dev')
compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')

Expand Down
21 changes: 13 additions & 8 deletions repositories.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,30 @@

repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
name 'sponge'
url 'https://repo.spongepowered.org/repository/maven-public'
}
maven {
name = "ic2"
url = "http://maven.ic2.player.to/"
name 'ic2'
url 'https://maven.ic2.player.to/'
metadataSources {
mavenPom()
artifact()
}
}
maven {
url = "https://cursemaven.com"
url 'https://cursemaven.com'
content {
includeGroup 'curse.maven'
}

}
maven {
url = "https://jitpack.io"
url 'https://jitpack.io'
}
}

0 comments on commit e181d43

Please sign in to comment.