Commit graph

21 commits

Author SHA1 Message Date
Jiakai Zhang
53dd895407 Determine GC type based on BUILT_KERNEL_VERSION_FILE.
How it works:
1. build/make/core/Makefile generates a txt file with the kernel
   version, which is taken from an explicit BOARD_KERNEL_VERSION value,
   or extracted from the kernel image on the source tree, or extracted
   from the kernel image extracted from the prebuilt boot.img.
   The file is saved at
   $ANDROID_PRODUCT_OUT/obj/PACKAGING/check_vintf_all_intermediates/kernel_version.txt.
2. If PRODUCT_ENABLE_UFFD_GC is "default", meaning the GC type needs to
   be determined by the kernel version, build/make/core/Makefile copies
   kernel_version.txt to
   out/soong/dexpreopt/kernel_version_for_uffd_gc.txt.
3. build/soong/dexpreopt/config.go writes the the UFFD GC flag to
   out/soong/dexpreopt/uffd_gc_flag.txt. The flag is determined by an
   explicit PRODUCT_ENABLE_UFFD_GC value or by contruct_uffd_gc_flag.py,
   which reads kernel_version_for_uffd_gc.txt and determines the flag
   accordingly.
4. dex2oat takes the UFFD GC flag from uffd_gc_flag.txt.
5. post_process_props.py mangles ro.dalvik.vm.enable_uffd_gc based on
   the same logic.

Bug: 321751629
Bug: 319554951
Bug: 318763448
Bug: 319648491
Test: m --no-skip-soong-tests nothing
Test: atest uffd_gc_utils_test
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=default m` for device with no
  UFFD support -
  1. Check the existence of `-Xgc:CMC` in
     out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.invocation
     (dex2oat invocation for a boot image)
  2. Check the existence of `-Xgc:CMC` in
     out/soong/.intermediates/packages/apps/Settings/Settings/android_common/dexpreopt/Settings/oat/arm64/package.invocation
     (dex2oat invocation for an app defined in .bp)
  3. Check the existence of `-Xgc:CMC` in
     $ANDROID_PRODUCT_OUT/obj/APPS/Dialer_intermediates/oat/arm64/package.invocation
     (dex2oat invocation for an app defined in .mk)
  4. Check the value of ro.dalvik.vm.enable_uffd_gc in
     $ANDROID_PRODUCT_OUT/product/etc/build.prop
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=default m` for device with
  UFFD support, and do the steps above.
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=true m`, and do the steps
  above.
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=false m`, and do the steps
  above.

Change-Id: I8df6e5be1644da05d2d5c57b3520f29601dfd7a4
2024-02-01 22:10:33 +08:00
Inseob Kim
d8cde77607 Add support for auto-generated characteristics RRO
Setting use_rro_for_product will automatically generate an RRO package
which contains resources with 'product="{PRODUCT_CHARACTERISTICS}"'. The
RRO package will be installed to /product partition. The app will be
compiled with '--product default', making the app identical to all
targets.

Motivation for this change is to minimize divergence of system.img.

Bug: 294799593
Test: boot and idmap2 dump
Change-Id: I549c2589c69eab7a1568510a7d1ff0c8a003f7ea
2023-11-07 14:06:14 +09:00
Cole Faust
be5e391055 Revert "Add a check that the staging directories don't..."
Revert submission 2773149-partition_file_list_check

Reason for revert: b/305103467, b/305103783, b/305103468
Reverted changes: /q/submissionid:2773149-partition_file_list_check

Change-Id: I2fab3b4d7d24af4488e777ad84e12e280c42dcc0
2023-10-13 02:51:10 +00:00
Cole Faust
80fad16d14 Add a check that the staging directories don't...
...contain extra files after an installclean.

Bug: 205632228
Test: m installclean && m
Change-Id: Ib021465d1089a21bc4f43306b1441348baf71f9c
2023-10-11 17:42:34 -07:00
Jingwen Chen
f3406e64f7 Make auto_gen_test_config available to Bazel.
In the Bazel rule, the actual AndroidManifest.xml file isn't available
in the providers of the android_binary dependency. And for good reason,
we should also rely on aapt2 to dump the manifest contents from the
final packaged APK anyway, but this auto gen script doesn't support
reading the output of aapt2 dump.

This CL adds a simple reader of the output of `aapt2 dump xmltree`, and
enabled if the xmltree content is passed to this tool instead of
AndroidManifest.xml.

Also fixup auto_gen_test_config_test.py. The test was completely failing.

Test: atest auto_gen_test_config_test
Test: presubmits

Change-Id: I7fecd927d0ed7847b6463d964b3698f4164b0177
2023-09-18 12:34:29 +00:00
Wei Li
dec97b1462 Create separate python libraries for the following logic and refactor SBOM generation script accordingly.
1) writer classes of generating SBOM in different SPDX formats
2) data classes to model the SBOM structure in SPDX

