1// Copyright (C) 2020 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "art_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["art_license"],
22}
23
24soong_config_module_type_import {
25    from: "art/build/SoongConfig.bp",
26    module_types: [
27        "art_module_sdk",
28        "art_module_exports",
29    ],
30}
31
32// Additional visibility to add to the prebuilt modules that are part of
33// the snapshots of the ART sdk/module_exports to ensure that they are
34// visible to each other.
35prebuilt_visibility = [
36    // TODO(b/155921753): Restrict this when prebuilts are in their proper
37    // locations.
38    "//prebuilts:__subpackages__",
39]
40
41// The SDK for the art module apex.
42art_module_sdk {
43    name: "art-module-sdk",
44    host_supported: true,
45
46    // Enable if SOONG_CONFIG_art_module_source_build is true.
47    enabled: false,
48    soong_config_variables: {
49        source_build: {
50            enabled: true,
51        },
52    },
53
54    prebuilt_visibility: prebuilt_visibility,
55
56    target: {
57        // Both android and host linux but not windows or darwin.
58        linux: {
59            native_header_libs: [
60                "jni_headers",
61                "libartpalette-headers",
62                "libnativehelper_header_only",
63                "libopenjdkjvmti_headers",
64            ],
65
66            native_shared_libs: [
67                "libandroidio",
68                "libdexfile",
69                "libnativebridge",
70                "libnativehelper",
71                "libnativeloader",
72                "libsigchain",
73            ],
74
75            native_static_libs: [
76                "libdexfile_support",
77                "libdexfile_static",
78                "libnativehelper_lazy",
79            ],
80        },
81
82        android: {
83            bootclasspath_fragments: [
84                // Adds the fragment and its contents to the sdk.
85                "art-bootclasspath-fragment",
86            ],
87
88            compat_configs: [
89                "libcore-platform-compat-config",
90            ],
91
92            java_header_libs: [
93                // Needed by any module that builds against any non-numeric
94                // sdk_version other than "none".
95                //
96                // This is actually only used for compiling Java 8 and kotlin.
97                // Java 9 uses system modules which encapsulates this
98                // internally.
99                "core-lambda-stubs",
100
101                // Needed by any module that builds against any non-numeric
102                // sdk_version other than "none" or "core_platform".
103                //
104                // This is actually only used for compiling Java 8 and kotlin.
105                // Java 9 uses system modules which encapsulates this
106                // internally.
107                "core.current.stubs",
108
109                // Needed by any module that builds against an sdk_version of
110                // "core_platform".
111                //
112                // This is actually only used for compiling Java 8 and kotlin.
113                // Java 9 uses system modules which encapsulates this
114                // internally.
115                "legacy.core.platform.api.stubs",
116                "stable.core.platform.api.stubs",
117            ],
118
119            java_sdk_libs: [
120                "art.module.public.api",
121            ],
122
123            java_system_modules: [
124                "art-module-public-api-stubs-system-modules",
125                "art-module-lib-api-stubs-system-modules",
126                "art-module-intra-core-api-stubs-system-modules",
127                "core-current-stubs-system-modules",
128                "core-module-lib-stubs-system-modules",
129                "legacy-core-platform-api-stubs-system-modules",
130                "stable-core-platform-api-stubs-system-modules",
131            ],
132            native_header_libs: [
133                "libnativeloader-headers",
134            ],
135            native_shared_libs: [
136                "libnativebridge_lazy",
137                "libnativehelper_compat_libc++",
138                "libnativeloader_lazy",
139            ],
140        },
141
142        linux_bionic: {
143            enabled: false,
144        },
145        darwin: {
146            enabled: false,
147        },
148    },
149}
150
151// Exported host tools and libraries.
152art_module_exports {
153    name: "art-module-host-exports",
154    host_supported: true,
155
156    // Enable if SOONG_CONFIG_art_module_source_build is true.
157    enabled: false,
158    soong_config_variables: {
159        source_build: {
160            enabled: true,
161        },
162    },
163
164    prebuilt_visibility: prebuilt_visibility,
165
166    target: {
167        host: {
168            // Set in target.host because the top level compile_multilib
169            // property is fixed to "both" in the sdk/module_exports
170            // implementation and cannot be overridden any other way.
171            compile_multilib: "64",
172
173            java_libs: [
174                "art.module.api.annotations",
175
176                // Needed for grpc-grpc-java
177                "okhttp-norepackage",
178            ],
179            native_binaries: [
180                "dex2oat",
181                "dex2oatd",
182                "dexdump",
183                "hiddenapi",
184                "oatdump",
185                "profman",
186                "veridex",
187            ],
188            native_libs: [
189                "libartpalette", // libdexfile dependency
190                "libartbase", // libdexfile dependency
191            ],
192        },
193
194        linux_bionic: {
195            enabled: false,
196        },
197        darwin: {
198            enabled: false,
199        },
200        windows: {
201            enabled: false,
202        },
203    },
204}
205
206// Exported tests and supporting libraries
207art_module_exports {
208    name: "art-module-test-exports",
209
210    // Enable if SOONG_CONFIG_art_module_source_build is true.
211    enabled: false,
212    soong_config_variables: {
213        source_build: {
214            enabled: true,
215        },
216    },
217
218    prebuilt_visibility: prebuilt_visibility,
219
220    java_libs: [
221        "core-compat-test-rules",
222        "core-test-rules",
223        "core-tests-support",
224        "okhttp-tests-nojarjar",
225
226        // Needed for CtsJvmtiDeviceRunTestAppBase.
227        "art_cts_jvmti_test_library",
228        "expected_cts_outputs",
229
230        // Needed for robolectric.
231        "core-libart-for-host",
232        "okhttp-for-host",
233
234        // Needed for CtsLibcore...TestCases
235        "libcore-expectations-knownfailures-jar",
236        "libcore-expectations-virtualdeviceknownfailures-jar",
237
238        // Needed for CtsLibcoreOkHttpTestCases
239        "okhttp-nojarjar",
240    ],
241
242    java_tests: [
243        // Needed for CtsJdwpTestCases.
244        "apache-harmony-jdwp-tests",
245
246        "libcore-crypto-tests",
247
248        // Needed for CtsLibcoreOjTestCases
249        "core-ojtests-public",
250
251        // Needed for CtsLibcoreJsr166TestCases
252        "jsr166-tests",
253
254        // Needed for CtsLibcoreTestCases
255        "apache-harmony-tests",
256        "core-tests",
257    ],
258
259    native_shared_libs: [
260        "libjavacoretests",
261    ],
262    native_static_libs: [
263        // TODO(b/187288515): Providing this as a prebuilt introduces an issue
264        // with sdk_version propagation. Temporarily use the source library
265        // instead.
266        //"libctstiagent",
267    ],
268}
269