Bob Badour | a060d41 | 2021-02-12 14:45:18 -0800 | [diff] [blame] | 1 | package { |
| 2 | default_applicable_licenses: ["external_kotlinx.coroutines_license"], |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 3 | default_visibility: ["//visibility:private"], |
Bob Badour | a060d41 | 2021-02-12 14:45:18 -0800 | [diff] [blame] | 4 | } |
| 5 | |
| 6 | // Added automatically by a large-scale-change that took the approach of |
| 7 | // 'apply every license found to every target'. While this makes sure we respect |
| 8 | // every license restriction, it may not be entirely correct. |
| 9 | // |
| 10 | // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| 11 | // |
| 12 | // Please consider splitting the single license below into multiple licenses, |
| 13 | // taking care not to lose any license_kind information, and overriding the |
| 14 | // default license using the 'licenses: [...]' property on targets as needed. |
| 15 | // |
| 16 | // For unused files, consider creating a 'fileGroup' with "//visibility:private" |
| 17 | // to attach the license to, and including a comment whether the files may be |
| 18 | // used in the current project. |
| 19 | // |
| 20 | // large-scale-change included anything that looked like it might be a license |
| 21 | // text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. |
| 22 | // |
| 23 | // Please consider removing redundant or irrelevant files from 'license_text:'. |
| 24 | // See: http://go/android-license-faq |
| 25 | license { |
| 26 | name: "external_kotlinx.coroutines_license", |
| 27 | visibility: [":__subpackages__"], |
| 28 | license_kinds: [ |
| 29 | "SPDX-license-identifier-Apache-2.0", |
| 30 | "SPDX-license-identifier-MIT", |
| 31 | ], |
| 32 | license_text: [ |
| 33 | "LICENSE", |
| 34 | "LICENSE.txt", |
| 35 | "license/**/*", |
| 36 | ], |
| 37 | } |
| 38 | |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 39 | // Upstream compiles this lib against the JVM bootclasspath; compiling against the Android |
| 40 | // bootclasspath will fail. Work around this by defining this as a java_library_host, and use |
| 41 | // java_host_for_device to expose it to Android targets. |
| 42 | java_library_host { |
| 43 | name: "kotlinx_coroutines-host", |
Colin Cross | 905a53f | 2020-06-25 19:12:23 -0700 | [diff] [blame] | 44 | srcs: ["kotlinx-coroutines-core/jvm/src/**/*.kt"], |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 45 | common_srcs: [ |
| 46 | "kotlinx-coroutines-core/common/src/**/*.kt", |
| 47 | "kotlinx-coroutines-core/concurrent/src/**/*.kt", |
| 48 | ], |
Colin Cross | 905a53f | 2020-06-25 19:12:23 -0700 | [diff] [blame] | 49 | exclude_srcs: [ |
| 50 | "kotlinx-coroutines-core/jvm/src/debug/**/*.kt", |
| 51 | "kotlinx-coroutines-core/jvm/src/test_/TestCoroutineContext.kt", |
| 52 | ], |
Colin Cross | 361f4f6 | 2021-08-03 13:36:05 -0700 | [diff] [blame] | 53 | java_resource_dirs: ["kotlinx-coroutines-core/jvm/resources"], |
Colin Cross | 905a53f | 2020-06-25 19:12:23 -0700 | [diff] [blame] | 54 | static_libs: [ |
| 55 | "kotlinx_atomicfu", |
| 56 | ], |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 57 | libs: [ |
| 58 | "annotations", // for android.annotation.SuppressLint |
| 59 | "kotlinx-coroutines-android-annotation-stubs", |
| 60 | ], |
Colin Cross | 905a53f | 2020-06-25 19:12:23 -0700 | [diff] [blame] | 61 | kotlincflags: [ |
| 62 | "-Xmulti-platform", |
Colin Cross | 53eee30 | 2022-06-23 15:36:42 -0700 | [diff] [blame] | 63 | "-opt-in=kotlin.RequiresOptIn", |
| 64 | "-opt-in=kotlin.experimental.ExperimentalTypeInference", |
| 65 | "-opt-in=kotlin.ExperimentalMultiplatform", |
| 66 | "-opt-in=kotlinx.coroutines.DelicateCoroutinesApi", |
| 67 | "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", |
| 68 | "-opt-in=kotlinx.coroutines.ObsoleteCoroutinesApi", |
| 69 | "-opt-in=kotlinx.coroutines.InternalCoroutinesApi", |
| 70 | "-opt-in=kotlinx.coroutines.FlowPreview", |
Colin Cross | 905a53f | 2020-06-25 19:12:23 -0700 | [diff] [blame] | 71 | ], |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 72 | apex_available: [ |
| 73 | "//apex_available:platform", |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 74 | "//apex_available:anyapex", |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 75 | ], |
Colin Cross | 905a53f | 2020-06-25 19:12:23 -0700 | [diff] [blame] | 76 | } |
Colin Cross | 9b946d0 | 2020-07-17 15:12:08 -0700 | [diff] [blame] | 77 | |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 78 | // Expose the host library to Android targets. This is generally an unsafe operation; in using |
| 79 | // this, we are asserting that any host-only code will never be evaluated at runtime on Android. |
| 80 | // If we're wrong, we will see runtime exceptions. |
| 81 | java_host_for_device { |
| 82 | name: "kotlinx_coroutines-device", |
| 83 | libs: ["kotlinx_coroutines-host"], |
| 84 | } |
| 85 | |
| 86 | // Combine host and Android libs back into a single target. |
| 87 | java_library { |
| 88 | name: "kotlinx_coroutines", |
| 89 | host_supported: true, |
| 90 | sdk_version: "core_current", |
| 91 | min_sdk_version: "28", |
| 92 | target: { |
| 93 | host: { |
| 94 | static_libs: ["kotlinx_coroutines-host"], |
| 95 | }, |
| 96 | android: { |
| 97 | static_libs: ["kotlinx_coroutines-device"], |
| 98 | }, |
| 99 | }, |
| 100 | apex_available: [ |
| 101 | "//apex_available:platform", |
| 102 | "//apex_available:anyapex", |
| 103 | ], |
| 104 | visibility: ["//visibility:public"], |
| 105 | } |
| 106 | |
Colin Cross | 9b946d0 | 2020-07-17 15:12:08 -0700 | [diff] [blame] | 107 | java_library { |
| 108 | name: "kotlinx_coroutines_android", |
Cole Faust | 4963ba0 | 2022-06-28 15:59:28 -0700 | [diff] [blame] | 109 | sdk_version: "current", |
| 110 | min_sdk_version: "28", |
Colin Cross | 9b946d0 | 2020-07-17 15:12:08 -0700 | [diff] [blame] | 111 | srcs: ["ui/kotlinx-coroutines-android/src/**/*.kt"], |
Colin Cross | 361f4f6 | 2021-08-03 13:36:05 -0700 | [diff] [blame] | 112 | java_resource_dirs: ["ui/kotlinx-coroutines-android/resources"], |
Colin Cross | 9b946d0 | 2020-07-17 15:12:08 -0700 | [diff] [blame] | 113 | kotlincflags: [ |
Colin Cross | 53eee30 | 2022-06-23 15:36:42 -0700 | [diff] [blame] | 114 | "-opt-in=kotlinx.coroutines.InternalCoroutinesApi", |
| 115 | "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", |
Colin Cross | 9b946d0 | 2020-07-17 15:12:08 -0700 | [diff] [blame] | 116 | ], |
Colin Cross | 70e6515 | 2022-09-22 16:51:25 -0700 | [diff] [blame] | 117 | static_libs: [ |
Colin Cross | 9b946d0 | 2020-07-17 15:12:08 -0700 | [diff] [blame] | 118 | "kotlinx_coroutines", |
Colin Cross | 70e6515 | 2022-09-22 16:51:25 -0700 | [diff] [blame] | 119 | ], |
| 120 | libs: [ |
Colin Cross | 9b946d0 | 2020-07-17 15:12:08 -0700 | [diff] [blame] | 121 | "androidx.annotation_annotation", |
| 122 | ], |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 123 | apex_available: [ |
| 124 | "//apex_available:platform", |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 125 | "//apex_available:anyapex", |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 126 | ], |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 127 | visibility: ["//visibility:public"], |
Colin Cross | 9b946d0 | 2020-07-17 15:12:08 -0700 | [diff] [blame] | 128 | } |
Colin Cross | 39c9745 | 2021-07-30 12:16:41 -0700 | [diff] [blame] | 129 | |
| 130 | java_library { |
| 131 | name: "kotlinx_coroutines_test", |
| 132 | host_supported: true, |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 133 | srcs: ["kotlinx-coroutines-test/jvm/src/**/*.kt"], |
| 134 | common_srcs: ["kotlinx-coroutines-test/common/src/**/*.kt"], |
| 135 | java_resource_dirs: ["kotlinx-coroutines-test/jvm/resources"], |
Colin Cross | 39c9745 | 2021-07-30 12:16:41 -0700 | [diff] [blame] | 136 | kotlincflags: [ |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 137 | "-Xmulti-platform", |
| 138 | "-opt-in=kotlin.ExperimentalMultiplatform", |
Colin Cross | 53eee30 | 2022-06-23 15:36:42 -0700 | [diff] [blame] | 139 | "-opt-in=kotlinx.coroutines.InternalCoroutinesApi", |
| 140 | "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", |
Colin Cross | 39c9745 | 2021-07-30 12:16:41 -0700 | [diff] [blame] | 141 | ], |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 142 | libs: ["kotlinx_coroutines"], |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 143 | apex_available: [ |
| 144 | "//apex_available:platform", |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 145 | "//apex_available:anyapex", |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 146 | ], |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 147 | visibility: ["//visibility:public"], |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 148 | } |
| 149 | |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 150 | |
| 151 | // Compile stub implementations of annotations used by kotlinx-coroutines but not present in the |
| 152 | // Android tree. |
| 153 | java_library { |
| 154 | name: "kotlinx-coroutines-android-annotation-stubs", |
| 155 | host_supported: true, |
| 156 | sdk_version: "core_current", |
| 157 | srcs: ["android-annotation-stubs/src/**/*.java"], |
| 158 | } |
| 159 | |
| 160 | // Temporary aliases for kotlinx-coroutines-core, kotlinx-coroutines-core-jvm and |
| 161 | // kotlinx-coroutines-android |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 162 | |
| 163 | java_library { |
| 164 | name: "kotlinx-coroutines-core", |
| 165 | host_supported: true, |
Cole Faust | 4963ba0 | 2022-06-28 15:59:28 -0700 | [diff] [blame] | 166 | sdk_version: "core_current", |
| 167 | min_sdk_version: "28", |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 168 | static_libs: ["kotlinx_coroutines"], |
| 169 | apex_available: [ |
| 170 | "//apex_available:platform", |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 171 | "//apex_available:anyapex", |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 172 | ], |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 173 | visibility: ["//visibility:public"], |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | java_library { |
| 177 | name: "kotlinx-coroutines-core-jvm", |
| 178 | host_supported: true, |
Cole Faust | 4963ba0 | 2022-06-28 15:59:28 -0700 | [diff] [blame] | 179 | sdk_version: "core_current", |
| 180 | min_sdk_version: "28", |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 181 | static_libs: ["kotlinx_coroutines"], |
| 182 | apex_available: [ |
| 183 | "//apex_available:platform", |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 184 | "//apex_available:anyapex", |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 185 | ], |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 186 | visibility: ["//visibility:public"], |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | java_library { |
| 190 | name: "kotlinx-coroutines-android", |
Cole Faust | 4963ba0 | 2022-06-28 15:59:28 -0700 | [diff] [blame] | 191 | sdk_version: "current", |
| 192 | min_sdk_version: "28", |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 193 | static_libs: [ |
| 194 | "kotlinx_coroutines_android", |
| 195 | "kotlinx_coroutines", |
| 196 | ], |
| 197 | apex_available: [ |
| 198 | "//apex_available:platform", |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 199 | "//apex_available:anyapex", |
Colin Cross | b5da258 | 2021-07-30 16:43:21 -0700 | [diff] [blame] | 200 | ], |
Steve Elliott | ca095be | 2022-07-25 14:26:10 +0000 | [diff] [blame] | 201 | visibility: ["//visibility:public"], |
Colin Cross | 39c9745 | 2021-07-30 12:16:41 -0700 | [diff] [blame] | 202 | } |
Anubha Kushwaha | 7687439 | 2022-04-13 21:56:03 +0000 | [diff] [blame] | 203 | |
| 204 | filegroup { |
| 205 | name: "kotlinx-coroutines-play-services", |
| 206 | srcs: ["integration/kotlinx-coroutines-play-services/src/**/*.kt"], |
| 207 | } |