1/**
2 * This file was created using the `create_project.py` script located in the
3 * `<AndroidX root>/development/project-creator` directory.
4 *
5 * Please use that script when creating a new project, rather than copying an existing project and
6 * modifying its settings.
7 */
8import androidx.build.PlatformIdentifier
9import androidx.build.SoftwareType
10import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
11import org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode
12import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkConfig
13
14plugins {
15    id("AndroidXPlugin")
16}
17
18androidXMultiplatform {
19    def xcf = new XCFrameworkConfig(project, "AndroidXDarwinBenchmarks")
20    ios {
21        binaries.framework {
22            baseName = "AndroidXDarwinBenchmarks"
23            // https://youtrack.jetbrains.com/issue/KT-48552
24            embedBitcode = BitcodeEmbeddingMode.DISABLE
25            xcf.add(it)
26        }
27    }
28    // needed for snapshot publishing to trigger component creation
29    jvm()
30    // default platform is not JVM but we need to use it because it is
31    // the only platform built on all machines
32    defaultPlatform(PlatformIdentifier.JVM)
33    sourceSets {
34        darwinMain {
35            dependsOn(commonMain)
36            dependencies {
37                api(libs.kotlinStdlib)
38            }
39        }
40        darwinTest {
41            dependsOn(commonTest)
42            dependencies {
43                implementation(libs.kotlinTest)
44                implementation(libs.kotlinTestAnnotationsCommon)
45            }
46        }
47        iosMain {
48            dependsOn(darwinMain)
49            dependencies {
50                api(project(":benchmark:benchmark-darwin-core"))
51            }
52        }
53        iosArm64Main {
54            dependsOn(iosMain)
55        }
56        iosSimulatorArm64Main {
57            dependsOn(iosMain)
58        }
59        iosX64Main {
60            dependsOn(iosMain)
61        }
62        targets.configureEach { target ->
63            if (target.platformType == KotlinPlatformType.native) {
64                target.compilations["main"].defaultSourceSet {
65                    dependsOn(darwinMain)
66                }
67                target.compilations["test"].defaultSourceSet {
68                    dependsOn(darwinTest)
69                }
70                target.compilations.configureEach {
71                    compilerOptions.options.optIn.add("kotlinx.cinterop.ExperimentalForeignApi")
72                }
73            }
74        }
75    }
76    kotlin.metadata {
77        // KT-63338
78        compilations.matching { it.name == "iosMain" }.configureEach {
79            it.compileTaskProvider.configure {
80                enabled = false
81            }
82        }
83    }
84}
85
86androidx {
87    name = "Benchmarks - Darwin"
88    inceptionYear = "2022"
89    description = "AndroidX Benchmarks - Darwin"
90    type = SoftwareType.SNAPSHOT_ONLY_LIBRARY
91}
92