Commit graph

2678 commits

Author SHA1 Message Date
Spandan Das
2cf278e75b Do not propagate strict_updatability linting to conscrypt
and framework-media java_sdk_libraries

Tmp fix for
https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master&target=errorprone&lkgb=8352129&lkbb=8353967&fkbb=8352538

Test: m
out/soong/.intermediates/external/conscrypt/conscrypt.module.public.api.stubs.system/android_common/lint/lint-baseline.xml
Test: (internal CI target) https://android-build.googleplex.com/builds/abtd/run/L67700000953708519
Bug: 182349282
Bug: 226637002
Bug: 226608044

Change-Id: I17e540877200f59bfd51e69e57d8bcca6cf3850f
2022-03-25 02:31:20 +00:00
Spandan Das
ad40fffa64 Merge changes I4c373b29,I9ccda6fc,I1b390b0e,I30151217
* changes:
  Do not propagate strict updatability linting to libcore/
  Create allowlist to skip strict updatability lint check
  Propagate strict_updatability_linting to transitive deps of updatable apexes
  Export LintDepSetsIntf from java package
2022-03-24 16:38:20 +00:00
Colin Cross
3c66771c62 Merge "Use single module for clang runtime libraries" 2022-03-08 06:51:43 +00:00
Colin Cross
d9ccb6a2cb Skip install rules for apexes with installable: false
When an apex sets installable: false call SkipInstall to prevent
creating the install rules, and don't report the install rules
to Make.

Fixes: 221261079
Test: m checkbuild
Change-Id: If94759b16f79ee10ddcf8ee89603ca9e822b74f5
2022-03-08 02:40:32 +00:00
Colin Cross
4c4c1be915 Use single module for clang runtime libraries
The clang prebuilts now provide a single module with per-architecture
variants instead of a module per architecture.

Bug: 220019988
Test: m checkbuild
Change-Id: I39e2cf8ae14edf8510276dab38011afaef85822c
Merged-In: I39e2cf8ae14edf8510276dab38011afaef85822c
2022-03-07 14:56:32 -08:00
Remi NGUYEN VAN
979b652dec Merge "Support overriding APEX java contents" 2022-03-03 01:26:19 +00:00
Remi NGUYEN VAN
be90172f0a Support overriding APEX java contents
In addition to the current "apps", support overriding
bootclasspath_fragments, systemserverclasspath_fragments, and java_libs.

This is useful to build APEXes with slightly different contents, for
example where the base APEX could contain libraries that only use stable
APIs, but the overriding APEX could contain a variant that also uses
non-finalized APIs.

Bug: 222247869
Test: m (runs apex tests)
Change-Id: I14da6f835c58b44be31e517598695ec8ff830648
2022-03-02 21:23:15 +09:00
Jiakai Zhang
0407606ce1 Merge "Install required deps for flattened APEX." 2022-02-28 15:29:31 +00:00
Jiakai Zhang
d70dff7c9b Install required deps for flattened APEX.
The primary boot image is a required dep of the ART APEX. It needs to be
installed no matter the APEX is flattened or not.

Bug: 220991677
Test: 1. m OVERRIDE_TARGET_FLATTEN_APEX=true com.android.art
  2. See boot.art in /system/framework/<isa>
Change-Id: I1a69ae1b86df97fc44ea6c75c8bb9ec960c8d249
2022-02-28 11:18:29 +00:00
Treehugger Robot
7ff6e3d257 Merge "apex: track transitive dependencies of rust jni lib" 2022-02-24 23:50:14 +00:00
Jiyong Park
34d5c33529 apex: track transitive dependencies of rust jni lib
dependencies of rust library registered as jni_lib are correctly
tracked.

Bug: 220397949
Test: m nothing
Change-Id: I43016a77656d04f59f798b02d541c6a19288ec9c
2022-02-24 18:02:44 +09:00
Jooyung Han
a6d3667b67 apex supports ".apex" tag
Tests can embed non-compressed .apex output with the tag.

