This repository has been archived by the owner on Feb 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding version catalogs, gradle convention plugin (#206)
* Adding version catalogs, gradle convention plugin * Solve build issues * Apply suggestions from code review Co-authored-by: Imran Malic Settuba <[email protected]> * Resolve kotest version from version catalog in convention plugin * Revert "Apply suggestions from code review" This reverts commit d1acee6. * Fix build Co-authored-by: Imran Malic Settuba <[email protected]>
- Loading branch information
Showing
13 changed files
with
285 additions
and
574 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +0,0 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
plugins { | ||
java | ||
kotlin("multiplatform").version("1.6.20") apply false | ||
`java-library` | ||
id("maven-publish") | ||
signing | ||
id("org.jetbrains.dokka") version "1.6.21" | ||
id("io.kotest.multiplatform") version "5.3.0" | ||
id("ru.vyarus.animalsniffer") version "1.5.4" | ||
} | ||
|
||
allprojects { | ||
group = "io.kotest.extensions" | ||
version = Ci.version | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
|
||
apply(plugin = "ru.vyarus.animalsniffer") | ||
apply(plugin = "java") | ||
apply(plugin = "java-library") | ||
apply(plugin = "io.kotest.multiplatform") | ||
apply(plugin = "maven-publish") | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} | ||
} | ||
|
||
subprojects { | ||
apply(plugin = "org.jetbrains.kotlin.multiplatform") | ||
} | ||
|
||
val publications: PublicationContainer = (extensions.getByName("publishing") as PublishingExtension).publications | ||
|
||
signing { | ||
useGpgCmd() | ||
if (Ci.isRelease) | ||
sign(publications) | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import org.gradle.kotlin.dsl.`kotlin-dsl` | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
gradlePluginPortal() | ||
} | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
dependencies { | ||
implementation(libs.kotlin.gradle.plugin) | ||
implementation(libs.animalsniffer) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
import org.gradle.api.tasks.testing.Test | ||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
import org.gradle.kotlin.dsl.all | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.gradle.kotlin.dsl.named | ||
|
||
plugins { | ||
`java-library` | ||
kotlin("multiplatform") | ||
id("ru.vyarus.animalsniffer") | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
gradlePluginPortal() | ||
} | ||
|
||
group = "io.kotest.extensions" | ||
version = Ci.version | ||
|
||
kotlin { | ||
explicitApi() | ||
|
||
targets { | ||
metadata() | ||
|
||
jvm { | ||
compilations.all { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} | ||
} | ||
|
||
js(IR) { | ||
browser() | ||
nodejs() | ||
} | ||
|
||
linuxX64() | ||
|
||
mingwX64() | ||
|
||
iosArm32() | ||
iosArm64() | ||
iosSimulatorArm64() | ||
iosX64() | ||
macosArm64() | ||
macosX64() | ||
tvosArm64() | ||
tvosSimulatorArm64() | ||
tvosX64() | ||
watchosArm32() | ||
watchosArm64() | ||
watchosSimulatorArm64() | ||
watchosX64() | ||
watchosX86() | ||
} | ||
|
||
sourceSets { | ||
val commonMain by getting | ||
val commonTest by getting { | ||
dependsOn(commonMain) | ||
} | ||
|
||
val jvmMain by getting { | ||
dependsOn(commonMain) | ||
} | ||
|
||
val kotestVersion = resolveVersion("kotest") | ||
|
||
val jvmTest by getting { | ||
dependsOn(commonTest) | ||
dependsOn(jvmMain) | ||
dependencies { | ||
implementation("io.kotest:kotest-runner-junit5:$kotestVersion") | ||
} | ||
} | ||
|
||
val jsMain by getting { | ||
dependsOn(commonMain) | ||
} | ||
|
||
val jsTest by getting { | ||
dependsOn(commonTest) | ||
dependsOn(jsMain) | ||
} | ||
|
||
val mingwX64Main by getting | ||
val linuxX64Main by getting | ||
val iosArm32Main by getting | ||
val iosArm64Main by getting | ||
val iosSimulatorArm64Main by getting | ||
val iosX64Main by getting | ||
val macosArm64Main by getting | ||
val macosX64Main by getting | ||
val tvosArm64Main by getting | ||
val tvosSimulatorArm64Main by getting | ||
val tvosX64Main by getting | ||
val watchosArm32Main by getting | ||
val watchosArm64Main by getting | ||
val watchosSimulatorArm64Main by getting | ||
val watchosX64Main by getting | ||
val watchosX86Main by getting | ||
|
||
val nativeMain by creating { | ||
dependsOn(commonMain) | ||
mingwX64Main.dependsOn(this) | ||
linuxX64Main.dependsOn(this) | ||
iosArm32Main.dependsOn(this) | ||
iosArm64Main.dependsOn(this) | ||
iosSimulatorArm64Main.dependsOn(this) | ||
iosX64Main.dependsOn(this) | ||
macosArm64Main.dependsOn(this) | ||
macosX64Main.dependsOn(this) | ||
tvosArm64Main.dependsOn(this) | ||
tvosSimulatorArm64Main.dependsOn(this) | ||
tvosX64Main.dependsOn(this) | ||
watchosArm32Main.dependsOn(this) | ||
watchosArm64Main.dependsOn(this) | ||
watchosSimulatorArm64Main.dependsOn(this) | ||
watchosX64Main.dependsOn(this) | ||
watchosX86Main.dependsOn(this) | ||
} | ||
|
||
val mingwX64Test by getting | ||
val linuxX64Test by getting | ||
val iosArm32Test by getting | ||
val iosArm64Test by getting | ||
val iosSimulatorArm64Test by getting | ||
val iosX64Test by getting | ||
val macosArm64Test by getting | ||
val macosX64Test by getting | ||
val tvosArm64Test by getting | ||
val tvosSimulatorArm64Test by getting | ||
val tvosX64Test by getting | ||
val watchosArm32Test by getting | ||
val watchosArm64Test by getting | ||
val watchosSimulatorArm64Test by getting | ||
val watchosX64Test by getting | ||
val watchosX86Test by getting | ||
|
||
create("nativeTest") { | ||
dependsOn(nativeMain) | ||
dependsOn(commonTest) | ||
mingwX64Test.dependsOn(this) | ||
linuxX64Test.dependsOn(this) | ||
iosArm32Test.dependsOn(this) | ||
iosArm64Test.dependsOn(this) | ||
iosSimulatorArm64Test.dependsOn(this) | ||
iosX64Test.dependsOn(this) | ||
macosArm64Test.dependsOn(this) | ||
macosX64Test.dependsOn(this) | ||
tvosArm64Test.dependsOn(this) | ||
tvosSimulatorArm64Test.dependsOn(this) | ||
tvosX64Test.dependsOn(this) | ||
watchosArm32Test.dependsOn(this) | ||
watchosArm64Test.dependsOn(this) | ||
watchosSimulatorArm64Test.dependsOn(this) | ||
watchosX64Test.dependsOn(this) | ||
watchosX86Test.dependsOn(this) | ||
} | ||
|
||
all { | ||
languageSettings.optIn("kotlin.RequiresOptIn") | ||
} | ||
} | ||
} | ||
|
||
animalsniffer { | ||
ignore = listOf("java.lang.*") | ||
} | ||
|
||
tasks.named<Test>("jvmTest") { | ||
useJUnitPlatform() | ||
maxParallelForks = Runtime.getRuntime().availableProcessors() | ||
testLogging { | ||
showExceptions = true | ||
showStandardStreams = true | ||
events = setOf( | ||
TestLogEvent.FAILED, | ||
TestLogEvent.PASSED | ||
) | ||
exceptionFormat = TestExceptionFormat.FULL | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.VersionCatalogsExtension | ||
import org.gradle.kotlin.dsl.getByType | ||
|
||
// Workaround for https://github.com/gradle/gradle/issues/15383 | ||
fun Project.resolveVersion(name: String) = | ||
extensions.getByType<VersionCatalogsExtension>() | ||
.named("libs") | ||
.findVersion(name) | ||
.get().requiredVersion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[versions] | ||
arrow = "1.1.2" | ||
kotlin = "1.6.21" | ||
kotest = "5.3.2" | ||
|
||
[libraries] | ||
kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" } | ||
kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" } | ||
kotest-framework-engine = { module = "io.kotest:kotest-framework-engine", version.ref = "kotest" } | ||
kotest-framework-api = { module = "io.kotest:kotest-framework-api", version.ref = "kotest" } | ||
kotest-property = { module = "io.kotest:kotest-property", version.ref = "kotest" } | ||
|
||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.6.3" } | ||
|
||
arrow-fx-coroutines = { module = "io.arrow-kt:arrow-fx-coroutines", version.ref = "arrow" } | ||
arrow-core = { module = "io.arrow-kt:arrow-core", version.ref = "arrow" } | ||
arrow-optics = { module = "io.arrow-kt:arrow-optics", version.ref = "arrow" } | ||
|
||
# Gradle plugins used in buildSrc | ||
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } | ||
animalsniffer = { module = "ru.vyarus:gradle-animalsniffer-plugin", version = "1.5.4" } | ||
|
||
[plugins] |
Oops, something went wrong.