Bug: 272358880
Test: CIs
Test: build/soong/tests/sbom_test.sh
Test: atest --host sbom_writers_test

Change-Id: I1175cf0d99864bc4304559a59484ef0ba401cd64
2023-04-13 13:34:57 -07:00
Jihoon Kang
8f6edbbf04 Specify list_files to be built with embedded launcher
In the current use case of list_files, the module is built with a
possibly incompatible host machine's python version. This change fixes
this by specifying module to be built with embedded launcher.

Test: m list_files
Bug: 277124374
Change-Id: Id894271042136c9db50e63852075a8c4ef36a71e
2023-04-06 05:25:20 +00:00
Jihoon Kang
108379310d Create a python script to list files given a directory as an input
The script will be used in generating a file that lists generated stub
files from metalava, which will be passed to soong_zip to extract
selected stub files when generating stubs from java_api_library modules
with incomplete api surface text files.

Test: build java_api_library modules in aosp/2487335
Change-Id: I36b830f14c714315f81e3fd8608d84c29f673f83
2023-04-03 17:52:41 +00:00
Wei Li
499333616c Generate SBOM of the target product in file sbom.spdx.json in product out directory.
Original aosp/2374663 was reverted, so this change cnotains the implementation but disabled by default and SBOM will not be built by default with "m dist".

The feature will be enabled later in small CLs after running tests successfully in forrest.

Test: m sbom
Test: m dist
Test: on aosp, lunch aosp_bluejay-userdebug && m dist
Bug: 266726655
Change-Id: I926d0f97f3a0330ef61d059f12ea660005d370e6
2023-03-14 15:14:06 -07:00
Yihan Dong
881461fb90 Tool for generating GTS open-sourced report
The report contains:
1. whether gts-verifier need to be open-sourced
2. gts test modules that need to be open-sourced

Test: m gts
Change-Id: I1ce48f7e612556162d5ce1c76b3168ee7f35f826
Merged-In: I1ce48f7e612556162d5ce1c76b3168ee7f35f826
2023-02-16 21:54:23 +00:00
Spandan Das
60b8195c83 Migrate check_elf_file.py to python3
Also, create a python_binary_host so that it runs using the hermetic
python toolchain.

Test: m check-elf-files
Bug: 203436762
Change-Id: I964342a27f6b6c9dcdbbe910d4dc6c9ec00c2213
2022-10-27 02:08:23 +00:00
Spandan Das
ce69e9c812 Convert check_radio_versions to python3
Additionaly,
1. Run it as a python_binary_host so that it uses the hermetic python
toolchain
2. Fix an existing bug where if `board_info_txt` was empty, $^ would
   evaluate to its own path, and it would try to parse the relevant
   configuration from the wrong file

Bug: 196300985
Test: m out/target/product/vsoc_arm64/android-info.txt
Change-Id: Ie1e51a93041591829da4351dd57f37106e15d764
2022-10-24 21:02:00 +00:00
Sasha Smundak
2bfc570d8f Copy symlink farm creation tool from Bazel.
SymlinkTree is one of the action types Blaze returns in response to
`aquery` (action query). build-runfiles is a tool copied from Bazel
to implement this action (see src/main/tools/build-runfiles.cc in
the Bazel Git repo). It creates a symlink farm (i.e., a directory
hiearchy consisting of symlinks) from a given manifest. Mixed builds
need this tool the mixed builds (in particular, every Python applicaion
has a runtime symlink farm).

Bug: 232085015
Test: m USE_BAZEL_ANALYSIS=1 com.android.adbd
Change-Id: I9cfcb33cb7d0f63bd36ffd2b4101f53cfc6a42fc
2022-06-24 09:57:45 -07:00
Bob Badour
d2c7c08e7c Fix licenses and license texts.
Use Android-Apache-2.0 for all Apache 2.0

Remove legacy_restricted (no longer appears in code).

Remove Android.bp which did not build anything but was a placeholder
for the missing license texts.

Test: m nothing
Change-Id: Ia491a59c735ca20afda9b4bbac9d8b33dbf8874e
2022-01-24 16:19:41 -08:00
Cole Faust
547ca205ae Convert generate-self-extracting-archive.py to python 3
Test: Add a VENDOR_BLOBS_LICENSE entry to an existing product, then `m with-license`
Bug: 203436762
Change-Id: I4bbe77bda7789b6c44bea141518b1cd2e699d326
2021-12-29 13:58:28 -08:00
Bob Badour
0390580262 [LSC] Add LOCAL_LICENSE_KINDS to build/make
Added SPDX-license-identifier-Apache-2.0 to:
  target/product/sysconfig/Android.bp
  tools/apicheck/Android.bp
  tools/product_config/Android.bp
  tools/releasetools/Android.bp
  tools/signapk/Android.bp
  tools/signtos/Android.bp
  tools/zipalign/Android.bp
  tools/ziptime/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-CC-BY SPDX-license-identifier-GPL
    SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-LGPL
    SPDX-license-identifier-MIT legacy_not_a_contribution
    legacy_restricted
