Commit graph

513 commits

Author SHA1 Message Date
Spandan Das
456a77e9a0 Update sdk_version check for jni_libs of updatable apps
With aosp/1640364, all variants of a cc_* module use min_sdk_version as
the version part of the clang triple. Therefore, checking
min_sdk_version of jni_libs should be sufficient to ensure that there is
no unintended access to symbols in newer Android versions

Test: go test ./java
Test: TH
Bug: 155209650
Bug: 209409604

Change-Id: I6c064f8a6ea12c8aa40165a9063380306a180c9b
Merged-In: I6c064f8a6ea12c8aa40165a9063380306a180c9b
(cherry picked from commit 2e8c044b2c)
2022-05-13 19:15:58 +00:00
Paul Duffin
3953153c9e Prevent non-app/non-test modules from statically including jacocoagent
Previously, the .impl library of java_sdk_library modules would end up
with the jacocoagent statically included. That is because their
Instrument flag was set to true when created by their parent. As that
was before the deps were added that meant that they ended up with a
static dependency on jacoagent (at least when UnbundledBuild() was
true).

That was not previously a problem because the .impl files were only
used at build time. However, a recent change to make updatable-media
statically include framework-media.impl (which statically included the
jacocoagent classes) broke the coverage build because the jacocoagent
classes are not in the permitted packages for the updatable-media.

When instrumenting the bootclasspath the jacocoagent library is added
to the art-bootclasspath-fragment.

The jacocoagent should only be statically included in apps, or test
apps. This change adds an extra flag to specify whether the module type
supports statically including the jacocoagent. This is set to true by
apps and test apps but not when the java_sdk_library creates the .impl
java_library preventing it from statically including jacocoagent.

Bug: 230967146
Bug: 229932396
Test: COVERAGE_MODULES=media \
      PRODUCT=mainline_modules_x86 \
      TARGET_BUILD_APPS=com.google.android.media \
      vendor/google/build/build_unbundled_coverage_mainline_module.sh
      # Fails without this change, passes with it.
Change-Id: Ic95cf11a05f59b67e623474ed3dd9be6b4442c42
2022-05-03 00:46:55 +00:00
Colin Cross
6bfe9bc4fa Merge changes I046d75db,Ie13817dc am: d2aa190bdc am: f2c86c8c76 am: 1a3ea67458
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2058908

Change-Id: I9ab91976903abbb4e3ec17b3d26db15447f074d6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-12 00:58:51 +00:00
Colin Cross
412436f7fe Don't panic if no certificates found
Getting the first certificate will panic if there are no certificates,
which can happen when AllowMissingDependencies is set and the
certificate property is a module reference to a missing module.
Only get the first certificate if the list is not nil.

Bug: 228379411
Test: TestAppMissingCertificateAllowMissingDependencies
Change-Id: I046d75dbbd4f21f4a2b6851f558e430e9879fcff
2022-04-11 11:50:34 -07:00
Matt Banda
8c80126987 Surface Java APIs Used By APK-only Modules.
Previously we were only generating used-by API-coverage for APEX modules.
This change adds support for APK-only modules such as NetworkStack and DocumentsUI.

Bug: b/216313756
Forrest Run: https://android-build.googleplex.com/builds/abtd/run/L10800000953846781

Test: TARGET_BUILD_VARIANT=userdebug PRODUCT=mainline_modules_x86 ./vendor/google/build/build_unbundled_coverage_mainline_module.sh -j16

Change-Id: Id17e4a55c2a52e9903632a654e778f8d54982dfc
Merged-In: Id17e4a55c2a52e9903632a654e778f8d54982dfc
(cherry picked from commit 56d75785bd)
2022-04-05 21:28:29 +00:00
Treehugger Robot
c7f2125a26 Merge "Keep dependency files out of the apk file." am: 5f58c378b6 am: d4a37e0757 am: f82be53525
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2055425

Change-Id: Ifdaf251cae92a6cb38f338e1455390fea84fc5df
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-05 06:50:38 +00:00
Bob Badour
2c8888edef Keep dependency files out of the apk file.
Bug: 227682036

