Commit Graph

567 Commits

Author SHA1 Message Date
Treehugger Robot
02ab2a1db5 Merge "Read BUILD files in bp2build" am: 01f8784246 am: 73daae6519 am: 14923c16f8 am: 577e59bebb am: f4125ef827 am: 2c690369ea
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2617569

Change-Id: I3c0ede4919a1cc387bbc6005f50cb28cb44a9c09
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-10 03:08:30 +00:00
Chris Parsons
8152a94816 Read BUILD files in bp2build
The parsed BUILD files will be scanned for obvious definitions of BUILD
targets which have Android.bp counterparts. In such cases, bp2build will
automatically omit conversion of these defined modules (to prevent
collisions). With this change, we no longer need one-off denylisting of
modules which have BUILD file definitions.

This has a 0.03s to 0.2s slowdown for bp2build with current state. This
impact is identical on a heavier test branch, as well. I also ran an
experiment that applied BUILD scanning to all source BUILD files
(regardless of allowlisting), and this had a 2 second slowdown.

We may want to look into parallelizing or improving the performance of
this evaluation, but it's probably not worth the effort at this time,
since the current performance hit is small.

Test: New integration test
Test: Removed libprotobuf-python from denylist and tested building the
package
Test: Treehugger

Change-Id: Ibde3bab12cd4a8fed642ad46e5344a56953bec91
2023-06-09 16:02:40 +00:00
Jihoon Kang
a3479c0cf8 Introduce product variable Build_from_text_stub am: cbcad7c62f am: 8e27c844a7 am: 10d9c21e1d am: eb81e4cdac am: 87afa05ed6 am: a5aba303de
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2612390

Change-Id: I8893db86480b09dc278e50fe42cb7baca5e5f1de
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-06 21:47:42 +00:00
Jihoon Kang
8e27c844a7 Introduce product variable Build_from_text_stub am: cbcad7c62f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2612390

Change-Id: I1461724bf554f66f38bbd8d9569691795eef2e20
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-06 19:43:19 +00:00
Jihoon Kang
4190764669 Merge changes from topic "android_stubs_current_refactor"
* changes:
  Cleanup android.JavaApiLibraryName references
  Redefine core and core platform API surface java_library
  Introduce product variable Build_from_text_stub
  Introduce "Exclude_static_libs" property for Java modules
2023-06-06 19:16:25 +00:00
Steven Moreland
38962ec52e Merge "Remove SepolicySplit." am: 15a74066ea am: f4a9db7005 am: 1c21851153 am: 3137d16a1d am: 8f0f53d73b am: 7ac464d5b6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2610250

Change-Id: I2e700f96cd5a9c48efbddd5129361cc256bd17d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-06 02:45:31 +00:00
Steven Moreland
15a74066ea Merge "Remove SepolicySplit." 2023-06-05 23:08:24 +00:00
Jihoon Kang
cbcad7c62f Introduce product variable Build_from_text_stub
Build_from_text_stub can be used to specify static lib and exclude
static lib based on build configuration.

Bug: 285410821
Test: m
Change-Id: I083f32325c7b3ab5e88c4f5cb248c00f2094fb1e
2023-06-05 21:44:07 +00:00
Jiakai Zhang
7db6fc5f41 Merge "Add an allowlist for modules that have broken optional_uses_libs." am: 4f8b23e8e2 am: 9ec2a5568e am: e9aa9fdba0 am: ea123ebd24 am: 9e74da551e am: ad0a027256
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2612151

Change-Id: Ib50bece0819d5598b96cc1b7481cf52d0863ecdf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-05 18:37:02 +00:00
Jiakai Zhang
48203e3dee Add an allowlist for modules that have broken optional_uses_libs.
Bug: 282877248
Test: m nothing
Change-Id: I1afe9d523af0633f0428d4c15e1417db1dae4e93
2023-06-02 23:42:53 +01:00
Jiakai Zhang
fbd60faf3d Merge "Drop INTERNAL_PLATFORM_MISSING_USES_LIBRARIES." am: f508c252bb am: e36c0fa333 am: b712462847 am: b2e9deaf9a am: 982dd46413 am: a745dd69f2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2611189

Change-Id: I0c17e4a2b9ec8a5148cd532f85583cf6dcafafb2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-02 19:19:48 +00:00
Jiakai Zhang
4f65a03d30 Drop INTERNAL_PLATFORM_MISSING_USES_LIBRARIES.
Bug: 282877248
Test: Presubmit build tests.
Change-Id: Idd69433f308f5f47973ff0d5340a2399a27cb32c
2023-06-01 15:21:42 +01:00
Steven Moreland
26da122d61 Remove SepolicySplit.
Obsolete.