to:
  Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-CC-BY SPDX-license-identifier-GPL
    SPDX-license-identifier-MIT
to:
  tools/Android.bp
  tools/droiddoc/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0
    SPDX-license-identifier-LGPL SPDX-license-identifier-MIT
to:
  core/base_rules.mk
  core/dex_preopt_libart.mk
  core/package_internal.mk

Added SPDX-license-identifier-Apache-2.0 legacy_not_a_contribution
to:
  target/board/Android.mk

Added legacy_restricted
to:
  core/tasks/tools/package-modules.mk
  target/product/gsi/Android.bp
  target/product/gsi/Android.mk
  target/product/security/Android.bp
  target/product/security/Android.mk
  tools/acp/Android.bp
  tools/atree/Android.bp
  tools/fs_config/Android.bp
  tools/fs_config/Android.mk
  tools/fs_get_stats/Android.bp
  tools/libhost/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Id67a4eb1312940f999643b2ae57f45f34f120724
2021-02-14 10:37:20 -08:00
cfig
791378cda1
extract_kernel: make it py2/py3 compatible
use py3 for AOSP build, while the script itself can be
executed under py2/py3 environment directly.

TEST: extract info from Pixel 4 kernel

Change-Id: I00db6dabb1ff93f0758017a666c476816caefae7
2021-02-07 17:05:53 +08:00
Yifan Hong
351b6b811d Let extract_kernel return full kernel release.
Also add relevant soong rules for genrules to use it.

Test: use it in GKI APEX
Bug: 161563386
Change-Id: I04f80ba91748ee5783088d4e20e6438418863f62
2020-07-30 23:53:25 +00:00
Jiyong Park
d721e870bc Support optional prop assignments
This CL adds a number of changes to make the assignment of system
properties to be less confusing.

1. Added `a ?= b` syntax, which is called optional prop assignments. The
prop `a` gets the value `b` only when there is no non-optional prop
assignment for `a` such as `a = c`. This is useful for props that
provide some reasonable default values as fallback.

2. With the introduction of the optional prop assignment syntax,
duplicated non-optional assignments is prohibited; e.g., the follwing
now triggers a build-time error:

a = b
a = c

, but the following doesn't:

a ?= b
a = c

Note that the textual order between the optional and non-optional
assignments doesn't matter. The non-optional assignment eclipses the
optional assignment even when the former appears 'before' the latter.

a = c
a ?= b

In the above, `a` gets the value `c`

When there are multiple optional assignments without a non-optional
assignments as shown below, the last one wins:

a ?= b
a ?= c

`a` becomes `c`. Specifically, the former assignment is commented out
and the latter is converted to a non-optional assignment.

3. post_process_props.py is modified so that when a prop assignment is
deleted, changed, or added, the changes are recorded as comments. This
is to aid debugging. Previously, it was often difficult to find out why
a certain sysprop assignment is missing or is added.

4. post_process_prop.py now has a unittest

Bug: 117892318
Bug: 158735147
Test: atest --host post_process_prop_unittest

Exempt-From-Owner-Approval: cherry-pick from master

Merged-In: I9c073a21c8257987cf2378012cadaeeeb698a4fb
(cherry picked from commit 7aeb8de74e)
Change-Id: I9c073a21c8257987cf2378012cadaeeeb698a4fb
2020-06-30 18:44:01 +09:00
Jiyong Park
ae55638f75 Refactor post_process_props.py
The script is refactored to not parse lines everytime a prop is looked
up or updated.

Also it is now built using python_binary_host.

Bug: 117892318
Test: m

Change-Id: I1677ca5aa919c54b7b0740fdc52e1399009f9a12
2020-05-27 12:52:44 +09:00
Ian Kasprzak
9601e6e0f8 Add "with-license" rule to generate public AOSP phone image.
Bug: 125451157
Test: Verified output in out and dist folders

Additional verification:
- Without the VENDOR_BLOBS_NOTICE build fails
- Output shell artifact displays license as expected
- Shell artifact permissions are correct (ug executable)
- Shell artifact unzips inner zip after license agreement
- Unzipping shell artifact only unzips license.txt file

Change-Id: If1004bd61d873c592c8541a13724eb575f59cddf
2019-11-09 14:21:45 -08:00