Commit graph

43 commits

Author SHA1 Message Date
Cole Faust
99bec75197 Create EXTRA_INSTALL_ZIPS variable
Make needs to know about the "extra" zip files that are extracted
to the staging directories so that it can track all the installed files
correctly.

Also add a utility tool for listing the contents of relevant zips.

Bug: 337869220
Test: m droid and checked the contents of file_list.txt when adding an android_app_set locally
Change-Id: Idc5dd785b03c05f7972c66620d4e6359892b3863
2024-05-09 14:20:11 -07:00
Cole Faust
dfcb5c515b Remove embedded_launcher: true usages
The default value for embedded_launcher has been changed to true.

Bug: 174041232
Test: Presubmits
Change-Id: I2fb4b920828307e60c0fae6864ba720c7c31e1f2
2024-05-08 12:13:38 -07:00
Inseob Kim
8fa54dab08 Reland "Migrate buildinfo.sh script into Soong"
To build system.img in Soong, we need all artifacts including
build.prop. This fully migrates buildinfo.prop file into Soong as a
first step to build build.prop on Soong.

This fixes an error caused by an incorrect path to build thumbprint
file.

Bug: 322090587
Test: compare build.prop before and after
Test: build multiple times and see build.prop isn't rebuilt
Change-Id: Id4fa830009538856c30825ff47268b11fa6cb5d6
2024-03-27 14:18:45 +09:00
Gina Ko
465549b579 Revert "Migrate buildinfo.sh script into Soong"
Revert submission 3004875-buildinfo_prop_soong

Reason for revert: DroidMonitor-triggered revert due to breakage b/331462869

Reverted changes: /q/submissionid:3004875-buildinfo_prop_soong

Bug: 331462869
Change-Id: Ib8bbbad29a4ad7b800e6bd1a67a401c2225b78cb
2024-03-26 22:46:11 +00:00
Inseob Kim
5baf2cbcb6 Migrate buildinfo.sh script into Soong
To build system.img in Soong, we need all artifacts including
build.prop. This fully migrates buildinfo.prop file into Soong as a
first step to build build.prop on Soong.

Bug: 322090587
Test: compare build.prop before and after
Test: build multiple times and see build.prop isn't rebuilt
Change-Id: Icaa7e1fdab2a8c169ac00949d3aaf6c8212a1872
2024-03-26 05:55:49 +00:00
Cole Faust
4a2a7c98f6 Add include_make_built_files
If `include_make_built_files` is set to the name of a partition, the
make-built files from that partition will be incorperated into this
soong module. This is to ease the transition to soong built filesystems.

If any files are present in both the soong-built file list and the
make-built one, the soong ones will be preferred.

Bug: 329146343
Test: go test
Change-Id: I456b283e1189116e699ed75357cc056f5d217688
2024-03-14 16:40:42 -07:00
Jiakai Zhang
7d292228c1 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: I035ad32233e49e2a30ce11f6c7c318a648511ef8
2024-02-02 09:23:37 +08:00
Jihoon Kang
c32d1f5b33 Introduce script and module to pass aconfig flags to metalava
`keep-flagged-apis` module generates a txt file that
contains annotations based on aconfig flags that are passed to metalava
when generating "exportable" or "runtime" stubs.

`keep-flagged-apis.sh` already exists under
`packages/modules/SdkExtensions` directory, but modifying the script
(and the bp module definition) will break the `udc-mainline-prod` branch
in downstream. Therefore, the modified script and the module definition
is defined here, and will be used in the long term.

Test: m keep-flagged-apis && manual
Bug: 315485740
Change-Id: I4ab8d4ea2c6c8ddba6d55b2b25e8c8d3b7c8fa07
2023-12-27 19:31:51 +00:00
Andrei Onea
580f7b0094 Add script for modifying privapp permission allowlists
This script will be used to change the package that is being allowed to
use privileged permissions.

Test: python scripts/modify_permissions_allowlist.py
Bug: 242509786
Change-Id: I1d7cb3c906ad39aef42ad4394953251db40d1bf1
2023-05-02 15:10:16 -04:00
Jooyung Han
4b4f03fd82 Make conv_linker_config visible to linkerconfig
linkerconfig_diff_test uses conv_linker_config.

Bug: 276890767
Test: atest --host linkerconfig_diff_test
Change-Id: I2f669b83f24b9dd563fc034738fe4ba83f95fd49
2023-04-12 17:20:47 +09:00
Romain Jobredeaux
6d8716c176 Create a sh_binary target for jars-to-module-info
This will enable its bp2build conversion, and is needed for java_system_modules support in Bazel