Bug: 221024307
Test: soong test
Change-Id: Id4a239d1897237105a064cea8c97029f5b996a98
2022-02-24 13:59:45 +09:00
Spandan Das
d9c23abeca Do not propagate strict updatability linting to libcore/
propogation of this flag is determined by the location of the Android.bp
where a library is defined.
libcore/ libraries that are transtive deps of updatable apexes will
- inherit strict_updatability_linting:true if defined in libcore root
- not inherit strict_updatability_linting:true if defined in libcore
  subdir

Note that the module can explicitly list `lint:{strict_updatability_linting: true}'
in their Android.bp file, in which case they will not be allowed to
baseline NewApi errors

Test: m lint-check
Test: TH
Bug: 208656169
Bug: 182349282

Change-Id: I4c373b2960a7af16301d7f06aab448f39b937ea9
2022-02-23 21:49:56 +00:00
Gurpreet Singh
7761de5d4e Merge "Manifest Fixer Params code refactor" 2022-02-10 18:22:30 +00:00
Gurpreet Singh
7deabfacd0 Manifest Fixer Params code refactor
This CL refactors the code related to ManifestFixer parameters.
The required parameters android.ModuleContext, manifest android.Path are
passed separately as the parameters and the optional parameters are
kept as part of the ManifestFixerParams struct.

By default, the member variable of struct have the zero (nil, false,
empty string) values. Hence, it is only required to pass the
parameters of interest at the time of function call to
ManifestFixer.

Manual testing done to check the working of the code.

Test: m nothing && m test_com.android.sdkext
Test: manually tested the generation of AndroidManifest in the out
directory with the testOnly attribute
Test: atest manifest_fixer_test --host
To test the existing unittests are not breaking.

Change-Id: I20cb6c06c57f8fe7811050288bcb03945dc0425b
2022-02-10 13:37:50 +00:00
Spandan Das
08c911f4eb Create allowlist to skip strict updatability lint check
As of Jan 2022, some updatable mainline modules have (transitive) deps with
NewApi in their respective lint-baseline.xml. Create an allowlist to
relax this check temporarily for those mainline modules.

Test: m lint-check
Test: TH
Bug: 182349282

Change-Id: I9ccda6fccb973e9100e31b7e559f5642289ac717
2022-02-10 02:25:21 +00:00
Gurpreet Singh
a76f874d55 Geneate AndroidManifest file if the apex_test module does not have one.
If the build file contains the apex_test module, but the apex_test
module does not contain the AndroindManifest file, then create the
AndroidManifest file.

In such case, the apexer tool is already generating an AndroidManifest
file. In order to handle the testOnly attribute for apex_test modules, a
--test_only flag is appended to the opt flags.

The apexer tool reads the opt flags and if the --test_only flag is
present then it generate the AndroidManifest file with testOnly
attribute.

Bug: 213310150
Test: m nothing && m test_com.android.sdkext
Test: manually checked the generation of AndroidManifest file in the
unsigned zip file mentioned in the description.
This command allows to read the attribute of the binary xml file -
aapt2 dump xmltree test_com.android.sdkext.apex.unsigned --file
AndroidManifest.xml

Verified the presence of testOnly flag in the output.

Change-Id: Ic47378428b2dba51d73e75d912546c2374f68d57
2022-02-09 16:06:15 +00:00
Spandan Das
6677325124 Propagate strict_updatability_linting to transitive deps of updatable apexes
Create a topdown mutator to walk the deps of updatable apexes. If a dep
is lintable, set its strictUpdatabilityLinting to true

Creating a new mutator after apexInfoMutator makes it easy to maintain
an allowlist (e.g. override_apex does not require an entry in the
allowlist, its canonical name can be retrieved using ApexVariationName())

Test: In build/soong/, go test ./apex
Test: TH
Bug: 182349282

Change-Id: I1b390b0e3a8fb20754ce50c6b253d68d2b3f263b
2022-02-08 19:25:37 +00:00
Jooyung Han
472be14f26 Merge changes I11693286,I8d79a434
* changes:
  VNDK libs use "unique" APEX variants
  use_vndk_as_stable APEX shouldn't include VNDK lib
2022-02-08 01:03:41 +00:00
Treehugger Robot
210957500c Merge "Allow installing boot images outside of APEX for prebuilt." 2022-02-07 15:58:36 +00:00
Jooyung Han
91f9203af4 VNDK libs use "unique" APEX variants
In case there are two vendor apexes(one with "use_vndk_as_stable:true",
and the other with "use_vndk_as_stable:false") a VNDK lib used by both
will have "APEX" variant and the former APEX will use "apex" variation.

For example,

 apex1(use_vndk_as_stable) -> foo -> libvndk
 apex2 -> bar -> libvndk

Since foo, bar and libvndk are mutated into two APEX variations("",
"apex10000"), foo will use the apex variation of libvndk.

To fix this, VNDK libs can use "unique" APEX variations. Then, in the
above example, foo will have "myapex1" variation and libvndk will have
two APEX variations("" and "apex2"). So foo will link to ""(non-APEX)
variation as fallback.

Bug: 216847402
Test: m nothing (soong tests)
Change-Id: I116932860ef79e22dc338a58b251e3ca693ab4f3
2022-02-04 13:07:14 +09:00
Jooyung Han
c5a967630e use_vndk_as_stable APEX shouldn't include VNDK lib
Even though a vendor APEX sets use_vndk_as_stable:true it was possible
to include a VNDK lib by directly depending on it with
native_shared_libs.

But it's contradictory to have a VNDK lib while declaring not to include
VNDK libs. It was missing since pruning dependencies on VNDK libs was
done only for transitive deps.

Added a check to reject this.

Bug: 216847402
Test: m nothing(running soong tests)
Change-Id: I8d79a434b1bfe8e563cf8968fa76830b0e582f66
2022-02-04 13:07:11 +09:00
Gurpreet Singh
75d65f360c Add testOnly attribute to AndroidManifest file of apex_test
If the build file contains the apex_test module, add the
testOnly attribute to the application element of the
corresponding AndroidManifest file and set its value to true.
If the testOnly attribute is already present and has value
false, then do nothing.

Tests added in manifest_fixer_test.py to check if the updated
AndroidManifest file has the testOnly attribute set to true or not.

Bug: 213310150
Test: atest --host manifest_fixer_test
Test: m nothing
Test: manually checked the AndroidManifest file generated
Change-Id: I36247dbe0261c342d451a4422c314fd8fe0c2369
2022-02-01 12:03:48 +00:00
Jiakai Zhang
e6e90db00a Allow installing boot images outside of APEX for prebuilt.
This change is similar to aosp/1947127, but for prebuilts.

After this change, if `bootImageConfig.installDirOnDevice` is set to a
path outside of the APEX, the build system will build a boot image from
the dex files and the profile extracted from the prebuilt APEX.
Otherwise, it keeps the current behavior: extracting the boot image from
the prebuilt APEX.

This is a no-op change. Current behavior is not affected.

Bug: 211973309
Test: m nothing
Test: -
  On internal master:
  1. Patch aosp/1947128.
  2. Patch ag/16743847 and ag/16746804.
  3. m SOONG_CONFIG_art_module_source_build=false com.google.android.art
  4. See the boot image being installed in `/system/framework/<arch>`.
Change-Id: I24ca525309fecaf3ab7a67960fbf118cd00ecd1d
2022-01-28 15:08:06 +00:00
Wei Li
f034cb4d7b Add bp2build support for property "compressible" of apex module.
Bug: 214466457
Bug: 207551677
Test: b build //build/bazel/examples/apex/minimal:build.bazel.examples.apex.minimal
Test: b test //build/bazel/tests/apex:build.bazel.examples.apex.minimal_apex
Test: b test //build/bazel/tests/apex:build.bazel.examples.apex.minimal_capex

Change-Id: I6bf12c1b0c52d4486968bb430a67a3c3110766db
2022-01-25 19:42:43 +00:00
Oriol Prieto Gasco
a07099d858 Make 'Compressible' an overridable property
This is needed to allow the Android Go versions of modules
(com.google.android.go.*) to select a different compression toggle than
their non-Go (com.google.android.*) conterparts. go/go-updatability

Bug: 203024418
Test: Preloaded go variants on wembley, booted Android.
Change-Id: Ic96aff5fafb65fbd08e8a69d47c994532e27819e
Merged-In: Ic96aff5fafb65fbd08e8a69d47c994532e27819e
(cherry picked from commit 2c4a96375a)
2022-01-22 00:45:58 +00:00
Treehugger Robot
c85964a734 Merge "Improve apex build check explanation" 2022-01-20 21:06:39 +00:00
Andrei Onea
d967aee96f Improve apex build check explanation
Discourage jarjaring code where there are alternatives with
better system health implications.

Test: m
Bug: 215233995
Change-Id: I1b076d00e1ad6aa32b41da6bda1033978b5e829d
2022-01-19 16:07:21 +00:00
Jingwen Chen
539d41b686 Merge "Support multilib in apex." 2022-01-19 11:11:05 +00:00
Treehugger Robot
a9a5d36884 Merge "[NETD-BPF#34] Add a tag for bpf to specify the install folder" 2022-01-19 09:41:57 +00:00
Ken Chen
fad7f9d8b7 [NETD-BPF#34] Add a tag for bpf to specify the install folder
Currently, the bpf module netd.o (source system/netd/bpf_progs/netd.c)
will be built to /system/etc/bpf/netd.o. In Android T, it will be moved
to mainline module com.android.tethering.

The expected behavior is:
- In T device, it uses the netd.o in mainline module.
- In pre-T devices, it uses the original netd, built from platform.

However, netd.o will be double loaded if the tethering module is
installed in Pre-T devices. Because:
1. bpf in apex is packed into /apex/MAINLINE_MODULE/etc/bpf/
2. bpf in platform is packed into /system/etc/bpf/
3. bpfloader in pre-T loads ANY bpf modules under
/apex/com.android.tethering/etc/bpf/ and /system/etc/bpf/.

We can't change the behavior of bpfloader in pre-T devices. We can't
delete the /system/etc/bpf/netd.o from pre-T devices. Both of them are
not mainline modules. So the mainlined netd.o needs to be packed into a
folder other than /apex/com.android.tethering/etc/bpf/ or
/system/etc/bpf/.

This commit adds a tag 'sub_dir' for bpf module. The installation path
of bpf modules will be:
- /system/etc/bpf/SUB_DIR/     (for platform code)
- /apex/MAINLINE_MODULE/etc/bpf/SUB_DIR/     (for mainline module)

Bug: 202086915
Test: add test in apex_test.go and build
Change-Id: Icc6619768ab006de9f86620a7df1bb2853eaba13
2022-01-19 04:02:29 +00:00
Yu Liu
4ae55d17f6 Support multilib in apex.
Bug: b/208325023
Test: Added unit tests, also tested with adbd apex build manually.
Change-Id: I47e04cd4eb5d05227f0a84683dcb66dff00e3514
2022-01-18 10:38:05 -08:00
Jiakai Zhang
6decef916c Allow installing boot images outside of APEX.
After this change, `bootImageConfig.installDirOnDevice` can be set to a
path outside of the APEX, in which case, the boot image will not be
installed in the APEX. Instead, it will be installed to the given path
by Make.

This is a no-op change. Current behavior is not affected.

Bug: 211973309
Test: m nothing
Test: -
  1. m com.android.art
  2. See the boot image still being installed in the ART APEX.
Test: -
  1. Change `installDirOnDevice` of the ART boot image config to
     `system/framework`.
  2. See the boot image being installed in `/system/framework/<arch>`.
Change-Id: Ib13b17cc9e94dc5754c9b51b04df3307323b8783
2022-01-13 14:50:05 +00:00
Liz Kammer
a3d7915c9e Add comments and clarify errors in neverallow
Sample of new error for violation:

error: system/bt/gd/rust/topshim/macros/Android.bp:10:1: module
"libtopshim_macros" variant "linux_glibc_x86_64": violates neverallow
requirements. Not allowed:
        module types: ["rust_benchmark" "rust_benchmark_host"
"rust_binary" "rust_binary_host" "rust_library" "rust_library_dylib"
"rust_library_rlib" "rust_ffi" "rust_ffi_shared" "rust_ffi_static"
"rust_fuzz" "rust_library_host" "rust_library_host_dylib"
"rust_library_host_rlib" "rust_ffi_host" "rust_ffi_host_shared"
"rust_ffi_host_static" "rust_proc_macro" "rust_test" "rust_test_host"]
      EXCEPT in dirs: ["device/google/cuttlefish/"
"external/adhd/" "external/crosvm/" "external/libchromeos-rs/"
"external/minijail/" "external/rust/" "external/selinux/libselinux/"
"external/uwb/" "external/vm_tools/p9/"
"frameworks/native/libs/binder/rust/" "frameworks/proto_logging/stats/"
"packages/modules/DnsResolver/" "packages/modules/Virtualization/"
"prebuilts/rust/" "system/core/libstats/pull_rust/"
"system/extras/profcollectd/" "system/extras/simpleperf/"
"system/hardware/interfaces/keystore2/" "system/librustutils/"
"system/logging/liblog/" "system/logging/rust/" "system/nfc/"
"system/security/" "system/tools/aidl/"
"tools/security/fuzzing/example_rust_fuzzer/"
"tools/security/fuzzing/orphans/" "vendor/"]

Old error:

error: system/bt/gd/rust/topshim/macros/Android.bp:10:1: module
"libtopshim_macros" variant "linux_glibc_x86_64": neverallow
-dir:device/google/cuttlefish/* -dir:external/adhd/*
-dir:external/crosvm/* -dir:external/libchromeos-rs/*
-dir:external/minijail/* -dir:external/rust/*
-dir:external/selinux/libselinux/* -dir:external/uwb/*
-dir:external/vm_tools/p9/* -dir:frameworks/native/libs/binder/rust/*
-dir:frameworks/proto_logging/stats/*
-dir:packages/modules/DnsResolver/*
-dir:packages/modules/Virtualization/* -dir:prebuilts/rust/*
-dir:system/core/libstats/pull_rust/* -dir:system/extras/profcollectd/*
-dir:system/extras/simpleperf/*
-dir:system/hardware/interfaces/keystore2/* -dir:system/librustutils/*
-dir:system/logging/liblog/* -dir:system/logging/rust/*
-dir:system/nfc/* -dir:system/security/* -dir:system/tools/aidl/*
-dir:tools/security/fuzzing/example_rust_fuzzer/*
-dir:tools/security/fuzzing/orphans/* -dir:vendor/*
type:"rust_benchmark" type:"rust_benchmark_host type:rust_binary
type:rust_binary_host type:rust_library type:rust_library_dylib
type:rust_library_rlib type:rust_ffi type:rust_ffi_shared
type:rust_ffi_static type:rust_fuzz type:rust_library_host
type:rust_library_host_dylib type:rust_library_host_rlib
type:rust_ffi_host type:rust_ffi_host_shared type:rust_ffi_host_static
type:rust_proc_macro type:rust_test type:rust_test_host

Test: go test soong tests
Change-Id: I1a7ee6bbc8258dfffa5a76f02c12fb1e54fdba1a
2021-12-21 12:00:43 -05:00
Jiakai Zhang
880e11112d Merge changes I8f4eaed1,I358a62d3
* changes:
  Dexpreopt standalone system server jars from prebuilts.
  Dexpreopt standalone system server jars.
2021-12-20 19:52:37 +00:00
Jiakai Zhang
28bc9a8a7e Dexpreopt standalone system server jars from prebuilts.
This change adds support for dexpreopting standalone system server
jars from prebuilts.

Bug: 203198541
Test: -
  1. Add a standalone system server jar (e.g., by patching
     aosp/1906158)
  2. Build and drop a module SDK and an APEX.
  3. Build a system image from prebuilts.
  4. See the odex and vdex files generated in
     $ANDROID_PRODUCT_OUT/system/framework/oat/
Change-Id: I8f4eaed10a1053cd560b8583efa12dc495f58db1
2021-12-20 15:48:20 +00:00
Treehugger Robot
f1228f570a Merge "Remove InstallBypassMake and ToMakePath" 2021-12-17 06:15:16 +00:00
Etienne Ruffieux
a447c0973b Merge "Renamed bluetooth apex name to com.android.bluetooth" 2021-12-16 18:10:45 +00:00
Jiakai Zhang
5f496eed0a Merge "Test that DisableGenerateProfile takes effects for APEXes." 2021-12-16 14:50:51 +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
Etienne Ruffieux
1651267c9c Renamed bluetooth apex name to com.android.bluetooth
Tag: #feature
Bug: 206614050
Test: Compiles
Change-Id: I4dc9f3d12ddc12e320a97c68144d5b642d6ab29b
2021-12-15 15:49:04 +00:00
Martin Stjernholm
12cba52e4f Merge "Remove the compat symlinks to ART binaries." 2021-12-15 10:07:18 +00:00
Jiyong Park
ae9cf26353 Merge changes from topic "canned_fs_config"
* changes:
  Add canned_fs_config to apex module type
  Build canned_fs_config using RuleBuilder
2021-12-15 09:57:42 +00:00
Jiyong Park
038e852ce1 Add canned_fs_config to apex module type
The property is used to customize uid/gid/mode/capabilities of files in
an APEX.

Bug: 209971551
Test: m
Change-Id: I484e46ff819a5266c1e8046dae337e18ef3fefea
2021-12-15 09:11:15 +09:00
Jiyong Park
1b0893eeba Build canned_fs_config using RuleBuilder
... in preparation for adding the support for custom canned fs config

Bug: 209971551
Test: m nothing
Change-Id: I7f2576ff99c65bdb6c9ce4ace61bc783eea2f0d4
2021-12-15 09:11:08 +09:00
Martin Stjernholm
0291abca62 Remove the compat symlinks to ART binaries.
App compact impact is hard to judge (see http://b/124106384#comment9
ff), so this tries it early in the dessert cycle.

This is also a workaround for b/209867137 where the symlink install
rules interact badly with the artifact_path_requirements.mk check.

Test: m installclean && m droid
  verify that $(PRODUCT_DIR)/system/bin doesn't have dalvikvm and
  dex2oat symlinks
Bug: 124106384
Bug: 209867137
Change-Id: I044fb40f656beeb7c6e61f1d418fa13f56714a70
2021-12-14 17:56:26 +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
Jiakai Zhang
7d3c9e0b5f Test that DisableGenerateProfile takes effects for APEXes.
Bug: 209630530
Test: m nothing
Change-Id: I5953f36e219ba63f8a01fa5dc60456db35eef5ac
2021-12-14 10:55:12 +00:00
Martin Stjernholm
d7c3fc0ae0 Merge "Do not allow duplicate deapexer dependencies." 2021-12-13 15:52:19 +00:00
Jingwen Chen
8d0bd355fd Merge "bp2build: Fix apex.binaries to be a LabelListAttribute." 2021-12-13 10:03:50 +00:00