Test: TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_bundles.sh -j97

Change-Id: I1a9775af7c652191bb1ce3b97c1cb9365b469c19
2022-04-04 19:21:18 -07:00
Bob Badour
0a6539dd21 Merge "Revert "Revert "Build notice files from license metadata.""" am: 3aae38d451 am: b0489dec23 am: bf82573d27
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2051564

Change-Id: I0a1a9a0ea0ccd052dbc84cc6b2cce0b128393f63
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-02 01:48:21 +00:00
Bob Badour
de6a087d2d Revert "Revert "Build notice files from license metadata.""
This reverts commit 77807b3c27.

Reason for revert: fix and roll forward again

Change-Id: I80c796ca81ecf29df9522babe54d684a0d11b9e6
2022-04-01 18:00:00 +00:00
Wei Sheng Shih
67c0b63929 Revert "Build notice files from license metadata." am: 77807b3c27 am: 72f9cdb599 am: 6c698e406d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2052565

Change-Id: I7e4f410833a4b8349e476d6fca4b2161c8f254f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-01 17:26:29 +00:00
Wei Sheng Shih
77807b3c27 Revert "Build notice files from license metadata."
This reverts commit 43c2dcaef6.

Reason for revert: suspect build break

Bug: 227682036

Test: TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_bundles.sh -j97


Change-Id: Ibfb8b4fefc264f52f32ba661c269a9cd625d800a
2022-04-01 14:10:53 +00:00
Bob Badour
c64d309ce2 Fix breakage: bad path join using '/' literal am: 2a5c090c31 am: cf96d25b3d am: ec84245e25
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2052015

Change-Id: I5e8ea66626e0cde29a7c24f370b85548ae6b5d4a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-01 09:27:15 +00:00
Bob Badour
2a5c090c31 Fix breakage: bad path join using '/' literal
Typo in filename s/b NOTICE.html.gz not NOTICES.html.gz

Bug: 227682036

Test: TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_bundles.sh -j97

Change-Id: I75cc28e3ef22d975ad46f4e167071f6d82ba253d
2022-03-31 23:40:28 -07:00
Bob Badour
8d17118d5a Build notice files from license metadata. am: 43c2dcaef6 am: 6f7de5b1a9 am: cbcf8d9b05
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2047886

Change-Id: I6a76eee6321538b70c331a2e2a9cb1e5b644ac04
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-31 23:13:51 +00:00
Bob Badour
43c2dcaef6 Build notice files from license metadata.
Switch from generate-notice-files.py and mergenotice.py to htmlnotice.

Bug: 151177513
Bug: 213388645
Bug: 210912771

Test: m droid dist reportmissinglicenses
Change-Id: I6cac049d24f35ec358c6f341a04f4ba6161703bf
2022-03-31 17:29:01 +00:00
Treehugger Robot
5d123b15d9 Merge changes from topic "no-srcs-no-deps" am: d93afba1e6 am: d218781011 am: beb28cd9ad
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1995730

Change-Id: I8c8c7b973ffc6a6dfd91c35dc96e73c42bf30577
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-30 22:07:01 +00:00
Sam Delmerico
c016143602 emulate java_library static_deps with Bazel exports
In Soong, java_library can specify static_deps which are dependencies
that get aggregated into the final jar (akin to static linking). This is
useful because it allows dependencies higher up in the chain to compile
against the APIs exported by transitive dependencies. Bazel does not
support this functionality directly, but it can be emulated via the
exports attribute which makes any targets listed in the attribute public
to targets further up the chain.

Bug: 217236083
Bug: 219908977
Test: b build //external/error_prone:error_prone_core
Test: b build //external/bouncycastle:bouncycastle-host
Test: b build --platforms=//build/bazel/platforms:linux_x86
  //prebuilts/sdk/tools/jetifier/jetifier-standalone:jetifier
Change-Id: I2867e3f816de720a6f4bd9ff7a847d1b0c2da2d6
2022-03-30 18:58:38 +00:00
Sam Delmerico
865358d90c Merge "convert android_app certificate property, bp2build" am: d508a638c3 am: 9e3f98b8cf am: 19b7975f03
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1980606