Change-Id: I4f3ff5e36c8cd7f78efbb42f641efb2f76a8b71d
Bug: 215230098
2023-03-17 14:58:08 +00:00
Jooyung Han
f6fd4c2823 Fix conv_linker_config with multiple input json files
`conv_linker_config proto -s` should work with multiple json input
files, but ParseDict() overwrites list fields (e.g. provideLibs), not
appending elements.

Also added a test.

Bug: 264330513
Test: conv_linker_config_test
Change-Id: Idc482f941201f15e5fc276c0ffc0dfeaa09d0cc2
2023-03-09 07:46:00 +00:00
Jooyung Han
7113b19be8 Add a host tool to create an APEX bundle
Even though the soong build system generates a bundle module for an
apex, the bundle module itself should be further processed to be an
AppBundle (.aab) file which can be uploaded to Play.

This script fills the gap by invoking bundletool to create an
AppBundle (.aab) file out of soong-built bundle module for an apex.
(Note: uploading APEX bundle (.aab) to Play is not supported yet.)

You can create an .aab file by:
- TARGET_BUILD_APPS={apex name} m dist
- m build-apex-bundle
- build-apex-bundle --output out.aab out/dist/{apex name}-base.zip

For now it creates a single-ABI APEX bundle. In the future it can be
extended to support multiple-ABI APEX bundles.

Bug: 236673372
Test: m build-apex-bundle
Test: TARGET_BUILD_APPS=com.google.cf.bt m dist
Test: build-apex-bundle --output bt.aab out/dist/com.google.cf.bt-base.zip
Change-Id: Id321efcd42c0fe60294a8348047c9ebbf7acf391
2022-09-21 13:27:49 +09:00
Cole Faust
bcc3d05aba Fix module-file name collisions
Bazel doesn't allow a module and file with the same name.

Bug: 198619163
Test: Presubmits
Change-Id: Ie9731b627945d2ff221d3a5d08a32a5a172f9dcd
2022-09-01 15:20:00 -07:00
Alexei Nicoara
1e3d27821b Merge changes Ibcf908d9,I786ab152
* changes:
  Cleaning up the version sed rule
  Adding support to conditionally replace a value
2022-07-12 13:07:28 +00:00
Alexei Nicoara
7d69b1d8e6 Adding support to conditionally replace a value
Bug: 231691643
Test: presubmit
Change-Id: I786ab152a94126ebc8a9d7dea0bb68e07d789a0b
2022-07-12 11:53:07 +01:00
Martin Geisler
4e86b5e07a Make ‘rustfmt.toml’ available for other modules
We need the config file to ensure consistent output when running
tests.

Bug: 237977382
Test: manual
Change-Id: Ib19d4b739305a5cbed94a40908d76dbbeec67fe5
2022-07-04 08:35:44 +00:00
Sasha Smundak
fe11851029 Recursively list Android image contents.
Relies on debugfs utility to inspect image contents.
The output looks something like this:
```
./
./app/
./app/Calendar/
./app/Calendar/Calendar.apk
```

Test: manual
Change-Id: Ia05f4e857dfd28ac76ac2b450b08f5cf5577d21f
2022-04-20 20:02:11 -07:00
Jooyung Han
1df464a90b Revert "Add a tool to list contents of .img file"
Revert submission 2041990-microdroid-contents

Reason for revert: b/227144320 (broken build)
Reverted Changes:
Ie2f471d39:Add the golden list of microdroid contents
I7c4fca184:Add a tool to list contents of .img file

Change-Id: If2b5d6cb1325cb17ef2bdc4f13ded003ab2dd6d7
2022-03-28 09:44:33 +00:00
Jooyung Han
b3a3a2893b Add a tool to list contents of .img file
list_image <img> lists the contents of the file.

For example:
  $ m microdroid
  $ list_image <path to microdroid.img>
  ./
  ./apex/
  ./bin
  ..

Bug: 195425111
Bug: 225121718
Test: list_image .img
Change-Id: I7c4fca184751ba20066fd25fa4c366a955dbabf6
2022-03-25 02:44:36 +09:00
Cole Faust
c903f00e3f Remove python 2 support from manifest_utils
Bug: 203436762
Test: Presubmits
Change-Id: If93033a428aa1aa0dd2db973666d4790af8f0912
2021-11-30 12:24:02 -08:00
Cole Faust
c41dd72d3b Convert soong scripts to python 3
Except manifest_utils, which is used by
apexer.

