Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Support hmpp + upgrade kotlin and dependencies #77

Merged
merged 1 commit into from
Apr 8, 2021
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
38 changes: 24 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMetadataTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

val coroutinesVersion = "1.3.9"
val atomicfuVersion = "0.14.4"
val coroutinesVersion = "1.4.3"
val atomicfuVersion = "0.15.0"

plugins {
kotlin("multiplatform") version "1.4.21"
kotlin("multiplatform") version "1.4.32"
id("org.jetbrains.dokka") version "0.10.0"
id("maven-publish")
id("signing")
Expand Down Expand Up @@ -36,19 +37,28 @@ kotlin {
browser()
nodejs()
}
}

val nativeTargets = mutableListOf<KotlinNativeTarget>()
iosX64()
iosArm64()
iosArm32()
macosX64()
mingwX64()
linuxX64()

iosX64 { nativeTargets.add(this) }
iosArm64 { nativeTargets.add(this) }
iosArm32 { nativeTargets.add(this) }
macosX64 { nativeTargets.add(this) }
mingwX64 { nativeTargets.add(this) }
linuxX64 { nativeTargets.add(this) }
targets.withType<KotlinNativeTarget> {
val main by compilations.getting {
kotlinOptions.freeCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn")
}
}

nativeTargets.forEach {
val main by it.compilations.getting {
kotlinOptions.freeCompilerArgs = listOf("-Xuse-experimental=kotlin.Experimental")
// do this in afterEvaluate, when nativeMain compilation becomes available
afterEvaluate {
targets.withType<KotlinMetadataTarget> {
for (compilation in compilations) {
if (compilation.name == "nativeMain") {
compilation.kotlinOptions.freeCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn")
}
}
}
}
Expand Down Expand Up @@ -103,7 +113,7 @@ kotlin {
val ktlintConfig by configurations.creating

dependencies {
ktlintConfig("com.pinterest:ktlint:0.40.0")
ktlintConfig("com.pinterest:ktlint:0.41.0")
}

val ktlint by tasks.registering(JavaExec::class) {
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
VERSION=0.6.3
VERSION=0.6.4

kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.mpp.enableCompatibilityMetadataVariant=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 0 additions & 12 deletions publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ def getRepositoryPassword() {
return System.getenv('SONATYPE_PASSWORD') ?: ''
}

task emptySourcesJar(type: Jar) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

figured this out after some trial and error with benasher44/uuid

classifier = 'sources'
}

task javadocsJar(type: Jar, dependsOn: dokka) {
classifier = 'javadoc'
from dokka.outputDirectory
Expand Down Expand Up @@ -94,13 +90,6 @@ publishing {
}
}

afterEvaluate {
publications.getByName('kotlinMultiplatform') {
// Source jars are only created for platforms, not the common artifact.
artifact emptySourcesJar
}
}

repositories {
maven {
url isReleaseBuild() ? getReleaseRepositoryUrl() : getSnapshotRepositoryUrl()
Expand All @@ -127,7 +116,6 @@ tasks.register('publishMac') {
dependsOn 'publishIosX64PublicationToMavenRepository'
dependsOn 'publishMacosX64PublicationToMavenRepository'
dependsOn 'publishJvmPublicationToMavenRepository'
dependsOn 'publishMetadataPublicationToMavenRepository'
dependsOn 'publishKotlinMultiplatformPublicationToMavenRepository'
dependsOn 'publishJsPublicationToMavenRepository'
}
Expand Down