Change-Id: Iaa8fb9a85d42e2c299fadd34f81fe0b55bcd1a9a
2022-03-04 18:39:36 +00:00
Sam Delmerico
9dfb139b6d convert android_app certificate property, bp2build
The android_app certificate property can be converted to the
@android_rules debug_signing_keys attribute in Bazel after converting
the .pk8/.pem key pairs to a JKS keystore in Starlark.

Test: b build -s //frameworks/base/tests/appwidgets/AppWidgetHostTest
  and verify includes SignApk action with generated keystore
Bug: 194133023
Change-Id: I2c4276f94a7856fc68a7674e89742f887dca31b4
2022-02-18 20:17:01 +00:00
zhidou
a2ce78f80d Make "overrides" attribute of Android_app overridable
Move overrides attribute from appProperties to overridableAppProperties

Bug: 220029162
Test: m
Change-Id: I6f527df3173f142311734333ad37018c83d5e279
2022-02-17 13:40:53 +00:00
Paul Duffin
3ed2d0e53c Merge "Add support for excluding libraries from class loader contexts" am: e95d77b964 am: ab9e6fe18f am: 7c89c48887 am: 10ccb6c274
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1971343

Change-Id: Ia03300d88199034f2cf07dbb9ca229e5e13ceb00
2022-02-07 18:39:48 +00:00
Paul Duffin
0653057603 Add support for excluding libraries from class loader contexts
A number of tests in the cts/tests/signature/api-check check for the
accessibility of classes from the android.test.base,
android.test.runner and android.test.mock libraries. Some tests expect
to find the classes other do not. Unfortunately, the tests use
libraries, specifically compatibility-device-util-axt, that depend on
the android.test... libraries which causes Soong to implicitly add
<uses-library> entries to the manifest so that they will be accessible
at runtime. That causes the tests that do not expect to find the
classes to fail.

Bug: 209607558
Test: m nothing
Change-Id: I54c194ab23d5a70df790ece3fe98f2b3d6a1c1f6
2022-02-07 14:57:53 +00:00
Romain Jobredeaux
a50778b117 Merge "Use common java library attributes for android_app bp2build converter." am: 99a81c8dfd am: abf2323829 am: 7b368117a6 am: 9be703df2c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1969119

Change-Id: I49791f01bdeced17d8ce5964d7e170ef588b922a
2022-02-03 22:16:09 +00:00
Romain Jobredeaux
e8acade177 Use common java library attributes for android_app bp2build converter.
Change-Id: I4dc7600fbe80eddc54a7fadd6418d6911af0b7f2
Test: go test ./bp2build
2022-02-02 12:18:37 -05:00
Romain Jobredeaux
9246215c1d Merge "Revert "Revert "Add static_libs support to android_app bp2build converter.""" am: f49ca9e40d am: 2303c67479 am: b2e3ee4575 am: 0b93c3e3f1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1948956

Change-Id: I8ba757d3164908e6c2f9361cb2d6f8735c67a98b
2022-01-21 22:13:58 +00:00
Romain Jobredeaux
f49ca9e40d Merge "Revert "Revert "Add static_libs support to android_app bp2build converter.""" 2022-01-21 20:51:06 +00:00
Romain Jobredeaux
355851b520 Revert "Revert "Add static_libs support to android_app bp2build converter.""
This reverts commit b33e0b8b5b.

Reason for revert: CI failure deemed to be a fluke

Change-Id: Ia804d531092921e4ad090740420c4a4e02e6ff00
2022-01-19 21:13:51 +00:00
Romain Jobredeaux
cd41dd5c33 Merge "Revert "Add static_libs support to android_app bp2build converter."" am: 8a9a97b4a0 am: 474eddd20b am: 9b36f4b981 am: c19a2c16bd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1948756