Bug: 257176017
Test: build&boot
Change-Id: Id639ad77f12d38507ad1a2300cb392bbfeadb9e4
2023-05-31 22:00:56 +00:00
Kiyoung Kim
b96142759c Merge "Rename build.ninja with product name" am: 5500fc89c1 am: babe56a6c8 am: 1fcb13ac2e am: 0b814fe80e am: 4704391ec7 am: d5ca114a34
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2546570

Change-Id: I4221a16074afd86ae987c84de5d612735ae05630
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-30 12:00:19 +00:00
Kiyoung Kim
5500fc89c1 Merge "Rename build.ninja with product name" 2023-05-30 07:17:08 +00:00
Kiyoung Kim
a37d9baa96 Rename build.ninja with product name
Current build.ninja does not contain any product name, while other ninja
files (such as combined ninja) do. This change adds product name to the
build.ninja so it can be separated over multiple lunch targets

Bug: 277029044
Test: build succeeded and checked if out/soong/build.ninja has been
renamed

Change-Id: I16dc71f829fd76f01b98da0d509a8e0ef6f62fa9
2023-05-25 10:09:45 +09:00
Treehugger Robot
7d6c9a6ded Merge "Sandbox inputs to aidl rule in cc" am: cd4e6a609e am: 713bbad7bd am: edc81c3ebc am: e605dc7081 am: 12b219771a am: bb2adbfa73
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2592446

Change-Id: I25eb772d3f73d182eed65e09701f503733b75a6a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-24 04:17:18 +00:00
Vinh Tran
fda7ec4179 Merge "Support sandboxing genrule" am: c1910c9e07 am: 4c2d3da52d am: 5f20657e28 am: 05dfb2cc03 am: dcf4c422e9 am: cefd24d4a9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2584923

Change-Id: Icffee9aad44f5cfa51072c29906ee915db2a96f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-24 02:09:39 +00:00
Treehugger Robot
cd4e6a609e Merge "Sandbox inputs to aidl rule in cc" 2023-05-23 23:40:35 +00:00
Vinh Tran
c1910c9e07 Merge "Support sandboxing genrule" 2023-05-23 21:29:27 +00:00
Vinh Tran
095819530a Sandbox inputs to aidl rule in cc
Bug: 279960133
Test: go test
Test: Remove hdrs prop from IDropBoxManagerService_aidl && run  BUILD_BROKEN_DISABLE_BAZEL=true m libservices && Expect an error from aidl
Change-Id: Ifdb260d8e2da9a5767f1e212393de4134b210616
2023-05-23 15:53:10 -04:00
Treehugger Robot
1befe407a1 Merge "Revert "Revert "Restrict plugins to an existing allowlist""" 2023-05-23 17:08:46 +00:00
Yu Liu
6a7940cc99 Support sandboxing genrule
Bug: 281067655
Test: local build
Change-Id: I123b5e51eaf1476d1215e5208331b6540d45fd98
2023-05-22 15:02:36 -07:00
Jihoon Kang
480943ff64 Generate java_api_library from java_sdk_library
This change enables java_sdk_library to generate java_api_library
modules per api surface, so that from-text stubs can be generated per
api domain scope. This module is only created when
`--build-from-text-stub` flag is passed during build.

Ignore-AOSP-First: config.apiLibraries list differ between AOSP and internal master
Test: enable disabled modules in java/core-libraries/TxtStubLibraries.bp then m art.module.public.api.stubs.from-text --build-from-text-stub
Bug: 276957733
Change-Id: Ic1ead15b3d0bcb921ca8d31bcaeeb4cd9ee8715c
2023-05-19 06:11:44 +00:00
Jihoon Kang
1c92c3e092 Generate java_api_library from java_sdk_library
This change enables java_sdk_library to generate java_api_library
modules per api surface, so that from-text stubs can be generated per
api domain scope. This module is only created when
`--build-from-text-stub` flag is passed during build.

Test: enable disabled modules in java/core-libraries/TxtStubLibraries.bp then m art.module.public.api.stubs.from-text --build-from-text-stub
Bug: 276957733
Change-Id: Ic1ead15b3d0bcb921ca8d31bcaeeb4cd9ee8715c
Merged-In: Ic1ead15b3d0bcb921ca8d31bcaeeb4cd9ee8715c
2023-05-19 06:07:37 +00:00
Liz Kammer
33cc80eb1f Revert "Revert "Restrict plugins to an existing allowlist""
This reverts commit b20a12553e.

Reason for revert: Rollforward with fix

soong-ca-certificates-apex was missing from allowlist

