Skip to content

Commit

Permalink
Cleanup project structure and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
e5l committed Jul 7, 2022
1 parent 79a4b0e commit 9272fcf
Show file tree
Hide file tree
Showing 46 changed files with 228 additions and 352 deletions.
108 changes: 59 additions & 49 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,66 +27,76 @@ plugins {
id("org.jetbrains.kotlinx.kover") version "0.5.0"
}

allprojects {
group = "io.ktor"
group = "io.ktor"

repositories {
mavenLocal()
mavenCentral()
maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
repositories {
mavenLocal()
mavenCentral()
maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
}

apply(plugin = "kotlin-multiplatform")
apply(plugin = "kotlinx-atomicfu")

val coroutines_version: String by extra

kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(IR){
browser()
nodejs()
}

apply(plugin = "kotlin-multiplatform")
apply(plugin = "kotlinx-atomicfu")
mingwX64()
linuxX64()
macosX64()

val coroutines_version: String by extra
explicitApi()

kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
sourceSets {
val commonMain by getting {
dependencies {
}
}
js(BOTH) {
browser {
commonWebpackConfig {
cssSupport.enabled = true
}
val commonTest by getting {
dependencies {
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation(kotlin("test"))
}
}
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
val jvmMain by getting
val jvmTest by getting
val jsMain by getting
val jsTest by getting

explicitApi()
val nativeMain by creating
val nativeTest by creating

sourceSets {
val commonMain by getting {
dependencies {
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting
val jvmTest by getting
val jsMain by getting
val jsTest by getting
val nativeMain by getting
val nativeTest by getting
nativeMain.dependsOn(commonMain)
nativeTest.dependsOn(commonTest)
nativeTest.dependsOn(nativeMain)

val mingwX64Main by getting
val mingwX64Test by getting
val linuxX64Main by getting
val linuxX64Test by getting
val macosX64Main by getting
val macosX64Test by getting

listOf(linuxX64Main, mingwX64Main, macosX64Main).forEach {
it.dependsOn(nativeMain)
}

listOf(linuxX64Test, mingwX64Test, macosX64Test).forEach {
it.dependsOn(nativeTest)
}
}
}
Empty file removed core/build.gradle.kts
Empty file.
14 changes: 10 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
kotlin.code.style=official
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
kotlin.js.generate.executable.default=false

kotlin.native.binary.memoryModel=experimental
kotlin.incremental.js=true
kotlin.incremental.multiplatform=true
kotlin.native.ignoreIncorrectDependencies=true
kotlin.native.ignoreDisabledTargets=true
kotlin.mpp.stability.nowarn=true
kotlin.mpp.enableCompatibilityMetadataVariant=true
kotlin.mpp.enableCInteropCommonization=true
kotlin.internal.mpp.hierarchicalStructureByDefault=true

# versions
coroutines_version=1.6.0
atomicfu_version=0.17.0
kotlin_version=1.6.10
kotlin_version=1.7.0
Loading

0 comments on commit 9272fcf

Please sign in to comment.