| /* |
| * Copyright 2020 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| /** |
| * This file was created using the `create_project.py` script located in the |
| * `<AndroidX root>/development/project-creator` directory. |
| * |
| * Please use that script when creating a new project, rather than copying an existing project and |
| * modifying its settings. |
| */ |
| |
| import androidx.build.LibraryType |
| import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType |
| import org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode |
| import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkConfig |
| import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile |
| import org.jetbrains.kotlin.konan.target.Family |
| |
| plugins { |
| id("AndroidXPlugin") |
| id("com.android.library") |
| id("androidx.benchmark") |
| id("androidx.benchmark.darwin") |
| } |
| |
| androidXMultiplatform { |
| android() |
| |
| // XCFrameworkConfig must always be called AndroidXDarwinBenchmarks |
| def xcf = new XCFrameworkConfig(project, "AndroidXDarwinBenchmarks") |
| ios { |
| binaries.framework { |
| // The module name must be AndroidXDarwinBenchmarks for the discovery to work. |
| baseName = "AndroidXDarwinBenchmarks" |
| // https://youtrack.jetbrains.com/issue/KT-48552 |
| embedBitcode = BitcodeEmbeddingMode.DISABLE |
| export(project(":benchmark:benchmark-darwin")) |
| xcf.add(it) |
| } |
| } |
| |
| sourceSets { |
| commonMain { |
| dependencies { |
| implementation(project(":collection:collection")) |
| implementation(libs.kotlinStdlib) |
| } |
| } |
| |
| commonTest { |
| dependencies { |
| implementation(project(":collection:collection")) |
| implementation(libs.kotlinStdlib) |
| } |
| } |
| |
| androidInstrumentedTest { |
| dependsOn(commonTest) |
| dependencies { |
| implementation(projectOrArtifact(":benchmark:benchmark-junit4")) |
| implementation(libs.junit) |
| implementation(libs.testExtJunit) |
| implementation(libs.testCore) |
| implementation(libs.testRunner) |
| implementation(libs.testRules) |
| } |
| } |
| |
| darwinMain { |
| dependsOn(commonMain) |
| dependencies { |
| api(project(":benchmark:benchmark-darwin")) |
| } |
| } |
| |
| targets.configureEach { target -> |
| if (target.platformType == KotlinPlatformType.native) { |
| target.compilations["main"].defaultSourceSet { |
| def konanTargetFamily = target.konanTarget.family |
| if (konanTargetFamily == Family.OSX || konanTargetFamily == Family.IOS) { |
| dependsOn(darwinMain) |
| } else { |
| throw new GradleException("unknown native target ${target}") |
| } |
| } |
| target.compilations.configureEach { |
| compilerOptions.options.optIn.add("kotlinx.cinterop.ExperimentalForeignApi") |
| } |
| } |
| } |
| |
| // Workaround for https://youtrack.jetbrains.com/issue/KT-51763 |
| // Make sure commonization runs before any compilation task. |
| tasks.withType(KotlinNativeCompile).configureEach { |
| it.dependsOn(tasks.named("commonize")) |
| } |
| } |
| } |
| |
| androidx { |
| name = "Collections Benchmarks (Android / iOS)" |
| type = LibraryType.BENCHMARK |
| inceptionYear = "2022" |
| description = "AndroidX Collections Benchmarks (Android / iOS)" |
| } |
| |
| darwinBenchmark { |
| xcodeGenConfigFile = project.rootProject.file( |
| "benchmark/benchmark-darwin-xcode/projects/collection-benchmark-ios.yml" |
| ) |
| xcodeProjectName = "collection-benchmark-ios" |
| scheme = "testapp-ios" |
| // To run locally switch to iOS 17.0 simulators |
| destination = "platform=iOS Simulator,name=iPhone 13,OS=15.2" |
| referenceSha.set(androidx.getReferenceSha()) |
| } |
| |
| android { |
| namespace = "androidx.collection.benchmark" |
| defaultConfig { |
| minSdk = 22 // b/294570164 |
| } |
| } |