Skip to content

Commit

Permalink
update to gradle 8 (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
ToppleTheNun authored Feb 19, 2023
1 parent 940d9eb commit 8278708
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 38 deletions.
25 changes: 11 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`kotlin-dsl`
`maven-publish`
Expand All @@ -24,65 +21,70 @@ java {
withSourcesJar()
}

@Suppress("UnstableApiUsage")
gradlePlugin {
website.set("https://github.com/MythicDrops/mythicdrops-gradle-plugin")
vcsUrl.set("https://github.com/MythicDrops/mythicdrops-gradle-plugin")
plugins {
create("mythicDropsProject") {
id = "dev.mythicdrops.gradle.project"
displayName = "mythicDropsGradleProject"
description = "Orchestration plugin for all MythicDrops Gradle projects."
implementationClass = "dev.mythicdrops.gradle.MythicDropsPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsProjectRoot") {
id = "dev.mythicdrops.gradle.project.root"
displayName = "mythicDropsGradleProjectRoot"
description = "Common conventions for MythicDrops root Gradle projects."
implementationClass = "dev.mythicdrops.gradle.projects.MythicDropsRootPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsProjectBase") {
id = "dev.mythicdrops.gradle.project.base"
displayName = "mythicDropsGradleProjectBase"
description = "Common conventions for all MythicDrops Gradle projects."
implementationClass = "dev.mythicdrops.gradle.projects.MythicDropsBasePlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsReleaseGitHub") {
id = "dev.mythicdrops.gradle.release.github"
displayName = "mythicDropsGradleReleaseGitHub"
description = "Create a GitHub Release via GitHub Actions for all MythicDrops Gradle projects."
implementationClass = "dev.mythicdrops.gradle.release.MythicDropsReleaseGitHubPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionJava") {
id = "dev.mythicdrops.gradle.convention.java"
displayName = "mythicDropsGradleConventionJava"
description = "Common conventions for all MythicDrops Java Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsJavaPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionJavaPlatform") {
id = "dev.mythicdrops.gradle.convention.java-platform"
displayName = "mythicDropsGradleConventionJavaPlatform"
description = "Common conventions for all MythicDrops Java Platform Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsJavaPlatformPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionKotlinJvm") {
id = "dev.mythicdrops.gradle.convention.kotlin.jvm"
displayName = "mythicDropsGradleConventionKotlinJvm"
description = "Common conventions for all MythicDrops Kotlin JVM Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsKotlinJvmPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
create("mythicDropsConventionsMavenPublish") {
id = "dev.mythicdrops.gradle.convention.maven-publish"
displayName = "mythicDropsGradle"
description = "Common conventions for all MythicDrops Maven Publishing Gradle projects."
implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsMavenPublishPlugin"
tags.set(listOf("kotlin", "pixeloutlaw", "convention"))
}
}
}

pluginBundle {
website = "https://github.com/MythicDrops/mythicdrops-gradle-plugin"
vcsUrl = "https://github.com/MythicDrops/mythicdrops-gradle-plugin"
tags = listOf("kotlin", "pixeloutlaw", "convention")
}

tasks {
// get dokkaJavadoc task and make javadocJar depend on it
val dokkaJavadoc by this
Expand All @@ -91,11 +93,6 @@ tasks {
from(dokkaJavadoc)
}

// compile targeting JDK8
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

// use JUnit Jupiter
withType<Test> {
useJUnitPlatform()
Expand Down
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-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package dev.mythicdrops.gradle.conventions
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.testing.Test
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.configure
Expand Down Expand Up @@ -32,13 +31,6 @@ open class MythicDropsJavaPlugin : DependentPlugin("Java", "java") {
}
}

// enable passing `-parameters` to javac
target.tasks.withType<JavaCompile> {
options.compilerArgs.add("-parameters")
options.isFork = true
options.forkOptions.executable = "javac"
}

// enable and configure JaCoCo
target.pluginManager.apply(JacocoPlugin::class.java)
target.configure<JacocoPluginExtension> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ package dev.mythicdrops.gradle.conventions
import io.gitlab.arturbosch.detekt.DetektPlugin
import org.gradle.api.Project
import org.gradle.api.tasks.bundling.Jar
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getByName
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.KtlintPlugin
Expand All @@ -20,22 +17,11 @@ import org.jlleitschuh.gradle.ktlint.KtlintPlugin
*/
open class MythicDropsKotlinJvmPlugin : DependentPlugin("Kotlin JVM", "org.jetbrains.kotlin.jvm") {
override fun configureProject(target: Project) {
val javaExtension =
target.extensions.getByType<MythicDropsJavaExtension>().apply {
javaVersion.convention(DEFAULT_JAVA_VERSION)
}

// apply plugins
target.pluginManager.apply(DetektPlugin::class.java)
target.pluginManager.apply(DokkaPlugin::class.java)
target.pluginManager.apply(KtlintPlugin::class.java)

target.configure<KotlinJvmProjectExtension> {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(javaExtension.javaVersion.get().majorVersion))
}
}

// exclude files from the build directory from being linted or formatted
target.configure<KtlintExtension> {
// ktlint version that supports kotlin 1.8.0
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=4.0.*
version=5.0.*

0 comments on commit 8278708

Please sign in to comment.