2019-08-26 06:45:03 +02:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
|
|
import org.gradle.api.JavaVersion
|
|
|
|
import org.gradle.api.Project
|
|
|
|
import org.gradle.api.plugins.JavaPluginConvention
|
|
|
|
import org.gradle.api.tasks.bundling.Jar
|
2020-08-14 21:29:15 +02:00
|
|
|
import org.gradle.api.tasks.compile.JavaCompile
|
2019-08-26 06:45:03 +02:00
|
|
|
import org.gradle.api.tasks.javadoc.Javadoc
|
|
|
|
import org.gradle.api.tasks.testing.Test
|
2020-01-07 22:11:47 +01:00
|
|
|
import org.gradle.external.javadoc.StandardJavadocDocletOptions
|
2019-08-26 06:45:03 +02:00
|
|
|
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")
|
2020-10-05 19:41:41 +02:00
|
|
|
apply(plugin = "eclipse")
|
2019-08-26 06:45:03 +02:00
|
|
|
apply(plugin = "idea")
|
2021-01-18 21:58:50 +01:00
|
|
|
apply(plugin = "maven-publish")
|
2020-07-14 04:50:59 +02:00
|
|
|
// apply(plugin = "checkstyle")
|
2019-08-26 06:45:03 +02:00
|
|
|
apply(plugin = "com.github.johnrengelman.shadow")
|
|
|
|
|
|
|
|
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
|
|
|
|
|
2020-08-14 21:29:15 +02:00
|
|
|
tasks
|
|
|
|
.withType<JavaCompile>()
|
|
|
|
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
|
|
|
|
.configureEach {
|
|
|
|
val disabledLint = listOf(
|
|
|
|
"processing", "path", "fallthrough", "serial"
|
|
|
|
)
|
|
|
|
//options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
|
|
|
|
options.isDeprecation = false
|
|
|
|
options.encoding = "UTF-8"
|
|
|
|
}
|
|
|
|
|
2019-08-26 06:45:03 +02:00
|
|
|
// configure<CheckstyleExtension> {
|
|
|
|
// configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
2020-07-14 04:50:59 +02:00
|
|
|
// toolVersion = "8.34"
|
2019-08-26 06:45:03 +02:00
|
|
|
// }
|
|
|
|
|
|
|
|
tasks.withType<Test>().configureEach {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2020-09-17 22:31:55 +02:00
|
|
|
"compileOnly"("org.jetbrains:annotations:20.1.0")
|
2021-02-11 17:59:03 +01:00
|
|
|
"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}")
|
|
|
|
"testRuntime"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Java 8 turns on doclint which we fail
|
|
|
|
tasks.withType<Javadoc>().configureEach {
|
2020-08-14 21:29:15 +02:00
|
|
|
(options as StandardJavadocDocletOptions).apply {
|
|
|
|
addStringOption("Xdoclint:none", "-quiet")
|
|
|
|
tags(
|
|
|
|
"apiNote:a:API Note:",
|
|
|
|
"implSpec:a:Implementation Requirements:",
|
|
|
|
"implNote:a:Implementation Note:"
|
|
|
|
)
|
|
|
|
}
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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 == "worldedit-core" || name == "worldedit-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")
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fun Project.applyShadowConfiguration() {
|
|
|
|
tasks.named<ShadowJar>("shadowJar") {
|
|
|
|
dependencies {
|
|
|
|
include(project(":worldedit-libs:core"))
|
|
|
|
include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}"))
|
|
|
|
include(project(":worldedit-core"))
|
2021-01-25 11:14:09 +01:00
|
|
|
exclude("com.google.code.findbugs:jsr305")
|
2019-08-26 06:45:03 +02:00
|
|
|
}
|
2019-09-14 01:54:39 +02:00
|
|
|
archiveFileName.set("FastAsyncWorldEdit-${project.version}.jar")
|
2019-08-26 06:45:03 +02:00
|
|
|
exclude("GradleStart**")
|
|
|
|
exclude(".cache")
|
|
|
|
exclude("LICENSE*")
|
2019-11-19 22:25:36 +01:00
|
|
|
exclude("META-INF/maven/**")
|
2019-08-26 06:45:03 +02:00
|
|
|
minimize()
|
|
|
|
}
|
|
|
|
}
|
2020-01-11 04:32:12 +01:00
|
|
|
|
2019-12-16 12:00:12 +01:00
|
|
|
val CLASSPATH = listOf("truezip", "truevfs", "js")
|
|
|
|
.map { "$it.jar" }
|
|
|
|
.flatMap { listOf(it, "WorldEdit/$it") }
|
|
|
|
.joinToString(separator = " ")
|