Change-Id: I36a0fd3f7147ef9975f55b61e872020a4bcd6c9e
2022-01-13 17:57:52 +00:00
Romain Jobredeaux
8a9a97b4a0 Merge "Revert "Add static_libs support to android_app bp2build converter."" 2022-01-13 17:03:26 +00:00
Romain Jobredeaux
8a36f521f8 Merge "Add static_libs support to android_app bp2build converter." am: 24431448b2 am: 6eae04a33f am: 519e09f11d am: 9dbe366934
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1917405

Change-Id: I253922076c5eb0e947bcc6948987b8d38e9c4f06
2022-01-13 16:02:34 +00:00
Romain Jobredeaux
b33e0b8b5b Revert "Add static_libs support to android_app bp2build converter."
This reverts commit de722acd96.

Reason for revert: broke bp2build CI

Change-Id: I535e8746e846c20f1a47c2a1eb0362276af49206
2022-01-13 15:16:12 +00:00
Romain Jobredeaux
24431448b2 Merge "Add static_libs support to android_app bp2build converter." 2022-01-13 15:00:44 +00:00
Treehugger Robot
d887d9b452 Merge changes I9ad66ea2,I4c95b77b am: 57271b9f45 am: a7c0107744 am: 16213c6bbe am: f7e9e1f434
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1934955

Change-Id: I5e05dbd3bca3c14bb52ad383c8af3eaf491222a1
2022-01-11 08:11:46 +00:00
Jooyung Han
01d80d8b4b Make android_app.stem overridable
override_android_app can set "stem" property to set the APK name.

Bug: 193504286
Test: m (soong test)
Change-Id: I9ad66ea28bd1b030cb2c588d1f070d72e62ab1c7
2022-01-11 13:07:44 +09:00
Jooyung Han
29e2f6d2c4 Use 'stem' to override APK name
When android_app.stem is set, use it as the APK name like other module
types.

Bug: 193504286
Test: m (soong test)
Change-Id: I4c95b77be382cff3cfecaf6ce38f99aed9f3238f
2022-01-11 13:03:49 +09:00
Romain Jobredeaux
de722acd96 Add static_libs support to android_app bp2build converter.
With this change we can allow list WifiDirectDemo, as its dependencies
happen to have manual BUILD file conversions.

Test: ./build/bazel/scripts/run_presubmits.sh
Change-Id: I68b4c2b129fe750913f013384c87a5332fdcc9b6
2022-01-07 16:47:14 -05:00
Treehugger Robot
dbd3553d83 Merge "Remove InstallBypassMake and ToMakePath" am: f1228f570a am: a9f335cf5a am: fd865c6688 am: 8ef2179a6e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1889722

Change-Id: If49c894804c5ca0dfd197ca848ff1c9ac79556f4
2021-12-17 07:36:53 +00:00
Colin Cross
c68db4b305 Remove InstallBypassMake and ToMakePath
InstallBypassMake and ToMakePath are obsolete, remove them.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
2021-12-15 15:22:53 -08:00
Liz Kammer
6299b235bb Merge "Use one mutator for all bp2build conversion." am: 92344259c5 am: 782f37eaee am: 5f4df317ee am: 037105c0f8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1878397

Change-Id: I56073dc653947ebf69d7a74e97c1092f06aab139
2021-12-14 20:25:04 +00:00
Liz Kammer
be46fccc40 Use one mutator for all bp2build conversion.
Each conversion required defining a separate mutator, which will each
operate on _all_ modules and requires each to repeat checks whether the
mutator should operator. Instead, we introduce a single mutator and
modules can define a ConvertWithBp2build to implement bp2build
conversion for that module.

Test: bp2build.sh
Bug: 183079158
Change-Id: I99d4b51f441c2903879092c5b56313d606d4338d
2021-12-14 09:37:45 -05:00
Romain Jobredeaux
fa0f10d6d3 Merge "Initial bp2build converter for android_app." am: 4526269c2e am: f7a7a95c07 am: 019d78829d am: 6ba0a6a4a9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1907394

