1/* 2 * Copyright (C) 2017 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/** 18 * This file was created using the `create_project.py` script located in the 19 * `<AndroidX root>/development/project-creator` directory. 20 * 21 * Please use that script when creating a new project, rather than copying an existing project and 22 * modifying its settings. 23 */ 24 25 26import androidx.build.SoftwareType 27import androidx.build.PlatformIdentifier 28import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType 29import org.jetbrains.kotlin.konan.target.Family 30 31 32plugins { 33 id("AndroidXPlugin") 34} 35 36androidXMultiplatform { 37 jvm() 38 mac() 39 linux() 40 ios() 41 watchos() 42 tvos() 43 androidLibrary { 44 namespace = "androidx.paging.common" 45 withAndroidTestOnDeviceBuilder { 46 it.compilationName = "instrumentedTest" 47 it.defaultSourceSetName = "androidInstrumentedTest" 48 it.sourceSetTreeName = "test" 49 } 50 } 51 52 defaultPlatform(PlatformIdentifier.JVM) 53 54 sourceSets { 55 commonMain { 56 dependencies { 57 api(libs.kotlinStdlib) 58 api(libs.kotlinCoroutinesCore) 59 api("androidx.annotation:annotation:1.9.1") 60 } 61 } 62 63 commonJvmAndroidMain { 64 dependsOn(commonMain) 65 66 dependencies { 67 api("androidx.arch.core:core-common:2.2.0") 68 } 69 } 70 71 jvmMain { 72 dependsOn(commonJvmAndroidMain) 73 } 74 75 androidMain { 76 dependsOn(commonJvmAndroidMain) 77 } 78 79 commonTest { 80 dependencies { 81 implementation(libs.kotlinCoroutinesTest) 82 implementation(libs.kotlinTest) 83 implementation(project(":kruth:kruth")) 84 implementation(project(":internal-testutils-paging")) 85 } 86 } 87 88 commonJvmAndroidTest { 89 dependsOn(commonTest) 90 dependencies { 91 implementation(libs.junit) 92 implementation(libs.mockitoCore) 93 implementation(libs.mockitoKotlin) 94 implementation(project(":internal-testutils-common")) 95 implementation(project(":internal-testutils-ktx")) 96 } 97 } 98 99 jvmTest { 100 dependsOn(commonJvmAndroidTest) 101 } 102 103 androidInstrumentedTest { 104 dependsOn(commonJvmAndroidTest) 105 dependencies { 106 implementation(libs.testRunner) 107 implementation(libs.mockitoAndroid5) 108 } 109 } 110 111 nativeMain { 112 dependsOn(commonMain) 113 dependencies { 114 implementation(libs.atomicFu) 115 } 116 } 117 nativeTest { 118 dependsOn(commonTest) 119 } 120 121 darwinMain { 122 dependsOn(nativeMain) 123 } 124 125 linuxMain { 126 dependsOn(nativeMain) 127 } 128 129 targets.configureEach { target -> 130 if (target.platformType == KotlinPlatformType.native) { 131 target.compilations["main"].defaultSourceSet { 132 def konanTargetFamily = target.konanTarget.family 133 if (konanTargetFamily == Family.OSX || 134 konanTargetFamily == Family.IOS || 135 konanTargetFamily == Family.WATCHOS || 136 konanTargetFamily == Family.TVOS) { 137 dependsOn(darwinMain) 138 } else if (konanTargetFamily == Family.LINUX) { 139 dependsOn(linuxMain) 140 } else { 141 throw new GradleException("unknown native target ${target}") 142 } 143 } 144 target.compilations["test"].defaultSourceSet { 145 dependsOn(nativeTest) 146 } 147 } 148 } 149 } 150} 151 152androidx { 153 name = "Paging-Common" 154 type = SoftwareType.PUBLISHED_LIBRARY 155 inceptionYear = "2017" 156 description = "Android Paging-Common" 157 legacyDisableKotlinStrictApiMode = true 158 samples(project(":paging:paging-samples")) 159} 160