diff options
-rw-r--r-- | Android.bp | 68 |
1 files changed, 18 insertions, 50 deletions
@@ -1,6 +1,5 @@ package { default_applicable_licenses: ["external_kotlinx.coroutines_license"], - default_visibility: ["//visibility:private"], } // Added automatically by a large-scale-change that took the approach of @@ -36,11 +35,11 @@ license { ], } -// Upstream compiles this lib against the JVM bootclasspath; compiling against the Android -// bootclasspath will fail. Work around this by defining this as a java_library_host, and use -// java_host_for_device to expose it to Android targets. -java_library_host { - name: "kotlinx_coroutines-host", +java_library { + name: "kotlinx_coroutines", + host_supported: true, + sdk_version: "current", + min_sdk_version: "28", srcs: ["kotlinx-coroutines-core/jvm/src/**/*.kt"], common_srcs: [ "kotlinx-coroutines-core/common/src/**/*.kt", @@ -54,10 +53,7 @@ java_library_host { static_libs: [ "kotlinx_atomicfu", ], - libs: [ - "annotations", // for android.annotation.SuppressLint - "kotlinx-coroutines-android-annotation-stubs", - ], + libs: ["kotlinx-coroutines-android-annotation-stubs"], kotlincflags: [ "-Xmulti-platform", "-opt-in=kotlin.RequiresOptIn", @@ -71,37 +67,13 @@ java_library_host { ], apex_available: [ "//apex_available:platform", - "//apex_available:anyapex", + "//apex_available:anyapex" ], -} - -// Expose the host library to Android targets. This is generally an unsafe operation; in using -// this, we are asserting that any host-only code will never be evaluated at runtime on Android. -// If we're wrong, we will see runtime exceptions. -java_host_for_device { - name: "kotlinx_coroutines-device", - libs: ["kotlinx_coroutines-host"], -} - -// Combine host and Android libs back into a single target. -java_library { - name: "kotlinx_coroutines", - host_supported: true, - sdk_version: "core_current", - min_sdk_version: "28", target: { host: { - static_libs: ["kotlinx_coroutines-host"], - }, - android: { - static_libs: ["kotlinx_coroutines-device"], + libs: ["annotations"], // for android.annotation.SuppressLint }, }, - apex_available: [ - "//apex_available:platform", - "//apex_available:anyapex", - ], - visibility: ["//visibility:public"], } java_library { @@ -122,9 +94,8 @@ java_library { ], apex_available: [ "//apex_available:platform", - "//apex_available:anyapex", + "//apex_available:anyapex" ], - visibility: ["//visibility:public"], } java_library { @@ -139,15 +110,15 @@ java_library { "-opt-in=kotlinx.coroutines.InternalCoroutinesApi", "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", ], - libs: ["kotlinx_coroutines"], + libs: [ + "kotlinx_coroutines", + ], apex_available: [ "//apex_available:platform", - "//apex_available:anyapex", + "//apex_available:anyapex" ], - visibility: ["//visibility:public"], } - // Compile stub implementations of annotations used by kotlinx-coroutines but not present in the // Android tree. java_library { @@ -163,27 +134,25 @@ java_library { java_library { name: "kotlinx-coroutines-core", host_supported: true, - sdk_version: "core_current", + sdk_version: "current", min_sdk_version: "28", static_libs: ["kotlinx_coroutines"], apex_available: [ "//apex_available:platform", - "//apex_available:anyapex", + "//apex_available:anyapex" ], - visibility: ["//visibility:public"], } java_library { name: "kotlinx-coroutines-core-jvm", host_supported: true, - sdk_version: "core_current", + sdk_version: "current", min_sdk_version: "28", static_libs: ["kotlinx_coroutines"], apex_available: [ "//apex_available:platform", - "//apex_available:anyapex", + "//apex_available:anyapex" ], - visibility: ["//visibility:public"], } java_library { @@ -196,9 +165,8 @@ java_library { ], apex_available: [ "//apex_available:platform", - "//apex_available:anyapex", + "//apex_available:anyapex" ], - visibility: ["//visibility:public"], } filegroup { |