Change-Id: Ia3aa0e678b02c8405b391fb2665be0c336798c57
2021-12-07 21:34:00 +00:00
Romain Jobredeaux
4526269c2e Merge "Initial bp2build converter for android_app." 2021-12-07 20:14:29 +00:00
Romain Jobredeaux
1282c42484 Initial bp2build converter for android_app.
The only supported attributes at this point are:
- srcs
- manifest
- package_name
- resource_dirs
as they most easily map to bazel's android_binary's srcs, manifest, custom_package, and resource_files respectively.
Allow-listing all apps that use these fields, along with sdk_version and dex_preopt. The latter 2 are ignored by the converter,
- sdk_version because we're currently relying on a single pre-built SDK,
- dex_preopt because,
   1. though it is not supported in Bazel builds yet, it doesn't prevent the apps from building, and
   2. the apps being converted only use the dex_preopt attribute to disable dex_preopt, which is what is happening anyway.

Change-Id: I4a4f771eeb8f60a1cd4844b2ac1ce3df7c070e73
Test: ./build/bazel/scripts/run_presubmits.sh
Bug: 198224074
Bug: 203688791
2021-12-07 09:41:49 -05:00
Artur Satayev
6e8071d17a Merge "Add ModuleWithMinSdkVersionCheck type." am: a4fc08d204 am: 25f5783263 am: fe55ffd190 am: 44d0ef55da
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1907860

Change-Id: I147da371d445f09ca2f131df1be91545eba37772
2021-12-06 18:09:34 +00:00
satayev
b3fd411465 Add ModuleWithMinSdkVersionCheck type.
This is to help following refactor for individual modules to have their
own version of checking where needed.

For example, apk in apex may want to enforce it's own version of
CheckMinSdkVersion.

Bug: 205923322
Test: presubmit
Change-Id: Ia2fad6c52af39e21f65385bcb283f1e3adab5548
2021-12-06 12:05:48 +00:00
Treehugger Robot
e558319465 Merge changes I9e38ac73,I9412147f am: 45da465ef6 am: 0a93afc2b9 am: 331599f461 am: 76df6461c5 am: 0d3522cece
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1887532

Change-Id: Ia74c51187284aad60b8e700c488a60a0083f4cfc
2021-11-11 07:35:58 +00:00
Colin Cross
fa9bfcd0d2 Honor PreventInstall for APKs and dexpreopt files
Native coverage builds create a second variant of APKs and set
PreventInstall on the non-coverage variant.  Skip calling
ctx.InstallFile for APKs and in dexpreopt when PreventInstall
is set.

Fixes: 205865567
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS="*" NATIVE_COVERAGE_EXCLUDE_PATHS="art bionic/libc device external/compiler-rt external/clang external/llvm external/swiftshader/third_party/llvm-10.0"
Change-Id: I9e38ac737315db12475e8f9bfb3e0e7c0327fc06
2021-11-10 16:42:38 -08:00
Colin Cross
da9b639573 Fix ctx.InstallFile calls for java modules am: 1d0eb7a9d0 am: c871fe905e am: 406461d954 am: 0978bcd3c1 am: 57c4a25fe3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1880649

Change-Id: Icd21a62944d48b02d573f109deb0333ffb63da77
2021-11-10 18:10:39 +00:00
Colin Cross
1d0eb7a9d0 Fix ctx.InstallFile calls for java modules
Call ctx.InstallFile on the primary install file last so that the
primary install file can depend on the extra install files, and so that
the primary install file can be inferred from the last installed file.

Add missing ctx.InstallFile calls for the dexpreopt and hostdex outputs.

Fix the install subdirectory for modules installing to the testcases
directory.

Bug: 204136549
Test: m checkbuild
Change-Id: I7edd7647be27439d3ca0ecc589ca5e89d4ba8474
2021-11-05 14:20:28 -07:00
Rupert Shuttleworth
8eab869bfe Add ability to set --rotation-min-sdk-version for signapk via Android.bp files.
(vs via Android.mk files, done earlier in http://ag/16094391)

Bug: 197787352

Test: Added unit tests.

Change-Id: I3ccd2f2134b069fb4c4a90fe384c23c1814c2ba2
2021-11-03 10:46:15 -04:00