mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-10-31 18:07:12 +00:00
Update to Gradle 7 (#1078)
This commit is contained in:
parent
9aa25ce109
commit
aa0ad16a1b
@ -6,7 +6,6 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
maven {
|
maven {
|
||||||
name = "EngineHub"
|
name = "EngineHub"
|
||||||
@ -23,5 +22,5 @@ val properties = Properties().also { props ->
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(gradleApi())
|
implementation(gradleApi())
|
||||||
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0")
|
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0")
|
||||||
implementation("com.github.jengelman.gradle.plugins:shadow:6.1.0")
|
implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0")
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.plugins.JavaPluginExtension
|
import org.gradle.api.plugins.JavaPluginExtension
|
||||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||||
|
import org.gradle.jvm.toolchain.JvmVendorSpec
|
||||||
import org.gradle.kotlin.dsl.dependencies
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
import org.gradle.kotlin.dsl.get
|
import org.gradle.kotlin.dsl.get
|
||||||
import org.gradle.kotlin.dsl.repositories
|
import org.gradle.kotlin.dsl.repositories
|
||||||
@ -50,7 +51,8 @@ fun Project.applyCommonConfiguration() {
|
|||||||
|
|
||||||
plugins.withId("java") {
|
plugins.withId("java") {
|
||||||
the<JavaPluginExtension>().toolchain {
|
the<JavaPluginExtension>().toolchain {
|
||||||
languageVersion.set(JavaLanguageVersion.of(8))
|
languageVersion.set(JavaLanguageVersion.of(11))
|
||||||
|
vendor.set(JvmVendorSpec.ADOPTOPENJDK)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,27 @@
|
|||||||
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.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.artifacts.ExternalModuleDependency
|
import org.gradle.api.artifacts.ExternalModuleDependency
|
||||||
import org.gradle.api.artifacts.ModuleDependency
|
import org.gradle.api.artifacts.ModuleDependency
|
||||||
import org.gradle.api.internal.HasConvention
|
import org.gradle.api.attributes.Bundling
|
||||||
import org.gradle.api.plugins.MavenRepositoryHandlerConvention
|
import org.gradle.api.attributes.Category
|
||||||
import org.gradle.api.tasks.Upload
|
import org.gradle.api.attributes.DocsType
|
||||||
|
import org.gradle.api.attributes.LibraryElements
|
||||||
|
import org.gradle.api.attributes.Usage
|
||||||
|
import org.gradle.api.attributes.java.TargetJvmVersion
|
||||||
|
import org.gradle.api.component.AdhocComponentWithVariants
|
||||||
|
import org.gradle.api.component.SoftwareComponentFactory
|
||||||
|
import org.gradle.api.publish.PublishingExtension
|
||||||
|
import org.gradle.api.publish.maven.MavenPublication
|
||||||
import org.gradle.api.tasks.bundling.Jar
|
import org.gradle.api.tasks.bundling.Jar
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
import org.gradle.kotlin.dsl.get
|
import org.gradle.kotlin.dsl.get
|
||||||
import org.gradle.kotlin.dsl.getPlugin
|
import org.gradle.kotlin.dsl.getPlugin
|
||||||
import org.gradle.kotlin.dsl.invoke
|
import org.gradle.kotlin.dsl.invoke
|
||||||
|
import org.gradle.kotlin.dsl.named
|
||||||
import org.gradle.kotlin.dsl.register
|
import org.gradle.kotlin.dsl.register
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
fun Project.applyLibrariesConfiguration() {
|
fun Project.applyLibrariesConfiguration() {
|
||||||
applyCommonConfiguration()
|
applyCommonConfiguration()
|
||||||
@ -20,14 +31,13 @@ fun Project.applyLibrariesConfiguration() {
|
|||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
create("shade")
|
create("shade")
|
||||||
getByName("archives").extendsFrom(getByName("default"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "${rootProject.group}.worldedit-libs"
|
group = "${rootProject.group}.worldedit-libs"
|
||||||
|
|
||||||
val relocations = mapOf(
|
val relocations = mapOf(
|
||||||
"net.kyori.text" to "com.sk89q.worldedit.util.formatting.text",
|
"net.kyori.text" to "com.sk89q.worldedit.util.formatting.text",
|
||||||
"net.kyori.minecraft" to "com.sk89q.worldedit.util.kyori"
|
"net.kyori.minecraft" to "com.sk89q.worldedit.util.kyori",
|
||||||
)
|
)
|
||||||
|
|
||||||
tasks.register<ShadowJar>("jar") {
|
tasks.register<ShadowJar>("jar") {
|
||||||
@ -47,22 +57,22 @@ fun Project.applyLibrariesConfiguration() {
|
|||||||
}
|
}
|
||||||
val altConfigFiles = { artifactType: String ->
|
val altConfigFiles = { artifactType: String ->
|
||||||
val deps = configurations["shade"].incoming.dependencies
|
val deps = configurations["shade"].incoming.dependencies
|
||||||
.filterIsInstance<ModuleDependency>()
|
.filterIsInstance<ModuleDependency>()
|
||||||
.map { it.copy() }
|
.map { it.copy() }
|
||||||
.map { dependency ->
|
.map { dependency ->
|
||||||
dependency.artifact {
|
dependency.artifact {
|
||||||
name = dependency.name
|
name = dependency.name
|
||||||
type = artifactType
|
type = artifactType
|
||||||
extension = "jar"
|
extension = "jar"
|
||||||
classifier = artifactType
|
classifier = artifactType
|
||||||
}
|
|
||||||
dependency
|
|
||||||
}
|
}
|
||||||
|
dependency
|
||||||
|
}
|
||||||
|
|
||||||
files(configurations.detachedConfiguration(*deps.toTypedArray())
|
files(configurations.detachedConfiguration(*deps.toTypedArray())
|
||||||
.resolvedConfiguration.lenientConfiguration.artifacts
|
.resolvedConfiguration.lenientConfiguration.artifacts
|
||||||
.filter { it.classifier == artifactType }
|
.filter { it.classifier == artifactType }
|
||||||
.map { zipTree(it.file) })
|
.map { zipTree(it.file) })
|
||||||
}
|
}
|
||||||
tasks.register<Jar>("sourcesJar") {
|
tasks.register<Jar>("sourcesJar") {
|
||||||
from({
|
from({
|
||||||
@ -85,25 +95,85 @@ fun Project.applyLibrariesConfiguration() {
|
|||||||
dependsOn("jar", "sourcesJar")
|
dependsOn("jar", "sourcesJar")
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
project.apply<LibsConfigPluginHack>()
|
||||||
val jar = tasks.named("jar")
|
|
||||||
add("default", jar) {
|
val libsComponent = project.components["libs"] as AdhocComponentWithVariants
|
||||||
builtBy(jar)
|
|
||||||
|
val apiElements = project.configurations.register("apiElements") {
|
||||||
|
isVisible = false
|
||||||
|
description = "API elements for libs"
|
||||||
|
isCanBeResolved = false
|
||||||
|
isCanBeConsumed = true
|
||||||
|
attributes {
|
||||||
|
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_API))
|
||||||
|
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||||
|
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
||||||
|
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||||
|
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 11)
|
||||||
}
|
}
|
||||||
val sourcesJar = tasks.named("sourcesJar")
|
outgoing.artifact(tasks.named("jar"))
|
||||||
add("archives", sourcesJar) {
|
}
|
||||||
builtBy(sourcesJar)
|
|
||||||
|
val runtimeElements = project.configurations.register("runtimeElements") {
|
||||||
|
isVisible = false
|
||||||
|
description = "Runtime elements for libs"
|
||||||
|
isCanBeResolved = false
|
||||||
|
isCanBeConsumed = true
|
||||||
|
attributes {
|
||||||
|
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME))
|
||||||
|
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||||
|
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
||||||
|
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||||
|
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 11)
|
||||||
|
}
|
||||||
|
outgoing.artifact(tasks.named("jar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
val sourcesElements = project.configurations.register("sourcesElements") {
|
||||||
|
isVisible = false
|
||||||
|
description = "Source elements for libs"
|
||||||
|
isCanBeResolved = false
|
||||||
|
isCanBeConsumed = true
|
||||||
|
attributes {
|
||||||
|
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME))
|
||||||
|
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.DOCUMENTATION))
|
||||||
|
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
||||||
|
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, project.objects.named(DocsType.SOURCES))
|
||||||
|
}
|
||||||
|
outgoing.artifact(tasks.named("sourcesJar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
libsComponent.addVariantsFromConfiguration(apiElements.get()) {
|
||||||
|
mapToMavenScope("compile")
|
||||||
|
}
|
||||||
|
|
||||||
|
libsComponent.addVariantsFromConfiguration(runtimeElements.get()) {
|
||||||
|
mapToMavenScope("runtime")
|
||||||
|
}
|
||||||
|
|
||||||
|
libsComponent.addVariantsFromConfiguration(sourcesElements.get()) {
|
||||||
|
mapToMavenScope("runtime")
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<PublishingExtension> {
|
||||||
|
publications {
|
||||||
|
register<MavenPublication>("maven") {
|
||||||
|
from(libsComponent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Upload>("install") {
|
}
|
||||||
configuration = configurations["archives"]
|
|
||||||
(repositories as HasConvention).convention.getPlugin<MavenRepositoryHandlerConvention>().mavenInstaller {
|
|
||||||
pom.version = project.version.toString()
|
|
||||||
pom.artifactId = project.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// A horrible hack because `softwareComponentFactory` has to be gotten via plugin
|
||||||
|
// gradle why
|
||||||
|
internal open class LibsConfigPluginHack @Inject constructor(
|
||||||
|
private val softwareComponentFactory: SoftwareComponentFactory
|
||||||
|
) : Plugin<Project> {
|
||||||
|
override fun apply(project: Project) {
|
||||||
|
val libsComponents = softwareComponentFactory.adhoc("libs")
|
||||||
|
project.components.add(libsComponents)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.constrainDependenciesToLibsCore() {
|
fun Project.constrainDependenciesToLibsCore() {
|
||||||
|
@ -30,7 +30,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
|||||||
} else {
|
} else {
|
||||||
ext["internalVersion"] = "$version"
|
ext["internalVersion"] = "$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks
|
tasks
|
||||||
.withType<JavaCompile>()
|
.withType<JavaCompile>()
|
||||||
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
|
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
|
||||||
@ -60,7 +60,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
|||||||
"testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}")
|
"testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}")
|
||||||
"testImplementation"("org.mockito:mockito-junit-jupiter:${Versions.MOCKITO}")
|
"testImplementation"("org.mockito:mockito-junit-jupiter:${Versions.MOCKITO}")
|
||||||
"testImplementation"("net.bytebuddy:byte-buddy:1.11.0")
|
"testImplementation"("net.bytebuddy:byte-buddy:1.11.0")
|
||||||
"testRuntime"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
|
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Java 8 turns on doclint which we fail
|
// Java 8 turns on doclint which we fail
|
||||||
|
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-6.9-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -61,7 +61,7 @@ dependencies {
|
|||||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7") { isTransitive = false }
|
compileOnly("com.github.MilkBowl:VaultAPI:1.7") { isTransitive = false }
|
||||||
api(project(":worldedit-core"))
|
api(project(":worldedit-core"))
|
||||||
api(project(":worldedit-libs:bukkit"))
|
api(project(":worldedit-libs:bukkit"))
|
||||||
compile(":worldedit-adapters:")
|
implementation(":worldedit-adapters:")
|
||||||
// Paper-patched NMS jars
|
// Paper-patched NMS jars
|
||||||
compileOnly("com.destroystokyo.paperv1_15_r1:paperv1_15_r1:1_15_r1")
|
compileOnly("com.destroystokyo.paperv1_15_r1:paperv1_15_r1:1_15_r1")
|
||||||
compileOnly("com.destroystokyo.paperv1_16_r1:paperv1_16_r1:1_16_r1")
|
compileOnly("com.destroystokyo.paperv1_16_r1:paperv1_16_r1:1_16_r1")
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.4.21"
|
kotlin("jvm") version "1.5.0-RC"
|
||||||
application
|
application
|
||||||
}
|
}
|
||||||
|
|
||||||
applyCommonConfiguration()
|
applyCommonConfiguration()
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
tasks.withType<KotlinCompile> {
|
||||||
kotlinOptions.jvmTarget = "1.8"
|
kotlinOptions.jvmTarget = "11"
|
||||||
}
|
}
|
||||||
|
|
||||||
application.mainClass.set("com.sk89q.worldedit.internal.util.DocumentationPrinter")
|
application.mainClass.set("com.sk89q.worldedit.internal.util.DocumentationPrinter")
|
||||||
|
Loading…
Reference in New Issue
Block a user