Commit graph

577 commits

Author SHA1 Message Date
Colin Cross
a54f4b5262 Use missing.x509.pem instead of missing.pem for faked missing certificates
sign_target_files_apks and check_target_files_signatures require that
certificates have a .x509.pem extension and reject missing.pem.  Using
missing.x509.pem instead.

Bug: 259861670
Change-Id: I0b2367213a8cbe390c231a8609bb04df2b125eda
2022-11-21 04:35:55 +00:00
Alix
8062f4dee7 bp2build for java_library with .kt srcs or common_srcs
java_library modules with .kt srcs or common_srcs will be converted into
module type kt_jvm_library

Test: m bp2build, manually inspected build files for allowlisted modules
Bug: 258688914
Change-Id: I8293a11c8247b4b76358d0991f82c6b61b58adc3
2022-11-15 20:01:29 +00:00
Jingwen Chen
6817bbb3c8 Introduce BazelStringOrLabelFromProp.
Soong supports string properties, but they are overloaded, and can mean
one of three things:

* path reference
* module reference
* string literal

Bazel has different types: label and string attributes. Thus there needs
to be a way to categorize them correctly in bp2build.

This CL introduces a new function to be used on properties like
apex_key.private_key / apex_key.public_key, as well as
android_app.certificate / apex.certificate.

It is important to disambiguate the prop betenn a string literal
attribute or file/rule target label attribute, so this functions does
just that.  The new attributes are then further handled by their
respective macros (apex_key, android_binary, apex).

Bug: 253557437
Fixes: 253557437
Test: presubmits, new tests

Change-Id: Id8111cdd60d3aabcae7d17fe9da84d0ee3966023
2022-10-20 14:57:37 +00:00
Jihoon Kang
0b5f7f153f Merge "Specify jnilib partition in Android-<target>.mk" 2022-10-05 16:19:51 +00:00
Jihoon Kang
f78a890183 Specify jnilib partition in Android-<target>.mk
Context
- Android-<target>.mk currently does not contain information about partition for its dependent unembedded jni libraries, but only lists the name of the unembedded jni libraries.
- If an android_app module depends on an unembedded jni library that is located in a different partition, make cannot find the library.

Implementation
- Create a string field partition in jniLib struct.
- Add variable "LOCAL_SOONG_JNI_LIBS_PARTITION_<target>", an array of mappings of the name of the jni library to its partition.

Bug: 154162945
Test: m
Change-Id: I6b8e1272ff59dc70e3dd6ce8c6c8e4686dad76df
2022-10-04 03:26:05 +00:00
Jingwen Chen
bea58093b4 Share certificate bp2build between android_app and apex.
The certificate module is handled the same in Soong between android apps
and apexes, so share the bp2build code as well.

There are a few changes in this CL:

- If override_apex.certificate is unset, the generated apex also unsets
  it. This prevents the generated apex from using the base apex's
  certificate, which is most likely incorrect (e.g. google variant using
  the cert for the aosp variant). Instead, rely on the default
  certificate handling in the macro.
- If the certificate prop is a string, then it gets generated into
  certificate_name in order to disambiguate. This behavior is identical
  to android_app.

Test: added various unit tests.

Bug: 249089160
Fixes: 249089160
Change-Id: I99e18964ff546429a985d0f64dc21e2c69d35d9d
2022-10-03 09:20:47 +00:00
Harshit Mahajan
964a46cb64 Merge "Enforce mainline modules to have latest target sdk version by default." 2022-09-27 17:04:27 +00:00
Rico Wind
6008155960 Merge "Add soong support for resource shrinking" 2022-09-24 05:19:33 +00:00
Rico Wind
351bac996c Add soong support for resource shrinking
This adds a new flag to the optimize section to allow invoking the resource shrinker

