Small buildscript tweaks & fixes (#4584)

* Small buildscript tweaks

* Fix CI builds on branches containing a /

* Fix running without Gradle.

(cherry picked from commit 112e550e7e)
This commit is contained in:
modmuss 2025-04-16 18:43:36 +01:00 committed by modmuss50
parent c1dce2181f
commit e042dd4188
3 changed files with 7 additions and 5 deletions

View file

@ -9,7 +9,7 @@ plugins {
}
def branchProvider = providers.of(GitBranchValueSource.class) {}
version = project.version + "+" + (providers.environmentVariable("CI").present ? branchProvider.get() : "local")
version = project.version + "+" + (providers.environmentVariable("CI").present ? branchProvider.get().replace("/", "_") : "local")
logger.lifecycle("Building Fabric: " + version)
def metaProjects = [
@ -115,7 +115,7 @@ allprojects {
apply plugin: "maven-publish"
apply plugin: "me.modmuss50.remotesign"
tasks.withType(GenerateModuleMetadata) {
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}

View file

@ -3,7 +3,7 @@
* This task should be used to easily bump the major/minor/patch version of a fabric-api module.
* It will automatically bump the versions of dependent modules.
*/
task bumpVersions(type: BumpVersionTask)
tasks.register('bumpVersions', BumpVersionTask)
class BumpVersionTask extends DefaultTask {
BumpVersionTask() {

View file

@ -1,7 +1,9 @@
task validateAnnotations(type: ValidateAnnotations) {
tasks.register('validateAnnotations', ValidateAnnotations) {
group = 'fabric'
description = "Validate annotations used in Fabric API code."
outputs.upToDateWhen { true } // Task has no outputs
// Only apply to default source directories since there's also generated package-info files.
source file("src/client/java")
source file("src/main/java")
@ -9,7 +11,7 @@ task validateAnnotations(type: ValidateAnnotations) {
source file("src/testmodClient/java")
}
tasks.check.dependsOn validateAnnotations
tasks.check.dependsOn "validateAnnotations"
class ValidateAnnotations extends SourceTask {
private static final def API_STATUS_INTERNAL = ~/@ApiStatus\.Internal/