Skip to content

Commit

Permalink
Revert "chore: Migrate to gradle 8.0 (#125)"
Browse files Browse the repository at this point in the history
This reverts commit dd35fd0.
  • Loading branch information
ursjoss committed Feb 26, 2023
1 parent 4b6f9cb commit 50ada62
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
path: '**/build/reports'

- name: Run all tests with Gradle
run: ./gradlew check detekt --info --no-daemon
run: ./gradlew check detekt sonar --info --no-daemon
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 16 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("UnstableApiUsage")

import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
Expand All @@ -24,6 +22,10 @@ plugins {
jacoco
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(libs.versions.java.get()))
}

val jacocoTestReportFile = "$buildDir/reports/jacoco/test/jacocoTestReport.xml"

jacoco {
Expand Down Expand Up @@ -76,27 +78,31 @@ tasks {
}
}

testing {
suites {
val test by getting(JvmTestSuite::class) {
useJUnitJupiter()
}
}
}

val kotlinSrcSet = "/src/main/kotlin"

subprojects.forEach { subProject ->
subProject.tasks {
val kotlinVersion = libs.versions.kotlin.get()
val kotlinApiLangVersion = kotlinVersion.subSequence(0, 3).toString()
val jvmTargetVersion = libs.versions.java.get()
withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = kotlinApiLangVersion
languageVersion = kotlinApiLangVersion
jvmTarget = jvmTargetVersion
freeCompilerArgs = freeCompilerArgs + listOf("-opt-in=kotlin.RequiresOptIn")
}
}
withType<JavaCompile>().configureEach {
sourceCompatibility = jvmTargetVersion
targetCompatibility = jvmTargetVersion
}

withType<Test> {
useJUnitPlatform {
includeEngines("junit-jupiter", "kotest")
}
}
withType<DokkaTaskPartial>().configureEach {
dokkaSourceSets {
configureEach {
Expand Down
8 changes: 0 additions & 8 deletions gradle-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
plugins {
kotlin("jvm") version "1.8.10"
}

kotlin {
jvmToolchain(11)
}

val buildTask = tasks.register("buildPlugins")

subprojects {
Expand Down
4 changes: 4 additions & 0 deletions gradle-plugins/publishing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ dependencies {
implementation(libs.plugin.detekt)
}

tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile::class.java).configureEach {
kotlinOptions.jvmTarget = libs.versions.java.get()
}

detekt {
buildUponDefaultConfig = true
config.from(file("../../config/detekt/detekt.yml"))
Expand Down
4 changes: 4 additions & 0 deletions gradle-plugins/verification/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ dependencies {
implementation(libs.plugin.detekt)
}

tasks.withType(KotlinJvmCompile::class.java).configureEach {
kotlinOptions.jvmTarget = libs.versions.java.get()
}

detekt {
buildUponDefaultConfig = true
config.from(file("../../config/detekt/detekt.yml"))
Expand Down
5 changes: 4 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mockk = "1.13.4"
nexusPublish = "1.2.0"
rxjava = "2.2.21"
sonarqube = "4.0.0.2929"
testSets = "4.0.0"
versions = "0.46.0"

[libraries]
Expand All @@ -37,7 +38,8 @@ plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.

[bundles]
kotlin = ["kotlin-stdlib", "kotlin-reflect", "coroutines-core"]
testDeps = ["junitJupiter-api", "kotest-runner-junit5", "kotest-framework-api", "mockk", "kluent", "assertj-core"]
testDeps = ["junitJupiter-api", "kotest-framework-api", "mockk", "kluent", "assertj-core"]
testEngines = ["junitJupiter-engine", "kotest-runner-junit5"]

[plugins]
asciidoctorConvert = { id = "org.asciidoctor.jvm.convert", version.ref = "asciidoctor" }
Expand All @@ -46,4 +48,5 @@ dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
gitPublish = { id = "org.ajoberstar.git-publish", version.ref = "gitPublish" }
nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublish" }
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }
testSets = { id = "org.unbroken-dome.test-sets", version.ref = "testSets" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
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.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion subprojects/kris-core/kris-core.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ dependencies {
implementation(libs.coroutines.rx2)

testImplementation(libs.bundles.testDeps)
testRuntimeOnly(libs.bundles.testEngines)
}

kotlin {
explicitApi()
jvmToolchain(libs.versions.java.get().toInt())
}

tasks {
Expand Down
11 changes: 9 additions & 2 deletions subprojects/kris-guide/kris-guide.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`java-library`
kotlin("jvm")
}

kotlin {
jvmToolchain(libs.versions.java.get().toInt())
tasks {
withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = libs.versions.java.get()
}
}
}

dependencies {
Expand All @@ -13,4 +19,5 @@ dependencies {
implementation(libs.bundles.kotlin)

testImplementation(libs.bundles.testDeps)
testRuntimeOnly(libs.bundles.testEngines)
}
32 changes: 5 additions & 27 deletions subprojects/kris-io/kris-io.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,21 @@ plugins {
id("kris-publish")
id("kris-jacoco")
kotlin("jvm")
`jvm-test-suite`
alias(libs.plugins.testSets)
alias(libs.plugins.dokka)
}

kotlin {
explicitApi()
jvmToolchain(libs.versions.java.get().toInt())
}

testing {
suites {
val test by getting(JvmTestSuite::class) {
useJUnitJupiter()
}

val integrationTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project())
}

targets {
all {
testTask.configure {
shouldRunAfter(test)
}
}
}
}
}
}

val integrationTestImplementation by configurations.getting {
extendsFrom(configurations.testImplementation.get())
testSets {
create("integrationTest")
}

tasks {
named("check") {
dependsOn(testing.suites.named("integrationTest"))
dependsOn("integrationTest")
}
val javadocJar by existing(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
Expand All @@ -60,4 +37,5 @@ dependencies {
implementation(libs.bundles.kotlin)

testImplementation(libs.bundles.testDeps)
testRuntimeOnly(libs.bundles.testEngines)
}

0 comments on commit 50ada62

Please sign in to comment.