Retry: Update art sdk/module_exports to support conscrypt

Disabled the breaking modules on darwin.

Provides the prebuilts necessary for conscrypt to build against a
snapshot of the art sdk/module_exports.

Some of the exported modules should not actually be exported as they
are internal implementation details of other exported modules which is
not something that the sdk/module_exports currently supports. Bug#
155372760 tracks the follow up work to remove those.

Tested as follows:

Built art sdk and module_exports using:
  m art-module-sdk art-module-host-exports art-module-test-exports

Then in separate work tree with limited manifest the 3 snapshots were
unpacked using the following (where SDK_BUILD_TOP is the path to the
work tree where the art sdk and module_exports were built). It has to
unpack the zips in the same directory, rename each Android.bp to
a unique name and then generated an Android.bp that includes those.
This is to work around an issue with visibility where one snapshot
references prebuilts provided by another snapshot which are not visible
to it.

  SDK_BUILD_TOP=/home/paulduffin/android/aosp/master
  rm -fr art-module &&
    mkdir -p art-module &&
    unzip -d art-module /usr/local/google${SDK_BUILD_TOP}/out/soong/.intermediates/art/build/sdk/art-module-sdk/common_os/art-module-sdk-current.zip &&
    mv art-module/Android.bp art-module/sdk.bp &&
    unzip -d art-module /usr/local/google${SDK_BUILD_TOP}/out/soong/.intermediates/art/build/sdk/art-module-test-exports/common_os/art-module-test-exports-current.zip &&
    mv art-module/Android.bp art-module/test.bp &&
    unzip -d art-module /usr/local/google${SDK_BUILD_TOP}/out/soong/.intermediates/art/build/sdk/art-module-host-exports/common_os/art-module-host-exports-current.zip &&
    mv art-module/Android.bp art-module/host.bp && echo "build = [\"sdk.bp\",\"test.bp\",\"host.bp\"]" > art-module/Android.bp

Once the snapshots have been unpacked then all targets under
external/conscrypt were built with the following:
  ALLOW_MISSING_DEPENDENCIES=true mmm external/conscrypt/

ALLOW_MISSING_DEPENDENCIES=true is needed because there are many
repositories that contain dependencies needed by conscrypt but which
also depend on things that need conscrypt, e.g. frameworks/base.

Bug: 142935992
Bug: 155372760
Test: m art-module-sdk art-module-host-exports art-module-test-exports
      As above
Change-Id: I2067c2c15ca63300e410c9d4d167ff1f60297f35
diff --git a/build/sdk/Android.bp b/build/sdk/Android.bp
index a9048d0..ce1ecd7 100644
--- a/build/sdk/Android.bp
+++ b/build/sdk/Android.bp
@@ -17,20 +17,54 @@
     name: "art-module-sdk",
     host_supported: true,
     native_header_libs: [
+        "jni_headers",
         "libnativehelper_header_only",
     ],
+    native_shared_libs: [
+        "libandroidio",
+    ],
     target: {
         android: {
+            java_header_libs: [
+                // Needed by any module that builds against any non-numeric
+                // sdk_version other than "none".
+                //
+                // This is actually only used for compiling Java 8 and kotlin.
+                // Java 9 uses system modules which encapsulates this
+                // internally.
+                "core-lambda-stubs",
+
+                // Needed by any module that builds against any non-numeric
+                // sdk_version other than "none" or "core_platform".
+                //
+                // This is actually only used for compiling Java 8 and kotlin.
+                // Java 9 uses system modules which encapsulates this
+                // internally.
+                "core.current.stubs",
+
+                // Needed by any module that builds against an sdk_version of
+                // "core_platform".
+                //
+                // This is actually only used for compiling Java 8 and kotlin.
+                // Java 9 uses system modules which encapsulates this
+                // internally.
+                "core.platform.api.stubs",
+            ],
+
             java_system_modules: [
                 "art-module-public-api-stubs-system-modules",
                 "art-module-intra-core-api-stubs-system-modules",
                 "art-module-platform-api-stubs-system-modules",
+                "core-current-stubs-system-modules",
                 "core-platform-api-stubs-system-modules",
             ],
             native_static_libs: [
                 "libartimagevalues",
             ],
         },
+        darwin: {
+            enabled: false,
+        },
     },
 }
 
@@ -45,34 +79,61 @@
             // property is fixed to "both" in the sdk/module_exports
             // implementation and cannot be overridden any other way.
             compile_multilib: "64",
+
+            java_libs: [
+                "timezone-host",
+            ],
+            native_binaries: [
+                "hiddenapi",
+                "dex2oat",
+                "dex2oatd",
+            ],
+            native_shared_libs: [
+                // The following three libraries are internal implementation libraries
+                // that are needed by hiddenapi.
+                // TODO(http://b/155372760): Remove dependencies.
+                "libartbase",
+                "libartpalette",
+                "libdexfile",
+            ],
         },
         darwin: {
             enabled: false,
         },
     },
-    java_libs: [
-        "timezone-host",
-    ],
-    native_binaries: [
-        "hiddenapi",
-        "dex2oat",
-        "dex2oatd",
-    ],
 }
 
 // Exported tests and supporting libraries
 module_exports {
     name: "art-module-test-exports",
+    host_supported: true,
     java_libs: [
-        "core-compat-test-rules",
-        "core-test-rules",
-        "core-tests-support",
-        "okhttp-tests-nojarjar",
+        // The following bouncycastle modules are required by:
+        // * conscrypt-benchmarks (all)
+        // * conscrypt-tests (all)
+        // * signapk (all except ocsp)
+        "bouncycastle-unbundled",
+        "bouncycastle-bcpkix-unbundled",
+        "bouncycastle-ocsp-unbundled",
     ],
-    java_tests: [
-        "libcore-crypto-tests",
-    ],
-    native_shared_libs: [
-        "libjavacoretests",
-    ],
+    target: {
+        android: {
+            java_libs: [
+                "core-compat-test-rules",
+                "core-compat-test-rules",
+                "core-test-rules",
+                "core-tests-support",
+                "okhttp-tests-nojarjar",
+            ],
+            java_tests: [
+                "libcore-crypto-tests",
+            ],
+            native_shared_libs: [
+                "libjavacoretests",
+            ],
+        },
+        darwin: {
+            enabled: false,
+        },
+    },
 }