Skip to content

Update build config, and dependencies #71

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

Merged
merged 5 commits into from
May 2, 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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
gradle-check:
strategy:
matrix:
os: [ ubuntu-latest, macos-11, windows-latest ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
uses: ./.github/workflows/gradle_task.yml
with:
Expand Down
9 changes: 0 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,8 @@ gitVersioning.apply {
rev { version = "\${commit}" }
}


tasks.wrapper {
gradleVersion = "7.6"
distributionType = Wrapper.DistributionType.BIN
}


idea {
module {
isDownloadSources = true
isDownloadJavadoc = true
excludeGeneratedGradleDsl(layout)
excludeDirs = excludeDirs + layout.files(
".idea",
Expand Down
23 changes: 0 additions & 23 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`kotlin-dsl`
}


dependencies {
implementation(platform(libs.kotlin.bom))

Expand All @@ -21,22 +18,6 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-html:0.8.0")
}


tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = libs.versions.jvmTarget.get()
apiVersion = libs.versions.kotlinTarget.get()
languageVersion = libs.versions.kotlinTarget.get()
}

kotlinOptions.freeCompilerArgs += listOf(
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlin.ExperimentalStdlibApi",
"-opt-in=kotlin.time.ExperimentalTime",
)
}


kotlin {
jvmToolchain {
languageVersion.set(
Expand All @@ -46,7 +27,3 @@ kotlin {
)
}
}

kotlinDslPluginOptions {
jvmTarget.set(libs.versions.jvmTarget)
}
60 changes: 0 additions & 60 deletions buildSrc/repositories.settings.gradle.kts

This file was deleted.

13 changes: 11 additions & 2 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
rootProject.name = "buildSrc"

apply(from = "./repositories.settings.gradle.kts")
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
@Suppress("UnstableApiUsage")
repositories {
mavenCentral()
gradlePluginPortal()
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
Expand Down
23 changes: 0 additions & 23 deletions buildSrc/src/main/kotlin/buildsrc/config/kmm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,3 @@ fun Project.relocateKotlinJsStore() {
}
}
}


fun KotlinMultiplatformExtension.currentHostTarget(
targetName: String = "native",
configure: KotlinNativeTargetWithHostTests.() -> Unit,
): KotlinNativeTargetWithHostTests {
val hostOs = System.getProperty("os.name")
val hostTarget = when {
hostOs == "Mac OS X" -> macosX64(targetName)
hostOs == "Linux" -> linuxX64(targetName)
hostOs.startsWith("Windows") -> mingwX64(targetName)
else -> throw GradleException("Preset for host OS '$hostOs' is undefined")
}

println("Current host target ${hostTarget.targetName}/${hostTarget.preset?.name}")
hostTarget.configure()
return hostTarget
}


fun KotlinMultiplatformExtension.publicationsFromMainHost(): List<String> {
return listOf(jvm(), js()).map { it.name } + "kotlinMultiplatform"
}
21 changes: 0 additions & 21 deletions buildSrc/src/main/kotlin/buildsrc/config/publishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,3 @@ fun MavenPublication.createKxsTsGenPom(): Unit = pom {
url.set("https://github.com/adamko-dev/kotlinx-serialization-typescript-generator")
}
}


// hacks because IntelliJ still doesn't properly load DSL accessors for buildSrc


/** Configure [PublishingExtension] */
fun Project.publishing(configure: PublishingExtension.() -> Unit): Unit =
extensions.configure(configure)


val Project.publishing: PublishingExtension
get() = extensions.getByType<PublishingExtension>()


/** Configure [SigningExtension] */
fun Project.signing(configure: SigningExtension.() -> Unit): Unit =
extensions.configure(configure)


val Project.signing: SigningExtension
get() = extensions.getByType<SigningExtension>()
16 changes: 12 additions & 4 deletions buildSrc/src/main/kotlin/buildsrc/convention/kotlin-mpp.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@ plugins {
relocateKotlinJsStore()


//kotlin {
extensions.configure<KotlinMultiplatformExtension> {
kotlin {
js(IR) {
browser()
nodejs()
}

jvm {
withJava()
}

targets.configureEach {
compilations.configureEach {
kotlinOptions {
languageVersion = "1.7"
apiVersion = "1.7"
languageVersion = "1.8"
apiVersion = "1.8"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package buildsrc.convention

import buildsrc.config.createKxsTsGenPom
import buildsrc.config.credentialsAction
import buildsrc.config.isKotlinMultiplatformJavaEnabled
import buildsrc.config.publishing
import buildsrc.config.signing
import buildsrc.config.*
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin


Expand Down Expand Up @@ -44,7 +40,7 @@ tasks.withType<AbstractPublishToMaven>().configureEach {
mustRunAfter(tasks.withType<Sign>())

doLast {
logger.lifecycle("[${this.name}] ${project.group}:${project.name}:${project.version}")
logger.lifecycle("[${path}] ${publication?.groupId}:${publication?.artifactId}:${publication?.version}")
}
}

Expand Down Expand Up @@ -133,7 +129,6 @@ fun Project.javadocStubTask(): Jar {
archiveClassifier.set("javadoc")
}


tasks.withType<AbstractPublishToMaven>().all {
dependsOn(javadocJarStub)
}
Expand Down
20 changes: 13 additions & 7 deletions docs/code/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
buildsrc.convention.`kotlin-jvm`
buildsrc.convention.node
Expand All @@ -26,10 +24,16 @@ dependencies {
testFixturesImplementation(libs.kotest.assertionsCore)
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += listOf(
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
kotlin {
sourceSets {
configureEach {
languageSettings {
// optIn("kotlin.ExperimentalStdlibApi")
// optIn("kotlin.time.ExperimentalTime")
// optIn("kotlinx.serialization.ExperimentalSerializationApi")
}
}
}
}

sourceSets.main {
Expand All @@ -52,7 +56,9 @@ knit {
}
}

tasks.withType<Test>().configureEach { dependsOn(tasks.knit) }
tasks.withType<Test>().configureEach {
dependsOn(tasks.knit)
}

tasks.test {
// TSCompile tests are slow, they don't need to run every time
Expand Down
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ org.gradle.caching=true
org.gradle.unsafe.configuration-cache=true
org.gradle.unsafe.configuration-cache-problems=warn

# cache accessors - defaults to 'true' in Gradle 8.0 https://github.com/gradle/gradle/issues/20416
org.gradle.kotlin.dsl.precompiled.accessors.strict=true

kotlin.mpp.stability.nowarn=true

kxstsgen_enableTsCompileTests=false
Loading