Tests run:
m construct_context_test manifest_check_test manifest_fixer_test test_config_fixer_test
out/host/linux-x86/testcases/construct_context_test/x86_64/construct_context_test
out/host/linux-x86/testcases/manifest_check_test/x86_64/manifest_check_test
out/host/linux-x86/testcases/manifest_fixer_test/x86_64/manifest_fixer_test
out/host/linux-x86/testcases/test_config_fixer_test/x86_64/test_config_fixer_test

Bug: 203436762
Test: Tests listed above + presubmits
Change-Id: Ife75b3af1efc871a2d8521d26153a262573bb706
2021-11-10 13:49:27 -08:00
Pirama Arumuga Nainar
2558ce3890 [scripts] Add script to print clang prebuilts version
Bug: http://b/187231324

This script parses soong/cc/config/global.go to return clang prebuilts
version.  (It may get the version from a json config file in the
future.)

Currently it's used in development/scripts/symbol.py and is the
recommended way to get clang prebuilts version number in the future.

Test: get_clang_version_test.py
Change-Id: Id92a74fd523a5270999bb4d6454525bf2f2f0c04
2021-06-25 11:57:16 -07:00
satayev
73c7b8547a Move conv_classpaths.proto to packages/modules/common.
The classpaths.proto file is needed at build time to generate appropriate
classpath configs for the modules. Unbundled ART branches do not include
packages/modules/SdkExtenstion in their manifest; so put the proto in a
project that should be visible to all unbundled modules.

Bug: 180105615
Test: m nothing
Change-Id: Ie5be1822fbee92f280332622a9317894cc98d7ac
2021-05-10 13:14:23 +01:00
Jaewoong Jung
7b93908d2e Add lint_project_xml_test.py
Test: lint_project_xml_test.py
Bug: 182349282
Change-Id: Ibdeb2e5aaf9dcdb02c5d30214e5ea89665145eb3
2021-04-20 11:04:51 -07:00
Jaewoong Jung
5a4202575e Rename lint-project-xml.py to remove dashes.
So that a future test can import it without a dirty syntax.

Test: m lint-check
Bug: 182349282
Change-Id: I520a5af49543801ab2a8ee888ff235876546dc74
2021-04-20 07:06:03 -07:00
Artur Satayev
ca6fe3453a Add a converter for classpaths.proto between proto and json/text formats.
The proto is used at build time to define classpath fragments to be read
and parsed at runtime by `derive_classpath` service; in order to define
and set BOOTCLASSPATH, DEX2OATCLASSPATH, and SYSTEMSERVERCLASSPATH
environ variables.

The tool is used for debugging and generation of binary protos.

Bug: 180105615
Test: m && launch_cvd with a follow up changes
Change-Id: I7e8b084e5f63e9aaad11da3221b909818e69e235
2021-04-06 18:37:13 +01:00
Julien Desprez
2dc86b2956 Migrate manifest_*_test out of test mapping
Unit tests do not require an explicit TEST_MAPPING config

Change-Id: Ieccebc78a26b9555803a2278e2962d0b388a6957
Test: presubmit
Bug: 183209529
2021-03-19 17:16:16 +00:00
Thiébaud Weksteen
713db480cd Add bloaty_merger
This script will be used to merge the csv outputs from bloaty into a
single proto file.

