blob: ba99dbb0acda59503666a6c352277eb42e2df15a [file] [log] [blame]
Chris Craik9fd8e6172017-06-23 14:07:04 -07001/*
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
Tiem Songee0da742024-01-03 14:08:46 -080017/**
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 */
Fred Sladkeyd5f3dd32024-01-23 13:50:51 -050024
Omar Ismail86e66062024-05-03 16:10:50 +010025import androidx.build.LibraryType
Clara Fokfe2df432023-06-23 15:00:32 -070026import androidx.build.PlatformIdentifier
27import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
Yigit Boyar358dfe62023-07-06 09:04:03 -070028import org.jetbrains.kotlin.konan.target.Family
29
Chris Craik9fd8e6172017-06-23 14:07:04 -070030
Aurimas Liutikasf8b708a2017-11-02 16:07:13 -070031plugins {
Aurimas Liutikas2cc275f2019-04-04 19:33:53 +010032 id("AndroidXPlugin")
Clara Fok8ca12ff2023-07-05 17:24:35 -070033 id("com.android.library")
Aurimas Liutikasf8b708a2017-11-02 16:07:13 -070034}
Aurimas Liutikasbb85fac2017-08-24 13:32:28 -070035
Clara Fokfe2df432023-06-23 15:00:32 -070036androidXMultiplatform {
37 jvm()
38 mac()
39 linux()
40 ios()
Clara Fok8ca12ff2023-07-05 17:24:35 -070041 android()
Clara Fokfe2df432023-06-23 15:00:32 -070042
43 defaultPlatform(PlatformIdentifier.JVM)
44
45 sourceSets {
Clara Fokfe2df432023-06-23 15:00:32 -070046 commonMain {
47 dependencies {
48 api(libs.kotlinStdlib)
49 api(libs.kotlinCoroutinesCore)
Prajakta Patilc42933f2024-05-01 23:05:50 +000050 api("androidx.annotation:annotation:1.8.0")
Clara Fokfe2df432023-06-23 15:00:32 -070051 }
52 }
53
Clara Fok5f18ef32023-07-07 19:10:23 -070054 commonJvmAndroidMain {
Clara Fokfe2df432023-06-23 15:00:32 -070055 dependsOn(commonMain)
Clara Fok5f18ef32023-07-07 19:10:23 -070056
Clara Fokfe2df432023-06-23 15:00:32 -070057 dependencies {
Clara Fokfe2df432023-06-23 15:00:32 -070058 api("androidx.arch.core:core-common:2.2.0")
Clara Fokfe2df432023-06-23 15:00:32 -070059 }
60 }
61
Clara Fok5f18ef32023-07-07 19:10:23 -070062 jvmMain {
63 dependsOn(commonJvmAndroidMain)
64 }
65
Clara Fok8ca12ff2023-07-05 17:24:35 -070066 androidMain {
Clara Fok5f18ef32023-07-07 19:10:23 -070067 dependsOn(commonJvmAndroidMain)
Clara Fok8ca12ff2023-07-05 17:24:35 -070068 }
69
Clara Fokfe2df432023-06-23 15:00:32 -070070 commonTest {
71 dependencies {
72 implementation(libs.kotlinCoroutinesTest)
Veyndan Stuart87207612023-06-28 22:56:10 +000073 implementation(libs.kotlinTest)
Dustin Lam14495fa2023-07-05 17:32:26 -070074 implementation(project(":kruth:kruth"))
Veyndan Stuart89b052d2023-07-04 21:22:48 +000075 implementation(project(":internal-testutils-paging"))
Clara Fokfe2df432023-06-23 15:00:32 -070076 }
77 }
78
Clara Fok5f18ef32023-07-07 19:10:23 -070079 commonJvmAndroidTest {
Clara Fok12c32932023-07-10 17:26:25 -070080 dependsOn(commonTest)
Clara Fokfe2df432023-06-23 15:00:32 -070081 dependencies {
82 implementation(libs.junit)
Fred Sladkeya788bdd2023-09-13 20:06:47 +000083 implementation(libs.mockitoCore)
84 implementation(libs.mockitoKotlin)
Clara Fokfe2df432023-06-23 15:00:32 -070085 implementation(project(":internal-testutils-common"))
Clara Fokfe2df432023-06-23 15:00:32 -070086 implementation(project(":internal-testutils-ktx"))
Clara Fokfe2df432023-06-23 15:00:32 -070087 }
88 }
89
Clara Fok5f18ef32023-07-07 19:10:23 -070090 jvmTest {
91 dependsOn(commonJvmAndroidTest)
92 }
93
Fred Sladkeyd2ea9cf2023-08-17 21:19:01 -040094 androidInstrumentedTest {
Clara Fok5f18ef32023-07-07 19:10:23 -070095 dependsOn(commonJvmAndroidTest)
Clara Fok12c32932023-07-10 17:26:25 -070096 dependencies {
97 implementation(libs.testRunner)
Clara Foke86ad8ca2023-12-06 14:16:05 -080098 implementation(libs.mockitoAndroid5)
Dustin Lam84bdfb42023-09-12 09:15:29 -070099 implementation(libs.multidex)
Clara Fok12c32932023-07-10 17:26:25 -0700100 }
Clara Fok8ca12ff2023-07-05 17:24:35 -0700101 }
102
Fred Sladkeyd5f3dd32024-01-23 13:50:51 -0500103 nativeMain {
104 dependsOn(commonMain)
105 dependencies {
106 implementation(libs.atomicFu)
Clara Fokfe2df432023-06-23 15:00:32 -0700107 }
108 }
Fred Sladkeyd5f3dd32024-01-23 13:50:51 -0500109 nativeTest {
110 dependsOn(commonTest)
Yigit Boyar358dfe62023-07-06 09:04:03 -0700111 }
112
Fred Sladkeyd5f3dd32024-01-23 13:50:51 -0500113 darwinMain {
114 dependsOn(nativeMain)
115 }
116
117 linuxMain {
118 dependsOn(nativeMain)
Yigit Boyar358dfe62023-07-06 09:04:03 -0700119 }
Clara Fokfe2df432023-06-23 15:00:32 -0700120
Omar Ismailce79d6f2024-05-14 16:05:13 +0100121 targets.configureEach { target ->
Clara Fokfe2df432023-06-23 15:00:32 -0700122 if (target.platformType == KotlinPlatformType.native) {
123 target.compilations["main"].defaultSourceSet {
Yigit Boyar358dfe62023-07-06 09:04:03 -0700124 def konanTargetFamily = target.konanTarget.family
125 if (konanTargetFamily == Family.OSX || konanTargetFamily == Family.IOS) {
126 dependsOn(darwinMain)
127 } else if (konanTargetFamily == Family.LINUX) {
128 dependsOn(linuxMain)
129 } else {
130 throw new GradleException("unknown native target ${target}")
131 }
Clara Fokfe2df432023-06-23 15:00:32 -0700132 }
133 target.compilations["test"].defaultSourceSet {
134 dependsOn(nativeTest)
135 }
136 }
137 }
138 }
139}
140
Aurimas Liutikas2ad31612019-04-01 04:23:03 -0700141androidx {
Alan Viverettec9e1fd72023-05-08 17:36:59 -0400142 name = "Paging-Common"
Omar Ismail86e66062024-05-03 16:10:50 +0100143 type = LibraryType.PUBLISHED_LIBRARY
Aurimas Liutikasea5ee822017-11-06 12:52:28 -0800144 inceptionYear = "2017"
145 description = "Android Paging-Common"
Aurimas Liutikas5c5419a2024-05-29 15:26:58 -0700146 legacyDisableKotlinStrictApiMode = true
Owen Gray96be2082023-12-04 10:46:10 -0500147 samples(project(":paging:paging-samples"))
Chris Craik368e82c2018-02-12 16:40:12 -0800148}
Clara Fok8ca12ff2023-07-05 17:24:35 -0700149
150android {
151 namespace "androidx.paging.common"
Arkadii Ivanovca693ef2023-08-18 15:14:52 +0100152
153 defaultConfig {
154 multiDexEnabled = true
155 }
Clara Fok8ca12ff2023-07-05 17:24:35 -0700156}