diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 22ab270d..68a1c156 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,7 +8,7 @@ gradlePluginPublish = "1.2.1" immutables = "2.9.3" indra = "3.1.2" jetbrainsAnnotations = "24.0.1" -jgit = "5.13.0.+" # stay on 5.x series, 6+ requires Java 11 +jgit = "6.6.0.+" # stay on 5.x series, 6+ requires Java 11 junit = "5.10.0" kotlin = "1.9.10" mammoth = "1.3.1" @@ -48,8 +48,7 @@ gradlePluginPublish = { module = "com.gradle.publish:plugin-publish-plugin", ver nexusPublishPlugin = { module = "io.github.gradle-nexus:publish-plugin", version = "1.3.0" } # spotless-licenser -spotlessLegacy = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.13.0" } # build against this, for J8 support -spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } # published as a dep on a special J11+ variant +spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } # testlib mammoth-test = { module = "net.kyori:mammoth-test", version.ref = "mammoth" } diff --git a/indra-licenser-spotless/build.gradle b/indra-licenser-spotless/build.gradle index a99b518d..ac946dc5 100644 --- a/indra-licenser-spotless/build.gradle +++ b/indra-licenser-spotless/build.gradle @@ -1,72 +1,12 @@ -import org.gradle.api.attributes.java.TargetJvmVersion -import org.gradle.api.plugins.internal.JavaConfigurationVariantMapping - -static def transferAttributes(HasAttributes src, HasAttributes dest) { - def destAttrs = dest.attributes - src.attributes.keySet().each { - destAttrs.attribute(it, src.attributes.getAttribute(it)) - } -} - -def duplicateConfiguration(Configuration src, String name, Configuration parent) { - configurations.create(name) { - canBeConsumed = true - canBeResolved = false - visible = true - - transferAttributes(src, delegate) - attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 11) - - outgoing.variants.addAll(src.outgoing.variants) - outgoing.variants.configureEach { - it.attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 11) - } - artifacts.addAll(src.artifacts) - - src.incoming.dependencies.each { - if (it.group != "com.diffplug.spotless") { // yikes - project.dependencies.add(name, it) - } - } - extendsFrom parent - } -} - -configurations { - java11Deps { - canBeConsumed = false - canBeResolved = true - } -} dependencies { compileOnlyApi libs.jetbrainsAnnotations api libs.mammoth - api libs.spotlessLegacy - java11Deps libs.spotless + api libs.spotless testImplementation project(":indra-testlib") testImplementation libs.spotless } -configurations { - // must be after dep declaration because we eagerly read declared deps - duplicateConfiguration(apiElements, 'java11ApiElements', java11Deps) - duplicateConfiguration(runtimeElements, 'java11RuntimeElements', java11Deps) - - [testCompileClasspath, testRuntimeClasspath].each { - it.attributes { - attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 11) - } - } -} - -components.java { - // This is technically internal api but because it's our own buildscript we can just update as needed - // and it's easier than matching their logic - addVariantsFromConfiguration(configurations.java11ApiElements, new JavaConfigurationVariantMapping('compile', true)) - addVariantsFromConfiguration(configurations.java11RuntimeElements, new JavaConfigurationVariantMapping('runtime', true)) -} - indraPluginPublishing { plugin( "indra.licenser.spotless", @@ -76,16 +16,3 @@ indraPluginPublishing { ["indra", "licenser", "license-header", "spotless"] ) } - -tasks.named('pluginUnderTestMetadata', PluginUnderTestMetadata).configure { - pluginClasspath.setFrom(sourceSets.main.output, configurations.java11Deps, configurations.runtimeClasspath) -} - -indra { - javaVersions { - // TODO(4): remove this since we'll target 11 - def oldTestWith = testWith().get() - testWith().empty() - testWith().addAll(oldTestWith.findAll { it != 8}) - } -}