Bug: 172339795
Test: atest --host bloaty_merger_test
Change-Id: I9a3c12d7b0c4b5e347fec04e6758bcc1fbc8ab40
2021-02-18 10:25:25 +01:00
Bob Badour
02040de891 Add LOCAL_LICENSE_KINDS to build/soong
Added SPDX-license-identifier-Apache-2.0 to:
  Android.bp
  android/Android.bp
  android/soongconfig/Android.bp
  androidmk/Android.bp
  apex/Android.bp
  bazel/Android.bp
  bp2build/Android.bp
  bpf/Android.bp
  bpfix/Android.bp
  cc/Android.bp
  cc/config/Android.bp
  cc/libbuildversion/Android.bp
  cc/libbuildversion/tests/Android.bp
  cc/ndk_api_coverage_parser/Android.bp
  cc/ndkstubgen/Android.bp
  cc/symbolfile/Android.bp
  cmd/dep_fixer/Android.bp
  cmd/diff_target_files/Android.bp
  cmd/extract_apks/Android.bp
  cmd/extract_jar_packages/Android.bp
  cmd/extract_linker/Android.bp
  cmd/fileslist/Android.bp
  cmd/host_bionic_inject/Android.bp
  cmd/javac_wrapper/Android.bp
  cmd/merge_zips/Android.bp
  cmd/multiproduct_kati/Android.bp
  cmd/path_interposer/Android.bp
  cmd/pom2bp/Android.bp
  cmd/pom2mk/Android.bp
  cmd/sbox/Android.bp
  cmd/soong_build/Android.bp
  cmd/soong_env/Android.bp
  cmd/soong_ui/Android.bp
  cmd/zip2zip/Android.bp
  cmd/zipsync/Android.bp
  cuj/Android.bp
  dexpreopt/Android.bp
  dexpreopt/dexpreopt_gen/Android.bp
  env/Android.bp
  etc/Android.bp
  filesystem/Android.bp
  finder/Android.bp
  finder/cmd/Android.bp
  genrule/Android.bp
  jar/Android.bp
  java/Android.bp
  java/config/Android.bp
  kernel/Android.bp
  linkerconfig/Android.bp
  linkerconfig/proto/Android.bp
  makedeps/Android.bp
  partner/Android.bp
  phony/Android.bp
  python/Android.bp
  python/tests/Android.bp
  remoteexec/Android.bp
  rust/Android.bp
  rust/config/Android.bp
  scripts/Android.bp
  sdk/Android.bp
  sh/Android.bp
  shared/Android.bp
  symbol_inject/Android.bp
  symbol_inject/cmd/Android.bp
  sysprop/Android.bp
  tradefed/Android.bp
  ui/build/Android.bp
  ui/logger/Android.bp
  ui/metrics/Android.bp
  ui/metrics/proc/Android.bp
  ui/status/Android.bp
  ui/terminal/Android.bp
  ui/tracer/Android.bp
  xml/Android.bp
  zip/Android.bp
  zip/cmd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  finder/fs/Android.bp
  third_party/zip/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work

Change-Id: Ia47ca14f16b8c9f84f9d533a07e5b00e2c04e8d4
2021-02-06 04:23:21 +00:00
Paul Duffin
9a89a2a0ea Move boot jars package check from make
Adds a singleton that traverses the module variants finding the ones
that are in the list (updatable and non-updatable) of boot jars and
add a ninja rule to ensure that they only contain packages from an
allowed list.

Replaces a hack that ignored any prebuilt boot jars supplied as dex
file with an equivalent one to ensure that they are still ignored.
A follow up change that switches to checking dex jars will allow the
hack to be removed.

The boot jars check can be strict or lax. If strict then all the boot
jars listed in the configuration must be found, otherwise it will only
check the ones it finds. It is strict by default unless
TARGET_BUILD_UNBUNDLED=true or ALLOW_MISSING_DEPENDENCIES=true.

Moves the script and data file from build/make.

Test: m check-boot-jars - for failing and passing cases
      SKIP_BOOT_JARS_CHECK=true - no check-boot-jars target created
	  ALLOW_MISSING_DEPENDENCIES=true - not strict
	  TARGET_BUILD_UNBUNDLED=true - not strict
      verified manually that apart from path differences the same
      files (same check sum) were checked in both old make checks and
      the new Soong ones
      EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m check-boot-jars
Bug: 171479578
Change-Id: I9d81d6650ba64fc0d48d2dab4ba5a3ba8dd03dec
2020-10-29 17:20:06 +00:00
Kiyoung Kim
62abd12ba5 Handle new filetype 'linker_config'
Handle new filetype 'linker_config' which is configuration for
linkerconfig in json type and convert into protobuf in build time.

Bug: 169634881
Test: Build succeeded and cuttlefish boot succeeded
Change-Id: I56555fc738e6d6600d15a191a24f79a2ee747f52
2020-10-15 23:09:35 +09:00
Ulyana Trafimovich
8fab5bcce3 Merge changes from topic "uses-libs-5"
* changes:
  Rewrite construct_context.sh in Python.
  Refactor class loader context generation.