Test: verify fixes CI breakages
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dfe4a9e4dd088f42ba5e0a3c4f7777c253d378d3)
Merged-In: I00687bd2962dbdaaf55189ca4aa82183264eb8d7
Change-Id: I00687bd2962dbdaaf55189ca4aa82183264eb8d7
2023-05-18 18:20:28 +00:00
Treehugger Robot
12dc1a34c3 Merge "Revert "Revert "Restrict plugins to an existing allowlist""" into udc-dev-plus-aosp 2023-05-18 14:06:43 +00:00
Liz Kammer
dfe4a9e4dd Revert "Revert "Restrict plugins to an existing allowlist""
This reverts commit b20a12553e.

Reason for revert: Rollforward with fix

soong-ca-certificates-apex was missing from allowlist

Test: verify fixes CI breakages
Change-Id: I00687bd2962dbdaaf55189ca4aa82183264eb8d7
2023-05-18 13:28:23 +00:00
Treehugger Robot
44c9b696bf Merge "Revert "Restrict plugins to an existing allowlist"" into udc-dev-plus-aosp 2023-05-18 00:36:39 +00:00
Liz Kammer
b20a12553e Revert "Restrict plugins to an existing allowlist"
This reverts commit 09ddb3a73e.

Reason for revert: breaks branches without vendor

Change-Id: I2de95d7b99e4e5fd3d696f51d5b4d6a68a298365
2023-05-17 22:51:43 +00:00
Treehugger Robot
9267a344be Merge "Restrict plugins to an existing allowlist" into udc-dev-plus-aosp 2023-05-17 15:44:58 +00:00
Joe Onorato
fee845a737 Aconfig rules
Test: m services_device_config (which runs sooong tests too)
Change-Id: I432e914d01d2bff77ba68de65ae5baea527090f5
2023-05-13 11:32:25 -07:00
MarkDacek
1de78f3174 Fix instantiation of config.bazelForceEnabledModules
Currently, uninstantiated, the field will be set to [""]
instead of an empty slice.

Test: m nothing --ensure-allowlist-integrity
Test: m nothing --ensure-allowlist-integrity
--bazel-force-enabled-modules=com.google.android.neuralnetworks (this
fails, as expected)

Change-Id: Ib4cd26f0cb0d40714b8c3f263ee2d22093ee15ef
2023-05-03 03:48:27 +00:00
MarkDacek
6f6b962bd0 Modify --ensure-allowlist-integrity call to avoid spurious errors.
We now ensure that the module is disabled and _not_ enabled before
failing the build.

Bug: 280439299
Test: m nothing --ensure-allowlist-integrity --bazel-mode-staging (on
master and aosp)

Change-Id: I59c969a27b064f07913a511cb29bc06d23daa371
2023-05-02 21:07:36 +00:00
Treehugger Robot
2f6179d4f5 Merge "Enable HWASan for multiple modules in one place(Soong)" 2023-04-29 00:10:16 +00:00
Liz Kammer
09ddb3a73e Restrict plugins to an existing allowlist
Adds a singleton to do validation that can be disabled via a
BUILD_BROKEN_PLUGIN_VALIDATION flag.

Validation process:
For all go modules that are a plugin for soong_build:
* if path is in build/soong, allow
* if path is in vendor, outside of google paths, allow
* if path is in hardware, outside of google paths, allow
* if name is in allowlist of current plugins, allow

We extend the plugin the list for internal modules via
vendor/google/build/soong/internal_plugins.json

Ignore-AOSP-First: Requires an internal only change to not break when submitted
Test: CI
Change-Id: I264a89b3636043330711d6c996c0360b61f51d92
2023-04-28 18:28:03 +00:00
Juan Yescas
05d4d90114 16k: Align shared libraries and executables to 4k by default
The default ELF segment alignment will be 4096. This alignment
can be overriden by setting the desired alignment in
PRODUCT_MAX_PAGE_SIZE_SUPPORTED flag. The alignment has to be
a multiple of the configured kernel page size.

Test: Built changes for Pixel 4a, 6 and checked alignment.
Bug: 276963698
Bug: 276801883
Change-Id: Icb380041a5b27da1fa0d86b302e1e7cde9a236d7
2023-04-28 02:42:20 +00:00
MarkDacek
f47e142ffd Refactor MixedBuildsEnabled and add --ensure-allowlist-integrity.
Currently, there is little verification around allowlisted modules
actually being mixed-built. This flag would allow us to verify
that a module allowlisted is mixed-built for at least one variant.

Bug: 278910100
Test: m nothing --bazel-mode-staging --ensure-allowlist-integrity
Test: m nothing --bazel-mode-staging --ensure-allowlist-integrity
--bazel-force-enabled-modules=com.google.android.neuralnetworks (This
fails, as expected)
Test: build/soong/test/mixed_mode_test.sh

