| /* |
| * Copyright (C) 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. |
| */ |
| |
| |
| import androidx.build.BundleInsideHelper |
| import androidx.build.KmpPlatformsKt |
| import androidx.build.LibraryType |
| import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType |
| import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget |
| |
| plugins { |
| id("AndroidXPlugin") |
| alias(libs.plugins.kotlinSerialization) |
| } |
| |
| def enableNative = KmpPlatformsKt.enableNative(project) |
| |
| androidXMultiplatform { |
| jvm() { |
| withJava() |
| } |
| mac() |
| linux() |
| ios() |
| |
| sourceSets { |
| all { |
| languageSettings.optIn("kotlin.RequiresOptIn") |
| } |
| |
| commonMain { |
| dependencies { |
| api(libs.kotlinStdlib) |
| api(libs.okio) |
| api(project(":datastore:datastore-core")) |
| api(project(":datastore:datastore-core-okio")) |
| } |
| } |
| commonTest { |
| dependencies { |
| implementation(libs.kotlinTestCommon) |
| implementation(libs.kotlinTestAnnotationsCommon) |
| implementation(libs.kotlinCoroutinesTest) |
| implementation(project(":datastore:datastore-core")) |
| implementation(project(":internal-testutils-kmp")) |
| implementation(project(":internal-testutils-datastore")) |
| } |
| } |
| jvmMain { |
| dependsOn(commonMain) |
| } |
| jvmTest { |
| dependsOn(commonTest) |
| dependencies { |
| implementation(libs.junit) |
| implementation(libs.kotlinTest) |
| implementation(project(":internal-testutils-datastore")) |
| implementation(project(":internal-testutils-kmp")) |
| } |
| } |
| if (enableNative) { |
| nativeMain { |
| dependsOn(commonMain) |
| dependencies { |
| implementation(libs.kotlinSerializationCore) |
| implementation(libs.kotlinSerializationProtobuf) |
| } |
| } |
| |
| nativeTest { |
| dependsOn(commonTest) |
| dependencies { |
| implementation(libs.kotlinTest) |
| implementation(project(":internal-testutils-datastore")) |
| implementation(project(":internal-testutils-kmp")) |
| } |
| } |
| } |
| |
| targets.withType(KotlinNativeTarget).configureEach { |
| binaries.all { |
| binaryOptions["memoryModel"] = "experimental" |
| } |
| } |
| targets.all { target -> |
| if (target.platformType == KotlinPlatformType.native) { |
| target.compilations["main"].defaultSourceSet { |
| dependsOn(nativeMain) |
| } |
| target.compilations["test"].defaultSourceSet { |
| dependsOn(nativeTest) |
| } |
| } |
| } |
| } |
| } |
| |
| BundleInsideHelper.forInsideJarKmp( |
| project, |
| /* from = */ "com.google.protobuf", |
| /* to = */ "androidx.datastore.preferences.protobuf" |
| ) |
| |
| dependencies { |
| bundleInside(project( |
| path: ":datastore:datastore-preferences-proto", |
| configuration: "export" |
| )) |
| } |
| |
| androidx { |
| name = "Android Preferences DataStore Core" |
| type = LibraryType.PUBLISHED_LIBRARY |
| inceptionYear = "2020" |
| description = "Android Preferences DataStore without the Android Dependencies" |
| legacyDisableKotlinStrictApiMode = true |
| } |