2020-07-02 09:06:27 +00:00
Ulya Trafimovich
5f364b63b8 Rewrite construct_context.sh in Python.
This allows to reuse SDK version comparison routine from other Python
scripts. With the addition of non-numeric versions comparison has become
more complex, and the deleted shell script did it incorrectly: it used
comparisons like `[[ "S" -lt 28 ]]` which results in "true" as strings
are converted to zero in numeric context. This resulted in adding legacy
libraries to class loader context of apps targeting recent SDK versions.
The error was masked because currently there is only one non-AOSP app
that uses the script (GoogleDialer), and it targets numeric SDK version.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I26e752e29b5453fd3e29d5dbfbe4d9df9c0a55b7
2020-07-01 09:44:23 +01:00
Treehugger Robot
e9eacaa061 Merge "Move gen-kotlin-build-file.sh to python" 2020-06-29 21:12:45 +00:00
Thiébaud Weksteen
5e291c238f Fix bpfmt issues and add bpfmt to preupload checks
Test: m nothing
Change-Id: I10526a33685335bdd26cc7692815133379d4e0f6
2020-06-29 09:14:08 +02:00
Colin Cross
9b1aa0cb86 Move gen-kotlin-build-file.sh to python
Kotlin common multiplatform sources support will require more
complexity in gen-kotlin-build-file.sh, move it to python instead.

Test: m checkbuild
Change-Id: I02312160ad781877f1fec971168331c0dcecf136
2020-06-26 22:41:34 -07:00
Colin Cross
014489c1e6 Add support for running Android lint on java and android modules.
Add a rule that runs Android lint on each java and android module
and produces reports in xml, html and text formats.

Bug: 153485543
Test: m out/soong/.intermediates/packages/apps/Settings/Settings-core/android_common/lint-report.html
Change-Id: I5a530975b73ba767fef45b257d4f9ec901a19fcb
2020-06-16 15:44:16 -07:00
Baligh Uddin
3be82c00fe Create manifest_utils library target.
This utility can also be used for parsing and
managing the Android Manifest for apex under
system/apex/apexer.

Test:
python manifest_fixer_test.py
python manifest_check_test.py

BUG: 148198056
Change-Id: Iffe465b5f36b2a3fbf81414d6f19e241c5f5648f
2020-02-20 15:58:00 +00:00
Jaewoong Jung
e5cd4e10a0 Optionally overwrite package value in test config.
If package_name is set for an android_test module, package names in its
AndroidTest.xml config need to be updated too.

Test: test_config_fixer_test.py
Fixes: 145011263
Change-Id: I52f17ef1d1902364b9bcfec4f6e246bd655dbf09
2019-12-05 11:17:09 -08:00
Jooyung Han
04329f131a Add jsonmodify tool
This tool is used to modify apex_manifest.json when building apex
module.

Here's the usage:

usage: jsonmodify [-h] [-o output] [-v path value] [-s path value]
                     [-r path] [-a path [value ...]]
                     [input]

positional arguments:
  input                 JSON file

optional arguments:
  -h, --help            show this help message and exit
  -o output, --out output
                        write result to a file. If omitted, print to stdout
  -v path value, --value path value
                        set value of the key specified by path. If path
                        doesn't exist, creates new one.
  -s path value, --replace path value
                        replace value of the key specified by path. If path
                        doesn't exist, no op.
  -r path, --remove path
                        remove the key specified by path. If path doesn't
                        exist, no op.
  -a path [value ...], --append_list path [value ...]
                        append values to the list specified by path. If path
                        doesn't exist, creates new list for it.

Bug: 138695532
Test: m jsonmodify
Test: echo {} | jsonmodify -v name hello -a list.nested a b c
{
  "name": "hello",
  "list": {
    "nested": [
      "a",
      "b",
      "c"
    ]
  }
}

Change-Id: I2cd043c614b3ad2306a0c27ccee302633c6d2525
2019-08-02 00:08:05 +09:00
Colin Cross
7211910fd0 Add manifest_check tool
Add a tool that can check that the <uses-library> tags in an
AndroidManifest.xml file match a list provided by the build.

Bug: 132357300
Test: manifest_check_test
Change-Id: If15abf792282bef677469595e80f19923b87ab62
2019-05-24 13:43:27 -07:00
Colin Cross
4af387c20e Move manifest_fixer to a python_binary_host module
In preparation for making it use multiple files so that some
implementation can be shared with a new tool.

Also make manifest_fixer_test a python_test_host, and add it
to TEST_MAPPING.

Test: m checkbuild
Change-Id: Iaae177efcb978187b126d90359b82cdfd3176857
2019-05-24 13:43:19 -07:00