Skip to content

Commit

Permalink
build: Update plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Sep 25, 2022
1 parent 15f744d commit 7d839e6
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 35 deletions.
67 changes: 43 additions & 24 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import com.diffplug.gradle.spotless.FormatExtension
import com.diffplug.gradle.spotless.SpotlessExtension
import net.kyori.indra.IndraExtension
import net.kyori.indra.crossdoc.CrossdocExtension
import net.kyori.indra.gradle.IndraPluginPublishingExtension
import net.kyori.indra.licenser.spotless.IndraSpotlessLicenserExtension

plugins {
id("com.gradle.plugin-publish") apply false
id("net.kyori.indra") apply false
id("com.diffplug.spotless") apply false
id("net.kyori.indra.crossdoc") apply false
id("net.kyori.indra.licenser.spotless") apply false
id("net.kyori.indra.publishing.gradle-plugin") apply false
}

Expand All @@ -17,18 +22,13 @@ subprojects {
apply(JavaGradlePluginPlugin::class)
apply("com.gradle.plugin-publish")
apply("net.kyori.indra")
apply("com.diffplug.spotless")
apply("net.kyori.indra.crossdoc")
apply("net.kyori.indra.licenser.spotless")
apply("net.kyori.indra.publishing.gradle-plugin")
apply("net.kyori.indra.git")
}

repositories {
mavenLocal {
mavenContent {
snapshotsOnly()
includeGroup("net.kyori")
}
}
maven("https://repo.spongepowered.org/repository/maven-public/") {
name = "sponge"
}
Expand Down Expand Up @@ -82,27 +82,38 @@ subprojects {
}

extensions.configure(SpotlessExtension::class) {
fun FormatExtension.standardOptions() {
endWithNewline()
indentWithSpaces(4)
trimTrailingWhitespace()
this.toggleOffOn("@formatter:off", "@formatter:on")
}

java {
standardOptions()
formatAnnotations()
}

project.plugins.withId("groovy") {
groovy {
standardOptions()
}
}

kotlinGradle {
standardOptions()
}
}

extensions.configure(IndraSpotlessLicenserExtension::class) {
val name: String by project
val organization: String by project
val projectUrl: String by project

java {
val lineSep = System.lineSeparator()
val contents = rootProject.file("HEADER.txt")
.readLines().asSequence()
.map { (" * " + it).trimEnd() }
.joinToString(prefix = "/*${lineSep}", postfix = "${lineSep} */", separator = lineSep)

val formattedContents = groovy.text.SimpleTemplateEngine()
.createTemplate(contents)
.make(mutableMapOf(
"name" to name,
"organization" to organization,
"url" to projectUrl
))

licenseHeader(formattedContents.toString())
}
licenseHeaderFile(rootProject.file("HEADER.txt"))
property("name", name)
property("organization", organization)
property("url", projectUrl)
}

extensions.configure(SigningExtension::class) {
Expand All @@ -124,4 +135,12 @@ subprojects {
pluginIdBase("$group.gradle")
website("https://spongepowered.org/")
}

extensions.configure(CrossdocExtension::class) {
baseUrl(providers.gradleProperty("javadocLinkRoot"))
nameBasedDocumentationUrlProvider {
projectNamePrefix.set("spongegradle-")
lowercaseProjectName.set(true)
}
}
}
5 changes: 1 addition & 4 deletions convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ plugins {
}

tasks.withType(GroovyCompile::class).configureEach {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.release.set(indra.javaVersions().target())
options.compilerArgs.add("-Xlint:all")
}

Expand All @@ -32,4 +29,4 @@ indraPluginPublishing {
description = "Conventions for implementations of Sponge projects",
tags = listOf("sponge", "minecraft", "convention")
)*/
}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name=SpongeGradle
url=https://www.spongepowered.org
organization=SpongePowered
projectUrl=https://www.spongepowered.org
projectUrl=https://www.spongepowered.org
javadocLinkRoot=https://jd.spongepowered.org/spongegradle/
4 changes: 2 additions & 2 deletions plugin-development/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ configurations.named(functionalTest.compileClasspathConfigurationName) { extends
configurations.named(functionalTest.runtimeClasspathConfigurationName) { extendsFrom(configurations.testRuntimeClasspath.get()) }

dependencies {
functionalTest.implementationConfigurationName("net.kyori:mammoth-test:1.1.0")
functionalTest.implementationConfigurationName("net.kyori:mammoth-test:1.2.0")
functionalTest.implementationConfigurationName("com.google.code.gson:gson:2.9.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
Expand Down Expand Up @@ -39,4 +39,4 @@ indraPluginPublishing {
"Set up a project for building Sponge plugins",
listOf("minecraft", "sponge", "plugin-development")
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public abstract class WritePluginMetadataTask extends DefaultTask {
public WritePluginMetadataTask() {
this.setGroup(Constants.TASK_GROUP);
}

@Nested
public abstract Property<MetadataContainerConfiguration> getSourceContainer();

Expand Down
8 changes: 5 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ pluginManagement {
}

plugins {
val indraVersion = "2.1.1"
id("com.gradle.plugin-publish") version "0.21.0"
id("com.diffplug.spotless") version "6.10.0"
val indraVersion = "2.2.0"
id("com.gradle.plugin-publish") version "1.0.0"
id("com.diffplug.spotless") version "6.11.0"
id("net.kyori.indra") version indraVersion
id("net.kyori.indra.crossdoc") version indraVersion
id("net.kyori.indra.publishing.gradle-plugin") version indraVersion
id("net.kyori.indra.licenser.spotless") version indraVersion
}
}

Expand Down

0 comments on commit 7d839e6

Please sign in to comment.