From 7d9f90cd3c59306b1cfd826e1bc1d1a5d9449538 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 7 Jan 2024 21:33:34 -0600 Subject: [PATCH] Update build script version to 1704659416 (#2341) Co-authored-by: DStrand1 Co-authored-by: alongstringofnumbers --- build.gradle | 67 ++++++++++++++++++++++++++++++++++++++--------- gradle.properties | 3 +++ settings.gradle | 4 +-- 3 files changed, 59 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 913152a71c5..ebae36cf19e 100644 --- a/build.gradle +++ b/build.gradle @@ -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. @@ -62,6 +62,7 @@ propertyDefaultIfUnset("generateGradleTokenClass", "") propertyDefaultIfUnset("gradleTokenModId", "") propertyDefaultIfUnset("gradleTokenModName", "") propertyDefaultIfUnset("gradleTokenVersion", "") +propertyDefaultIfUnset("useSrcApiPath", false) propertyDefaultIfUnset("includeWellKnownRepositories", true) propertyDefaultIfUnset("includeCommonDevEnvMods", true) propertyDefaultIfUnset("noPublishedSources", false) @@ -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}") } @@ -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()) { @@ -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 @@ -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}/**" + } } } @@ -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) } @@ -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) @@ -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) diff --git a/gradle.properties b/gradle.properties index 2408eee2147..43e31d58feb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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. @@ -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 diff --git a/settings.gradle b/settings.gradle index b6371aad5ab..771def37e1f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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'