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 org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
9import org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode
10import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkConfig
11
12plugins {
13    id("AndroidXPlugin")
14    id("androidx.benchmark.darwin")
15}
16
17androidXMultiplatform {
18    // XCFrameworkConfig must always be called AndroidXDarwinBenchmarks
19    def xcf = new XCFrameworkConfig(project, "AndroidXDarwinBenchmarks")
20    jvm() // add an empty compilation to prevent the warning for unused sourceSets.
21    ios {
22        binaries.framework {
23            // The module name must be AndroidXDarwinBenchmarks for the discovery to work.
24            baseName = "AndroidXDarwinBenchmarks"
25            // https://youtrack.jetbrains.com/issue/KT-48552
26            embedBitcode = BitcodeEmbeddingMode.DISABLE
27            export(project.project(":benchmark:benchmark-darwin"))
28            xcf.add(it)
29        }
30    }
31
32    sourceSets {
33        iosMain {
34            dependsOn(commonMain)
35            dependencies {
36                api(libs.kotlinStdlib)
37                api(project(":benchmark:benchmark-darwin"))
38            }
39        }
40        iosArm64Main {
41            dependsOn(iosMain)
42        }
43        iosSimulatorArm64Main {
44            dependsOn(iosMain)
45        }
46        iosX64Main {
47            dependsOn(iosMain)
48        }
49    }
50
51    targets.configureEach { target ->
52        if (target.platformType == KotlinPlatformType.native) {
53            target.compilations.configureEach {
54                compilerOptions.options.optIn.add("kotlinx.cinterop.ExperimentalForeignApi")
55            }
56        }
57    }
58}
59
60darwinBenchmark {
61    xcodeGenConfigFile = new File(rootDir,
62            "benchmark/benchmark-darwin-xcode/projects/benchmark-darwin-samples-xcode.yml")
63    xcodeProjectName = "benchmark-darwin-samples-xcode"
64    scheme = "testapp-ios"
65    // To run locally switch to iOS 17.0 simulators
66    destination = "platform=iOS Simulator,name=iPhone 13,OS=15.2"
67    referenceSha.set(androidx.getReferenceSha())
68}
69
70androidx {
71    name = "Benchmarks - Darwin Samples"
72    inceptionYear = "2022"
73    description = "AndroidX Benchmarks - Darwin Samples"
74}
75