blob: 9cbe10da31ff8c26a746f273c637a9e6149a9b2f [file] [log] [blame]
Kenny Root923342a2016-09-22 17:04:35 -07001//
2// Copyright (C) 2016 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
Paul Duffina3891b02019-06-04 12:50:59 +010017package {
18 default_visibility: [
19 ":__subpackages__",
20 ],
Bob Badour808f8222021-02-12 15:19:10 -080021 default_applicable_licenses: ["external_conscrypt_license"],
22}
23
24// Added automatically by a large-scale-change that took the approach of
25// 'apply every license found to every target'. While this makes sure we respect
26// every license restriction, it may not be entirely correct.
27//
28// e.g. GPL in an MIT project might only apply to the contrib/ directory.
29//
30// Please consider splitting the single license below into multiple licenses,
31// taking care not to lose any license_kind information, and overriding the
32// default license using the 'licenses: [...]' property on targets as needed.
33//
34// For unused files, consider creating a 'fileGroup' with "//visibility:private"
35// to attach the license to, and including a comment whether the files may be
36// used in the current project.
37//
38// large-scale-change included anything that looked like it might be a license
39// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
40//
41// Please consider removing redundant or irrelevant files from 'license_text:'.
42// See: http://go/android-license-faq
43license {
44 name: "external_conscrypt_license",
45 visibility: [":__subpackages__"],
46 license_kinds: [
47 "SPDX-license-identifier-Apache-2.0",
48 "legacy_unencumbered",
49 ],
50 license_text: [
51 "LICENSE",
52 "NOTICE",
53 "licenses/**/*",
54 ],
Paul Duffina3891b02019-06-04 12:50:59 +010055}
56
Colin Cross8024b112017-10-09 13:34:58 -070057//
58// Definitions for building the Conscrypt Java library, native code,
59// and associated tests.
60//
61
Neil Fullerde17f742018-09-25 11:48:05 +010062// Conscrypt is divided into subdirectories.
Colin Cross8024b112017-10-09 13:34:58 -070063//
64// The structure is:
65//
66// constants/
67// src/gen # Generates NativeConstants.java.
68// common/
69// src/main/java # Common Java source for all platforms.
70// src/jni/
71// main # Common C++ source for all platforms.
72// unbundled # C++ source used for OpenJDK and unbundled Android.
Adam Vartaniana0509172018-06-15 19:19:20 +010073// src/test/java # Common test files for all platforms.
Colin Cross8024b112017-10-09 13:34:58 -070074// android/
75// src/main/java # Java source for unbundled Android.
76// openjdk/
77// src/main/java # Java source for OpenJDK.
78// src/test
79// java/ # Java source for common tests.
80// resources/ # Support files for tests
81// platform/
82// src/main/java # Java source for bundled Android.
83// src/test
84// java/ # Java source for bundled tests.
85//
86
Kenny Root923342a2016-09-22 17:04:35 -070087cc_defaults {
88 name: "conscrypt_global",
89
90 cflags: [
91 "-Wall",
92 "-Wextra",
93 "-Werror",
94 "-Wunused",
95 ],
96
97 srcs: [
Tobias Thierer33b649f2019-01-22 20:59:36 +000098 "common/src/jni/main/cpp/conscrypt/compatibility_close_monitor.cc",
Nathan Mittlercd7a1582017-08-10 15:17:37 -070099 "common/src/jni/main/cpp/conscrypt/jniload.cc",
100 "common/src/jni/main/cpp/conscrypt/jniutil.cc",
Nathan Mittlerf8c8d4b2017-08-02 06:57:22 -0700101 "common/src/jni/main/cpp/conscrypt/native_crypto.cc",
Nathan Mittlercd7a1582017-08-10 15:17:37 -0700102 "common/src/jni/main/cpp/conscrypt/netutil.cc",
Pete Bentley05779862022-04-13 11:54:29 +0000103 "common/src/jni/main/cpp/conscrypt/trace.cc",
nmittler7782d132016-11-22 11:34:01 -0800104 ],
105
Orion Hodson9af9e362020-04-03 06:47:07 +0100106 header_libs: ["jni_headers"],
107
nmittler7782d132016-11-22 11:34:01 -0800108 local_include_dirs: [
109 "common/src/jni/main/include",
Kenny Root923342a2016-09-22 17:04:35 -0700110 ],
111
Kenny Root923342a2016-09-22 17:04:35 -0700112 compile_multilib: "both",
113 stl: "c++_static",
114}
115
116cc_defaults {
Colin Cross8024b112017-10-09 13:34:58 -0700117 name: "conscrypt_unbundled-jni-defaults",
Kenny Root923342a2016-09-22 17:04:35 -0700118
Kenny Root923342a2016-09-22 17:04:35 -0700119 local_include_dirs: [
nmittler7782d132016-11-22 11:34:01 -0800120 "common/src/jni/unbundled/include",
Kenny Root923342a2016-09-22 17:04:35 -0700121 ],
122
Orion Hodson9af9e362020-04-03 06:47:07 +0100123 header_libs: ["jni_headers"],
124
Kenny Root7bf42db2016-10-05 10:01:40 -0700125 shared_libs: [
126 "liblog",
127 ],
128
Kenny Root923342a2016-09-22 17:04:35 -0700129 static_libs: [
130 "libssl",
Colin Cross1b4bbbf2019-09-18 11:05:41 -0700131 "libcrypto_static",
Kenny Root923342a2016-09-22 17:04:35 -0700132 ],
133
134 sdk_version: "9",
135}
136
137cc_library {
138 name: "libconscrypt_jni",
Colin Cross8024b112017-10-09 13:34:58 -0700139 defaults: [
140 "conscrypt_global",
141 "conscrypt_unbundled-jni-defaults",
142 ],
Kenny Root923342a2016-09-22 17:04:35 -0700143}
144
145cc_library_host_shared {
146 name: "libconscrypt_openjdk_jni",
Colin Cross8a7ef9d2020-12-02 11:39:02 -0800147 visibility: [
148 "//build/make/tools/signapk",
149 "//tools/apksig",
Kwang-un Jin6d1d2262021-05-14 08:10:00 +0000150 "//vendor:__subpackages__",
Colin Cross8a7ef9d2020-12-02 11:39:02 -0800151 ],
Kenny Root923342a2016-09-22 17:04:35 -0700152 defaults: ["conscrypt_global"],
153
154 cflags: [
155 "-DCONSCRYPT_OPENJDK",
156 ],
157
Kenny Root923342a2016-09-22 17:04:35 -0700158 local_include_dirs: [
nmittler7782d132016-11-22 11:34:01 -0800159 "common/src/jni/unbundled/include",
Kenny Root923342a2016-09-22 17:04:35 -0700160 ],
161
Kenny Root923342a2016-09-22 17:04:35 -0700162 static_libs: [
Adam Vartanian9b0c0172017-08-16 16:44:17 +0100163 "libssl",
Colin Cross1b4bbbf2019-09-18 11:05:41 -0700164 "libcrypto_static",
Kenny Root923342a2016-09-22 17:04:35 -0700165 ],
166
167 // TODO: b/26097626. ASAN breaks use of this library in JVM.
168 // Re-enable sanitization when the issue with making clients of this library
169 // preload ASAN runtime is resolved. Without that, clients are getting runtime
170 // errors due to unresolved ASAN symbols, such as
171 // __asan_option_detect_stack_use_after_return.
172 sanitize: {
173 never: true,
174 },
175
Kenny Root7bf42db2016-10-05 10:01:40 -0700176 stl: "libc++_static",
Dan Willemsenc9d6d8f2019-01-04 16:13:27 -0800177
178 // The post-build signing tools need signapk.jar and its shared libs
179 multilib: {
180 lib64: {
181 dist: {
182 targets: ["droidcore"],
183 },
184 },
185 },
Kenny Root923342a2016-09-22 17:04:35 -0700186}
Colin Cross8024b112017-10-09 13:34:58 -0700187
188cc_binary_host {
189 name: "conscrypt_generate_constants",
190 srcs: ["constants/src/gen/cpp/generate_constants.cc"],
Chih-Hung Hsieh7a286142017-10-25 16:07:06 -0700191 cflags: [
192 "-Wall",
193 "-Werror",
194 ],
Colin Cross8024b112017-10-09 13:34:58 -0700195 shared_libs: [
196 "libcrypto",
197 "libssl",
198 ],
199}
200
201genrule {
Paul Duffin38fb8012019-09-20 15:55:58 +0100202 name: "conscrypt-unbundled_generated_constants",
Colin Cross8024b112017-10-09 13:34:58 -0700203 out: ["org/conscrypt/NativeConstants.java"],
204 cmd: "$(location conscrypt_generate_constants) > $(out)",
205 tools: ["conscrypt_generate_constants"],
206}
207
Paul Duffin31d1d152018-09-19 15:03:21 +0100208genrule {
209 name: "conscrypt_generated_constants",
210 out: ["com/android/org/conscrypt/NativeConstants.java"],
211 cmd: "$(location conscrypt_generate_constants) com.android.org.conscrypt > $(out)",
212 tools: ["conscrypt_generate_constants"],
213}
214
Neil Fuller3bf29f22018-09-24 17:35:33 +0100215filegroup {
216 name: "conscrypt_java_files",
217 srcs: [
218 "repackaged/common/src/main/java/**/*.java",
219 "repackaged/platform/src/main/java/**/*.java",
220 ":conscrypt_generated_constants",
221 ],
222}
223
Adam Vartanianacc0e552018-10-18 10:09:22 +0100224filegroup {
225 name: "conscrypt_public_api_files",
Paul Duffinc2e15cd2019-03-28 14:26:40 +0000226 srcs: ["publicapi/src/main/java/**/*.java"],
Jiyong Park956d12f2019-09-13 20:47:19 +0900227 path: "publicapi/src/main/java",
Adam Vartanianacc0e552018-10-18 10:09:22 +0100228}
229
Paul Duffin31d1d152018-09-19 15:03:21 +0100230// Create the conscrypt library from the source produced by the srcgen/generate_android_src.sh
231// script.
Colin Cross8024b112017-10-09 13:34:58 -0700232java_library {
233 name: "conscrypt",
Paul Duffinc2e15cd2019-03-28 14:26:40 +0000234 visibility: [
Paul Duffina3891b02019-06-04 12:50:59 +0100235 "//device:__subpackages__",
Paul Duffinc2e15cd2019-03-28 14:26:40 +0000236 "//system/apex/tests",
237 ":__subpackages__",
238 ],
Jiyong Park59e066f2019-12-02 13:58:22 +0900239 apex_available: [
240 "com.android.conscrypt",
241 "test_com.android.conscrypt",
242 ],
Jooyung Han82724752020-04-27 17:41:26 +0900243 // Conscrypt should support Q
244 min_sdk_version: "29",
245
Colin Cross291db152018-06-27 11:00:08 -0700246 installable: true,
Nicolas Geoffray5e442fd2020-03-31 14:03:19 +0100247 // Hostdex is only for ART testing on host: ART build file has its
248 // own hostdex support for conscrypt.
249 hostdex: false,
Neil Fullera179d2b2018-09-11 18:43:08 +0100250
Adam Vartanianacc0e552018-10-18 10:09:22 +0100251 srcs: [
252 ":conscrypt_java_files",
253 ":conscrypt_public_api_files",
254 ],
Neil Fullera179d2b2018-09-11 18:43:08 +0100255
Martin Stjernholm5b621262020-11-05 14:28:21 +0000256 libs: ["unsupportedappusage"],
Artur Satayev1c258292019-12-10 12:08:51 +0000257
Neil Fuller2f117722018-09-26 16:14:23 +0100258 // Conscrypt can be updated independently from the other core libraries so it must only depend
259 // on public SDK and intra-core APIs.
Paul Duffin1f66bef2019-06-12 11:04:35 +0100260 sdk_version: "none",
Paul Duffin8e719de2019-10-02 12:19:33 +0100261 system_modules: "art-module-intra-core-api-stubs-system-modules",
Paul Duffin9cc43592019-09-20 14:37:14 +0100262 patch_module: "java.base",
Neil Fullera179d2b2018-09-11 18:43:08 +0100263
Pete Bentleye58b81d2019-04-15 17:48:45 +0100264 target: {
Tobias Thierer52344592019-09-02 17:32:02 +0100265 // boringssl_self_test needed in both /system/bin and /apex/com.android.conscrypt/bin
Pete Bentley29349d92022-09-20 16:33:21 +0100266 // prng_seeder is only needed in /system/bin
267 // The required directive is here rather than under boringssl to avoid circular
268 // dependencies.
Tobias Thierer52344592019-09-02 17:32:02 +0100269 android: {
Pete Bentley29349d92022-09-20 16:33:21 +0100270 required: [
271 "boringssl_self_test",
272 "prng_seeder",
273 ],
Tobias Thierer52344592019-09-02 17:32:02 +0100274 },
Pete Bentleye58b81d2019-04-15 17:48:45 +0100275 },
276
Vladimir Markof68e5092019-04-02 10:28:43 +0100277 permitted_packages: [
278 "android.net.ssl",
279 "com.android.org.conscrypt",
280 ],
Kun Niu7fd0a4b2019-07-02 10:16:55 -0700281
282 plugins: ["java_api_finder"],
Colin Cross8024b112017-10-09 13:34:58 -0700283}
284
Paul Duffin6e8a57c2021-04-19 18:00:55 +0100285// Java library for use on host, e.g. by robolectric.
286java_library {
287 name: "conscrypt-for-host",
288 visibility: [
289 "//art/build",
290 "//external/robolectric-shadows",
Rex Hoffman346bf702022-11-13 22:55:07 +0000291 "//external/robolectric",
Jerome Gaillard19a264e2021-09-22 17:31:04 +0000292 "//frameworks/layoutlib",
Paul Duffin6e8a57c2021-04-19 18:00:55 +0100293 ],
294 static_libs: [
295 "conscrypt",
296 ],
297 sdk_version: "none",
298 system_modules: "none",
299}
300
Paul Duffin7d1915d2019-12-24 09:22:30 +0000301// Referenced implicitly from conscrypt.module.platform.api.
302filegroup {
303 name: "conscrypt.module.platform.api.api.public.latest",
Paul Duffinbe619e82019-10-03 13:50:13 +0100304 srcs: [
Paul Duffin7d1915d2019-12-24 09:22:30 +0000305 "api/platform/last-api.txt",
Paul Duffinbe619e82019-10-03 13:50:13 +0100306 ],
Paul Duffin7d1915d2019-12-24 09:22:30 +0000307}
Paul Duffinbe619e82019-10-03 13:50:13 +0100308
Paul Duffin7d1915d2019-12-24 09:22:30 +0000309// Referenced implicitly from conscrypt.module.platform.api.
310filegroup {
311 name: "conscrypt.module.platform.api-removed.api.public.latest",
312 srcs: [
313 "api/platform/last-removed.txt",
314 ],
Paul Duffinbe619e82019-10-03 13:50:13 +0100315}
316
Jaewoong Jung696de952021-03-09 16:08:39 -0800317// Referenced implicitly from conscrypt.module.platform.api.
318filegroup {
319 name: "conscrypt.module.platform.api-incompatibilities.api.public.latest",
320 srcs: [
321 "api/platform/last-incompatibilities.txt",
322 ],
323}
324
Paul Duffinbe619e82019-10-03 13:50:13 +0100325// A library containing the core platform API stubs of the Conscrypt module.
326//
327// Core platform APIs are only intended for use of other parts of the platform, not the
328// core library modules.
Paul Duffin7d1915d2019-12-24 09:22:30 +0000329//
330// The API specification .txt files managed by this only contain the additional
331// classes/members that are in the platform API but which are not in the public
332// API.
Pete Gillin4efd91f2020-06-12 12:28:59 +0100333//
334// Note that this entire API surface is considered stable in the sense described in
335// libcore/mmodules/core_platform_api/Android.bp.
Paul Duffin7d1915d2019-12-24 09:22:30 +0000336java_sdk_library {
337 name: "conscrypt.module.platform.api",
Paul Duffinbe619e82019-10-03 13:50:13 +0100338 visibility: [
Paul Duffindf7df8e2021-07-10 23:33:28 +0100339 "//build/soong/java/core-libraries",
Paul Duffina938a162019-10-04 15:34:31 +0100340 "//external/wycheproof",
Martin Stjernholm25d61922020-05-07 02:01:09 +0100341 // Visibility for prebuilt conscrypt-module-sdk from the prebuilt of
342 // this module.
343 // TODO(b/155921753): Restrict this when prebuilts are in their proper
344 // locations.
345 "//prebuilts:__subpackages__",
Paul Duffind935af22022-07-15 16:15:24 +0000346
347 // DO NOT REMOVE: Legacy visibility, needed for snapshots that are
348 // generated for the S build.
349 "//libcore/mmodules/core_platform_api",
Paul Duffinbe619e82019-10-03 13:50:13 +0100350 ],
351 srcs: [
Paul Duffin7d1915d2019-12-24 09:22:30 +0000352 ":conscrypt_java_files",
353 ],
354 api_dir: "api/platform",
355 api_only: true,
Paul Duffin0b65d012020-11-20 11:45:23 +0000356 api_lint: {
357 enabled: true,
358 },
Paul Duffin7d1915d2019-12-24 09:22:30 +0000359 droiddoc_options: [
360 "--hide-annotation libcore.api.Hide",
Pete Gillin4efd91f2020-06-12 12:28:59 +0100361 "--show-single-annotation libcore.api.CorePlatformApi\\(status=libcore.api.CorePlatformApi.Status.STABLE\\)",
Paul Duffinbe619e82019-10-03 13:50:13 +0100362 ],
363 hostdex: true,
364
365 sdk_version: "none",
Victor Changc8c89072021-06-30 22:02:26 +0100366 system_modules: "art-module-lib-api-stubs-system-modules",
Paul Duffinf9158552020-11-19 19:26:08 +0000367
Anton Hanssondea8f0b2021-06-04 19:13:01 +0100368 dist_group: "android",
369 dist_stem: "conscrypt-coreplatform",
370 // TODO: remove this when Conscrypt's @CorePlatformApi has been migrated to @SystemApi
371 unsafe_ignore_missing_latest_api: true,
Paul Duffinbe619e82019-10-03 13:50:13 +0100372}
373
Paul Duffin68a53162020-04-08 23:59:02 +0100374// A library containing the public API stubs of the Conscrypt module.
375java_sdk_library {
376 name: "conscrypt.module.public.api",
Paul Duffin6fa05ed2019-10-03 16:01:06 +0100377 visibility: [
Paul Duffindf7df8e2021-07-10 23:33:28 +0100378 "//build/soong/java/core-libraries",
Paul Duffin5b5f8bf2020-03-26 15:35:44 +0000379 "//frameworks/base",
Anton Hanssonad10dff2020-09-21 17:24:46 +0100380 "//frameworks/base/api",
Paul Duffindf7df8e2021-07-10 23:33:28 +0100381 "//packages/modules/common/sdk",
Rayan Osseiran29b30d42020-08-26 18:08:06 +0000382 // TODO(b/165823103): Remove visiblity for IPsec once CorePlatformApi is available
383 "//packages/modules/IPsec",
Martin Stjernholm25d61922020-05-07 02:01:09 +0100384 // Visibility for prebuilt art-module-host-exports from the prebuilt of
385 // this module.
386 // TODO(b/155921753): Restrict this when prebuilts are in their proper
387 // locations.
388 "//prebuilts:__subpackages__",
Paul Duffind935af22022-07-15 16:15:24 +0000389
390 // DO NOT REMOVE: Legacy visibility, needed for snapshots that are
391 // generated for the S build.
392 "//libcore",
Paul Duffin6fa05ed2019-10-03 16:01:06 +0100393 ],
Paul Duffin0f6ed702019-09-27 14:55:06 +0100394 srcs: [
395 ":conscrypt_public_api_files",
396 ],
Paul Duffin8c78a8d2020-11-20 22:34:12 +0000397
398 // The base name for the artifacts that are automatically published to the
399 // dist and which end up in one of the sub-directories of prebuilts/sdk.
400 // As long as this matches the name of the artifacts in prebuilts/sdk then
401 // the API will be checked for compatibility against the latest released
402 // version of the API.
403 dist_stem: "conscrypt",
404
Paul Duffin368dace2022-01-25 15:52:38 +0000405 public: {
406 enabled: true,
407 },
408 system: {
409 enabled: true,
410 },
411 module_lib: {
412 enabled: true,
413 },
414
Paul Duffin68a53162020-04-08 23:59:02 +0100415 api_dir: "api/public",
416 api_only: true,
Paul Duffineb153362022-01-25 15:52:01 +0000417
418 // Emit nullability annotations from the source to the stub files.
419 annotations_enabled: true,
Paul Duffin68a53162020-04-08 23:59:02 +0100420
421 java_version: "1.9",
422
Paul Duffin0f6ed702019-09-27 14:55:06 +0100423 sdk_version: "none",
424 system_modules: "art-module-public-api-stubs-system-modules",
Colin Crosse34107b2021-05-10 10:47:44 -0700425 dist_group: "android",
Paul Duffin0f6ed702019-09-27 14:55:06 +0100426}
427
Paul Duffin067f1c02019-12-24 20:59:54 +0000428// Referenced implicitly from conscrypt.module.intra.core.api.
429filegroup {
430 name: "conscrypt.module.intra.core.api.api.public.latest",
Paul Duffin70fd0372019-10-02 11:07:56 +0100431 srcs: [
Paul Duffin067f1c02019-12-24 20:59:54 +0000432 "api/intra/last-api.txt",
Paul Duffin70fd0372019-10-02 11:07:56 +0100433 ],
Paul Duffin067f1c02019-12-24 20:59:54 +0000434}
Paul Duffin70fd0372019-10-02 11:07:56 +0100435
Paul Duffin067f1c02019-12-24 20:59:54 +0000436// Referenced implicitly from conscrypt.module.intra.core.api.
437filegroup {
438 name: "conscrypt.module.intra.core.api-removed.api.public.latest",
439 srcs: [
440 "api/intra/last-removed.txt",
441 ],
Paul Duffin70fd0372019-10-02 11:07:56 +0100442}
443
Jaewoong Jung696de952021-03-09 16:08:39 -0800444// Referenced implicitly from conscrypt.module.intra.core.api.
445filegroup {
446 name: "conscrypt.module.intra.core.api-incompatibilities.api.public.latest",
447 srcs: [
448 "api/intra/last-incompatibilities.txt",
449 ],
450}
451
Paul Duffin70fd0372019-10-02 11:07:56 +0100452// A library containing the intra-core API stubs of the Conscrypt module.
453//
454// Intra-core APIs are only intended for the use of other core library modules.
Paul Duffin067f1c02019-12-24 20:59:54 +0000455//
456// The API specification .txt files managed by this only contain the additional
457// classes/members that are in the intra-core API but which are not the public API.
458java_sdk_library {
459 name: "conscrypt.module.intra.core.api",
Paul Duffin70fd0372019-10-02 11:07:56 +0100460 visibility: [
Paul Duffin30fbc052019-10-02 14:01:49 +0100461 "//external/okhttp",
Paul Duffin70fd0372019-10-02 11:07:56 +0100462 "//libcore:__subpackages__",
Martin Stjernholm25d61922020-05-07 02:01:09 +0100463 // Visibility for prebuilt conscrypt-module-sdk from the prebuilt of
464 // this module.
465 // TODO(b/155921753): Restrict this when prebuilts are in their proper
466 // locations.
467 "//prebuilts:__subpackages__",
Paul Duffin70fd0372019-10-02 11:07:56 +0100468 ],
469 srcs: [
Paul Duffin067f1c02019-12-24 20:59:54 +0000470 ":conscrypt_java_files",
471 ":conscrypt_public_api_files",
472 ],
473 api_dir: "api/intra",
474 api_only: true,
475 droiddoc_options: [
476 "--hide-annotation libcore.api.Hide",
477 "--show-single-annotation libcore.api.IntraCoreApi",
Paul Duffin70fd0372019-10-02 11:07:56 +0100478 ],
479
480 sdk_version: "none",
481 system_modules: "art-module-intra-core-api-stubs-system-modules",
Paul Duffinf9158552020-11-19 19:26:08 +0000482
483 // Don't copy any output files to the dist.
484 no_dist: true,
Paul Duffin70fd0372019-10-02 11:07:56 +0100485}
486
Colin Cross8024b112017-10-09 13:34:58 -0700487// Platform conscrypt crypto JNI library
488cc_defaults {
489 name: "libjavacrypto-defaults",
490
491 cflags: [
492 "-Wall",
493 "-Wextra",
494 "-Werror",
495 "-Wunused",
496 "-fvisibility=hidden",
497 ],
498
499 srcs: ["common/src/jni/main/cpp/**/*.cc"],
Orion Hodson7631f2c2020-04-11 18:30:14 +0100500 header_libs: ["jni_headers"],
Colin Cross8024b112017-10-09 13:34:58 -0700501 local_include_dirs: ["common/src/jni/main/include"],
502}
503
504// Platform conscrypt crypto JNI library
505cc_library_shared {
506 name: "libjavacrypto",
507 host_supported: true,
508 defaults: ["libjavacrypto-defaults"],
509
510 cflags: ["-DJNI_JARJAR_PREFIX=com/android/"],
Orion Hodsonb5e43bd2019-01-27 10:57:34 +0000511 header_libs: ["libnativehelper_header_only"],
Colin Cross8024b112017-10-09 13:34:58 -0700512 shared_libs: [
513 "libcrypto",
Colin Cross8024b112017-10-09 13:34:58 -0700514 "liblog",
Colin Cross8024b112017-10-09 13:34:58 -0700515 "libssl",
516 ],
517
518 target: {
519 darwin: {
520 enabled: false,
521 },
Colin Cross17b0d182020-02-19 17:04:44 -0800522 android: {
523 runtime_libs: ["libandroidio"],
524 },
525 not_windows: {
526 runtime_libs: ["libandroidio"],
527 },
Colin Cross8024b112017-10-09 13:34:58 -0700528 },
Jiyong Park59e066f2019-12-02 13:58:22 +0900529 apex_available: [
530 "com.android.conscrypt",
531 "test_com.android.conscrypt",
532 ],
Jooyung Han43945302020-04-16 18:48:26 +0900533 min_sdk_version: "29",
Colin Cross8024b112017-10-09 13:34:58 -0700534}
535
Michael Groover68c477b2020-07-16 20:32:13 -0700536// Unbundled Conscrypt jar for use by signapk and apksigner tool
Paul Duffin38fb8012019-09-20 15:55:58 +0100537//
538// Builds against standard host libraries.
539java_library_host {
540 name: "conscrypt-unbundled",
541 visibility: [
542 "//build/make/tools/signapk",
Nicolas Geoffrayffd73562020-07-29 13:54:40 +0100543 "//tools/apksig",
Rex Hoffman346bf702022-11-13 22:55:07 +0000544 "//external/robolectric/robolectric",
Rex Hoffmandb4a1de2022-11-13 23:01:18 +0000545 "//external/robolectric:__subpackages__",
Paul Duffin38fb8012019-09-20 15:55:58 +0100546 ],
Colin Cross8024b112017-10-09 13:34:58 -0700547 srcs: [
548 "common/src/main/java/**/*.java",
Paul Duffin38fb8012019-09-20 15:55:58 +0100549 "openjdk/src/main/java/**/*.java",
550 ":conscrypt-unbundled_generated_constants",
Colin Cross8024b112017-10-09 13:34:58 -0700551 ],
Paul Duffin38fb8012019-09-20 15:55:58 +0100552 javacflags: ["-XDignore.symbol.file"],
Pete Bentleyf81aacc2021-07-27 08:33:01 +0000553 java_version: "1.8",
Dan Willemsen6e404a32021-09-20 23:23:13 -0700554 target: {
555 windows: {
556 enabled: true,
557 },
558 },
Colin Cross8024b112017-10-09 13:34:58 -0700559}
560
561// Static unbundled Conscrypt crypto JNI library
562cc_library_static {
563 name: "libconscrypt_static",
564 defaults: ["libjavacrypto-defaults"],
565
566 cflags: [
567 "-DJNI_JARJAR_PREFIX=com/google/android/gms/",
568 "-DCONSCRYPT_UNBUNDLED",
569 "-DSTATIC_LIB",
570 ],
571
572 local_include_dirs: ["common/src/jni/unbundled/include"],
573
574 static_libs: [
575 "libssl",
Colin Cross1b4bbbf2019-09-18 11:05:41 -0700576 "libcrypto_static",
Colin Cross8024b112017-10-09 13:34:58 -0700577 ],
578 sdk_version: "9",
579 stl: "c++_shared",
580}
Colin Crossf569ee32018-09-11 22:38:08 -0700581
Colin Crossf569ee32018-09-11 22:38:08 -0700582// Make the conscrypt-tests library.
583java_test {
584 name: "conscrypt-tests",
Paul Duffina3891b02019-06-04 12:50:59 +0100585 visibility: [
586 "//cts/tests/libcore/luni",
Daulet Zhanguzinaa10cf72020-01-23 13:51:51 +0000587 "//external/conscrypt/apex/tests",
Paul Duffina3891b02019-06-04 12:50:59 +0100588 ],
Colin Crossf569ee32018-09-11 22:38:08 -0700589 hostdex: true,
590 srcs: [
Paul Duffin31d1d152018-09-19 15:03:21 +0100591 "repackaged/platform/src/test/java/**/*.java",
592 "repackaged/common/src/test/java/**/*.java",
Paul Duffin31d1d152018-09-19 15:03:21 +0100593 "repackaged/testing/src/main/java/**/*.java",
Adam Vartanianacc0e552018-10-18 10:09:22 +0100594 "publicapi/src/test/java/**/*.java",
Colin Crossf569ee32018-09-11 22:38:08 -0700595 ],
596 java_resource_dirs: [
Paul Duffin31d1d152018-09-19 15:03:21 +0100597 // Resource directories do not need repackaging.
Colin Crossf569ee32018-09-11 22:38:08 -0700598 "openjdk/src/test/resources",
Pete Bentley3914ba72019-09-27 11:57:50 +0100599 "common/src/test/resources",
Colin Crossf569ee32018-09-11 22:38:08 -0700600 ],
Neil Fuller27e690d2018-10-10 12:58:01 +0100601
Paul Duffin1f66bef2019-06-12 11:04:35 +0100602 sdk_version: "none",
Paul Duffin8e719de2019-10-02 12:19:33 +0100603 system_modules: "art-module-intra-core-api-stubs-system-modules",
Colin Crossf569ee32018-09-11 22:38:08 -0700604 libs: [
Neil Fuller719e00f2018-10-19 09:32:43 +0100605 "conscrypt",
Paul Duffin880d5422019-09-24 16:22:04 +0100606 "core-test-rules",
Colin Crossf569ee32018-09-11 22:38:08 -0700607 "junit",
608 "mockito-target-minus-junit4",
Pete Bentley506e6f62020-12-07 13:45:14 +0000609 "framework-statsd.stubs.module_lib",
Colin Crossf569ee32018-09-11 22:38:08 -0700610 ],
Neil Fuller27e690d2018-10-10 12:58:01 +0100611
Colin Crossf569ee32018-09-11 22:38:08 -0700612 static_libs: [
Colin Crossf569ee32018-09-11 22:38:08 -0700613 "bouncycastle-unbundled",
614 "bouncycastle-bcpkix-unbundled",
615 "bouncycastle-ocsp-unbundled",
616 ],
617 javacflags: [
618 "-Xmaxwarns 9999999",
619 //"-Xlint:all",
620 //"-Xlint:-serial,-deprecation,-unchecked",
621 ],
622
Yo Chiang8e450f02020-08-07 04:22:18 +0000623 target: {
624 host: {
625 required: ["libjavacrypto"],
626 },
627 darwin: {
628 // required module "libjavacrypto" is disabled on darwin
629 enabled: false,
630 },
631 },
Pete Bentley58c7f7d2022-03-31 16:47:25 +0100632 java_version: "1.8",
Colin Crossf569ee32018-09-11 22:38:08 -0700633}
634
635// Make the conscrypt-benchmarks library.
636java_test {
637 name: "conscrypt-benchmarks",
638 srcs: [
Paul Duffin31d1d152018-09-19 15:03:21 +0100639 "repackaged/testing/src/main/java/**/*.java",
640 "repackaged/benchmark-base/src/main/java/**/*.java",
641 "repackaged/benchmark-android/src/main/java/**/*.java",
Colin Crossf569ee32018-09-11 22:38:08 -0700642 ],
Paul Duffin1f66bef2019-06-12 11:04:35 +0100643 sdk_version: "none",
Paul Duffin8e719de2019-10-02 12:19:33 +0100644 system_modules: "art-module-intra-core-api-stubs-system-modules",
Colin Crossf569ee32018-09-11 22:38:08 -0700645 libs: [
Neil Fuller719e00f2018-10-19 09:32:43 +0100646 "conscrypt",
Colin Crossf569ee32018-09-11 22:38:08 -0700647 "junit",
648 "bouncycastle-unbundled",
649 "bouncycastle-bcpkix-unbundled",
650 "bouncycastle-ocsp-unbundled",
651 "caliper-api-target",
652 ],
Neil Fuller5d272352018-10-12 22:10:57 +0100653
Colin Crossf569ee32018-09-11 22:38:08 -0700654 javacflags: [
655 "-Xmaxwarns 9999999",
656 //"-Xlint:all",
657 //"-Xlint:-serial,-deprecation,-unchecked",
658 ],
659
Yo Chiang8e450f02020-08-07 04:22:18 +0000660 target: {
661 host: {
662 required: ["libjavacrypto"],
663 },
664 darwin: {
665 // required module "libjavacrypto" is disabled on darwin
666 enabled: false,
667 },
668 },
Pete Bentley58c7f7d2022-03-31 16:47:25 +0100669 java_version: "1.8",
Colin Crossf569ee32018-09-11 22:38:08 -0700670}
Paul Duffin403d5052019-11-25 19:56:01 +0000671
672// Device SDK exposed by the Conscrypt module.
673sdk {
674 name: "conscrypt-module-sdk",
Paul Duffinb1919d62021-05-21 13:15:42 +0100675 bootclasspath_fragments: [
676 "com.android.conscrypt-bootclasspath-fragment",
Paul Duffinec02a052021-04-19 18:00:55 +0100677 ],
Paul Duffin83431472020-04-09 21:44:10 +0100678 java_sdk_libs: [
679 "conscrypt.module.public.api",
680 "conscrypt.module.intra.core.api",
681 "conscrypt.module.platform.api",
Paul Duffin403d5052019-11-25 19:56:01 +0000682 ],
683 native_shared_libs: [
684 "libconscrypt_jni",
685 ],
Paul Duffin403d5052019-11-25 19:56:01 +0000686}
Paul Duffinb3fbef32019-12-09 13:42:13 +0000687
Paul Duffin414f5232019-12-16 20:30:20 +0000688// Host tools exported by the Conscrypt module.
689module_exports {
690 name: "conscrypt-module-host-exports",
Paul Duffinb3fbef32019-12-09 13:42:13 +0000691 host_supported: true,
692 device_supported: false,
693 java_libs: [
694 "conscrypt-unbundled",
695 ],
Nicolas Geoffray42c20732020-04-23 15:10:56 +0100696 native_shared_libs: [
697 "libconscrypt_openjdk_jni",
698 ],
Paul Duffinb3fbef32019-12-09 13:42:13 +0000699}
Paul Duffin538cb632019-12-09 13:41:08 +0000700
701// Test libraries exposed by the Conscrypt module.
702module_exports {
703 name: "conscrypt-module-test-exports",
Nicolas Geoffraye3e93e72020-04-03 09:05:56 +0000704 host_supported: true,
705 target: {
706 android: {
707 java_libs: [
708 // For use by robolectric and ART tests.
Paul Duffin6e8a57c2021-04-19 18:00:55 +0100709 "conscrypt-for-host",
Nicolas Geoffraye3e93e72020-04-03 09:05:56 +0000710 ],
711 java_tests: [
712 // For use by CTS
713 "conscrypt-tests",
714 ],
Nicolas Geoffray7d5b4822020-04-08 18:09:51 +0100715 // TODO: Remove this when we resolve b/151303681.
716 native_shared_libs: [
717 "libjavacrypto",
718 ],
Nicolas Geoffraye3e93e72020-04-03 09:05:56 +0000719 },
720 darwin: {
721 enabled: false,
722 },
723 // For use by ART tests on host.
724 not_windows: {
725 native_shared_libs: [
726 "libjavacrypto",
727 ],
728 },
729 },
Paul Duffin538cb632019-12-09 13:41:08 +0000730}