Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to gradle 8.3 #84

Merged
merged 2 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 31 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ gradlePlugin {
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsJavaPlatformPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionJvmTestSuite") {
id = "dev.mythicdrops.gradle.convention.jvm-test-suite"
displayName = "mythicDropsGradleConventionJvmSuite"
description = "Common conventions for all MythicDrops JVM Test Suite Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsJvmTestSuitePlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionKotlinJvm") {
id = "dev.mythicdrops.gradle.convention.kotlin.jvm"
displayName = "mythicDropsGradleConventionKotlinJvm"
Expand All @@ -93,6 +100,18 @@ tasks {
from(dokkaJavadoc)
}

// use JUnit Jupiter
withType<Test> {
useJUnitPlatform()
}

withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
}
}

getByName("generateChangelog") {
dependsOn(
"compileJava",
Expand All @@ -107,9 +126,18 @@ tasks {
)
}

// use JUnit Jupiter
withType<Test> {
useJUnitPlatform()
// Make GitHub release depend on generating a changelog
val generateChangelog = getByName<org.shipkit.changelog.GenerateChangelogTask>("generateChangelog") {
previousRevision = project.ext.get("shipkit-auto-version.previous-tag")?.toString()
githubToken = System.getenv("GITHUB_TOKEN")
repository = "MythicDrops/mythicdrops-gradle-plugin"
}
getByName<org.shipkit.github.release.GithubReleaseTask>("githubRelease") {
dependsOn(generateChangelog)
repository = generateChangelog.repository
changelog = generateChangelog.outputFile
githubToken = System.getenv("GITHUB_TOKEN")
newTagRevision = System.getenv("GITHUB_SHA")
}
}

Expand Down Expand Up @@ -152,19 +180,5 @@ dependencies {
implementation("org.kohsuke:github-api:_")
}

val generateChangelog = tasks.getByName<org.shipkit.changelog.GenerateChangelogTask>("generateChangelog") {
previousRevision = project.ext.get("shipkit-auto-version.previous-tag")?.toString()
githubToken = System.getenv("GITHUB_TOKEN")
repository = "MythicDrops/mythicdrops-gradle-plugin"
}

tasks.getByName<org.shipkit.github.release.GithubReleaseTask>("githubRelease") {
dependsOn(generateChangelog)
repository = generateChangelog.repository
changelog = generateChangelog.outputFile
githubToken = System.getenv("GITHUB_TOKEN")
newTagRevision = System.getenv("GITHUB_SHA")
}

project.ext.set("gradle.publish.key", System.getenv("GRADLE_PUBLISH_KEY"))
project.ext.set("gradle.publish.secret", System.getenv("GRADLE_PUBLISH_SECRET"))
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
kotlin.code.style=official
org.gradle.console=plain
kotlin.experimental.tryK2=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pluginManagement {

plugins {
// See https://jmfayard.github.io/refreshVersions
id("de.fayard.refreshVersions") version "0.60.1"
id("de.fayard.refreshVersions") version "0.60.2"
id("com.gradle.enterprise") version "3.14.1"
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/dev/mythicdrops/gradle/MythicDropsPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dev.mythicdrops.gradle

import dev.mythicdrops.gradle.conventions.MythicDropsJavaPlatformPlugin
import dev.mythicdrops.gradle.conventions.MythicDropsJavaPlugin
import dev.mythicdrops.gradle.conventions.MythicDropsJvmTestSuitePlugin
import dev.mythicdrops.gradle.conventions.MythicDropsKotlinJvmPlugin
import dev.mythicdrops.gradle.conventions.MythicDropsMavenPublishPlugin
import dev.mythicdrops.gradle.projects.MythicDropsBasePlugin
Expand All @@ -28,6 +29,7 @@ open class MythicDropsPlugin : Plugin<Project> {
pluginManager.apply(MythicDropsBasePlugin::class)
pluginManager.apply(MythicDropsJavaPlugin::class)
pluginManager.apply(MythicDropsJavaPlatformPlugin::class)
pluginManager.apply(MythicDropsJvmTestSuitePlugin::class)
pluginManager.apply(MythicDropsKotlinJvmPlugin::class)
pluginManager.apply(MythicDropsMavenPublishPlugin::class)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.gradle.kotlin.dsl.withType
/**
* Plugin that configures Maven publications for Java Platforms.
*/
open class MythicDropsJavaPlatformPlugin : DependentPlugin("Java", "java-platform") {
open class MythicDropsJavaPlatformPlugin : DependentPlugin("Java Platform", "java-platform") {
override fun configureProject(target: Project) {
target.pluginManager.withPlugin("maven-publish") {
target.extensions.getByType<PublishingExtension>().publications.withType<MavenPublication> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ val DEFAULT_JAVA_VERSION = JavaVersion.VERSION_17
*/
open class MythicDropsJavaPlugin : DependentPlugin("Java", "java") {
override fun configureProject(target: Project) {
val javaExtension = target.extensions.create<MythicDropsJavaExtension>("mythicDropsJava")
javaExtension.apply {
val javaExtension = target.extensions.create<MythicDropsJavaExtension>("mythicDropsJava").apply {
// default to Java 17
javaVersion.convention(DEFAULT_JAVA_VERSION)
}
Expand All @@ -34,7 +33,7 @@ open class MythicDropsJavaPlugin : DependentPlugin("Java", "java") {
// enable and configure JaCoCo
target.pluginManager.apply(JacocoPlugin::class.java)
target.configure<JacocoPluginExtension> {
toolVersion = "0.8.8"
toolVersion = "0.8.10"
}
target.tasks.withType<JacocoReport> {
reports {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package dev.mythicdrops.gradle.conventions

import org.gradle.api.Project
import org.gradle.api.plugins.jvm.JvmTestSuite
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType
import org.gradle.testing.base.TestingExtension

/**
* Plugin that configures the base JVM Test Suite to use JUnit Jupiter.
*/
open class MythicDropsJvmTestSuitePlugin : DependentPlugin("JVM Test Suite", "org.gradle.jvm-test-suite") {
@Suppress("UnstableApiUsage")
override fun configureProject(target: Project) {
target.configure<TestingExtension> {
suites.withType<JvmTestSuite> {
useJUnitJupiter()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ open class MythicDropsKotlinJvmPlugin : DependentPlugin("Kotlin JVM", "org.jetbr

// exclude files from the build directory from being linted or formatted
target.configure<KtlintExtension> {
// ktlint version that supports kotlin 1.8.0
version.set("0.48.2")
version.set("0.50.0")
filter {
exclude { entry ->
entry.file.toString().contains("generated")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import com.adarshr.gradle.testlogger.theme.ThemeType
import nebula.plugin.responsible.NebulaResponsiblePlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType

/**
* Plugin that applies sensible defaults to all projects. Intended for use on root and subprojects.
Expand All @@ -31,10 +29,5 @@ open class MythicDropsBasePlugin : Plugin<Project> {
showSkippedStandardStreams = false
showPassedStandardStreams = false
}

// make tests use JUnit Jupiter
target.tasks.withType<Test>() {
useJUnitPlatform()
}
}
}
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=5.4.*
version=6.0.*
8 changes: 4 additions & 4 deletions versions.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#### Dependencies and Plugin versions with their available updates.
#### Generated by `./gradlew refreshVersions` version 0.60.1
#### Generated by `./gradlew refreshVersions` version 0.60.2
####
#### Don't manually edit or split the comments that start with four hashtags (####),
#### they will be overwritten by refreshVersions.
Expand All @@ -11,7 +11,7 @@ plugin.com.gradle.plugin-publish=1.2.1

plugin.io.gitlab.arturbosch.detekt=1.23.1

plugin.org.jetbrains.dokka=1.8.20
plugin.org.jetbrains.dokka=1.9.0

plugin.org.jlleitschuh.gradle.ktlint=11.5.1

Expand All @@ -29,9 +29,9 @@ version.org.shipkit..shipkit-changelog=1.2.0

version.com.adarshr..gradle-test-logger-plugin=3.2.0

version.org.jetbrains.dokka..dokka-core=1.8.20
version.org.jetbrains.dokka..dokka-core=1.9.0

version.org.jetbrains.dokka..dokka-gradle-plugin=1.8.20
version.org.jetbrains.dokka..dokka-gradle-plugin=1.9.0

version.com.netflix.nebula..nebula-project-plugin=10.1.5

Expand Down