Bug: 246217952
Test: m
Change-Id: I2e7851af1189db2a6adf6f9f9f444a1d7f3a8d60
2022-09-23 19:11:11 +02:00
Harshit Mahajan
5b8b730cdd Enforce mainline modules to have latest target sdk version by default.
Due to GMS target SDK requirements (https://docs.partner.android.com/gms/policies/preview/mba#min-target-sdk)
we need to ensure all the  mainline packages to target latest API
level. Currently, the team chases each module to bump their target
API level.

Updating the build code to make sure that mainline modules
(i.e updatable modules) target the latest sdk version by default.
It would be by default set to 10000 before SDK finalization and updated to the new API level after finalization.

Effectively it would mean:
1. '10000' in aosp and internal master
2. Finalized number in development branches like "33" in "tm-dev"
3. As sdk hasn't been finalised in "udc-dev", it would be "10000"
which would be automatically updated to finalized version after sdk finalization.

For local development if the target sdk version is required to be set,
users would need to set Updatable flag to false.
Enforce_default_target_sdk_version flag needs to be used in bp file,
if this feature needs to be tested locally when updatable: false.

Bug: b/227460469
Test: m nothing
Change-Id: I05e0ae74ae44fd73df75e91b926bcc924446253f
2022-09-21 19:09:38 +00:00
Colin Cross
bc2c8a7517 Move AllowMissingDependencies handling into processMainCert
I046d75dbbd4f21f4a2b6851f558e430e9879fcff fixed android_app modules
with missing certificate dependencies when AllowMissingDependencies
was set, but the same problem can occur in android_app_import and
android_rro modules.  Move the AllowMissingDependencies handling
into processMainCert so that it applies to all of them.

Bug: 246649647
Test: TestAppImportMissingCertificateAllowMissingDependencies
Change-Id: Ic7dd3e61e0e3af15c53b583cf680b1e52394a018
2022-09-14 12:48:17 -07:00
Treehugger Robot
48ec5b302a Merge "Add lint test property" 2022-08-16 21:23:12 +00:00
Cole Faust
d57e8b2c2a Add lint test property
Some libraries are only used for tests, but
are not test module types. These modules get warnings
about @VisibleForTesting usages when they really
shouldn't. Expose a test flag that module authors
can use to make lint treat a module as test code.

Bug: 235339747
Test: Manually tested applying it to SystemUI-tests
Change-Id: I1356749a669dc80a7725605d7159da27c9a211b4
2022-08-11 12:26:51 -07:00
Treehugger Robot
2a20239c70 Merge "Use aapt2" am: 258d296698
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2178198

Change-Id: I9fa8b617a0854826f6f4da5a66618d17338c5772
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 02:17:45 +00:00
Treehugger Robot
258d296698 Merge "Use aapt2" 2022-08-10 01:21:11 +00:00
Romain Jobredeaux
20f7fbc61e Merge "Bp2Build converter for android_library_import and android_library." am: aaf4f5ec8a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2165698

Change-Id: I7b1a2b36507a3354bbe35769fdfebfdeb859066a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-09 18:14:50 +00:00
Saeid Farivar Asanjan
fd27c7cbcc Use aapt2
Replace usage of `aapt` with `aapt2`.

Bug: 236602069
Test: m nothing
Change-Id: I0c3b224351aff82fa251fbe83447fd262ab520b1
2022-08-08 20:21:32 +00:00
Romain Jobredeaux
c9b2bba3cd Bp2Build converter for android_library_import and android_library.
Minor refactor of android_app converted to account for common attributes
between library and app.

Test: go test
Test: ../bazel/ci/bp2build.sh
Change-Id: I60b06eef6d2b9bc2d91f8b83522747ebbe76bbb6
Bug: 215230093
Bug: 215230095
2022-08-08 11:23:02 -04:00
Spandan Das
83df960615 Merge "Set targetSdkVersion to 10000 for MTS tests targeting current" am: 0264058aea
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2164782

Change-Id: Ifff15aa2a63aed775150aa6d6147e6300633cbfb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-06 01:50:06 +00:00
Spandan Das
9f7ae7f565 Set targetSdkVersion to 10000 for MTS tests targeting current
MTS tests built on unstable branches (e.g. git_master) should be testable on
old system images (e.g. S). However, they run into an error during installation
on older images:
`Requires development platform $<current_codename>, but this is a
release platform`

This CL fixes this issue by updating the target_sdk_version of MTS test apps
targeting current to the magical sdk_version 10000

Bug: 227473065
Test: go build ./java
Test: TH
Change-Id: Ic0358a48a19dc239defbb4ee8ec99225cce75584
2022-08-04 21:23:14 +00:00
Alexei Nicoara
342945df01 Merge "Overriding placeholder version in updatable apks" am: 075571b5e7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2167106

Change-Id: Ie411cb4fb7ba5c4c8b402bff916ac55fa1b6def8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-04 08:52:28 +00:00
Alexei Nicoara
075571b5e7 Merge "Overriding placeholder version in updatable apks" 2022-08-04 08:28:16 +00:00
Sam Delmerico
9276c1a4bb Merge "copy JNI from AAR files to android_app APK" am: fb845984df
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2149174

Change-Id: I8697a193bf054623dcdf67f6beded56a75c52875
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-03 13:31:01 +00:00
Alexei Nicoara
69cf0f3756 Overriding placeholder version in updatable apks
Test: presubmit, checked the app version after build locally
Bug: 231691162
Change-Id: Icd242432540ea424235b226a45aac839dbc995be
2022-08-03 12:05:14 +01:00
Sam Delmerico
82602492fc copy JNI from AAR files to android_app APK
JNI libs present in AAR files are ignored in the build. If those
libraries are necessary, they must be manually extracted and a
prebuilt_cc_library module must be created for them. Instead, we can
extract these libraries and copy them to an output APK as part of the build.

Bug: 228848794
Test: created android_app that depends on an android_library_import with
  JNI embedded, and verified that .so libs are present in APK
Test: created android_app that depends on an android_library which
  depends on android_library_import with JNI embedded, and verified
  that .so libs are present in APK
Test: verified that multiple .so's from a single architecture are copied
  to APK
Test: verified that the absence of a jni/<arch> folder or files in the
  folder will cause the Ninja action to error
Change-Id: I242a862d7bd881f7a4a8c23493924d8fe441ea25
2022-08-02 16:12:06 -04:00
Xin Li
313fdb5812 Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014
Merged-In: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
Change-Id: If059be00e6bdaaa94171b456afae1d585540639c
2022-06-28 21:23:06 +00:00
Ivan Lozano
3742d6ad9e Merge "rust: Allow rust_ffi_shared in jni_libs" 2022-06-28 12:57:05 +00:00
Ivan Lozano
7f67c2a665 rust: Allow rust_ffi_shared in jni_libs
Allow listing rust_ffi_shared modules as a jni_libs dependency
in conjunction with platform_api: true. This allows inclusion by
android_app modules.

Bug: 237304791
Test: android_app module builds with a rust_ffi_shared dependency.
Change-Id: I3a28e1baa522ad8f9c2aa86f1d23b19ce9f967e1
2022-06-27 16:00:26 -04:00
TreeHugger Robot
49030cd143 Merge "Move embedded notice file path above aapt rule generation" into tm-dev am: 8378feda12
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/19049995

Change-Id: I3a23f9b49c98c0c6662c768ac8b07b1d4dbeeff4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-23 20:07:24 +00:00
Colin Cross
61fb62e5e3 Move embedded notice file path above aapt rule generation
The embedded notice file generation for apps was moved below the aapt
rules, which meant the added asset path was ignored.  Move the code
to pick the notice file path selection back above the aapt rules,
and leave the code to generate the notice file rule where it is.

Bug: 236006463
Test: m NetworkStack ALWAYS_EMBED_NOTICES=true
Change-Id: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
Merged-in: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
2022-06-23 18:05:47 +00:00
Colin Cross
3d6cfd14d3 Move embedded notice file path above aapt rule generation
The embedded notice file generation for apps was moved below the aapt
rules, which meant the added asset path was ignored.  Move the code
to pick the notice file path selection back above the aapt rules,
and leave the code to generate the notice file rule where it is.

Bug: 236006463
Test: m NetworkStack ALWAYS_EMBED_NOTICES=true
Change-Id: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
Merged-in: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
2022-06-23 18:05:09 +00:00
Treehugger Robot
302846a63b Merge "Fix strip_prefix flags to strip install paths." am: 20b623da89 am: 28b9607224
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2120624

Change-Id: I5c9edaeb2df8a61eb18fe9368dd2f8e9d1321343
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-10 20:32:30 +00:00
Bob Badour
3d16d5ddf8 Fix strip_prefix flags to strip install paths.
Bug: 235331488

Test: m droid dist

Change-Id: I3cd2af5d90e46a4c983728bc9b2d941d6ffda229
Merged-in: I3cd2af5d90e46a4c983728bc9b2d941d6ffda229
2022-06-09 15:00:08 -07:00
Bob Badour
c6ec9fb849 Fix strip_prefix flags to strip install paths.
Bug: 235331488

Test: m droid dist

Change-Id: I3cd2af5d90e46a4c983728bc9b2d941d6ffda229
2022-06-09 14:24:41 -07:00
Jared Duke
2ecf00081a Merge "Revert "Revert "Use D8 by default for android_test""" am: 44338663a5 am: d810453e7c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2115753

Change-Id: Ibb75070b8e99a4b1b522af5586536ee2652c6e16
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-02 23:30:03 +00:00
Jared Duke
44338663a5 Merge "Revert "Revert "Use D8 by default for android_test""" 2022-06-02 22:35:43 +00:00
Jared Duke
63a3da94d1 Revert "Revert "Use D8 by default for android_test""
This reverts commit 4e445be558.

Reason for revert: GtsExoPlayerTestCases now uses multidex.

Test: m + manual builds for test_suites_x86_64_coverage
Change-Id: I608b3b79137b216f546446e1c4f89f4542572581
Bug: 192032291
2022-06-02 19:12:30 +00:00
Treehugger Robot
d4899ce231 Merge "Revert "Use D8 by default for android_test"" am: 14b500daba am: 1e2e5fcb73
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2100965

Change-Id: I263ec410fc4a118374989d16e0fadee30d9ddf63
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-23 06:20:25 +00:00
Treehugger Robot
14b500daba Merge "Revert "Use D8 by default for android_test"" 2022-05-23 05:49:40 +00:00
Jared Duke
4e445be558 Revert "Use D8 by default for android_test"
This reverts commit 02edc10047.

Reason for revert: Breaks test_suites_x86_64_coverage

Bug: 233421462
Change-Id: I7b04d3fd7802be0f271ea3c29ef25e3d08ab1389
2022-05-23 04:00:44 +00:00
Bob Badour
efdf8ab4cc Fix bug: allow multiple gen_notice modules. am: a5ea2479d3 am: d9771dedbb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2098696

Change-Id: I921b541c513779e4a73a70876a9ffff23e4361f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-21 03:22:39 +00:00
Bob Badour
a5ea2479d3 Fix bug: allow multiple gen_notice modules.
Test: m cts dist reportmissinglicenses

Change-Id: I07963c83eaddfe363a04871e813b56fe7f1465ad
2022-05-20 16:54:00 -07:00
Treehugger Robot
7158bc6012 Merge "Use D8 by default for android_test" am: 1811ed3764 am: db7ee090e1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2097291

Change-Id: I898a3308b5fe5d7477a261fc4d20871f5cacb01d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-20 23:23:50 +00:00
Treehugger Robot
1811ed3764 Merge "Use D8 by default for android_test" 2022-05-20 22:46:15 +00:00
Jared Duke
02edc10047 Use D8 by default for android_test
android_test defaults to using R8, but with shrinking, optimization and
obfuscation disabled, eliminating most of the benefits of R8. Instead,
use D8 by default, improving build performance and avoiding any other
issues that may arise in test-specific code related to whole-program R8
execution. An initial audit shows that android_test targets that *do*
enable shrinking or optimization also explicitly opt in to R8.

A follow-up CL will do the same for android_test_helper_app, but that
requires some additional auditing of downstream targets.

Bug: 192032291
Test: m + presubmit
Change-Id: I5b14a0986dde210f241a77c3a93daacf9e53d667
2022-05-20 12:02:13 -07:00
Bob Badour
00d6beecc9 Merge "Add gen_notice module." am: 335a4333fe am: 15aba3f5e0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2095028

Change-Id: I56c39b0693a8a18b6e43f0536c724e5b26338504
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-19 19:09:45 +00:00
Bob Badour
335a4333fe Merge "Add gen_notice module." 2022-05-19 18:03:09 +00:00
Bob Badour
eef4c1c563 Add gen_notice module.
Refactor notices to support notices for multiple modules.

Enforce visibility and handle missing dependencies.

Bug: 213388645

Change-Id: Id6a81987f087419ad37d0cce57a71e8a7c4cd6e0
2022-05-18 16:38:19 -07:00
Colin Cross
d7d2a2a6bf Merge "Fix prebuilts of overridden apps" into tm-dev 2022-05-18 17:40:23 +00:00
Colin Cross
5088544ddc Fix prebuilts of overridden apps
AndroidApp had its own HideFromMake method and flag that shadowed
the one in ModuleBase.  This caused performOverrideMutator to set the
AndroidApp flag, but ModuleBase.skipInstall to read the ModuleBase
flag, resulting in a conflicting install rule being created.  Remove
AndroidApp's HideFromMake in favor of the ModuleBase one.

Bug: 232788722
Test: TestOverrideAndroidAppWithPrebuilt
Change-Id: I8c0dfcb50ff4dc1e4d0574f150b10d79908f46aa
Merged-In: I8c0dfcb50ff4dc1e4d0574f150b10d79908f46aa
(cherry picked from commit aaa0c1ffcd)
2022-05-17 14:39:36 -07:00