Skip to content

Commit

Permalink
Update build script version to 1704659416 (GregTechCEu#2341)
Browse files Browse the repository at this point in the history
Co-authored-by: DStrand1 <[email protected]>
Co-authored-by: alongstringofnumbers <[email protected]>
  • Loading branch information
3 people authored Jan 8, 2024
1 parent f92e1c6 commit 7d9f90c
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 15 deletions.
67 changes: 55 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1702805890
//version: 1704659416
/*
* DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -62,6 +62,7 @@ propertyDefaultIfUnset("generateGradleTokenClass", "")
propertyDefaultIfUnset("gradleTokenModId", "")
propertyDefaultIfUnset("gradleTokenModName", "")
propertyDefaultIfUnset("gradleTokenVersion", "")
propertyDefaultIfUnset("useSrcApiPath", false)
propertyDefaultIfUnset("includeWellKnownRepositories", true)
propertyDefaultIfUnset("includeCommonDevEnvMods", true)
propertyDefaultIfUnset("noPublishedSources", false)
Expand Down Expand Up @@ -105,9 +106,16 @@ if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists(
}

if (apiPackage) {
targetPackageJava = javaSourceDir + modGroupPath + '/' + apiPackagePath
targetPackageScala = scalaSourceDir + modGroupPath + '/' + apiPackagePath
targetPackageKotlin = kotlinSourceDir + modGroupPath + '/' + apiPackagePath
final String endApiPath = modGroupPath + '/' + apiPackagePath
if (useSrcApiPath) {
targetPackageJava = 'src/api/java/' + endApiPath
targetPackageScala = 'src/api/scala/' + endApiPath
targetPackageKotlin = 'src/api/kotlin/' + endApiPath
} else {
targetPackageJava = javaSourceDir + endApiPath
targetPackageScala = scalaSourceDir + endApiPath
targetPackageKotlin = kotlinSourceDir + endApiPath
}
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}")
}
Expand Down Expand Up @@ -436,8 +444,7 @@ repositories {
}
maven {
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public'
allowInsecureProtocol = true
url 'https://nexus.gtnewhorizons.com/repository/public/'
}
}
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
Expand Down Expand Up @@ -675,6 +682,19 @@ jar {
it.isDirectory() ? it : zipTree(it)
}
}

if (useSrcApiPath && apiPackage) {
from sourceSets.api.output
dependsOn apiClasses

include "${modGroupPath}/**"
include "assets/**"
include "mcmod.info"
include "pack.mcmeta"
if (accessTransformersFile) {
include "META-INF/${accessTransformersFile}"
}
}
}

// Configure default run tasks
Expand All @@ -691,12 +711,21 @@ if (separateRunDirectories.toBoolean()) {
// Create API library jar
tasks.register('apiJar', Jar) {
archiveClassifier.set 'api'
from(sourceSets.main.java) {
include "${modGroupPath}/${apiPackagePath}/**"
}
if (useSrcApiPath) {
from(sourceSets.api.java) {
include "${modGroupPath}/${apiPackagePath}/**"
}
from(sourceSets.api.output) {
include "${modGroupPath}/${apiPackagePath}/**"
}
} else {
from(sourceSets.main.java) {
include "${modGroupPath}/${apiPackagePath}/**"
}

from(sourceSets.main.output) {
include "${modGroupPath}/${apiPackagePath}/**"
from(sourceSets.main.output) {
include "${modGroupPath}/${apiPackagePath}/**"
}
}
}

Expand Down Expand Up @@ -906,6 +935,12 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
}
String[] parts = dep.split(':')
String type = parts[0], slug = parts[1]
def types = [
'req' : 'requiredDependency', 'required': 'requiredDependency',
'opt' : 'optionalDependency', 'optional': 'optionalDependency',
'embed' : 'embeddedLibrary', 'embedded': 'embeddedLibrary',
'incomp': 'incompatible', 'fail' : 'incompatible']
if (types.containsKey(type)) type = types[type]
if (!(type in ['requiredDependency', 'embeddedLibrary', 'optionalDependency', 'tool', 'incompatible'])) {
throw new Exception('Invalid Curseforge dependency type: ' + type)
}
Expand Down Expand Up @@ -948,7 +983,7 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
}
String[] parts = dep.split(':')
String[] qual = parts[0].split('-')
addModrinthDep(qual[0], qual[1], parts[1])
addModrinthDep(qual[0], qual.length > 1 ? qual[1] : 'project', parts[1])
}
}
tasks.modrinth.dependsOn(build)
Expand All @@ -957,9 +992,17 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {

def addModrinthDep(String scope, String type, String name) {
com.modrinth.minotaur.dependencies.Dependency dep
def types = [
'req' : 'required',
'opt' : 'optional',
'embed' : 'embedded',
'incomp': 'incompatible', 'fail': 'incompatible']
if (types.containsKey(scope)) scope = types[scope]
if (!(scope in ['required', 'optional', 'incompatible', 'embedded'])) {
throw new Exception('Invalid modrinth dependency scope: ' + scope)
}
types = ['proj': 'project', '': 'project', 'p': 'project', 'ver': 'version', 'v': 'version']
if (types.containsKey(type)) type = types[type]
switch (type) {
case 'project':
dep = new ModDependency(name, scope)
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ gradleTokenVersion = VERSION
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage =
# If you want to keep your API code in src/api instead of src/main
useSrcApiPath=false

# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/
# There can be multiple files in a comma-separated list.
Expand Down Expand Up @@ -90,6 +92,7 @@ relocateShadowedDependencies = true
# Separate run directories into "run/client" for runClient task, and "run/server" for runServer task.
# Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/"
separateRunDirectories = false

# The display name format of versions published to Curse and Modrinth. $MOD_NAME and $VERSION are available variables.
# Default: $MOD_NAME \u2212 $VERSION. \u2212 is the minus character which looks much better than the hyphen minus on Curse.
versionDisplayFormat=$MOD_NAME: $VERSION
Expand Down
4 changes: 1 addition & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ pluginManagement {
maven {
// RetroFuturaGradle
name 'GTNH Maven'
//noinspection HttpUrlsUsage
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol = true
url 'https://nexus.gtnewhorizons.com/repository/public/'
//noinspection GroovyAssignabilityCheck
mavenContent {
includeGroup 'com.gtnewhorizons'
Expand Down

0 comments on commit 7d9f90c

Please sign in to comment.