|
| 1 | +/* |
| 2 | + * Copyright 2026 The Android Open Source Project |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import androidx.build.AndroidXComposePlugin |
| 18 | +import org.jetbrains.kotlin.gradle.dsl.KotlinNativeBinaryContainer |
| 19 | +import org.jetbrains.androidx.build.JetBrainsAndroidXPlugin |
| 20 | + |
| 21 | +plugins { |
| 22 | + id("AndroidXPlugin") |
| 23 | + id("AndroidXComposePlugin") |
| 24 | + id("kotlin-multiplatform") |
| 25 | + id("JetBrainsAndroidXPlugin") |
| 26 | +} |
| 27 | + |
| 28 | +AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project) |
| 29 | +JetBrainsAndroidXPlugin.applyAndConfigure(project) |
| 30 | + |
| 31 | +repositories { |
| 32 | + mavenLocal() |
| 33 | +} |
| 34 | + |
| 35 | +fun KotlinNativeBinaryContainer.configureFramework() { |
| 36 | + framework { |
| 37 | + baseName = "shared" |
| 38 | + freeCompilerArgs += listOf( |
| 39 | + "-linker-option", "-framework", "-linker-option", "Metal", |
| 40 | + "-linker-option", "-framework", "-linker-option", "CoreText", |
| 41 | + "-linker-option", "-framework", "-linker-option", "CoreGraphics" |
| 42 | + ) |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +kotlin { |
| 47 | + iosArm64 { |
| 48 | + binaries { |
| 49 | + configureFramework() |
| 50 | + } |
| 51 | + } |
| 52 | + iosSimulatorArm64 { |
| 53 | + binaries { |
| 54 | + configureFramework() |
| 55 | + } |
| 56 | + } |
| 57 | + sourceSets { |
| 58 | + val commonMain by getting { |
| 59 | + dependencies { |
| 60 | + implementation(project(":compose:foundation:foundation")) |
| 61 | + implementation(project(":compose:foundation:foundation-layout")) |
| 62 | + implementation(project(":compose:material:material")) |
| 63 | + implementation(project(":compose:mpp")) |
| 64 | + implementation(project(":compose:mpp:demo")) |
| 65 | + implementation(project(":compose:runtime:runtime")) |
| 66 | + implementation(project(":compose:ui:ui")) |
| 67 | + implementation(project(":compose:ui:ui-graphics")) |
| 68 | + implementation(project(":compose:ui:ui-text")) |
| 69 | + implementation(libs.kotlinCoroutinesCore) |
| 70 | + } |
| 71 | + } |
| 72 | + val skikoMain by creating { |
| 73 | + dependsOn(commonMain) |
| 74 | + dependencies { |
| 75 | + implementation(libs.skikoCommon) |
| 76 | + } |
| 77 | + } |
| 78 | + val nativeMain by creating { dependsOn(skikoMain) } |
| 79 | + val darwinMain by creating { dependsOn(nativeMain) } |
| 80 | + val iosMain by creating { |
| 81 | + dependsOn(darwinMain) |
| 82 | + } |
| 83 | + val iosArm64Main by getting { dependsOn(iosMain) } |
| 84 | + val iosSimulatorArm64Main by getting { dependsOn(iosMain) } |
| 85 | + } |
| 86 | +} |
0 commit comments