diff --git a/build.gradle b/build.gradle index 10b07fd..38116a8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,21 +1,24 @@ -import net.minecraftforge.gradleutils.PomUtils import net.ltgt.gradle.errorprone.ErrorProneOptions import net.ltgt.gradle.nullaway.NullAwayOptions plugins { id 'java-library' id 'maven-publish' - id 'org.gradlex.extra-java-module-info' version '1.11' - id 'net.minecraftforge.gradleutils' version '2.4.13' - id 'net.minecraftforge.licenser' version '1.1.1' + alias libs.plugins.modules + alias libs.plugins.gradleutils + alias libs.plugins.licenser // Enforce jSpecify annotations at compile-time - id 'net.ltgt.errorprone' version '4.1.0' - id 'net.ltgt.nullaway' version '2.2.0' + alias libs.plugins.errorprone + alias libs.plugins.nullaway } +final projectDisplayName = 'EventBus' +final projectVendor = 'Forge Development LLC' +description = 'High performance Event Bus library' group = 'net.minecraftforge' -version = gitversion.version.tagOffset +version = gitversion.tagOffset + print "Version: $version" java { @@ -24,11 +27,6 @@ java { withSourcesJar() } -repositories { - mavenCentral() - maven gradleutils.forgeMaven -} - dependencies { api libs.jspecify.annotations errorprone libs.errorprone.core @@ -56,19 +54,19 @@ tasks.withType(JavaCompile).configureEach { } // Enforce the ErrorProne checks we care about - errorProne.error("FieldCanBeFinal", "MethodCanBeStatic", "LambdaFunctionalInterface") + errorProne.error 'FieldCanBeFinal', 'MethodCanBeStatic', 'LambdaFunctionalInterface' } } tasks.named('jar', Jar) { manifest { attributes([ - 'Specification-Title': 'EventBus', - 'Specification-Version': gitversion.version.info.tag, - 'Specification-Vendor': 'Forge Development LLC', - 'Implementation-Title': 'EventBus', + 'Specification-Title' : projectDisplayName, + 'Specification-Version' : gitversion.info.tag, + 'Specification-Vendor' : projectVendor, + 'Implementation-Title' : projectDisplayName, 'Implementation-Version': project.version, - 'Implementation-Vendor': 'Forge Development LLC' + 'Implementation-Vendor' : projectVendor ]) } @@ -77,7 +75,7 @@ tasks.named('jar', Jar) { } license { - header = file("LICENSE-header.txt") + header = file('LICENSE-header.txt') newLine = false } @@ -86,15 +84,17 @@ publishing { from components.java artifactId = 'eventbus' pom { - name = 'EventBus' - description = 'High performance Event Bus library' + name = projectDisplayName + description = project.description gradleutils.pom.gitHubDetails = pom - license PomUtils.Licenses.LGPLv2_1 + licenses { + license gradleutils.pom.licenses.LGPLv2_1 + } developers { - developer PomUtils.Developers.Paint_Ninja + developer gradleutils.pom.developers.Paint_Ninja } } } @@ -105,17 +105,17 @@ publishing { } allprojects { - ext.VALID_VMS = [ - 'Adoptium': [21], - 'Amazon': [21], - 'Azul': (21), - 'BellSoft': (21), - 'Graal_VM': [21], - 'Microsoft': [21], - 'Oracle': (21), - ] - // Tests are expensive to run all variants, so only run if asked to if (!project.hasProperty('bulk_tests')) ext.VALID_VMS = ['Adoptium': [21]] + else + ext.VALID_VMS = [ + 'Adoptium': [21], + 'Amazon': [21], + 'Azul': [21], + 'BellSoft': [21], + 'Graal_VM': [21], + 'Microsoft': [21], + 'Oracle': [21], + ] } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index c7e6b98..44bb43d 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -2,13 +2,8 @@ plugins { id 'groovy' } -repositories { - mavenCentral() - maven { url = 'https://jitpack.io' } -} - java.toolchain.languageVersion = JavaLanguageVersion.of(21) dependencies { - implementation 'com.github.Steppschuh:Java-Markdown-Generator:1.3.2' + implementation libs.markdown.generator } diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle new file mode 100644 index 0000000..fa956e7 --- /dev/null +++ b/buildSrc/settings.gradle @@ -0,0 +1,12 @@ +rootProject.name = 'buildSrc' + +dependencyResolutionManagement { + repositories { + mavenCentral() + maven { url = 'https://jitpack.io' } + } + + versionCatalogs.register('libs') { + library 'markdown-generator', 'com.github.Steppschuh', 'Java-Markdown-Generator' version '1.3.2' + } +} diff --git a/buildSrc/src/main/groovy/ArchiveJfr.groovy b/buildSrc/src/main/groovy/ArchiveJfr.groovy index b78355b..0839e49 100644 --- a/buildSrc/src/main/groovy/ArchiveJfr.groovy +++ b/buildSrc/src/main/groovy/ArchiveJfr.groovy @@ -1,15 +1,10 @@ -import groovy.xml.DOMBuilder -import groovy.xml.dom.DOMCategory import org.gradle.api.DefaultTask import org.gradle.api.file.DirectoryProperty -import org.gradle.api.file.RegularFileProperty import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.OutputDirectory -import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction import java.nio.file.Files -import java.nio.file.StandardCopyOption abstract class ArchiveJfr extends DefaultTask { @InputDirectory diff --git a/eventbus-jmh/build.gradle b/eventbus-jmh/build.gradle index 09b5b44..1c7b2c9 100644 --- a/eventbus-jmh/build.gradle +++ b/eventbus-jmh/build.gradle @@ -1,13 +1,8 @@ plugins { id 'java-library' - id 'org.gradlex.extra-java-module-info' - id 'net.minecraftforge.gradleutils' - id 'net.minecraftforge.licenser' -} - -repositories { - mavenCentral() - maven gradleutils.forgeMaven + alias libs.plugins.modules + alias libs.plugins.gradleutils + alias libs.plugins.licenser } java { @@ -15,7 +10,7 @@ java { } license { - header = rootProject.file("LICENSE-header.txt") + header = rootProject.file('LICENSE-header.txt') newLine = false } @@ -33,7 +28,6 @@ dependencies { extraJavaModuleInfo { failOnMissingModuleInfo = false automaticModule('org.openjdk.jmh:jmh-core', 'jmh.core') - automaticModule('net.sf.jopt-simple:jopt-simple', 'jopt.simple') } tasks.register('aggregateJmh', AggregateJmh) { diff --git a/eventbus-test-jar/build.gradle b/eventbus-test-jar/build.gradle index 85b027b..aad54d1 100644 --- a/eventbus-test-jar/build.gradle +++ b/eventbus-test-jar/build.gradle @@ -1,14 +1,9 @@ plugins { id 'eclipse' id 'java-library' - id 'org.gradlex.extra-java-module-info' - id 'net.minecraftforge.gradleutils' - id 'net.minecraftforge.licenser' -} - -repositories { - mavenCentral() - maven gradleutils.forgeMaven + alias libs.plugins.modules + alias libs.plugins.gradleutils + alias libs.plugins.licenser } java { @@ -16,9 +11,9 @@ java { } dependencies { - implementation(rootProject) - implementation(libs.bundles.asm) - implementation(libs.unsafe) + implementation rootProject + implementation libs.bundles.asm + implementation libs.unsafe implementation libs.jmh.core } @@ -29,7 +24,7 @@ extraJavaModuleInfo { } license { - header = rootProject.file("LICENSE-header.txt") + header = rootProject.file('LICENSE-header.txt') newLine = false } diff --git a/eventbus-test/build.gradle b/eventbus-test/build.gradle index 1fef6cf..db04ebc 100644 --- a/eventbus-test/build.gradle +++ b/eventbus-test/build.gradle @@ -1,23 +1,18 @@ plugins { id 'eclipse' id 'java-library' - id 'net.minecraftforge.gradleutils' - id 'net.minecraftforge.licenser' - id 'org.gradlex.extra-java-module-info' + alias libs.plugins.gradleutils + alias libs.plugins.licenser + alias libs.plugins.modules id 'test-report-aggregation' } -repositories { - mavenCentral() - maven gradleutils.forgeMaven -} - java { toolchain.languageVersion = JavaLanguageVersion.of(21) } license { - header = rootProject.file("LICENSE-header.txt") + header = rootProject.file('LICENSE-header.txt') newLine = false } @@ -48,13 +43,15 @@ tasks.register('testAll', AggregateTest) { output.mkdirs() var task = tasks.register("test${javaVendor}${javaVersion}", Test) { useJUnitPlatform() + classpath = configurations.runtimeClasspath + testClassesDirs = sourceSets.main.output.classesDirs javaLauncher = javaToolchains.launcherFor { vendor = JvmVendorSpec."${javaVendor.toUpperCase(Locale.ROOT)}" as JvmVendorSpec languageVersion = JavaLanguageVersion.of(javaVersion) implementation = JvmImplementation.VENDOR_SPECIFIC } - reports.html.destination = file("build/test-reports/${javaVendor}-${javaVersion}/") - reports.junitXml.destination = output + reports.html.outputLocation.fileValue file("build/test-reports/${javaVendor}-${javaVersion}/") + reports.junitXml.outputLocation.fileValue output } tasks.named('testAll') { inputs.dir(output) diff --git a/settings.gradle b/settings.gradle index 8aa86bb..00aefa3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,55 +1,53 @@ -pluginManagement { +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.10.0' +} + +dependencyResolutionManagement { repositories { - gradlePluginPortal() + // TODO [Gradle9][GradleUtils3] Replace with gradleutils.forgeMaven maven { url = 'https://maven.minecraftforge.net/' } + mavenCentral() } -} -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0' -} + //@formatter:off + versionCatalogs.register('libs') { + plugin 'modules', 'org.gradlex.extra-java-module-info' version '1.11' + plugin 'gradleutils', 'net.minecraftforge.gradleutils' version '2.5.1' + plugin 'licenser', 'net.minecraftforge.licenser' version '1.2.0' -dependencyResolutionManagement { - versionCatalogs { - libs { - // https://mvnrepository.com/artifact/org.jspecify/jspecify - library('jspecify-annotations', 'org.jspecify', 'jspecify') version '1.0.0' - - // https://mvnrepository.com/artifact/com.google.errorprone/error_prone_core - library('errorprone-core', 'com.google.errorprone', 'error_prone_core') version '2.36.0' - - // https://mvnrepository.com/artifact/com.uber.nullaway/nullaway - library('nullaway', 'com.uber.nullaway', 'nullaway') version '0.12.4' - - // ModLauncher stack - library('modlauncher', 'net.minecraftforge:modlauncher:10.1.1') - library('securemodules', 'net.minecraftforge:securemodules:2.2.21') - library('unsafe', 'net.minecraftforge:unsafe:0.9.2') - - // Generics from lambdas - library('typetools', 'net.jodah:typetools:0.6.3') - - library('nulls', 'org.jetbrains:annotations:23.0.0') - library('jopt-simple', 'net.sf.jopt-simple:jopt-simple:5.0.4') - library('log4j-api', 'org.apache.logging.log4j:log4j-api:2.17.1') - - version('junit', '5.10.1') - library('junit-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit') - library('junit-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit') - library('junit-platform-launcher', 'org.junit.platform:junit-platform-launcher:1.10.1') - bundle('junit-runtime', ['junit-engine', 'junit-platform-launcher']) - - version('asm', '9.7.1') - library('asm', 'org.ow2.asm', 'asm' ).versionRef('asm') - library('asm-tree', 'org.ow2.asm', 'asm-tree' ).versionRef('asm') - library('asm-commons', 'org.ow2.asm', 'asm-commons').versionRef('asm') - bundle('asm', ['asm', 'asm-tree', 'asm-commons']) - - version('jmh', '1.37') - library('jmh-core', 'org.openjdk.jmh', 'jmh-core') versionRef 'jmh' - library('jmh-annotationProcessor', 'org.openjdk.jmh', 'jmh-generator-annprocess') versionRef 'jmh' - } + plugin 'errorprone', 'net.ltgt.errorprone' version '4.1.0' + plugin 'nullaway', 'net.ltgt.nullaway' version '2.2.0' + + // https://mvnrepository.com/artifact/org.jspecify/jspecify + library 'jspecify-annotations', 'org.jspecify', 'jspecify' version '1.0.0' + + // https://mvnrepository.com/artifact/com.google.errorprone/error_prone_core + library 'errorprone-core', 'com.google.errorprone', 'error_prone_core' version '2.36.0' + + // https://mvnrepository.com/artifact/com.uber.nullaway/nullaway + library 'nullaway', 'com.uber.nullaway', 'nullaway' version '0.12.4' + + + /* The rest is for testing */ + library 'unsafe', 'net.minecraftforge:unsafe:0.9.2' + + version 'junit', '5.10.1' + library 'junit-api', 'org.junit.jupiter', 'junit-jupiter-api' versionRef 'junit' + library 'junit-engine', 'org.junit.jupiter', 'junit-jupiter-engine' versionRef 'junit' + library 'junit-platform-launcher', 'org.junit.platform', 'junit-platform-launcher' version '1.10.1' + bundle 'junit-runtime', ['junit-engine', 'junit-platform-launcher'] + + version 'asm', '9.7.1' + library 'asm', 'org.ow2.asm', 'asm' versionRef 'asm' + library 'asm-tree', 'org.ow2.asm', 'asm-tree' versionRef 'asm' + library 'asm-commons', 'org.ow2.asm', 'asm-commons' versionRef 'asm' + bundle 'asm', ['asm', 'asm-tree', 'asm-commons'] + + version 'jmh', '1.37' + library 'jmh-core', 'org.openjdk.jmh', 'jmh-core' versionRef 'jmh' + library 'jmh-annotationProcessor', 'org.openjdk.jmh', 'jmh-generator-annprocess' versionRef 'jmh' } + //@formatter:on } enableFeaturePreview 'TYPESAFE_PROJECT_ACCESSORS'