Skip to content

Commit

Permalink
Use catalogs and multi-jvm testing
Browse files Browse the repository at this point in the history
  • Loading branch information
DanySK committed Oct 8, 2021
1 parent ec8cce5 commit 3d51fa1
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 246 deletions.
26 changes: 0 additions & 26 deletions .github/build-steps/build.sh

This file was deleted.

21 changes: 0 additions & 21 deletions .github/build-steps/check.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .github/build-steps/compatibility_check.sh

This file was deleted.

25 changes: 0 additions & 25 deletions .github/build-steps/deploy.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .github/scripts/deploy

This file was deleted.

3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "config/detekt"]
path = config/detekt
url = [email protected]:DanySK/detekt-configuration.git
69 changes: 37 additions & 32 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
`java-gradle-plugin`
id("org.danilopianini.git-sensitive-semantic-versioning")
kotlin("jvm")
id("com.gradle.plugin-publish")
id("org.danilopianini.publish-on-central")
id("org.jetbrains.dokka")
id("kotlin-qa")
alias(libs.plugins.dokka)
alias(libs.plugins.gitSemVer)
alias(libs.plugins.gradlePluginPublish)
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.qa)
alias(libs.plugins.publishOnCentral)
alias(libs.plugins.multiJvmTesting)
alias(libs.plugins.taskTree)
}

gitSemVer {
Expand All @@ -26,12 +29,30 @@ repositories {
mavenCentral()
}

multiJvm {
maximumSupportedJvmVersion.set(latestJavaSupportedByGradle)
}

/*
* By default, Gradle does not include all the plugin classpath into the testing classpath.
* This task creates a descriptor of the runtime classpath, to be injected (manually) when running tests.
*/
val createClasspathManifest = tasks.register("createClasspathManifest") {
val outputDir = file("$buildDir/$name")
inputs.files(sourceSets.main.get().runtimeClasspath)
outputs.dir(outputDir)
doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").writeText(sourceSets.main.get().runtimeClasspath.joinToString("\n"))
}
}

dependencies {
implementation(kotlin("stdlib"))
implementation(gradleApi())
testImplementation(gradleTestKit())
testImplementation("io.kotest:kotest-runner-junit5:_")
testImplementation("io.kotest:kotest-assertions-core-jvm:_")
testImplementation(libs.bundles.kotlin.testing)
testRuntimeOnly(files(createClasspathManifest))
}

tasks.withType<KotlinCompile> {
Expand All @@ -40,33 +61,17 @@ tasks.withType<KotlinCompile> {
}
}

tasks {
"test"(Test::class) {
useJUnitPlatform()
testLogging.showStandardStreams = true
testLogging {
showCauses = true
showStackTraces = true
showStandardStreams = true
events(*TestLogEvent.values())
}
}
register("createClasspathManifest") {
val outputDir = file("$buildDir/$name")
inputs.files(sourceSets.main.get().runtimeClasspath)
outputs.dir(outputDir)
doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").writeText(sourceSets.main.get().runtimeClasspath.joinToString("\n"))
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
showStandardStreams = true
showCauses = true
showStackTraces = true
events(*org.gradle.api.tasks.testing.logging.TestLogEvent.values())
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}

// Add the classpath file to the test runtime classpath
dependencies {
testRuntimeOnly(files(tasks["createClasspathManifest"]))
}

pluginBundle {
website = websiteUrl
vcsUrl = websiteUrl
Expand Down
29 changes: 0 additions & 29 deletions buildSrc/build.gradle.kts

This file was deleted.

4 changes: 0 additions & 4 deletions buildSrc/kotlin-qa-dependencies

This file was deleted.

9 changes: 0 additions & 9 deletions buildSrc/settings.gradle.kts

This file was deleted.

42 changes: 0 additions & 42 deletions buildSrc/src/main/kotlin/kotlin-qa.gradle.kts

This file was deleted.

1 change: 0 additions & 1 deletion config/detekt
Submodule detekt deleted from f53c66
25 changes: 25 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[versions]
konf = "1.1.2"
kotest = "4.6.3"
kotlin = "1.5.31"
mockito = "4.0.0"

[libraries]
classgraph = "io.github.classgraph:classgraph:4.8.125"
konf-yaml = { module = "com.uchuhimo:konf-yaml", version.ref = "konf" }
kotest-junit5-jvm = { module = "io.kotest:kotest-runner-junit5-jvm", version.ref = "kotest" }
kotest-assertions-core-jvm = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "kotest" }
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }

[bundles]
kotlin-testing = [ "kotest-junit5-jvm", "kotest-assertions-core-jvm", "mockito-core" ]

[plugins]
dokka = { id = "org.jetbrains.dokka", version.ref = "kotlin" }
gitSemVer = { id = "org.danilopianini.git-sensitive-semantic-versioning", version = "0.3.0" }
gradlePluginPublish = { id = "com.gradle.plugin-publish", version = "0.15.0" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-qa = { id = "org.danilopianini.gradle-kotlin-qa", version = "0.2.1" }
multiJvmTesting = { id = "org.danilopianini.multi-jvm-test-plugin", version = "0.1.0" }
publishOnCentral = { id = "org.danilopianini.publish-on-central", version = "0.6.1" }
taskTree = { id = "com.dorongold.task-tree", version = "2.1.0" }
13 changes: 9 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
plugins {
id("de.fayard.refreshVersions") version "0.10.1"
id("com.gradle.enterprise") version "3.7"
}
refreshVersions {
featureFlags {
enable(de.fayard.refreshVersions.core.FeatureFlag.LIBS)

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishOnFailure()
}
}

rootProject.name = "publish-on-central"
enableFeaturePreview("VERSION_CATALOGS")
32 changes: 0 additions & 32 deletions versions.properties

This file was deleted.

0 comments on commit 3d51fa1

Please sign in to comment.