Skip to content
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

Add support for composite builds #19

Merged
merged 5 commits into from
Mar 6, 2023

Conversation

05nelsonm
Copy link
Owner

@05nelsonm 05nelsonm commented Mar 6, 2023

Closes #18

Now projects who utilize composite builds can create an extension function in their build-logic/build-support module such that they can configure containers multiple times

// :build-logic
// shared.gradle.kts
plugins {
    id("io.matthewnelson.kmp.configuration")
}
// :build-logic
// KmpConfigurationExtensionExt.kt
fun KmpConfigurationExtension.configureShared(
    action: Action<KmpConfigurationContainerDsl>
) {
    configure {
        // configuration for all projects that apply the "shared" plugin generated by shared.gradle.kts
        jvm {
            target { withJava() }

            kotlinJvmTarget = JavaVersion.VERSION_1_8
            compileSourceCompatibility = JavaVersion.VERSION_1_8
            compileTargetCompatibility = JavaVersion.VERSION_1_8
        }

        js()
//        wasm()
        wasmNativeAll()

        androidNativeAll()

        iosAll()
        macosAll()
        tvosAll()
        watchosAll()

        linuxAll()
        mingwAll()

        common {
            sourceSetTest {
                dependencies {
                    implementation(kotlin("test"))
                }
            }
        }

        action.execute(this)
    }
}
// :my-project
// build.gradle.kts
plugins {
    id("shared")
}

kmpConfiguration {
    configureShared {
        common {
            sourceSetMain {
                dependencies {
                    implementation(project(":my-other-project"))
                }
            }
        }
    }
}

@05nelsonm 05nelsonm self-assigned this Mar 6, 2023
Copy link
Owner Author

@05nelsonm 05nelsonm left a comment

Choose a reason for hiding this comment

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

🔥

@05nelsonm 05nelsonm merged commit 7a878f4 into master Mar 6, 2023
@05nelsonm 05nelsonm deleted the issue/18-composite-build-support branch March 6, 2023 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support composite builds
1 participant