Change-Id: Icd5976f4f44f1a8caca1e5247d986642f7995f97
2023-04-25 20:55:07 +00:00
Hang Lu
a98aab98c4 Enable HWASan for multiple modules in one place(Soong)
Environment variables HWASAN_INCLUDE_PATHS and
PRODUCT_HWASAN_INCLUDE_PATHS can be used to enable HWASan for multiple
modules, by just adding the module directory to the env variable.

Bug: b/271948407
Test: Set specific module directory to above env variable and check the
assembly codes of output elf files after building, finding hwasan
related symbols inside.

Change-Id: Ic49b515830c4469ca5fa94f547b26c0fb602fc54
2023-04-19 22:59:54 +00:00
MarkDacek
9c094ca153 Fix issue where bazel-force-enabled-modules aren't actually analyzed.
Bug: 273910287
Test: run mixed_mode_test.sh

Change-Id: I309c423b6e7f505ad1db0d9327e7de6b8298dfe9
2023-04-14 02:17:54 +00:00
Cole Faust
37d27c4884 Fix crash when missing platform sdk version
Fixes: 277890306
Test: Presubmits
Change-Id: I26658a90856cb057c631bb71ca0cd094ed648cf5
2023-04-12 10:32:18 -07:00
Cole Faust
eb644cfb34 Break constant information out of product vars
We don't want rules to load the product variables directly, because
then they won't be able to transition on them.

Break constant information that is safe to load outside of the
product vars file, so that we can make the product vars file have
more restricted visibility later.

Bug: 269577299
Test: m nothing
Change-Id: I848bff33e4f5798f51296ea3a2600615cab36985
2023-04-11 15:38:43 -07:00
Jiyong Park
7a64621169 Merge "Assert that platform_sdk_codename is set" 2023-04-03 23:28:58 +00:00
Treehugger Robot
43a2a9a5c6 Merge changes from topic "fdo_profile"
* changes:
  Reimplement afdo support for rust
  Implement fdo_profile module type
2023-04-03 22:35:25 +00:00
Jiyong Park
3a00e3defb Assert that platform_sdk_codename is set
This is already the case for bazel. Soong should do the same.

Bug: 271277773
Test: m nothing
Change-Id: Ibb680801872bd04eade511e1a174cc629af80722
2023-04-03 20:36:40 +09:00
Vinh Tran
44cb78c988 Implement fdo_profile module type
Introducing fdo_profile module type to reimplement the afdo support in cc moduels. This change allows the feature to be compatible with Bazel migration.

How it works:

PreDepsMutators:
  * BeginMutator: If non-static cc modules sets afdo prop, search and add corresponding fdo_profile module as a dep with fdoProfileTag
  * fdoProfileMutator:
    * If in fdo_profile module, set FdoProfileProvider with full path to profile
    * If in cc module, read FdoProfileProvider from dep with fdoProfileTag and set FdoProfileInfo.Path to FdoProfilePath field

PostDepsMutators:
  * afdoDepsMutator: If a module has FdoProfilePath set, walk to its static deps and set itself to the deps' AfdoRdeps
  * afdoMutator: If a static dep has AfdoRDeps set, create afdo variant.

Ignore-AOSP-First: Other CLs in the same topic are internal-only
Test: go test
Bug: b/267229065
Change-Id: I687d798a02d9743c92804fea36fb4ae3a7a0e5e3
Merged-In: I687d798a02d9743c92804fea36fb4ae3a7a0e5e3
2023-03-31 17:52:01 -04:00
Spandan Das
4deab28fd4 Create a SetBuildFromTextStub method
This will be useful for writing unit tests

Test: go build ./android
Change-Id: If27a050c0cfd0492e0cd3a422ac33f40b7a0a6d5
2023-03-30 17:06:32 +00:00
Treehugger Robot
bc2906efef Merge "Modify Soong to utilize from-text android.jar in build" 2023-03-29 20:31:20 +00:00
Dan Albert
a910e10b76 Merge "Generate api_levels.json from the preview codenames." 2023-03-29 17:57:22 +00:00
Jihoon Kang
1bff0349d4 Modify Soong to utilize from-text android.jar in build
Context
- from-text android.jar files are built using Metalava, and these can be
  utilized in `decodeSdkDep` so that any modules that depends on APIs
  can be compiled using from-text android.jars
- This change removes dependency on source java files when compiling
  stub android.jar files

Implementation
- Modify java_api_library module to create system modules using the
  generated android.jar
- Replace modules in decodeSdkDep to link against java_api_library
  modules
- Add --build-from-text-stub flag to hide the feature behind a flag

Test: m --build-from-text-stub
Bug: 271154441
Change-Id: I104df595edc65c0006820d5ae5b15f1fb167e190
2023-03-28 21:53:45 +00:00