2018-11-05 09:54:00 -05:00
|
|
|
plugins {
|
2021-05-12 15:23:04 -04:00
|
|
|
id "java-library"
|
2020-10-11 16:28:03 -04:00
|
|
|
id "eclipse"
|
|
|
|
id "idea"
|
|
|
|
id "maven-publish"
|
2022-11-24 10:04:21 -05:00
|
|
|
id 'jacoco'
|
2023-12-08 10:19:29 -05:00
|
|
|
id "fabric-loom" version "1.4.4" apply false
|
2023-08-02 13:51:21 -04:00
|
|
|
id "com.diffplug.spotless" version "6.20.0"
|
2021-05-12 15:23:04 -04:00
|
|
|
id "org.ajoberstar.grgit" version "3.1.0"
|
2022-12-11 10:41:34 -05:00
|
|
|
id "me.modmuss50.remotesign" version "0.4.0" apply false
|
2023-12-08 10:19:29 -05:00
|
|
|
id "me.modmuss50.mod-publish-plugin" version "0.4.5"
|
2018-11-05 09:54:00 -05:00
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
def ENV = System.getenv()
|
2018-11-05 09:54:00 -05:00
|
|
|
|
2021-11-12 07:48:58 -05:00
|
|
|
version = project.version + "+" + (ENV.GITHUB_RUN_NUMBER ? "" : "local-") + getBranch()
|
2020-04-05 10:51:59 -04:00
|
|
|
logger.lifecycle("Building Fabric: " + version)
|
|
|
|
|
2024-01-11 10:45:18 -05:00
|
|
|
def metaProjects = [
|
|
|
|
'deprecated',
|
|
|
|
'fabric-api-bom',
|
|
|
|
'fabric-api-catalog'
|
|
|
|
]
|
2023-05-30 07:52:53 -04:00
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
import net.fabricmc.loom.util.gradle.SourceSetHelper
|
2023-05-30 07:52:53 -04:00
|
|
|
import groovy.json.JsonSlurper
|
2019-07-14 12:42:09 -04:00
|
|
|
import org.apache.commons.codec.digest.DigestUtils
|
2019-05-11 02:55:17 -04:00
|
|
|
|
2021-11-12 07:48:58 -05:00
|
|
|
def getSubprojectVersion(project) {
|
|
|
|
// Get the version from the gradle.properties file
|
|
|
|
def version = project.properties["${project.name}-version"]
|
|
|
|
|
|
|
|
if (!version) {
|
|
|
|
throw new NullPointerException("Could not find version for " + project.name)
|
|
|
|
}
|
|
|
|
|
2019-05-13 05:20:47 -04:00
|
|
|
if (grgit == null) {
|
|
|
|
return version + "+nogit"
|
|
|
|
}
|
2021-04-14 13:35:48 -04:00
|
|
|
|
2019-05-11 17:48:33 -04:00
|
|
|
def latestCommits = grgit.log(paths: [project.name], maxCommits: 1)
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2019-05-11 17:48:33 -04:00
|
|
|
if (latestCommits.isEmpty()) {
|
|
|
|
return version + "+uncommited"
|
|
|
|
}
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2021-11-12 07:48:58 -05:00
|
|
|
return version + "+" + latestCommits.get(0).id.substring(0, 8) + DigestUtils.sha256Hex(project.rootProject.minecraft_version).substring(0, 2)
|
2019-05-11 02:55:17 -04:00
|
|
|
}
|
2018-11-05 09:54:00 -05:00
|
|
|
|
2020-04-05 10:07:27 -04:00
|
|
|
def getBranch() {
|
2020-11-05 13:12:01 -05:00
|
|
|
def ENV = System.getenv()
|
|
|
|
if (ENV.GITHUB_REF) {
|
|
|
|
def branch = ENV.GITHUB_REF
|
2019-08-27 15:40:07 -04:00
|
|
|
return branch.substring(branch.lastIndexOf("/") + 1)
|
2019-08-27 15:26:27 -04:00
|
|
|
}
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2019-08-27 15:11:55 -04:00
|
|
|
if (grgit == null) {
|
|
|
|
return "unknown"
|
|
|
|
}
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2019-12-27 18:32:40 -05:00
|
|
|
def branch = grgit.branch.current().name
|
|
|
|
return branch.substring(branch.lastIndexOf("/") + 1)
|
2019-08-27 15:11:55 -04:00
|
|
|
}
|
|
|
|
|
2020-11-15 14:15:35 -05:00
|
|
|
def moduleDependencies(project, List<String> depNames) {
|
2021-11-12 07:48:58 -05:00
|
|
|
def deps = depNames.iterator().collect { project.dependencies.project(path: ":$it", configuration: 'namedElements') }
|
2022-05-21 11:26:46 -04:00
|
|
|
def clientOutputs = depNames.iterator().collect { findProject(":$it").sourceSets.client.output }
|
|
|
|
|
2020-11-15 14:15:35 -05:00
|
|
|
project.dependencies {
|
|
|
|
deps.each {
|
2021-05-12 15:23:04 -04:00
|
|
|
api it
|
2020-11-15 14:15:35 -05:00
|
|
|
}
|
2022-05-21 11:26:46 -04:00
|
|
|
|
|
|
|
clientOutputs.each {
|
|
|
|
clientImplementation it
|
|
|
|
}
|
2020-11-15 14:15:35 -05:00
|
|
|
}
|
2022-03-13 09:52:58 -04:00
|
|
|
|
|
|
|
// As we manually handle the maven artifacts, we need to also manually specify the deps.
|
|
|
|
project.publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
pom.withXml {
|
|
|
|
def depsNode = asNode().appendNode("dependencies")
|
|
|
|
deps.each {
|
|
|
|
def depNode = depsNode.appendNode("dependency")
|
|
|
|
depNode.appendNode("groupId", it.group)
|
|
|
|
depNode.appendNode("artifactId", it.name)
|
|
|
|
depNode.appendNode("version", it.version)
|
|
|
|
depNode.appendNode("scope", "compile")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-11-15 14:15:35 -05:00
|
|
|
}
|
|
|
|
|
2022-05-21 11:26:46 -04:00
|
|
|
def testDependencies(project, List<String> depNames) {
|
|
|
|
def deps = depNames.iterator().collect { project.dependencies.project(path: ":$it", configuration: 'namedElements') }
|
|
|
|
def clientOutputs = depNames.iterator().collect { findProject(":$it").sourceSets.client.output }
|
|
|
|
|
|
|
|
project.dependencies {
|
|
|
|
deps.each {
|
|
|
|
testmodImplementation it
|
|
|
|
}
|
|
|
|
|
|
|
|
clientOutputs.each {
|
2023-05-01 08:55:19 -04:00
|
|
|
testmodClientImplementation it
|
2022-05-21 11:26:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
allprojects {
|
2022-05-01 10:44:16 -04:00
|
|
|
group = "net.fabricmc.fabric-api"
|
|
|
|
|
2022-05-01 11:16:30 -04:00
|
|
|
apply plugin: "maven-publish"
|
|
|
|
apply plugin: "me.modmuss50.remotesign"
|
|
|
|
|
2022-05-01 10:44:16 -04:00
|
|
|
tasks.withType(GenerateModuleMetadata) {
|
|
|
|
enabled = false
|
|
|
|
}
|
|
|
|
|
2023-08-02 13:51:21 -04:00
|
|
|
remoteSign {
|
|
|
|
requestUrl = ENV.SIGNING_SERVER
|
|
|
|
pgpAuthKey = ENV.SIGNING_PGP_KEY
|
|
|
|
jarAuthKey = ENV.SIGNING_JAR_KEY
|
2022-05-01 10:44:16 -04:00
|
|
|
|
2023-08-02 13:51:21 -04:00
|
|
|
useDummyForTesting = ENV.SIGNING_SERVER == null
|
|
|
|
|
|
|
|
afterEvaluate {
|
|
|
|
// PGP sign all maven publications.
|
|
|
|
sign publishing.publications.mavenJava
|
2022-05-01 10:44:16 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
setupRepositories(repositories)
|
|
|
|
}
|
|
|
|
|
2024-01-11 10:45:18 -05:00
|
|
|
if (metaProjects.contains(it.name)) {
|
2023-05-30 08:07:11 -04:00
|
|
|
return
|
|
|
|
}
|
2022-05-01 10:44:16 -04:00
|
|
|
|
2021-05-12 15:23:04 -04:00
|
|
|
apply plugin: "java-library"
|
2020-10-11 16:28:03 -04:00
|
|
|
apply plugin: "checkstyle"
|
|
|
|
apply plugin: "fabric-loom"
|
2022-05-01 10:44:16 -04:00
|
|
|
apply plugin: "com.diffplug.spotless"
|
2018-12-14 13:48:37 -05:00
|
|
|
|
2020-11-10 14:58:58 -05:00
|
|
|
tasks.withType(JavaCompile).configureEach {
|
2021-11-16 13:41:10 -05:00
|
|
|
it.options.release = 17
|
2020-11-10 14:58:58 -05:00
|
|
|
}
|
2018-11-05 09:54:00 -05:00
|
|
|
|
2022-05-21 11:26:46 -04:00
|
|
|
java {
|
|
|
|
// Must be added before the split source sets are setup.
|
|
|
|
withSourcesJar()
|
|
|
|
}
|
|
|
|
|
|
|
|
loom {
|
|
|
|
splitEnvironmentSourceSets()
|
|
|
|
}
|
|
|
|
|
2020-05-03 12:56:50 -04:00
|
|
|
sourceSets {
|
|
|
|
testmod {
|
|
|
|
compileClasspath += main.compileClasspath
|
|
|
|
runtimeClasspath += main.runtimeClasspath
|
2023-05-01 08:55:19 -04:00
|
|
|
}
|
2022-05-21 11:26:46 -04:00
|
|
|
|
2023-05-01 08:55:19 -04:00
|
|
|
testmodClient {
|
|
|
|
compileClasspath += main.compileClasspath
|
|
|
|
runtimeClasspath += main.runtimeClasspath
|
2022-05-21 11:26:46 -04:00
|
|
|
compileClasspath += client.compileClasspath
|
|
|
|
runtimeClasspath += client.runtimeClasspath
|
2023-05-01 08:55:19 -04:00
|
|
|
|
|
|
|
compileClasspath += testmod.compileClasspath
|
|
|
|
runtimeClasspath += testmod.runtimeClasspath
|
2020-05-03 12:56:50 -04:00
|
|
|
}
|
2023-05-30 08:07:11 -04:00
|
|
|
|
|
|
|
test {
|
|
|
|
compileClasspath += testmodClient.compileClasspath
|
|
|
|
runtimeClasspath += testmodClient.runtimeClasspath
|
|
|
|
}
|
2020-05-03 12:56:50 -04:00
|
|
|
}
|
|
|
|
|
2021-05-12 15:23:04 -04:00
|
|
|
loom {
|
2022-01-30 16:37:23 -05:00
|
|
|
runtimeOnlyLog4j = true
|
|
|
|
|
2021-05-12 15:23:04 -04:00
|
|
|
runs {
|
|
|
|
testmodClient {
|
|
|
|
client()
|
|
|
|
ideConfigGenerated project.rootProject == project
|
|
|
|
name = "Testmod Client"
|
2023-05-01 08:55:19 -04:00
|
|
|
source sourceSets.testmodClient
|
2021-05-12 15:23:04 -04:00
|
|
|
}
|
|
|
|
testmodServer {
|
|
|
|
server()
|
|
|
|
ideConfigGenerated project.rootProject == project
|
|
|
|
name = "Testmod Server"
|
|
|
|
source sourceSets.testmod
|
|
|
|
}
|
|
|
|
}
|
2020-11-15 14:06:27 -05:00
|
|
|
}
|
|
|
|
|
2023-09-23 05:08:54 -04:00
|
|
|
loom.runs.configureEach {
|
|
|
|
vmArg("-enableassertions")
|
|
|
|
}
|
|
|
|
|
2022-05-21 11:26:46 -04:00
|
|
|
allprojects.each { p ->
|
2024-01-11 10:45:18 -05:00
|
|
|
if (metaProjects.contains(project.name)) {
|
2023-05-30 08:07:11 -04:00
|
|
|
return
|
|
|
|
}
|
2022-05-21 11:26:46 -04:00
|
|
|
|
|
|
|
loom.mods.register(p.name) {
|
|
|
|
sourceSet p.sourceSets.main
|
|
|
|
sourceSet p.sourceSets.client
|
|
|
|
}
|
|
|
|
|
|
|
|
loom.mods.register(p.name + "-testmod") {
|
|
|
|
sourceSet p.sourceSets.testmod
|
2023-05-01 08:55:19 -04:00
|
|
|
sourceSet p.sourceSets.testmodClient
|
2022-05-21 11:26:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
dependencies {
|
2021-11-12 07:48:58 -05:00
|
|
|
minecraft "com.mojang:minecraft:$rootProject.minecraft_version"
|
|
|
|
mappings "net.fabricmc:yarn:${rootProject.minecraft_version}${project.yarn_version}:v2"
|
|
|
|
modApi "net.fabricmc:fabric-loader:${project.loader_version}"
|
2022-05-21 11:26:46 -04:00
|
|
|
|
|
|
|
testmodImplementation sourceSets.main.output
|
2023-05-01 08:55:19 -04:00
|
|
|
testmodClientImplementation sourceSets.main.output
|
|
|
|
testmodClientImplementation sourceSets.client.output
|
|
|
|
testmodClientImplementation sourceSets.testmod.output
|
2023-05-30 08:07:11 -04:00
|
|
|
|
|
|
|
testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
|
|
|
|
testImplementation sourceSets.testmodClient.output
|
2023-08-09 11:30:51 -04:00
|
|
|
testImplementation 'org.mockito:mockito-core:5.4.0'
|
2023-05-30 08:07:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
|
|
|
|
afterEvaluate {
|
|
|
|
// See: https://github.com/FabricMC/fabric-loader/pull/585
|
|
|
|
def classPathGroups = loom.mods.stream()
|
|
|
|
.map { modSettings ->
|
|
|
|
SourceSetHelper.getClasspath(modSettings, getProject()).stream()
|
|
|
|
.map(File.&getAbsolutePath)
|
|
|
|
.collect(Collectors.joining(File.pathSeparator))
|
|
|
|
}
|
|
|
|
.collect(Collectors.joining(File.pathSeparator+File.pathSeparator))
|
|
|
|
|
|
|
|
systemProperty("fabric.classPathGroups", classPathGroups)
|
|
|
|
}
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
2018-11-05 09:54:00 -05:00
|
|
|
|
2022-05-21 18:11:44 -04:00
|
|
|
tasks.withType(ProcessResources).configureEach {
|
2021-11-12 07:48:58 -05:00
|
|
|
inputs.property "version", project.version
|
2019-04-23 18:46:23 -04:00
|
|
|
|
2021-11-12 07:48:58 -05:00
|
|
|
filesMatching("fabric.mod.json") {
|
|
|
|
expand "version": project.version
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
2021-11-12 07:48:58 -05:00
|
|
|
}
|
2019-04-26 14:18:20 -04:00
|
|
|
|
2022-05-01 10:44:16 -04:00
|
|
|
spotless {
|
|
|
|
java {
|
|
|
|
licenseHeaderFile(rootProject.file("HEADER"))
|
2023-10-22 08:35:58 -04:00
|
|
|
removeUnusedImports()
|
|
|
|
importOrder('java', 'javax', '', 'net.minecraft', 'net.fabricmc')
|
|
|
|
indentWithTabs()
|
|
|
|
trimTrailingWhitespace()
|
2022-05-01 10:44:16 -04:00
|
|
|
}
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
|
|
|
|
2019-10-26 22:39:47 -04:00
|
|
|
checkstyle {
|
|
|
|
configFile = rootProject.file("checkstyle.xml")
|
2023-08-02 13:51:21 -04:00
|
|
|
toolVersion = "10.12.1"
|
2019-10-26 22:39:47 -04:00
|
|
|
}
|
2021-05-12 15:23:04 -04:00
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.withType(AbstractArchiveTask).configureEach {
|
2021-05-12 15:23:04 -04:00
|
|
|
preserveFileTimestamps = false
|
|
|
|
reproducibleFileOrder = true
|
|
|
|
}
|
2021-11-12 07:48:58 -05:00
|
|
|
|
2023-08-02 13:51:21 -04:00
|
|
|
remoteSign {
|
|
|
|
sign remapJar
|
2022-03-13 09:52:58 -04:00
|
|
|
}
|
2022-04-17 14:23:48 -04:00
|
|
|
|
|
|
|
// Run this task after updating minecraft to regenerate any required resources
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('generateResources') {
|
2022-04-17 14:23:48 -04:00
|
|
|
group = "fabric"
|
|
|
|
}
|
2022-05-21 11:26:46 -04:00
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('testmodJar', Jar) {
|
2022-05-21 11:26:46 -04:00
|
|
|
from sourceSets.testmod.output
|
2023-05-01 08:55:19 -04:00
|
|
|
from sourceSets.testmodClient.output
|
2022-05-21 11:26:46 -04:00
|
|
|
destinationDirectory = new File(project.buildDir, "devlibs")
|
|
|
|
archiveClassifier = "testmod"
|
|
|
|
}
|
|
|
|
|
2022-11-22 11:49:14 -05:00
|
|
|
[jar, sourcesJar].each {
|
2022-09-25 09:46:02 -04:00
|
|
|
it.from(rootProject.file("LICENSE")) {
|
2023-04-23 08:02:02 -04:00
|
|
|
rename { "${it}-${project.base.archivesName.get()}"}
|
2022-09-25 09:46:02 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-22 11:49:14 -05:00
|
|
|
if (file("src/client").exists() && !file("src/main").exists()) {
|
|
|
|
remapJar {
|
2023-04-23 08:02:02 -04:00
|
|
|
additionalClientOnlyEntries.add("LICENSE-${project.base.archivesName.get()}")
|
2022-11-22 11:49:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
remapSourcesJar {
|
2023-04-23 08:02:02 -04:00
|
|
|
additionalClientOnlyEntries.add("LICENSE-${project.base.archivesName.get()}")
|
2022-11-22 11:49:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('remapTestmodJar', net.fabricmc.loom.task.RemapJarTask) {
|
|
|
|
dependsOn testmodJar
|
2022-05-21 11:26:46 -04:00
|
|
|
input = testmodJar.archiveFile
|
|
|
|
archiveClassifier = "testmod"
|
|
|
|
addNestedDependencies = false
|
2023-05-01 08:55:19 -04:00
|
|
|
includesClientOnlyClasses = true
|
|
|
|
clientOnlySourceSetName = sourceSets.testmodClient.name
|
2022-05-21 11:26:46 -04:00
|
|
|
}
|
|
|
|
build.dependsOn remapTestmodJar
|
2022-08-15 13:59:19 -04:00
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('validateMixinNames', net.fabricmc.loom.task.ValidateMixinNameTask) {
|
2022-08-15 13:59:19 -04:00
|
|
|
source(sourceSets.main.output)
|
|
|
|
source(sourceSets.client.output)
|
|
|
|
source(sourceSets.testmod.output)
|
|
|
|
}
|
2022-11-22 11:33:56 -05:00
|
|
|
|
|
|
|
// Apply to each valid subproject.
|
|
|
|
apply from: rootProject.file('gradle/package-info.gradle')
|
2023-01-05 07:50:15 -05:00
|
|
|
apply from: rootProject.file('gradle/validate-annotations.gradle')
|
2019-06-27 12:22:48 -04:00
|
|
|
}
|
2019-10-26 22:39:47 -04:00
|
|
|
|
2022-05-24 10:04:30 -04:00
|
|
|
remapTestmodJar {
|
|
|
|
def testModJarTasks = []
|
|
|
|
|
|
|
|
subprojects {
|
2024-01-11 10:45:18 -05:00
|
|
|
if (metaProjects.contains(it.name) || !(it.file("src/testmod").exists() || it.file("src/testmodClient").exists())) {
|
2023-05-30 08:07:11 -04:00
|
|
|
return
|
|
|
|
}
|
2022-05-24 10:04:30 -04:00
|
|
|
|
|
|
|
testModJarTasks += it.tasks.remapTestmodJar
|
|
|
|
}
|
|
|
|
|
|
|
|
nestedJars.setFrom(testModJarTasks)
|
|
|
|
addNestedDependencies = true
|
2023-05-01 08:55:19 -04:00
|
|
|
clientOnlySourceSetName = sourceSets.testmodClient.name
|
2022-05-24 10:04:30 -04:00
|
|
|
}
|
|
|
|
|
2021-01-19 13:48:09 -05:00
|
|
|
// Apply auxiliary buildscripts to submodules
|
|
|
|
// This must be done after all plugins are applied to subprojects
|
|
|
|
apply from: "gradle/module-validation.gradle"
|
2021-11-12 07:48:58 -05:00
|
|
|
apply from: "gradle/module-versioning.gradle"
|
2021-01-19 13:48:09 -05:00
|
|
|
|
2022-10-22 15:38:33 -04:00
|
|
|
loom {
|
|
|
|
// Required as the item-group API uses access widened classes in its API, without this the javadoc generation fails.
|
|
|
|
accessWidenerPath = file("fabric-item-group-api-v1/src/main/resources/fabric-item-group-api-v1.accesswidener")
|
|
|
|
}
|
|
|
|
|
2019-10-26 22:39:47 -04:00
|
|
|
javadoc {
|
2020-04-05 10:07:27 -04:00
|
|
|
options {
|
2021-11-16 13:41:10 -05:00
|
|
|
source = "17"
|
2020-10-11 16:28:03 -04:00
|
|
|
encoding = "UTF-8"
|
|
|
|
charSet = "UTF-8"
|
2020-04-05 10:07:27 -04:00
|
|
|
memberLevel = JavadocMemberLevel.PACKAGE
|
|
|
|
links(
|
2022-09-25 09:45:12 -04:00
|
|
|
"https://maven.fabricmc.net/docs/yarn-${rootProject.minecraft_version}${project.yarn_version}/"
|
2023-05-30 08:07:11 -04:00
|
|
|
)
|
2020-04-05 10:07:27 -04:00
|
|
|
// Disable the crazy super-strict doclint tool in Java 8
|
2020-10-11 16:28:03 -04:00
|
|
|
addStringOption("Xdoclint:none", "-quiet")
|
2023-05-14 09:57:28 -04:00
|
|
|
|
|
|
|
tags(
|
|
|
|
'apiNote:a:API Note:',
|
|
|
|
'implSpec:a:Implementation Requirements:',
|
|
|
|
'implNote:a:Implementation Note:'
|
2023-05-30 08:07:11 -04:00
|
|
|
)
|
2020-04-05 10:07:27 -04:00
|
|
|
}
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2020-04-05 10:07:27 -04:00
|
|
|
allprojects.each {
|
2024-01-11 10:45:18 -05:00
|
|
|
if (metaProjects.contains(it.name)) {
|
2023-05-30 08:07:11 -04:00
|
|
|
return
|
|
|
|
}
|
2022-05-21 11:26:46 -04:00
|
|
|
|
2022-11-22 11:33:56 -05:00
|
|
|
source(it.sourceSets.main.allJava)
|
|
|
|
source(it.sourceSets.client.allJava)
|
2020-04-05 10:07:27 -04:00
|
|
|
}
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2022-05-21 11:26:46 -04:00
|
|
|
classpath = files(sourceSets.main.compileClasspath, sourceSets.client.compileClasspath)
|
2020-04-05 10:07:27 -04:00
|
|
|
include("**/api/**")
|
2022-10-22 15:38:33 -04:00
|
|
|
failOnError true
|
2018-12-22 10:21:31 -05:00
|
|
|
}
|
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('javadocJar', Jar) {
|
2020-04-05 10:07:27 -04:00
|
|
|
dependsOn javadoc
|
|
|
|
from javadoc.destinationDir
|
2020-02-10 12:05:41 -05:00
|
|
|
//Set as `fatjavadoc` to prevent an ide form trying to use this javadoc, over using the modules javadoc
|
2020-10-11 16:28:03 -04:00
|
|
|
archiveClassifier = "fatjavadoc"
|
2020-02-10 12:05:41 -05:00
|
|
|
}
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2020-02-10 12:05:41 -05:00
|
|
|
build.dependsOn javadocJar
|
|
|
|
|
2021-05-12 15:23:04 -04:00
|
|
|
loom {
|
|
|
|
runs {
|
2021-11-12 07:48:58 -05:00
|
|
|
gametest {
|
|
|
|
inherit testmodServer
|
|
|
|
|
|
|
|
name "Game Test"
|
|
|
|
|
|
|
|
// Enable the gametest runner
|
|
|
|
vmArg "-Dfabric-api.gametest"
|
|
|
|
vmArg "-Dfabric-api.gametest.report-file=${project.buildDir}/junit.xml"
|
|
|
|
runDir "build/gametest"
|
|
|
|
}
|
2021-05-12 15:23:04 -04:00
|
|
|
autoTestServer {
|
|
|
|
inherit testmodServer
|
2023-08-02 13:51:21 -04:00
|
|
|
name "Auto Test Server"
|
2022-11-22 11:49:00 -05:00
|
|
|
vmArg "-Dfabric.autoTest"
|
|
|
|
}
|
|
|
|
autoTestClient {
|
|
|
|
inherit testmodClient
|
|
|
|
name "Auto Test Client"
|
2021-05-12 15:23:04 -04:00
|
|
|
vmArg "-Dfabric.autoTest"
|
|
|
|
}
|
2022-11-24 10:04:21 -05:00
|
|
|
|
|
|
|
// Create duplicate tasks for this, as jacoco slows things down a bit
|
|
|
|
gametestCoverage {
|
|
|
|
inherit gametest
|
|
|
|
name "Game Test Coverage"
|
|
|
|
ideConfigGenerated = false
|
|
|
|
}
|
|
|
|
|
|
|
|
autoTestClientCoverage {
|
|
|
|
inherit autoTestClient
|
|
|
|
name "Auto Test Client Coverage"
|
|
|
|
ideConfigGenerated = false
|
|
|
|
}
|
2020-11-15 14:06:27 -05:00
|
|
|
}
|
|
|
|
}
|
2021-11-12 07:48:58 -05:00
|
|
|
test.dependsOn runGametest
|
2020-11-15 14:06:27 -05:00
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
def coverageTasks = [
|
|
|
|
runGametestCoverage,
|
|
|
|
runAutoTestClientCoverage
|
|
|
|
]
|
2022-11-24 10:04:21 -05:00
|
|
|
|
|
|
|
jacoco {
|
|
|
|
coverageTasks.forEach {
|
|
|
|
applyTo it
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('coverage', JacocoReport) {
|
|
|
|
dependsOn coverageTasks
|
2022-11-24 10:04:21 -05:00
|
|
|
coverageTasks.forEach {
|
|
|
|
executionData it
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add all source as input
|
|
|
|
allprojects { p ->
|
2023-05-30 08:07:11 -04:00
|
|
|
if (p.path.startsWith(":deprecated")) {
|
|
|
|
return
|
|
|
|
}
|
2023-05-01 08:55:19 -04:00
|
|
|
sourceSets p.sourceSets.main, p.sourceSets.client, p.sourceSets.testmod, p.sourceSets.testmodClient
|
2022-11-24 10:04:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Exclude mixins
|
2023-05-30 08:07:11 -04:00
|
|
|
classDirectories.setFrom(files(classDirectories.files.collect {
|
|
|
|
fileTree(dir: it, exclude: '**/mixin/**')
|
|
|
|
}))
|
2022-11-24 10:04:21 -05:00
|
|
|
}
|
|
|
|
|
2022-11-22 11:49:00 -05:00
|
|
|
configurations {
|
|
|
|
productionRuntime {
|
|
|
|
extendsFrom configurations.minecraftLibraries
|
|
|
|
extendsFrom configurations.loaderLibraries
|
2023-04-23 08:02:02 -04:00
|
|
|
extendsFrom configurations.minecraftRuntimeLibraries
|
2022-11-22 11:49:00 -05:00
|
|
|
}
|
2022-12-11 08:49:21 -05:00
|
|
|
productionRuntimeServer
|
2022-11-22 11:49:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
productionRuntime "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
|
|
productionRuntime "net.fabricmc:intermediary:${project.minecraft_version}"
|
2022-12-11 08:49:21 -05:00
|
|
|
|
|
|
|
productionRuntimeServer "net.fabricmc:fabric-installer:${project.installer_version}:server"
|
2022-11-22 11:49:00 -05:00
|
|
|
}
|
|
|
|
|
2023-04-23 08:02:02 -04:00
|
|
|
import net.fabricmc.loom.util.Platform
|
2022-11-22 11:49:00 -05:00
|
|
|
|
|
|
|
// This is very far beyond loom's API if you copy this, you're on your own.
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('runProductionAutoTestClient', JavaExec) {
|
|
|
|
dependsOn remapJar, remapTestmodJar, downloadAssets
|
2022-11-22 11:49:00 -05:00
|
|
|
classpath.from configurations.productionRuntime
|
|
|
|
mainClass = "net.fabricmc.loader.impl.launch.knot.KnotClient"
|
|
|
|
workingDir = file("run")
|
|
|
|
|
|
|
|
doFirst {
|
|
|
|
classpath.from loom.minecraftProvider.minecraftClientJar
|
|
|
|
workingDir.mkdirs()
|
|
|
|
|
|
|
|
args(
|
2023-05-30 08:07:11 -04:00
|
|
|
"--assetIndex", loom.minecraftProvider.versionInfo.assetIndex().fabricId(loom.minecraftProvider.minecraftVersion()),
|
|
|
|
"--assetsDir", new File(loom.files.userCache, "assets").absolutePath,
|
|
|
|
"--gameDir", workingDir.absolutePath
|
|
|
|
)
|
2022-11-22 11:49:00 -05:00
|
|
|
|
2023-04-23 08:02:02 -04:00
|
|
|
if (Platform.CURRENT.operatingSystem.isMacOS()) {
|
2022-11-22 11:49:00 -05:00
|
|
|
jvmArgs(
|
2023-05-30 08:07:11 -04:00
|
|
|
"-XstartOnFirstThread"
|
|
|
|
)
|
2022-11-22 11:49:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
jvmArgs(
|
2023-05-30 08:07:11 -04:00
|
|
|
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
|
2023-09-23 05:08:54 -04:00
|
|
|
"-Dfabric.autoTest",
|
|
|
|
"-enableassertions"
|
2023-05-30 08:07:11 -04:00
|
|
|
)
|
2022-11-22 11:49:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('serverPropertiesJar', Jar) {
|
2022-12-11 08:49:21 -05:00
|
|
|
def propsFile = file("build/tmp/install.properties")
|
|
|
|
|
|
|
|
doFirst {
|
|
|
|
propsFile.text = """\
|
|
|
|
fabric-loader-version=${project.loader_version}
|
|
|
|
game-version=${project.minecraft_version}
|
|
|
|
""".stripMargin().stripIndent()
|
|
|
|
}
|
|
|
|
|
|
|
|
archiveFileName = "test-server-properties.jar"
|
|
|
|
destinationDirectory = file("build/tmp")
|
|
|
|
from(propsFile)
|
|
|
|
}
|
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('runProductionAutoTestServer', JavaExec) {
|
|
|
|
dependsOn remapJar, remapTestmodJar, serverPropertiesJar
|
2022-12-11 08:49:21 -05:00
|
|
|
classpath.from configurations.productionRuntimeServer, serverPropertiesJar
|
|
|
|
mainClass = "net.fabricmc.installer.ServerLauncher"
|
|
|
|
workingDir = file("run")
|
|
|
|
|
|
|
|
doFirst {
|
|
|
|
workingDir.mkdirs()
|
|
|
|
|
|
|
|
jvmArgs(
|
2023-05-30 08:07:11 -04:00
|
|
|
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
|
2023-09-23 05:08:54 -04:00
|
|
|
"-Dfabric.autoTest",
|
|
|
|
"-enableassertions"
|
2023-05-30 08:07:11 -04:00
|
|
|
)
|
2022-12-11 08:49:21 -05:00
|
|
|
|
|
|
|
args("nogui")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-30 08:07:11 -04:00
|
|
|
// Format all the gradle files
|
|
|
|
spotless {
|
|
|
|
groovyGradle {
|
|
|
|
target 'src/**/*.gradle', '*.gradle', 'gradle/*.gradle'
|
|
|
|
greclipse()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-30 07:52:53 -04:00
|
|
|
def addPomMetadataInformation(Project project, MavenPom pom) {
|
|
|
|
def modJsonFile = project.file("src/main/resources/fabric.mod.json")
|
2023-05-30 08:07:11 -04:00
|
|
|
|
|
|
|
if (!modJsonFile.exists()) {
|
2023-05-30 07:52:53 -04:00
|
|
|
modJsonFile = project.file("src/client/resources/fabric.mod.json")
|
2023-05-30 08:07:11 -04:00
|
|
|
}
|
|
|
|
|
2023-05-30 07:52:53 -04:00
|
|
|
def modJson = new JsonSlurper().parse(modJsonFile)
|
|
|
|
pom.name = modJson.name
|
|
|
|
pom.url = "https://github.com/FabricMC/fabric/tree/HEAD/${project.rootDir.relativePath(project.projectDir)}"
|
|
|
|
pom.description = modJson.description
|
|
|
|
pom.licenses {
|
|
|
|
license {
|
|
|
|
name = "Apache-2.0"
|
|
|
|
url = "https://github.com/FabricMC/fabric/blob/HEAD/LICENSE"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pom.developers {
|
|
|
|
developer {
|
|
|
|
name = "FabricMC"
|
|
|
|
url = "https://fabricmc.net/"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pom.scm {
|
|
|
|
connection = "scm:git:https://github.com/FabricMC/fabric.git"
|
|
|
|
url = "https://github.com/FabricMC/fabric"
|
|
|
|
developerConnection = "scm:git:git@github.com:FabricMC/fabric.git"
|
|
|
|
}
|
|
|
|
pom.issueManagement {
|
|
|
|
system = "GitHub"
|
|
|
|
url = "https://github.com/FabricMC/fabric/issues"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
subprojects {
|
2024-01-11 10:45:18 -05:00
|
|
|
if (metaProjects.contains(it.name)) {
|
2023-05-30 08:07:11 -04:00
|
|
|
return
|
|
|
|
}
|
2022-05-01 10:44:16 -04:00
|
|
|
|
2023-08-02 13:51:21 -04:00
|
|
|
base {
|
|
|
|
archivesName = project.name
|
|
|
|
}
|
|
|
|
|
2020-05-03 12:56:50 -04:00
|
|
|
dependencies {
|
2021-05-12 15:23:04 -04:00
|
|
|
testmodImplementation sourceSets.main.output
|
2021-11-12 07:48:58 -05:00
|
|
|
|
2021-12-03 08:35:29 -05:00
|
|
|
// Make all modules depend on the gametest api (and thus res loader) to try and promote its usage.
|
|
|
|
if (project.name != "fabric-gametest-api-v1") {
|
2021-11-12 07:48:58 -05:00
|
|
|
testmodImplementation project(path: ':fabric-gametest-api-v1', configuration: 'namedElements')
|
2023-05-01 08:55:19 -04:00
|
|
|
testmodClientImplementation project(":fabric-gametest-api-v1").sourceSets.client.output
|
2021-12-03 08:35:29 -05:00
|
|
|
testmodImplementation project(path: ':fabric-resource-loader-v0', configuration: 'namedElements')
|
2023-05-01 08:55:19 -04:00
|
|
|
testmodClientImplementation project(":fabric-resource-loader-v0").sourceSets.client.output
|
2021-12-03 08:35:29 -05:00
|
|
|
}
|
2022-03-13 09:52:18 -04:00
|
|
|
|
|
|
|
// Make all testmods run with registry-sync-v0 as it is required to register new objects.
|
|
|
|
if (project.name != "fabric-registry-sync-v0") {
|
|
|
|
testmodRuntimeOnly project(path: ':fabric-registry-sync-v0', configuration: 'namedElements')
|
2023-05-01 08:55:19 -04:00
|
|
|
testmodClientImplementation project(":fabric-registry-sync-v0").sourceSets.client.output
|
2022-03-13 09:52:18 -04:00
|
|
|
}
|
2020-05-03 12:56:50 -04:00
|
|
|
}
|
|
|
|
|
2019-04-23 19:14:43 -04:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
2023-05-30 07:52:53 -04:00
|
|
|
pom {
|
|
|
|
addPomMetadataInformation(project, pom)
|
|
|
|
}
|
2023-08-02 13:51:21 -04:00
|
|
|
artifact(signRemapJar.output) {
|
|
|
|
builtBy(signRemapJar)
|
2022-03-13 09:52:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
artifact(remapSourcesJar) {
|
|
|
|
builtBy remapSourcesJar
|
|
|
|
}
|
2019-04-23 19:14:43 -04:00
|
|
|
}
|
2019-07-24 17:07:45 -04:00
|
|
|
}
|
2019-04-23 19:14:43 -04:00
|
|
|
}
|
|
|
|
|
2022-03-13 09:52:58 -04:00
|
|
|
// We manually handle the pom generation
|
|
|
|
loom.disableDeprecatedPomGeneration(publishing.publications.mavenJava)
|
|
|
|
|
2019-06-27 12:22:48 -04:00
|
|
|
javadoc.enabled = false
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
2019-04-03 15:34:09 -04:00
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
2023-08-02 13:51:21 -04:00
|
|
|
artifact(signRemapJar.output) {
|
|
|
|
builtBy(signRemapJar)
|
2019-04-23 19:14:43 -04:00
|
|
|
}
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2019-04-23 19:14:43 -04:00
|
|
|
artifact(sourcesJar) {
|
|
|
|
builtBy remapSourcesJar
|
|
|
|
}
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2020-04-05 10:07:27 -04:00
|
|
|
artifact javadocJar
|
2022-12-11 08:49:21 -05:00
|
|
|
artifact remapTestmodJar
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2023-05-30 07:52:53 -04:00
|
|
|
pom {
|
|
|
|
addPomMetadataInformation(rootProject, pom)
|
|
|
|
}
|
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
pom.withXml {
|
|
|
|
def depsNode = asNode().appendNode("dependencies")
|
|
|
|
subprojects.each {
|
2023-08-13 11:01:17 -04:00
|
|
|
// The maven BOM containing all of the deprecated modules is added manually below.
|
2023-05-30 08:07:11 -04:00
|
|
|
if (it.path.startsWith(":deprecated")) {
|
|
|
|
return
|
|
|
|
}
|
2022-05-01 10:44:16 -04:00
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
def depNode = depsNode.appendNode("dependency")
|
|
|
|
depNode.appendNode("groupId", it.group)
|
|
|
|
depNode.appendNode("artifactId", it.name)
|
2019-05-17 10:20:37 -04:00
|
|
|
depNode.appendNode("version", it.version)
|
2019-04-23 18:46:23 -04:00
|
|
|
depNode.appendNode("scope", "compile")
|
|
|
|
}
|
2023-08-13 11:01:17 -04:00
|
|
|
|
|
|
|
// Depend on the deprecated BOM to allow opting out of deprecated modules.
|
|
|
|
def depNode = depsNode.appendNode("dependency")
|
|
|
|
depNode.appendNode("groupId", group)
|
|
|
|
depNode.appendNode("artifactId", "fabric-api-deprecated")
|
|
|
|
depNode.appendNode("version", version)
|
|
|
|
depNode.appendNode("scope", "compile")
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
2019-11-28 03:03:04 -05:00
|
|
|
}
|
2019-04-03 15:34:09 -04:00
|
|
|
}
|
2020-04-05 10:07:27 -04:00
|
|
|
}
|
|
|
|
|
2021-11-12 07:48:58 -05:00
|
|
|
// Required until the deprecation is removed. Fabric API's main jar that is published to maven does not contain sub modules.
|
2021-09-17 13:42:42 -04:00
|
|
|
loom.disableDeprecatedPomGeneration(publishing.publications.mavenJava)
|
|
|
|
|
2020-04-05 10:07:27 -04:00
|
|
|
void setupRepositories(RepositoryHandler repositories) {
|
|
|
|
//repositories.mavenLocal() // uncomment for testing
|
2020-11-05 13:12:01 -05:00
|
|
|
def ENV = System.getenv()
|
|
|
|
if (ENV.MAVEN_URL) {
|
2020-04-05 10:07:27 -04:00
|
|
|
repositories.maven {
|
2020-11-05 13:12:01 -05:00
|
|
|
url ENV.MAVEN_URL
|
Fabric Transfer API: item transfer and fluid-containing items. (#1553)
* Add item and "fluid item" APIs
* Rework ContainerItemContext javadoc
* Rework the Inventory wrapper API
* Cleanup inventory wrapper implementation, add < 64 max stack count test, separate tests better
* Fix Inventory wrapper not limiting the stack count correctly (thanks @lilybeevee!)
* Rewrite inventory wrapper, add SingleStackStorage base implementation
* Composters
* SingleStackStorage adjustements
* Bump version
* Move icon to correct location. Closes #1565
* Bump version
* Remove composter implementation (it's broken), slight renames
* Fix SidedInventory extract
* Bump version
* Don't use MAVEN_USERNAME if it's not specified
* Add comparator output, add missing markDirty calls, fix tests
* Bump version
* Add SingleVariantStorage, deprecate SingleFluidStorage, definalize a few things, make sure markDirty() is only called once per successful outer transaction in inventory wrappers
* Add composter support
* Move EmptyFluidView to BlankVariantView, update README and package-info
* Bump version
* Key -> variant
* Add Transaction#openNested(@Nullable TransactionContext)
* Add SingleSlotContainerItemContext
* Bump prerelease version
* Remove useless comment
* Remove ContainerItemContext#getWorld
* Bump prerelease version
* Add StorageUtil#findExtractableContent and ContainerItemContext#withInitial
* Bump prerelease version
2021-08-17 14:08:09 -04:00
|
|
|
if (ENV.MAVEN_USERNAME) {
|
|
|
|
credentials {
|
|
|
|
username ENV.MAVEN_USERNAME
|
|
|
|
password ENV.MAVEN_PASSWORD
|
|
|
|
}
|
2019-04-23 19:14:43 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-03 15:34:09 -04:00
|
|
|
}
|
|
|
|
|
2022-05-01 10:44:16 -04:00
|
|
|
subprojects.each {
|
2024-01-11 10:45:18 -05:00
|
|
|
if (metaProjects.contains(it.name)) {
|
2023-05-30 08:07:11 -04:00
|
|
|
return
|
|
|
|
}
|
2022-05-01 10:44:16 -04:00
|
|
|
|
|
|
|
remapJar.dependsOn("${it.path}:remapJar")
|
|
|
|
}
|
2019-04-26 14:18:20 -04:00
|
|
|
|
2021-08-31 08:59:35 -04:00
|
|
|
// These modules are not included in the fat jar, maven will resolve them via the pom.
|
2023-05-30 08:07:11 -04:00
|
|
|
def devOnlyModules = ["fabric-gametest-api-v1",]
|
2021-08-31 08:59:35 -04:00
|
|
|
|
2019-04-23 18:46:23 -04:00
|
|
|
dependencies {
|
|
|
|
afterEvaluate {
|
|
|
|
subprojects.each {
|
2024-01-11 10:45:18 -05:00
|
|
|
if (metaProjects.contains(it.name)) {
|
2023-05-30 08:07:11 -04:00
|
|
|
return
|
|
|
|
}
|
2022-05-01 10:44:16 -04:00
|
|
|
|
|
|
|
api project(path: "${it.path}", configuration: "namedElements")
|
2022-05-21 11:26:46 -04:00
|
|
|
clientImplementation project("${it.path}:").sourceSets.client.output
|
2021-08-31 08:59:35 -04:00
|
|
|
|
2022-05-01 10:44:16 -04:00
|
|
|
testmodImplementation project("${it.path}:").sourceSets.testmod.output
|
2023-05-01 08:55:19 -04:00
|
|
|
testmodClientImplementation project("${it.path}:").sourceSets.testmodClient.output
|
2019-04-23 18:46:23 -04:00
|
|
|
}
|
|
|
|
}
|
2018-11-05 09:54:00 -05:00
|
|
|
}
|
|
|
|
|
2022-03-13 09:52:58 -04:00
|
|
|
remapJar {
|
|
|
|
afterEvaluate {
|
|
|
|
subprojects.each {
|
2024-01-11 10:45:18 -05:00
|
|
|
if (it.name in devOnlyModules || metaProjects.contains(it.name)) {
|
2023-05-30 08:07:11 -04:00
|
|
|
return
|
|
|
|
}
|
2022-03-13 09:52:58 -04:00
|
|
|
|
|
|
|
// Include the signed or none signed jar from the sub project.
|
2023-08-02 13:51:21 -04:00
|
|
|
nestedJars.from project("${it.path}").tasks.getByName("signRemapJar")
|
2022-03-13 09:52:58 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-02 13:51:21 -04:00
|
|
|
publishMods {
|
|
|
|
file = signRemapJar.output
|
|
|
|
changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided")
|
|
|
|
type = project.prerelease == "true" ? BETA : STABLE
|
|
|
|
displayName = "[${project.minecraft_version}] Fabric API $project.version"
|
|
|
|
modLoaders.add("fabric")
|
2023-08-09 13:10:52 -04:00
|
|
|
dryRun = providers.environmentVariable("CURSEFORGE_API_KEY").getOrNull() == null
|
2020-10-11 16:28:03 -04:00
|
|
|
|
2023-08-02 13:51:21 -04:00
|
|
|
curseforge {
|
|
|
|
accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
|
|
|
|
projectId = "306612"
|
|
|
|
minecraftVersions.add(project.curseforge_minecraft_version)
|
2019-05-11 18:00:57 -04:00
|
|
|
}
|
2023-08-02 13:51:21 -04:00
|
|
|
modrinth {
|
|
|
|
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
|
|
|
|
projectId = "P7dR8mSH"
|
|
|
|
minecraftVersions.add(project.minecraft_version)
|
2019-05-11 18:00:57 -04:00
|
|
|
}
|
2023-08-02 13:51:21 -04:00
|
|
|
github {
|
|
|
|
accessToken = providers.environmentVariable("GITHUB_TOKEN")
|
|
|
|
repository = providers.environmentVariable("GITHUB_REPOSITORY").getOrElse("FabricMC/dryrun")
|
|
|
|
commitish = providers.environmentVariable("GITHUB_REF_NAME").getOrElse("dryrun")
|
2020-07-01 13:58:47 -04:00
|
|
|
}
|
|
|
|
}
|
2020-11-05 13:12:01 -05:00
|
|
|
|
2023-08-02 13:51:21 -04:00
|
|
|
assemble.dependsOn signRemapJar
|
2021-01-25 13:19:18 -05:00
|
|
|
|
2023-08-02 13:51:21 -04:00
|
|
|
import java.util.stream.Collectors
|
2021-01-25 13:19:18 -05:00
|
|
|
|
2020-11-05 13:12:01 -05:00
|
|
|
// A task to ensure that the version being released has not already been released.
|
2023-05-30 08:07:11 -04:00
|
|
|
tasks.register('checkVersion') {
|
2020-11-05 13:12:01 -05:00
|
|
|
doFirst {
|
|
|
|
def xml = new URL("https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api/maven-metadata.xml").text
|
|
|
|
def metadata = new XmlSlurper().parseText(xml)
|
|
|
|
def versions = metadata.versioning.versions.version*.text();
|
|
|
|
if (versions.contains(version)) {
|
|
|
|
throw new RuntimeException("${version} has already been released!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-02 13:51:21 -04:00
|
|
|
tasks.publishMods.dependsOn checkVersion
|
2020-11-05 13:12:01 -05:00
|
|
|
publish.mustRunAfter checkVersion
|