Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions build-plugins/build-support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ dependencies {
runtimeOnly(project(":ktlint-rules"))
implementation(libs.nexusPublishPlugin)
compileOnly(gradleApi())
implementation("aws.sdk.kotlin:s3:1.1.+")
implementation("aws.sdk.kotlin:cloudwatch:1.1.+")
implementation("aws.sdk.kotlin:s3:+")
implementation("aws.sdk.kotlin:cloudwatch:+")
testImplementation(libs.junit.jupiter)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package aws.sdk.kotlin.gradle.kmp

import aws.sdk.kotlin.gradle.util.prop
import org.gradle.api.Project
import org.gradle.api.tasks.testing.Test
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
Expand Down Expand Up @@ -45,7 +46,7 @@ val Project.hasWindows: Boolean get() = hasNative || files.any { it.name == "win
* Test if a project follows the convention and needs configured for KMP (used in handful of spots where we have a
* subproject that is just a container for other projects but isn't a KMP project itself).
*/
public val Project.needsKmpConfigured: Boolean get() = hasCommon || hasJvm || hasNative || hasJs
public val Project.needsKmpConfigured: Boolean get() = hasCommon || hasJvm || hasNative || hasJs || hasJvmAndNative || hasDesktop || hasLinux || hasApple || hasWindows

@OptIn(ExperimentalKotlinGradlePluginApi::class)
fun Project.configureKmpTargets() {
Expand All @@ -64,7 +65,8 @@ fun Project.configureKmpTargets() {
return@withPlugin
}

// configure the target hierarchy, this does not actually enable the targets, just their relationships
// extend the default KMP target hierarchy
// this does not actually enable the targets, just their relationships
// see https://kotlinlang.org/docs/multiplatform-hierarchy.html#see-the-full-hierarchy-template
kmpExt.applyDefaultHierarchyTemplate {
if (hasJvmAndNative) {
Expand Down Expand Up @@ -95,24 +97,28 @@ fun Project.configureKmpTargets() {
}
}

// enable targets
// enable the targets
configureCommon()

if (hasJvm && JVM_ENABLED) {
configureJvm()
}

// FIXME Configure JS
// FIXME Configure Apple
// FIXME Configure Windows

withIf(hasLinux && NATIVE_ENABLED, kmpExt) {
configureLinux()
}

withIf(hasDesktop && NATIVE_ENABLED, kmpExt) {
configureLinux()
// FIXME Configure desktop
if (NATIVE_ENABLED) {
if (hasApple) {
kmpExt.apply { configureApple() }
}
if (hasWindows) {
kmpExt.apply { configureWindows() }
}
if (hasLinux) {
kmpExt.apply { configureLinux() }
}
if (hasDesktop) {
kmpExt.apply { configureWindows() }
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: hasDesktop && NATIVE_ENABLED resulting in configureLinux() before was wrong/temporary?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah good catch. It should be configuring all the desktop platforms (linux, macos, windows)

}
}

kmpExt.configureSourceSetsConvention()
Expand Down Expand Up @@ -155,14 +161,25 @@ fun Project.configureJvm() {

fun Project.configureLinux() {
kotlin {
linuxX64 {
// FIXME enable tests once the target is fully implemented
tasks.named("linuxX64Test") {
enabled = false
}
}
// FIXME - Okio missing arm64 target support
// linuxArm64()
linuxX64()
linuxArm64() // FIXME - Okio missing arm64 target support
}
}

fun Project.configureApple() {
kotlin {
macosX64()
macosArm64()
iosSimulatorArm64()
iosArm64()
iosX64()
}
}

fun Project.configureWindows() {
kotlin {
// FIXME Set up Docker files and CMake tasks for Windows
// mingwX64()
}
}

Expand All @@ -179,8 +196,5 @@ fun KotlinMultiplatformExtension.configureSourceSetsConvention() {
}
}

internal inline fun <T> withIf(condition: Boolean, receiver: T, block: T.() -> Unit) {
if (condition) {
receiver.block()
}
}
val Project.JVM_ENABLED get() = prop("aws.kotlin.jvm")?.let { it == "true" } ?: true
val Project.NATIVE_ENABLED get() = prop("aws.kotlin.native")?.let { it == "true" } ?: true

This file was deleted.

Loading