-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: support multiple native targets (#5)
- Loading branch information
Showing
31 changed files
with
207 additions
and
156 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -18,4 +18,7 @@ coverage-error.log | |
.DS_Store | ||
|
||
# Java | ||
*.hprof | ||
*.hprof | ||
|
||
# kmp | ||
kotlin-js-store |
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,22 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
`java-gradle-plugin` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compileOnly(kotlin("gradle-plugin")) | ||
compileOnly(kotlin("gradle-plugin-api")) | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
create("build-support") { | ||
id = "build-support" | ||
implementationClass = "BuildSupport" | ||
} | ||
} | ||
} |
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 @@ | ||
// empty. |
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,8 @@ | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
|
||
class BuildSupport : Plugin<Project> { | ||
override fun apply(project: Project) { | ||
// Do nothing. | ||
} | ||
} |
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,21 @@ | ||
import org.gradle.kotlin.dsl.creating | ||
import org.gradle.kotlin.dsl.getValue | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget | ||
|
||
fun KotlinMultiplatformExtension.native() { | ||
val targets = mutableListOf<KotlinNativeTarget>().apply { | ||
add(linuxX64()) | ||
add(macosX64()) | ||
add(macosArm64()) | ||
add(mingwX64()) | ||
} | ||
sourceSets.apply { | ||
val nativeMain by creating { dependsOn(getByName("commonMain")) } | ||
val nativeTest by creating { dependsOn(getByName("commonTest")) } | ||
targets.forEach { target -> | ||
getByName("${target.name}Main").dependsOn(nativeMain) | ||
getByName("${target.name}Test").dependsOn(nativeTest) | ||
} | ||
} | ||
} |
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,19 +1,36 @@ | ||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent.* | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
val kotlinVersion = "1.5.10" | ||
val kotlinVersion = "1.6.10" | ||
classpath(kotlin("gradle-plugin", version = kotlinVersion)) | ||
classpath(kotlin("serialization", version = kotlinVersion)) | ||
classpath("com.vanniktech:gradle-maven-publish-plugin:0.15.1") | ||
classpath("org.jetbrains.kotlinx:binary-compatibility-validator:0.6.0") | ||
classpath("com.vanniktech:gradle-maven-publish-plugin:0.18.0") | ||
classpath("org.jetbrains.kotlinx:binary-compatibility-validator:0.8.0") | ||
} | ||
} | ||
|
||
subprojects { | ||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
} | ||
val javadoc by tasks.creating(Javadoc::class) | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_1_8.toString() | ||
} | ||
} | ||
|
||
tasks.withType<Test> { | ||
testLogging { | ||
events(STARTED, PASSED, SKIPPED, FAILED) | ||
exceptionFormat = TestExceptionFormat.FULL | ||
showStandardStreams = false | ||
} | ||
} | ||
} |
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
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,26 +1,29 @@ | ||
[versions] | ||
coroutines = "1.5.0-native-mt" | ||
serialization = "1.2.1" | ||
ktor = "1.6.0" | ||
okio = "3.0.0-alpha.6" | ||
coroutines = "1.6.0-native-mt" | ||
serialization = "1.3.1" | ||
ktor = "2.0.0-beta-1" | ||
okio = "3.0.0" | ||
logback = "1.2.3" | ||
|
||
[libraries] | ||
# Coroutines | ||
coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" } | ||
coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" } | ||
# Serialization | ||
serialization-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-core", version.ref = "serialization" } | ||
serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" } | ||
# Ktor | ||
ktor-client-json = { group = "io.ktor", name = "ktor-client-json", version.ref = "ktor" } | ||
ktor-client-logging = { group = "io.ktor", name = "ktor-client-logging", version.ref = "ktor" } | ||
ktor-client-serialization = { group = "io.ktor", name = "ktor-client-serialization", version.ref = "ktor" } | ||
ktor-client-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor" } | ||
ktor-client-curl = { group = "io.ktor", name = "ktor-client-curl", version.ref = "ktor" } | ||
ktor-client-apache = { group = "io.ktor", name = "ktor-client-apache", version.ref = "ktor" } | ||
ktor-client-auth = { group = "io.ktor", name = "ktor-client-auth", version.ref = "ktor" } | ||
ktor-client-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" } | ||
ktor-client-serialization-kotlinx = { group = "io.ktor", name = "ktor-serialization-kotlinx", version.ref = "ktor" } | ||
# Okio | ||
okio-multiplatform = { group = "com.squareup.okio", name = "okio-multiplatform", version.ref = "okio" } | ||
okio-nodefilesystem = { group = "com.squareup.okio", name = "okio-nodefilesystem-multiplatform", version.ref = "okio" } | ||
okio-fakefilesystem = { group = "com.squareup.okio", name = "okio-fakefilesystem-multiplatform", version.ref = "okio" } | ||
okio = { group = "com.squareup.okio", name = "okio", version.ref = "okio" } | ||
okio-nodefilesystem = { group = "com.squareup.okio", name = "okio-nodefilesystem", version.ref = "okio" } | ||
okio-fakefilesystem = { group = "com.squareup.okio", name = "okio-fakefilesystem", version.ref = "okio" } | ||
# Logback | ||
logback-classic = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" } |
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,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
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
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
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
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
Oops, something went wrong.