Build script updates.
Bump gradle. Copy a bunch from WE. Hopefully nothing breaks.
This commit is contained in:
parent
216b061172
commit
3549f04a33
|
@ -1,2 +1,34 @@
|
||||||
*.java diff=java
|
* text=auto eol=lf
|
||||||
|
# Force Batch files to CRLF
|
||||||
|
*.bat eol=crlf -text
|
||||||
|
|
||||||
|
# Java sources
|
||||||
|
*.java text diff=java
|
||||||
|
*.kt text diff=java
|
||||||
|
*.gradle text diff=java
|
||||||
|
*.gradle.kts text diff=java
|
||||||
|
|
||||||
|
# These files are text and should be normalized (Convert crlf => lf)
|
||||||
|
*.css text diff=css
|
||||||
|
*.df text
|
||||||
|
*.htm text diff=html
|
||||||
|
*.html text diff=html
|
||||||
|
*.js text
|
||||||
|
*.jsp text
|
||||||
|
*.jspf text
|
||||||
|
*.jspx text
|
||||||
|
*.properties text
|
||||||
|
*.tld text
|
||||||
|
*.tag text
|
||||||
|
*.tagx text
|
||||||
|
*.xml text
|
||||||
|
|
||||||
|
# These files are binary and should be left untouched
|
||||||
|
# (binary is a macro for -text -diff)
|
||||||
|
*.class binary
|
||||||
|
*.dll binary
|
||||||
|
*.ear binary
|
||||||
|
*.jar binary
|
||||||
|
*.so binary
|
||||||
|
*.war binary
|
||||||
|
*.jks binary
|
||||||
|
|
|
@ -11,7 +11,7 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(gradleApi())
|
implementation(gradleApi())
|
||||||
implementation("gradle.plugin.org.cadixdev.gradle:licenser:0.6.1")
|
implementation("gradle.plugin.org.cadixdev.gradle:licenser:0.6.1")
|
||||||
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0")
|
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.1")
|
||||||
implementation("com.github.jengelman.gradle.plugins:shadow:6.1.0")
|
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2")
|
||||||
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0")
|
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.27.1")
|
||||||
}
|
}
|
|
@ -25,7 +25,7 @@ fun Project.applyCommonConfiguration() {
|
||||||
|
|
||||||
plugins.withId("java") {
|
plugins.withId("java") {
|
||||||
the<JavaPluginExtension>().toolchain {
|
the<JavaPluginExtension>().toolchain {
|
||||||
languageVersion.set(JavaLanguageVersion.of(16))
|
languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.plugins.JavaPluginExtension
|
||||||
|
import org.gradle.api.plugins.quality.CheckstyleExtension
|
||||||
|
import org.gradle.api.tasks.compile.JavaCompile
|
||||||
|
import org.gradle.api.tasks.javadoc.Javadoc
|
||||||
|
import org.gradle.api.tasks.testing.Test
|
||||||
|
import org.gradle.external.javadoc.StandardJavadocDocletOptions
|
||||||
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
|
import org.gradle.kotlin.dsl.get
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
|
||||||
|
fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, javaRelease: Int = 8, banSlf4j: Boolean = true) {
|
||||||
|
applyCommonConfiguration()
|
||||||
|
apply(plugin = "eclipse")
|
||||||
|
apply(plugin = "idea")
|
||||||
|
apply(plugin = "checkstyle")
|
||||||
|
|
||||||
|
tasks
|
||||||
|
.withType<JavaCompile>()
|
||||||
|
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
|
||||||
|
.configureEach {
|
||||||
|
val disabledLint = listOf(
|
||||||
|
"processing", "path", "fallthrough", "serial"
|
||||||
|
)
|
||||||
|
options.release.set(javaRelease)
|
||||||
|
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
|
||||||
|
options.isDeprecation = true
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
options.compilerArgs.add("-parameters")
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<CheckstyleExtension> {
|
||||||
|
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
||||||
|
toolVersion = "9.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Test>().configureEach {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"compileOnly"("com.google.code.findbugs:jsr305:${Versions.FINDBUGS}")
|
||||||
|
"testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}")
|
||||||
|
"testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}")
|
||||||
|
"testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}")
|
||||||
|
"testImplementation"("org.mockito:mockito-junit-jupiter:${Versions.MOCKITO}")
|
||||||
|
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Java 8 turns on doclint which we fail
|
||||||
|
tasks.withType<Javadoc>().configureEach {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
(options as StandardJavadocDocletOptions).apply {
|
||||||
|
addStringOption("Xdoclint:none", "-quiet")
|
||||||
|
tags(
|
||||||
|
"apiNote:a:API Note:",
|
||||||
|
"implSpec:a:Implementation Requirements:",
|
||||||
|
"implNote:a:Implementation Note:"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<JavaPluginExtension> {
|
||||||
|
disableAutoTargetJvm()
|
||||||
|
withJavadocJar()
|
||||||
|
if (sourcesJar) {
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (banSlf4j) {
|
||||||
|
configurations["compileClasspath"].apply {
|
||||||
|
resolutionStrategy.componentSelection {
|
||||||
|
withModule("org.slf4j:slf4j-api") {
|
||||||
|
reject("No SLF4J allowed on compile classpath")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("check").configure {
|
||||||
|
dependsOn("checkstyleMain", "checkstyleTest")
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.plugins.ExtraPropertiesExtension
|
import org.gradle.api.plugins.ExtraPropertiesExtension
|
||||||
import org.gradle.api.plugins.JavaPluginConvention
|
import org.gradle.api.plugins.JavaPluginExtension
|
||||||
import org.gradle.api.tasks.SourceSetContainer
|
import org.gradle.api.tasks.SourceSetContainer
|
||||||
import org.gradle.kotlin.dsl.getByType
|
import org.gradle.kotlin.dsl.getByType
|
||||||
import org.gradle.kotlin.dsl.the
|
import org.gradle.kotlin.dsl.the
|
||||||
|
@ -9,4 +9,4 @@ val Project.ext: ExtraPropertiesExtension
|
||||||
get() = extensions.getByType()
|
get() = extensions.getByType()
|
||||||
|
|
||||||
val Project.sourceSets: SourceSetContainer
|
val Project.sourceSets: SourceSetContainer
|
||||||
get() = the<JavaPluginConvention>().sourceSets
|
get() = the<JavaPluginExtension>().sourceSets
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.ExternalModuleDependency
|
||||||
import org.gradle.api.artifacts.ModuleDependency
|
import org.gradle.api.artifacts.ModuleDependency
|
||||||
import org.gradle.api.attributes.Bundling
|
import org.gradle.api.attributes.Bundling
|
||||||
import org.gradle.api.attributes.Category
|
import org.gradle.api.attributes.Category
|
||||||
|
@ -161,6 +162,8 @@ fun Project.applyLibrariesConfiguration() {
|
||||||
applyCommonArtifactoryConfig()
|
applyCommonArtifactoryConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A horrible hack because `softwareComponentFactory` has to be gotten via plugin
|
||||||
|
// gradle why
|
||||||
internal open class LibsConfigPluginHack @Inject constructor(
|
internal open class LibsConfigPluginHack @Inject constructor(
|
||||||
private val softwareComponentFactory: SoftwareComponentFactory
|
private val softwareComponentFactory: SoftwareComponentFactory
|
||||||
) : Plugin<Project> {
|
) : Plugin<Project> {
|
||||||
|
@ -169,3 +172,16 @@ internal open class LibsConfigPluginHack @Inject constructor(
|
||||||
project.components.add(libsComponents)
|
project.components.add(libsComponents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Project.constrainDependenciesToLibsCore() {
|
||||||
|
evaluationDependsOn(":worldguard-libs:core")
|
||||||
|
val coreDeps = project(":worldguard-libs:core").configurations["shade"].dependencies
|
||||||
|
.filterIsInstance<ExternalModuleDependency>()
|
||||||
|
dependencies.constraints {
|
||||||
|
for (coreDep in coreDeps) {
|
||||||
|
add("shade", "${coreDep.group}:${coreDep.name}:${coreDep.version}") {
|
||||||
|
because("libs should align with libs:core")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,78 +1,30 @@
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.component.AdhocComponentWithVariants
|
import org.gradle.api.component.AdhocComponentWithVariants
|
||||||
import org.gradle.api.plugins.JavaPluginExtension
|
|
||||||
import org.gradle.api.plugins.quality.CheckstyleExtension
|
|
||||||
import org.gradle.api.publish.PublishingExtension
|
import org.gradle.api.publish.PublishingExtension
|
||||||
import org.gradle.api.publish.maven.MavenPublication
|
import org.gradle.api.publish.maven.MavenPublication
|
||||||
import org.gradle.api.tasks.javadoc.Javadoc
|
|
||||||
import org.gradle.api.tasks.testing.Test
|
|
||||||
import org.gradle.external.javadoc.StandardJavadocDocletOptions
|
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
import org.gradle.kotlin.dsl.configure
|
import org.gradle.kotlin.dsl.configure
|
||||||
import org.gradle.kotlin.dsl.dependencies
|
|
||||||
import org.gradle.kotlin.dsl.get
|
import org.gradle.kotlin.dsl.get
|
||||||
import org.gradle.kotlin.dsl.named
|
import org.gradle.kotlin.dsl.named
|
||||||
import org.gradle.kotlin.dsl.register
|
import org.gradle.kotlin.dsl.register
|
||||||
import org.gradle.kotlin.dsl.withType
|
|
||||||
import org.gradle.kotlin.dsl.the
|
|
||||||
|
|
||||||
fun Project.applyPlatformAndCoreConfiguration() {
|
fun Project.applyPlatformAndCoreConfiguration(javaRelease: Int = 17) {
|
||||||
applyCommonConfiguration()
|
applyCommonConfiguration()
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
apply(plugin = "eclipse")
|
|
||||||
apply(plugin = "idea")
|
|
||||||
apply(plugin = "maven-publish")
|
apply(plugin = "maven-publish")
|
||||||
apply(plugin = "checkstyle")
|
|
||||||
apply(plugin = "com.jfrog.artifactory")
|
apply(plugin = "com.jfrog.artifactory")
|
||||||
|
applyCommonJavaConfiguration(
|
||||||
|
sourcesJar = true,
|
||||||
|
javaRelease = javaRelease,
|
||||||
|
banSlf4j = false
|
||||||
|
)
|
||||||
|
|
||||||
ext["internalVersion"] = "$version+${rootProject.ext["gitCommitHash"]}"
|
ext["internalVersion"] = "$version+${rootProject.ext["gitCommitHash"]}"
|
||||||
|
|
||||||
configure<CheckstyleExtension> {
|
|
||||||
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
|
||||||
toolVersion = "8.34"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<Test>().configureEach {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
"compileOnly"("com.google.code.findbugs:jsr305:3.0.2")
|
|
||||||
"testCompileOnly"("com.google.code.findbugs:jsr305:3.0.2")
|
|
||||||
"testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}")
|
|
||||||
"testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}")
|
|
||||||
"testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}")
|
|
||||||
"testImplementation"("org.mockito:mockito-junit-jupiter:${Versions.MOCKITO}")
|
|
||||||
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Java 8 turns on doclint which we fail
|
|
||||||
tasks.withType<Javadoc>().configureEach {
|
|
||||||
(options as StandardJavadocDocletOptions).apply {
|
|
||||||
addStringOption("Xdoclint:none", "-quiet")
|
|
||||||
tags(
|
|
||||||
"apiNote:a:API Note:",
|
|
||||||
"implSpec:a:Implementation Requirements:",
|
|
||||||
"implNote:a:Implementation Note:"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
the<JavaPluginExtension>().withJavadocJar()
|
|
||||||
|
|
||||||
if (name == "worldguard-core" || name == "worldguard-bukkit") {
|
|
||||||
the<JavaPluginExtension>().withSourcesJar()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named("check").configure {
|
|
||||||
dependsOn("checkstyleMain", "checkstyleTest")
|
|
||||||
}
|
|
||||||
|
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
publications {
|
publications {
|
||||||
register<MavenPublication>("maven") {
|
register<MavenPublication>("maven") {
|
||||||
from(components["java"])
|
|
||||||
versionMapping {
|
versionMapping {
|
||||||
usage("java-api") {
|
usage("java-api") {
|
||||||
fromResolutionOf("runtimeClasspath")
|
fromResolutionOf("runtimeClasspath")
|
||||||
|
@ -105,8 +57,10 @@ fun Project.applyShadowConfiguration() {
|
||||||
exclude("GradleStart**")
|
exclude("GradleStart**")
|
||||||
exclude(".cache")
|
exclude(".cache")
|
||||||
exclude("LICENSE*")
|
exclude("LICENSE*")
|
||||||
|
exclude("META-INF/maven/**")
|
||||||
}
|
}
|
||||||
val javaComponent = components["java"] as AdhocComponentWithVariants
|
val javaComponent = components["java"] as AdhocComponentWithVariants
|
||||||
|
// I don't think we want this published (it's the shadow jar)
|
||||||
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
||||||
skip()
|
skip()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
object Versions {
|
object Versions {
|
||||||
// const val PISTON = "0.4.3"
|
const val WORLDEDIT = "7.2.9"
|
||||||
// const val AUTO_VALUE = "1.6.5"
|
const val PISTON = "0.5.7"
|
||||||
const val WORLDEDIT = "7.2.7"
|
const val AUTO_VALUE = "1.9"
|
||||||
const val JUNIT = "5.7.0"
|
const val JUNIT = "5.8.1"
|
||||||
|
const val MOCKITO = "4.3.1"
|
||||||
const val SQUIRRELID = "0.3.0"
|
const val SQUIRRELID = "0.3.0"
|
||||||
const val GUAVA = "31.0.1-jre"
|
const val GUAVA = "31.0.1-jre"
|
||||||
const val MOCKITO = "3.7.7"
|
const val FINDBUGS = "3.0.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
group=com.sk89q.worldguard
|
group=com.sk89q.worldguard
|
||||||
version=7.0.8-SNAPSHOT
|
version=7.1.0-SNAPSHOT
|
||||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -8,10 +8,10 @@ dependencies {
|
||||||
"api"(project(":worldguard-libs:core"))
|
"api"(project(":worldguard-libs:core"))
|
||||||
"api"("com.sk89q.worldedit:worldedit-core:${Versions.WORLDEDIT}")
|
"api"("com.sk89q.worldedit:worldedit-core:${Versions.WORLDEDIT}")
|
||||||
"implementation"("org.flywaydb:flyway-core:3.0")
|
"implementation"("org.flywaydb:flyway-core:3.0")
|
||||||
"implementation"("org.yaml:snakeyaml:1.29")
|
"implementation"("org.yaml:snakeyaml:1.30")
|
||||||
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
|
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
|
||||||
|
|
||||||
"compileOnly"("com.google.code.findbugs:jsr305:1.3.9")
|
"compileOnly"("com.google.code.findbugs:jsr305:${Versions.FINDBUGS}")
|
||||||
"testImplementation"("org.hamcrest:hamcrest-library:1.2.1")
|
"testImplementation"("org.hamcrest:hamcrest-library:1.2.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
applyLibrariesConfiguration()
|
applyLibrariesConfiguration()
|
||||||
|
constrainDependenciesToLibsCore()
|
Loading…
Reference in New Issue