mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-03-13 15:20:05 +01:00
Migrate gradle to kotlin dsl.
This commit is contained in:
parent
556b638d04
commit
61494fd76e
16
HEADER.txt
Normal file
16
HEADER.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
WorldGuard, a suite of tools for Minecraft
|
||||||
|
Copyright (C) sk89q <http://www.sk89q.com>
|
||||||
|
Copyright (C) WorldGuard team and contributors
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
136
build.gradle
136
build.gradle
@ -1,136 +0,0 @@
|
|||||||
println """
|
|
||||||
*******************************************
|
|
||||||
You are building WorldGuard!
|
|
||||||
|
|
||||||
If you encounter trouble:
|
|
||||||
1) Read COMPILING.md if you haven't yet
|
|
||||||
2) Try running 'build' in a separate Gradle run
|
|
||||||
3) Use gradlew and not gradle
|
|
||||||
4) If you still need help, ask on IRC! irc.esper.net #sk89q
|
|
||||||
|
|
||||||
Output files will be in [subproject]/build/libs
|
|
||||||
*******************************************
|
|
||||||
"""
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations.all {
|
|
||||||
resolutionStrategy {
|
|
||||||
force 'com.google.guava:guava:21.0'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath "com.github.jengelman.gradle.plugins:shadow:4.0.3"
|
|
||||||
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.7.5'
|
|
||||||
classpath 'org.ajoberstar:gradle-git:1.7.2'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
group = 'com.sk89q.worldguard'
|
|
||||||
version = '7.0.1-SNAPSHOT'
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost"
|
|
||||||
if (!project.hasProperty("artifactory_user")) ext.artifactory_user = "guest"
|
|
||||||
if (!project.hasProperty("artifactory_password")) ext.artifactory_password = ""
|
|
||||||
|
|
||||||
if (!project.hasProperty("gitCommitHash")) {
|
|
||||||
try {
|
|
||||||
def repo = org.ajoberstar.grgit.Grgit.open(project.file('.'))
|
|
||||||
ext.gitCommitHash = repo.head().abbreviatedId
|
|
||||||
} catch (Exception e) {
|
|
||||||
ext.gitCommitHash = "no_git_id"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'com.jfrog.artifactory'
|
|
||||||
artifactory {
|
|
||||||
contextUrl = "${artifactory_contextUrl}"
|
|
||||||
publish {
|
|
||||||
repository {
|
|
||||||
repoKey = project.version.contains("SNAPSHOT") ? 'libs-snapshot-local' : 'libs-release-local'
|
|
||||||
username = "${artifactory_user}"
|
|
||||||
password = "${artifactory_password}"
|
|
||||||
maven = true
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
artifactoryPublish.skip = true
|
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'java-library'
|
|
||||||
apply plugin: 'maven'
|
|
||||||
apply plugin: 'checkstyle'
|
|
||||||
apply plugin: 'com.github.johnrengelman.shadow'
|
|
||||||
apply plugin: 'com.jfrog.artifactory'
|
|
||||||
|
|
||||||
ext.internalVersion = version + ";" + gitCommitHash
|
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
|
|
||||||
checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml")
|
|
||||||
checkstyle.toolVersion = '7.6.1'
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
maven { url "https://repo.spongepowered.org/maven/" }
|
|
||||||
maven { url "https://hub.spigotmc.org/nexus/content/groups/public" }
|
|
||||||
maven { url "https://maven.sk89q.com/repo/" }
|
|
||||||
maven { url "https://repo.maven.apache.org/maven2" }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JavaVersion.current().isJava8Compatible()) {
|
|
||||||
// Java 8 turns on doclint which we fail
|
|
||||||
tasks.withType(Javadoc) {
|
|
||||||
options.addStringOption('Xdoclint:none', '-quiet')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier = 'sources'
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
||||||
classifier = 'javadoc'
|
|
||||||
from javadoc.destinationDir
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives jar
|
|
||||||
archives sourcesJar
|
|
||||||
archives javadocJar
|
|
||||||
}
|
|
||||||
|
|
||||||
build.dependsOn(checkstyleMain)
|
|
||||||
build.dependsOn(checkstyleTest)
|
|
||||||
build.dependsOn(sourcesJar)
|
|
||||||
build.dependsOn(javadocJar)
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
classifier 'dist'
|
|
||||||
dependencies {
|
|
||||||
include(dependency('org.khelekore:prtree:1.5.0'))
|
|
||||||
include(dependency('com.sk89q:squirrelid:0.2.0'))
|
|
||||||
include(dependency('org.flywaydb:flyway-core:3.0'))
|
|
||||||
}
|
|
||||||
exclude 'GradleStart**'
|
|
||||||
exclude '.cache'
|
|
||||||
exclude 'LICENSE*'
|
|
||||||
}
|
|
||||||
|
|
||||||
artifactoryPublish {
|
|
||||||
publishConfigs('archives')
|
|
||||||
}
|
|
||||||
}
|
|
26
build.gradle.kts
Normal file
26
build.gradle.kts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import org.ajoberstar.grgit.Grgit
|
||||||
|
|
||||||
|
logger.lifecycle("""
|
||||||
|
*******************************************
|
||||||
|
You are building WorldGuard!
|
||||||
|
If you encounter trouble:
|
||||||
|
1) Try running 'build' in a separate Gradle run
|
||||||
|
2) Use gradlew and not gradle
|
||||||
|
3) If you still need help, ask on Discord! https://discord.gg/enginehub
|
||||||
|
|
||||||
|
Output files will be in [subproject]/build/libs
|
||||||
|
*******************************************
|
||||||
|
""")
|
||||||
|
|
||||||
|
applyRootArtifactoryConfig()
|
||||||
|
|
||||||
|
if (!project.hasProperty("gitCommitHash")) {
|
||||||
|
apply(plugin = "org.ajoberstar.grgit")
|
||||||
|
ext["gitCommitHash"] = try {
|
||||||
|
(ext["grgit"] as Grgit?)?.head()?.abbreviatedId
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.warn("Error getting commit hash", e)
|
||||||
|
|
||||||
|
"no_git_id"
|
||||||
|
}
|
||||||
|
}
|
19
buildSrc/build.gradle.kts
Normal file
19
buildSrc/build.gradle.kts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
kotlin("jvm") version embeddedKotlinVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(gradleApi())
|
||||||
|
implementation("gradle.plugin.net.minecrell:licenser:0.4.1")
|
||||||
|
implementation("org.ajoberstar.grgit:grgit-gradle:3.1.1")
|
||||||
|
implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
|
||||||
|
implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
|
||||||
|
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21")
|
||||||
|
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
|
||||||
|
}
|
40
buildSrc/src/main/kotlin/ArtifactoryConfig.kt
Normal file
40
buildSrc/src/main/kotlin/ArtifactoryConfig.kt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.named
|
||||||
|
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
|
||||||
|
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
|
||||||
|
|
||||||
|
private const val ARTIFACTORY_CONTEXT_URL = "artifactory_contextUrl"
|
||||||
|
private const val ARTIFACTORY_USER = "artifactory_user"
|
||||||
|
private const val ARTIFACTORY_PASSWORD = "artifactory_password"
|
||||||
|
|
||||||
|
fun Project.applyRootArtifactoryConfig() {
|
||||||
|
if (!project.hasProperty(ARTIFACTORY_CONTEXT_URL)) ext[ARTIFACTORY_CONTEXT_URL] = "http://localhost"
|
||||||
|
if (!project.hasProperty(ARTIFACTORY_USER)) ext[ARTIFACTORY_USER] = "guest"
|
||||||
|
if (!project.hasProperty(ARTIFACTORY_PASSWORD)) ext[ARTIFACTORY_PASSWORD] = ""
|
||||||
|
|
||||||
|
apply(plugin = "com.jfrog.artifactory")
|
||||||
|
configure<ArtifactoryPluginConvention> {
|
||||||
|
setContextUrl("${project.property(ARTIFACTORY_CONTEXT_URL)}")
|
||||||
|
clientConfig.publisher.run {
|
||||||
|
repoKey = when {
|
||||||
|
"${project.version}".contains("SNAPSHOT") -> "libs-snapshot-local"
|
||||||
|
else -> "libs-release-local"
|
||||||
|
}
|
||||||
|
username = "${project.property(ARTIFACTORY_USER)}"
|
||||||
|
password = "${project.property(ARTIFACTORY_PASSWORD)}"
|
||||||
|
isMaven = true
|
||||||
|
isIvy = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tasks.named<ArtifactoryTask>("artifactoryPublish") {
|
||||||
|
isSkip = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.applyCommonArtifactoryConfig() {
|
||||||
|
val named = tasks.named<ArtifactoryTask>("artifactoryPublish") {
|
||||||
|
publishConfigs("archives")
|
||||||
|
}
|
||||||
|
}
|
18
buildSrc/src/main/kotlin/CommonConfig.kt
Normal file
18
buildSrc/src/main/kotlin/CommonConfig.kt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.repositories
|
||||||
|
|
||||||
|
fun Project.applyCommonConfiguration() {
|
||||||
|
group = rootProject.group
|
||||||
|
version = rootProject.version
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven { url = uri("https://maven.sk89q.com/repo/") }
|
||||||
|
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
|
||||||
|
}
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy {
|
||||||
|
cacheChangingModulesFor(5, "minutes")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
buildSrc/src/main/kotlin/GradleExtras.kt
Normal file
12
buildSrc/src/main/kotlin/GradleExtras.kt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.plugins.ExtraPropertiesExtension
|
||||||
|
import org.gradle.api.plugins.JavaPluginConvention
|
||||||
|
import org.gradle.api.tasks.SourceSetContainer
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
import org.gradle.kotlin.dsl.the
|
||||||
|
|
||||||
|
val Project.ext: ExtraPropertiesExtension
|
||||||
|
get() = extensions.getByType()
|
||||||
|
|
||||||
|
val Project.sourceSets: SourceSetContainer
|
||||||
|
get() = the<JavaPluginConvention>().sourceSets
|
98
buildSrc/src/main/kotlin/LibsConfig.kt
Normal file
98
buildSrc/src/main/kotlin/LibsConfig.kt
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.ModuleDependency
|
||||||
|
import org.gradle.api.internal.HasConvention
|
||||||
|
import org.gradle.api.plugins.MavenRepositoryHandlerConvention
|
||||||
|
import org.gradle.api.tasks.Upload
|
||||||
|
import org.gradle.api.tasks.bundling.Jar
|
||||||
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.get
|
||||||
|
import org.gradle.kotlin.dsl.getPlugin
|
||||||
|
import org.gradle.kotlin.dsl.invoke
|
||||||
|
import org.gradle.kotlin.dsl.register
|
||||||
|
|
||||||
|
fun Project.applyLibrariesConfiguration() {
|
||||||
|
applyCommonConfiguration()
|
||||||
|
apply(plugin = "java-base")
|
||||||
|
apply(plugin = "maven")
|
||||||
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
|
apply(plugin = "com.jfrog.artifactory")
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
create("shade")
|
||||||
|
getByName("archives").extendsFrom(getByName("default"))
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "${rootProject.group}.worldguard-libs"
|
||||||
|
|
||||||
|
tasks.register<ShadowJar>("jar") {
|
||||||
|
configurations = listOf(project.configurations["shade"])
|
||||||
|
archiveClassifier.set("")
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
exclude(dependency("com.google.guava:guava"))
|
||||||
|
exclude(dependency("com.google.code.gson:gson"))
|
||||||
|
exclude(dependency("org.checkerframework:checker-qual"))
|
||||||
|
}
|
||||||
|
|
||||||
|
relocate("com.sk89q.squirrelid", "com.sk89q.worldguard.util.profile")
|
||||||
|
}
|
||||||
|
val altConfigFiles = { artifactType: String ->
|
||||||
|
val deps = configurations["shade"].incoming.dependencies
|
||||||
|
.filterIsInstance<ModuleDependency>()
|
||||||
|
.map { it.copy() }
|
||||||
|
.map { dependency ->
|
||||||
|
dependency.artifact {
|
||||||
|
name = dependency.name
|
||||||
|
type = artifactType
|
||||||
|
extension = "jar"
|
||||||
|
classifier = artifactType
|
||||||
|
}
|
||||||
|
dependency
|
||||||
|
}
|
||||||
|
|
||||||
|
files(configurations.detachedConfiguration(*deps.toTypedArray())
|
||||||
|
.resolvedConfiguration.lenientConfiguration.artifacts
|
||||||
|
.filter { it.classifier == artifactType }
|
||||||
|
.map { zipTree(it.file) })
|
||||||
|
}
|
||||||
|
tasks.register<Jar>("sourcesJar") {
|
||||||
|
from({
|
||||||
|
altConfigFiles("sources")
|
||||||
|
})
|
||||||
|
val filePattern = Regex("(.*)com/sk89q/squirrelid((?:/|$).*)")
|
||||||
|
val textPattern = Regex("com\\.sk89q\\.squirrelid")
|
||||||
|
eachFile {
|
||||||
|
filter {
|
||||||
|
it.replaceFirst(textPattern, "com.sk89q.worldguard.util.profile")
|
||||||
|
}
|
||||||
|
path = path.replaceFirst(filePattern, "$1com/sk89q/worldguard/util/profile$2")
|
||||||
|
}
|
||||||
|
archiveClassifier.set("sources")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("assemble").configure {
|
||||||
|
dependsOn("jar", "sourcesJar")
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
val jar = tasks.named("jar")
|
||||||
|
add("default", jar) {
|
||||||
|
builtBy(jar)
|
||||||
|
}
|
||||||
|
val sourcesJar = tasks.named("sourcesJar")
|
||||||
|
add("archives", sourcesJar) {
|
||||||
|
builtBy(sourcesJar)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Upload>("install") {
|
||||||
|
configuration = configurations["archives"]
|
||||||
|
(repositories as HasConvention).convention.getPlugin<MavenRepositoryHandlerConvention>().mavenInstaller {
|
||||||
|
pom.version = project.version.toString()
|
||||||
|
pom.artifactId = project.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
applyCommonArtifactoryConfig()
|
||||||
|
}
|
115
buildSrc/src/main/kotlin/PlatformConfig.kt
Normal file
115
buildSrc/src/main/kotlin/PlatformConfig.kt
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
import net.minecrell.gradle.licenser.LicenseExtension
|
||||||
|
import org.gradle.api.JavaVersion
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.plugins.JavaPluginConvention
|
||||||
|
import org.gradle.api.plugins.quality.CheckstyleExtension
|
||||||
|
import org.gradle.api.tasks.bundling.Jar
|
||||||
|
import org.gradle.api.tasks.javadoc.Javadoc
|
||||||
|
import org.gradle.api.tasks.testing.Test
|
||||||
|
import org.gradle.external.javadoc.CoreJavadocOptions
|
||||||
|
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.getByName
|
||||||
|
import org.gradle.kotlin.dsl.named
|
||||||
|
import org.gradle.kotlin.dsl.register
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
|
||||||
|
fun Project.applyPlatformAndCoreConfiguration() {
|
||||||
|
applyCommonConfiguration()
|
||||||
|
apply(plugin = "java")
|
||||||
|
apply(plugin = "eclipse")
|
||||||
|
apply(plugin = "idea")
|
||||||
|
apply(plugin = "maven")
|
||||||
|
apply(plugin = "checkstyle")
|
||||||
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
|
apply(plugin = "com.jfrog.artifactory")
|
||||||
|
apply(plugin = "net.minecrell.licenser")
|
||||||
|
|
||||||
|
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
|
||||||
|
|
||||||
|
configure<JavaPluginConvention> {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<CheckstyleExtension> {
|
||||||
|
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
||||||
|
toolVersion = "7.6.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Test>().configureEach {
|
||||||
|
useJUnit()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"testImplementation"("junit:junit:${Versions.JUNIT}")
|
||||||
|
"testRuntime"("junit:junit:${Versions.JUNIT}")
|
||||||
|
// TODO switch to jupiter - doesn't support abstract test classes so tests need rewriting
|
||||||
|
//"testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}")
|
||||||
|
//"testRuntime"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Java 8 turns on doclint which we fail
|
||||||
|
tasks.withType<Javadoc>().configureEach {
|
||||||
|
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Jar>("javadocJar") {
|
||||||
|
dependsOn("javadoc")
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
|
from(tasks.getByName<Javadoc>("javadoc").destinationDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("assemble").configure {
|
||||||
|
dependsOn("javadocJar")
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
add("archives", tasks.named("jar"))
|
||||||
|
add("archives", tasks.named("javadocJar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "worldguard-core" || name == "worldguard-bukkit") {
|
||||||
|
tasks.register<Jar>("sourcesJar") {
|
||||||
|
dependsOn("classes")
|
||||||
|
archiveClassifier.set("sources")
|
||||||
|
from(sourceSets["main"].allSource)
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
add("archives", tasks.named("sourcesJar"))
|
||||||
|
}
|
||||||
|
tasks.named("assemble").configure {
|
||||||
|
dependsOn("sourcesJar")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("check").configure {
|
||||||
|
dependsOn("checkstyleMain", "checkstyleTest")
|
||||||
|
}
|
||||||
|
|
||||||
|
applyCommonArtifactoryConfig()
|
||||||
|
|
||||||
|
configure<LicenseExtension> {
|
||||||
|
header = rootProject.file("HEADER.txt")
|
||||||
|
include("**/*.java")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.applyShadowConfiguration() {
|
||||||
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
|
archiveClassifier.set("dist")
|
||||||
|
dependencies {
|
||||||
|
include(project(":worldguard-libs:core"))
|
||||||
|
include(project(":worldguard-libs:${project.name.replace("worldguard-", "")}"))
|
||||||
|
include(project(":worldguard-core"))
|
||||||
|
}
|
||||||
|
exclude("GradleStart**")
|
||||||
|
exclude(".cache")
|
||||||
|
exclude("LICENSE*")
|
||||||
|
}
|
||||||
|
}
|
6
buildSrc/src/main/kotlin/Versions.kt
Normal file
6
buildSrc/src/main/kotlin/Versions.kt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
object Versions {
|
||||||
|
// const val PISTON = "0.4.3"
|
||||||
|
// const val AUTO_VALUE = "1.6.5"
|
||||||
|
const val JUNIT = "4.11"
|
||||||
|
const val SQUIRRELID = "0.2.0"
|
||||||
|
}
|
@ -58,10 +58,4 @@
|
|||||||
<!-- <module name="TypeName"/> Unlikely that we would miss this in a PR -->
|
<!-- <module name="TypeName"/> Unlikely that we would miss this in a PR -->
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
<!-- Require the header, something that many people forget and we hate to fix -->
|
|
||||||
<!-- You should configure the header in your IDE -->
|
|
||||||
<module name="Header">
|
|
||||||
<property name="headerFile" value="${basedir}/config/checkstyle/header.txt"/>
|
|
||||||
<property name="fileExtensions" value="java"/>
|
|
||||||
</module>
|
|
||||||
</module>
|
</module>
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* WorldGuard, a suite of tools for Minecraft
|
|
||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
||||||
* Copyright (C) WorldGuard team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
2
gradle.properties
Normal file
2
gradle.properties
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
group=com.sk89q.worldguard
|
||||||
|
version=7.0.1-SNAPSHOT
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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-5.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
rootProject.name = 'worldguard'
|
|
||||||
|
|
||||||
include 'worldguard-core', 'worldguard-bukkit'
|
|
7
settings.gradle.kts
Normal file
7
settings.gradle.kts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
rootProject.name = "worldguard"
|
||||||
|
|
||||||
|
include("worldguard-libs")
|
||||||
|
include("worldguard-libs:core")
|
||||||
|
include("worldguard-core")
|
||||||
|
include("worldguard-libs:bukkit")
|
||||||
|
include("worldguard-bukkit")
|
@ -1,55 +0,0 @@
|
|||||||
apply plugin: 'eclipse'
|
|
||||||
apply plugin: 'idea'
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = 'bstats repo'
|
|
||||||
url = 'https://repo.codemc.org/repository/maven-public'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile project(path: ':worldguard-core', configuration: 'shadow')
|
|
||||||
api 'org.bukkit:bukkit:1.14.2-R0.1-SNAPSHOT'
|
|
||||||
api ('com.sk89q.worldedit:worldedit-bukkit:7.0.1-SNAPSHOT') {
|
|
||||||
exclude group: 'io.papermc', module: 'paperlib'
|
|
||||||
}
|
|
||||||
implementation ('com.sk89q:commandbook:2.3') {
|
|
||||||
exclude group: 'com.sk89q', module: 'worldedit'
|
|
||||||
exclude group: 'com.zachsthings.libcomponents'
|
|
||||||
exclude group: 'org.bukkit'
|
|
||||||
exclude group: 'net.sf.opencsv'
|
|
||||||
}
|
|
||||||
implementation 'org.bstats:bstats-bukkit:1.5'
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
from (sourceSets.main.resources.srcDirs) {
|
|
||||||
expand project.properties
|
|
||||||
include 'plugin.yml'
|
|
||||||
}
|
|
||||||
|
|
||||||
from (sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude 'plugin.yml'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
attributes("Implementation-Version": version)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
dependencies {
|
|
||||||
include(dependency(':worldguard-core'))
|
|
||||||
relocate ("org.bstats", "com.sk89q.worldguard.bukkit.bstats") {
|
|
||||||
include(dependency("org.bstats:bstats-bukkit:1.5"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
relocate('org.flywaydb', 'com.sk89q.worldguard.internal.flywaydb')
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
build.dependsOn(shadowJar)
|
|
57
worldguard-bukkit/build.gradle.kts
Normal file
57
worldguard-bukkit/build.gradle.kts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("java-library")
|
||||||
|
id("net.ltgt.apt-eclipse")
|
||||||
|
id("net.ltgt.apt-idea")
|
||||||
|
}
|
||||||
|
|
||||||
|
applyPlatformAndCoreConfiguration()
|
||||||
|
applyShadowConfiguration()
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "spigot"
|
||||||
|
url = uri("https://hub.spigotmc.org/nexus/content/groups/public")
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = "bstats"
|
||||||
|
url = uri("https://repo.codemc.org/repository/maven-public")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"compile"(project(":worldguard-core"))
|
||||||
|
"compile"(project(":worldguard-libs:bukkit"))
|
||||||
|
"api"("org.bukkit:bukkit:1.14.2-R0.1-SNAPSHOT")
|
||||||
|
"api"("com.sk89q.worldedit:worldedit-bukkit:7.0.1-SNAPSHOT") { isTransitive = false }
|
||||||
|
"implementation"("com.sk89q:commandbook:2.3") { isTransitive = false }
|
||||||
|
"implementation"("org.bstats:bstats-bukkit:1.5")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<Copy>("processResources") {
|
||||||
|
filesMatching("plugin.yml") {
|
||||||
|
expand("internalVersion" to project.ext["internalVersion"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<Jar>("jar") {
|
||||||
|
manifest {
|
||||||
|
attributes("Implementation-Version" to project.version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
|
dependencies {
|
||||||
|
include(dependency(":worldguard-core"))
|
||||||
|
include(dependency(":worldguard-libs:core"))
|
||||||
|
include(dependency(":worldguard-libs:bukkit"))
|
||||||
|
relocate("org.bstats", "com.sk89q.worldguard.bukkit.bstats") {
|
||||||
|
include(dependency("org.bstats:bstats-bukkit:1.5"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("assemble").configure {
|
||||||
|
dependsOn("shadowJar")
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
name: WorldGuard
|
name: WorldGuard
|
||||||
main: com.sk89q.worldguard.bukkit.WorldGuardPlugin
|
main: com.sk89q.worldguard.bukkit.WorldGuardPlugin
|
||||||
version: "${project.internalVersion}"
|
version: "${internalVersion}"
|
||||||
depend: [WorldEdit]
|
depend: [WorldEdit]
|
||||||
softdepend: [CommandBook]
|
softdepend: [CommandBook]
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
apply plugin: 'eclipse'
|
|
||||||
apply plugin: 'idea'
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
api 'com.sk89q.worldedit:worldedit-core:7.0.1-SNAPSHOT'
|
|
||||||
implementation 'com.sk89q:squirrelid:0.2.0'
|
|
||||||
implementation 'org.flywaydb:flyway-core:3.0'
|
|
||||||
implementation 'org.khelekore:prtree:1.5.0'
|
|
||||||
|
|
||||||
api 'com.google.code.findbugs:jsr305:1.3.9'
|
|
||||||
testImplementation 'junit:junit:4.11'
|
|
||||||
testImplementation 'org.hamcrest:hamcrest-library:1.2.1'
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
main {
|
|
||||||
java {
|
|
||||||
srcDir 'src/main/java'
|
|
||||||
}
|
|
||||||
resources {
|
|
||||||
srcDir 'src/main/resources'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
relocate('com.sk89q.squirrelid', 'com.sk89q.worldguard.util.profile')
|
|
||||||
}
|
|
||||||
|
|
||||||
build.dependsOn(shadowJar { classifier = null })
|
|
33
worldguard-core/build.gradle.kts
Normal file
33
worldguard-core/build.gradle.kts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
plugins {
|
||||||
|
id("java-library")
|
||||||
|
id("net.ltgt.apt-eclipse")
|
||||||
|
id("net.ltgt.apt-idea")
|
||||||
|
}
|
||||||
|
|
||||||
|
applyPlatformAndCoreConfiguration()
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"compile"(project(":worldguard-libs:core"))
|
||||||
|
"compile"("com.sk89q.worldedit:worldedit-core:7.0.1-SNAPSHOT")
|
||||||
|
"implementation"("com.sk89q:squirrelid:0.2.0")
|
||||||
|
"implementation"("org.flywaydb:flyway-core:3.0")
|
||||||
|
"implementation"("org.khelekore:prtree:1.5.0")
|
||||||
|
|
||||||
|
"compileOnly"("com.google.code.findbugs:jsr305:1.3.9")
|
||||||
|
"testImplementation"("org.hamcrest:hamcrest-library:1.2.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
|
dependsOn(":worldguard-libs:build")
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
srcDir("src/main/java")
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
srcDir("src/main/resources")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.sk89q.worldguard.util.formatting.component;
|
package com.sk89q.worldguard.util.formatting.component;
|
||||||
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.sk89q.worldguard.util.formatting.component;
|
package com.sk89q.worldguard.util.formatting.component;
|
||||||
|
|
||||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||||
|
3
worldguard-libs/build.gradle.kts
Normal file
3
worldguard-libs/build.gradle.kts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
tasks.register("build") {
|
||||||
|
dependsOn(subprojects.map { it.tasks.named("build") })
|
||||||
|
}
|
1
worldguard-libs/bukkit/build.gradle.kts
Normal file
1
worldguard-libs/bukkit/build.gradle.kts
Normal file
@ -0,0 +1 @@
|
|||||||
|
applyLibrariesConfiguration()
|
5
worldguard-libs/core/build.gradle.kts
Normal file
5
worldguard-libs/core/build.gradle.kts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
applyLibrariesConfiguration()
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"shade"("com.sk89q:squirrelid:${Versions.SQUIRRELID}")
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
apply plugin: 'eclipse'
|
|
||||||
apply plugin: 'idea'
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile project(':worldguard-core')
|
|
||||||
compile 'org.spongepowered:spongeapi:2.1-SNAPSHOT'
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
dependencies {
|
|
||||||
include(dependency(':worldguard-core'))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
build.dependsOn(shadowJar)
|
|
Loading…
Reference in New Issue
Block a user