Commit graph

508 commits

Author SHA1 Message Date
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
Yike
40f5c3a1fe Export test config info to module-info while the module is uninstallable
All Robolectric tests are set as uninstallable modules, which skips the
logic exporting `test_config` and `auto_test_config` to module-info.
But downstream infra needs this information to determine if a module is
a test module. So that this change moves the logic that sets
`test_config` and `auto_test_config` for Robolectric tests out of the
snippet specifically for installable module.

Test: m out/target/product/coral/module-info.json
Bug: 268670243
Change-Id: Icf4caf3d6833f3a39927fb69c6fb76762b8f6f14
2023-02-15 03:18:28 +08:00
Kelvin Zhang
1143aaf772 Fix generic ramdisk build failures on dedicated recovery partitions
For targets with BoardUsesRecoveryAsBoot set to true, binaries in
generic_ramdisk are installed to $OUT/recovery/root/first_stage_ramdisk
This path is not on generic_ramdisk.mk 's allowlist, hence build fails.
To fix the failure, add $OUT/recovery/root/first_stage_ramdisk/system to
allow list.

Test: th, lunch eos-userdebug(a dedicated recovery partition target) and build.

Bug: 265477065
Change-Id: I89cf229adc028a7e5de632b9a3188ecb411de735
2023-01-17 17:11:55 +00:00
Yike Zhang
6ba1c7b6c3 Merge "Export Java libraries into module-info" 2022-09-08 10:46:59 +00:00
Yike
82f0a2d751 Export Java libraries into module-info
Some Java modules are defined in Android.mk and they declare
dependencies in eigther LOCAL_STATIC_JAVA_LIBRARIES or
LOCAL_JAVA_LIBRARIES. This information needs to present in
module_info.json and be exported to properly generate Bazel targets
that include these dependencies.

Test: m out/target/product/coral/module-info.json
Bug: 245686435
Change-Id: I77bc8de59f1d46bb098463066e1f52b98ebae955
2022-09-08 07:59:20 +00:00
Kiyoung Kim
ad0d7710fe Replace dependencies from the Makefile to API imported modules
There are some module definitions in the Makefile, which needs to be
built with API imported module. This change replaces existing
dependencies from the Makefile, to append suffix on the reference, so it
can be linked to API imported modules.

Bug: 243736650
Test: 'ALLOW_MISSING_DEPENDENCIES=true m halutil' succeeded.
Change-Id: I12baa36e41c0c69228be5f0d08fb4c18eb8a22b1
2022-09-02 13:15:05 +09:00
Zhenhuang Wang
415ee12c76 Export test_options.tags to module-info
The test_options.tags attribute modifies execution behavior when running
tests in ATest Bazel mode. Exporting the value to module-info enables
ATest to add them to the corresponding Bazel target.

Bug: 240928948
Test: manually add `test_options.tags` attribute and run:
    $ refreshmod && \
      cat out/target/product/generic/module-info.json |\
      grep <tags>
Change-Id: I1a70d5c66703ed6a5a250459a80e8bca71d659b6
2022-08-22 20:59:54 +08:00
Cole Faust
f773f3a024 Add deprecation warning for base-rules-hook
This lets product/board config define a function that
is called while processing modules defined in an
Android.mk file.

When the product/board configs are converted
to starlark, they won't be able to supply a base-rules-hook
anymore. Emit a warning saying that it's deprecated.

Bug: 226974242
Test: Manually
Change-Id: Ie6baa4952516a3ec5c6c440f9106f7b5185803b7
2022-04-28 16:20:32 -07:00
Treehugger Robot
8a6fa9c7c5 Merge "Allow init_rc files to be installed in ramdisk" 2022-04-20 18:07:17 +00:00
Kelvin Zhang
701f161eb6 Allow init_rc files to be installed in ramdisk
Test: th
Test: m target-file-package, then check INIT_BOOT dir of target file,
    make sure snapuserd.rc is there
Bug: 219841787
Bug: 228893064

Change-Id: Iac3f219c763fbf8acd17f0339089c7576974dc05
2022-04-15 10:17:18 -07:00
Trevor Radcliffe
6bb8a1ad22 Add comment for previous CL
Let people know why why change 2051889 was created

Bug: 226402757
Test: N/A
Change-Id: I57cfa6382805aa20e2a905936d63ffaec6c3c236
2022-04-05 16:29:18 +00:00
Trevor Radcliffe
74a4de735b Make changes to support test_suites for test lib
Had to make changes to make to ensure that we don't duplicate

Bug: 226402757
Test: Confirmed that libraries are installed to the correct place
Change-Id: I64e4a5ab7cac3fb57442d19b0f796fffb0a3f48a
2022-03-31 18:15:58 +00:00
Bob Badour
42f00c7b61 Test suite notices using dependencies.
Switch from combine-notice-files to html-notice-rule and
text-notice-rule.

Bug: 151177513
Bug: 213388645
Bug: 210912771

Test: m cts reportmissinglicenses
Change-Id: I59d78553f15f0fd6be87228c933693b63e2ebf04
2022-03-23 11:18:39 -07:00
yangbill
b2219c7052 Add supported variants to module-info
Export the list of variants (host, host_cross, device) a build module
supports to module-info for downstream tools. The values correspond to
the Soong `host_supported`, `host_cross_supported`, and `device_supported`
attribute values.

Bug: 220263783
Test: m out/target/product/vsoc_x86_64/module-info.json
Change-Id: I10ae6ea21791d0d100686dcabecbce543a9adc3f
2022-02-25 01:28:51 +00:00
yangbill
e6b498bf2d Add data_bins to data_dependencies in module-info
This change exports the list of test_data_bins as data dependencies
that are required by modules when running the test.

Bug: 215234071
Test: m out/target/product/vsoc_x86_64/module-info.json
Change-Id: Ie5c1ef70055618a5fa0ba1bcfbcba8054743d41a
2022-02-17 05:17:03 +00:00
yangbill
fa5026c4d8 Export runtime dependencies in module-info
This change exports the list of dependencies that are required by
modules at runtime. Note that only the host case is currently
handled.

Bug: 215243373
Test: m out/target/product/vsoc_x86_64/module-info.json
Change-Id: I05199c54da311e59c7ea87595397ee4eecfab6a3
2022-02-10 08:07:13 +00:00
yangbill
724565d885 Export test data dependencies in module-info
Add the list of targets that are handled as data inputs and
required by tests at runtime.

Bug: 205726862
Test: m out/target/product/vsoc_x86_64/module-info.json
Change-Id: Id1468ebaf8f72cf37787f3cc514a29724c115db5
2022-01-05 10:34:51 +08:00
yangbill
6dd962fdda Preserve all COMPATIBILITY_SUITES values in module-info
Extend COMPATIBILITY_SUITES in module-info to avoid overwriting previous
values. In particular, this happens for the `host-unit-tests` suite
which is automatically added by Soong rules only to be clobbered by the
modules that have both device and host variants.

Bug: 209806322
Test: source build/envsetup.sh ; lunch aosp_cf_x86_64_phone ;
      m out/target/product/vsoc_x86_64/module-info.json
Change-Id: I56a2d4c9786ed3da1e788ba211ec1bcaa6559549
2021-12-14 05:54:30 +00:00
Colin Cross
802f2116ed Translate BUILT_INSTALLED to LOCAL_BUILT_MODULE
Soong creates install rules and lists them in LOCAL_SOONG_INSTALL_PAIRS,
where they get copied to ALL_MODULE.$(m).BUILT_INSTALLED.  BUILT_INSTALLED
is used by package-modules.mk to copy the built modules to alternate
install locations for building zips like continuous_native_tests.zip.

Translate Soong's built module location, which is listed in
LOCAL_PREBUILT_MODULE_FILE, into $(LOCAL_BUILT_MODULE) when setting
BUILT_INSTALLED so that package-modules.mk copies from
$(LOCAL_BUILT_MODULE) instead of $(LOCAL_PREBUILT_MODULE_FILE).  This
ensures that the transitive dependencies added to $(LOCAL_BUILT_MODULE),
for example the unstripped symbols files, are present when
continuous_native_tests.zip is built.

Bug: 206137439
Test: manual
Change-Id: I1a45cd6d3c81d6435a10f4d29557e521753068a4
2021-11-15 13:15:22 -08:00
Treehugger Robot
372d74a8c9 Merge "Record ALL_DEPS by default." 2021-11-11 04:48:16 +00:00
Jim Tang
5c6410edee Record ALL_DEPS by default.
Abandon the use of RECORD_ALL_DEPS to record ALL_DEPS.

BUG: 204397180

Test: m, and inspect module-info.json.
Change-Id: Iaf35580b52c11ad37017b1fb8e0937b859d3f55b
2021-11-11 10:24:51 +08:00
Treehugger Robot
585ec03c47 Merge changes from topic "soong-java-install"
* changes:
  Move java install rules into Soong
  Don't create compatibility suite copy rules for installed path
2021-11-10 17:05:51 +00:00
Colin Cross
a69b809425 Don't create compatibility suite copy rules for installed path
Don't create compatibility suite copy rules for $(LOCAL_BUILT_MODULE)
to $(LOCAL_INSTALLED_MODULE), as that could conflict with a Soong
install rule.  Instead, always create the install rule the normal way,
and replace the compatibility suite copy rule with a noop if it is the
same as the normal rule.

Bug: 204136549
Test: m checkbuild
Change-Id: Ic8ac80eda8554fae2b7ecc2516165da020bdaebe
2021-11-08 15:23:32 -08:00
Colin Cross
d954ea888a Add missing dependency from module name to symlinks
The rules to install the symlinks had dependencies from PRODUCT_PACKAGES
install rules, but from manual install requests like `m toybox`.  Add
the missing dependencies.  Also add the new declare-0p-target licensing
call.

Fixes: 205524422
Test: m toybox
Change-Id: Ie9a5e37b09250aa271ab153a13f41bc34fa4a38a
2021-11-08 19:40:22 +00:00
Steven Moreland
ec71cbf0c8 Merge "vintf recovery install parity w/ init_rc" 2021-11-04 22:28:51 +00:00
Bob Badour
879cfa867d Add macros for non-module license metadata and deps
Gets rid of .meta_module files and instead defers emitting rules until
after all the non-module targets have been processed. Allows direct
dependency on .meta_lic files, which in turn depend on license text
files.

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Test: m systemlicense
Test: m reportmissinglicenses

Change-Id: I2c467feac6e13a9366ff66f924889f1dbd48c3f1
2021-11-03 00:52:25 +00:00
Treehugger Robot
dcb0e44c46 Merge "Add share_libs and system_share_libs to module-info" 2021-11-02 01:52:17 +00:00
Steven Moreland
b186183ae2 vintf recovery install parity w/ init_rc
There was a relatively recent change (id
I82d0f40d6d7047e271612204391c5a027f84f52f) which avoided installing
init_rc scripts to system when a module was installed to system. This
same bug also existed in VINTF installs.

Future consideration: macrotize behavior (delaying since there are some
subtle differences in paths/variables and given bazel efforts).

Fixes: 204270700
Test: boot
Test: 'mmma hardware/interfaces/health/aidl/default' installs vintf
fragments to '/system/etc/vintf/manifest' before this change but not
after.

Change-Id: Icf505af74c95386a0ed8cb4468dcf7c1122db847
2021-11-01 17:58:28 -07:00
yangbill
5f5e2362fa Add share_libs and system_share_libs to module-info
Bug: 202922558
Bug: 204269866
Test: m out/target/product/vsoc_x86_64/module-info.json

Change-Id: Idb4e66216cac4835968454f83196107f6bec4c1c
2021-11-01 06:38:43 +00:00
Colin Cross
23ee375a4a Support generating install rules in Soong
Support moving some install rules into Soong by allowing Soong to
provide a Makefile containing install rules, and by skipping parts
of base_rules.mk when Soong already created an install rule.

The install rules are exported as a Makefile instead of directly
in Soong's build.ninja file so that base_rules.mk can add dependencies
from the `required` property that are hard to resolve in Soong.

Bug: 204136549
Test: m checkbuild
Change-Id: Ife2964d76469b385e90c0c5f6adf21bd2b5e8bf6
2021-10-29 15:43:39 -07:00
Yuntao Xu
32a085c041 add LOCAL_DISABLE_TEST_CONFIG logic
Disable the generation of .config file when the variable
LOCAL_DISABLE_TEST_CONFIG is true.

Bug: 188927912
Test: rum 'm module-name' (`android_test_helper_app` type module)
Test: TreeHugger
Change-Id: I64372b4ba84fcf1af937abdee345ceb1d3c2f6c5
2021-05-27 10:19:48 -07:00
Treehugger Robot
207405719b Merge "Add LOCAL_FULL_VINTF_FRAGMENTS to handle full path" 2021-04-22 17:03:31 +00:00
yangbill
877586c8c8 Only allow LOCAL_IS_UNIT_TEST set to ALL_MODULES if defined.
To prevent the argument be cleaned if the same module name with
different unit_test value, treat it as unit test if one of the module is
treated as unit tests.

Bug: 176096135
Test: m out/target/product/generic/module-info.json
Change-Id: Iee4ee1063d47dcba1aaf915ec9e4e56f8c7df787
2021-04-19 20:34:07 +08:00
Liz Kammer
5b6f5a7bcc Add LOCAL_FULL_VINTF_FRAGMENTS to handle full path
Soong supports references to other modules for vintf_fragments property,
so full paths need to be passed from Soong to make rather than module
local paths.

Test: m droid
Bug: 184567830
Change-Id: Ia7f1cf977de8aeb08d41624277ff6231198222e5
2021-04-16 16:40:59 -04:00
Liz Kammer
382be36c43 Add LOCAL_FULL_INIT_RC to handle init_rc full path
Soong supports references to other modules for init_rc property, so full
paths need to be passed from Soong to make rather than module local
paths.

Test: m droid dist
Bug: 184567830
Change-Id: Ib1873a3418830f5cbf32e26f55d3ad0ab0d9c9c5
2021-04-08 11:33:46 -04:00
Bob Badour
17831e3da3 Remove LOCAL_LICENSE_KINDS from core makefiles.
Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: I4deec3e07862e89dd32880774efb4624a9723cf2
2021-02-16 04:37:23 -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
Yifan Hong
83d1c2ed4b Install init_rc for recovery modules correctly.
If a module is installed to TARGET_RECOVERY_ROOT_OUT,
then its init rc file (declared in LOCAL_INIT_RC) is installed
to $OUT/recovery/root/system/etc/init instead of
$TARGET(partition)_OUT_ETC/init.

Fixes: 178859897
Test: m snapuserd.recovery

Change-Id: I82d0f40d6d7047e271612204391c5a027f84f52f
2021-02-02 17:04:53 -08:00
yangbill
732b858481 Add unit_test option to module-info.json
Bug: 176096135
Test: atest -m hello_world_test, check module-info.json
Change-Id: Id8bc2eb0d93896afcbe5ce87b0205528615f090e
2021-01-08 17:36:56 +08:00
Dan Shi
41f6291a9f Add unit tests to host-unit-tests suite
Bug: 172006742
Test: m
Change-Id: Id58f5a24df2fe61229ce2eae2d655f7aa31b6aba
2020-11-16 16:55:42 -08:00
Jooyung Han
b27c2e8af9 Use file_contexts for flattened apexes
Because flattened apexes are installed in /<partition>/apex, associated
file_contexts file should be modified to accommodate path changes and
also merged into target-wide file_contexts.bin file.

Soong now emits modified file_contexts via LOCAL_FILE_CONTEXTS, and
these files are collected into a temporary file_contexts.modules.tmp
file, which is used as an additional input of file_contexts.bin.

Bug: 166518492
Test: m file_contexts.bin
      check the contents of file_contexts.concat.tmp file
Change-Id: I002a2294af9e06baeaf54bc5a9a5380d23b8a3da
2020-09-23 15:43:58 +00:00
Dan Shi
22bc099c02 Force extra config file to be .config
TradeFed only supports .config file as test config.

Bug: 163344047
Test: m HelloWorldTests

Change-Id: Ib963d04fc308b9c319d5b59f50f9ca9b5b575b72
2020-09-16 15:52:13 -07:00
Treehugger Robot
897cfaee46 Merge "Add test_mainline_modules option support in mk" 2020-09-09 07:36:11 +00:00
kellyhung
0ba6ec6f49 Add test_mainline_modules option support in mk
Bug: 165425972
Test: Apply aosp/1418212
      atest -b hello_world_test
      Check module-info.json for hello_world_test HelloWorldTests and
HelloWorldHostTest

Change-Id: Ie30a09a54b0ae927ca4d8d1aaba2ac0cdb15233a
2020-09-03 02:37:44 +00:00
Martin Stjernholm
a24c0fe655 Merge "Preserve symlinks in the Soong prebuilt install steps for host binaries and shared libs." 2020-09-01 10:32:49 +00:00
Martin Stjernholm
49a4e9b52e Preserve symlinks in the Soong prebuilt install steps for host binaries
and shared libs.

If a prebuilt module file is a symlink in the .intermediates tree it is
preserved when copied to the final install location. This preserves
symlinks to prebuilt binaries, so that they are run from their prebuilt
source location and can find libraries in relative paths from there.

Symlinks are converted to absolute, to not fail if they are relative in
the source tree.

Test: m clean && m droid dist checkbuild
  with and without the change, then compare the lists of symlinks in
  the out/ trees
Test: build/soong/soong_ui.bash --make-mode \
    TARGET_PRODUCT=crosshatch_hwasan TARGET_BUILD_VARIANT=userdebug \
    droid SANITIZE_TARGET=hwaddress \
    continuous_instrumentation_tests_api_coverage \
    continuous_native_tests device-tests platform_tests
  check that libclang_rt.hwasan_static-aarch64-android.a isn't a
  symlink in out/target/product/crosshatch/obj
Bug: 145934348
Change-Id: I7600e5b0754f8ea6cd0ffc8e1ba6d39153f182aa
2020-09-01 00:24:54 +01:00
Treehugger Robot
947cb0fd87 Merge "Introduce BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES" 2020-08-28 04:26:49 +00:00
Jeongik Cha
0d1d98157a Introduce BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES
If BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES has a numeric value,
it replaces "current" or "system_current" with the version which
the flag indicates.

Bug: 163009188
Test: BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES=29 m, and then check if every vendor
java module's sdk_version is 29 if its sdk_version was current.

Change-Id: I8c7cf21563b984b8e9ef398192031b1f66d96494
2020-08-24 23:16:19 +09:00
Dan Shi
0c9a525b98 Add extra_test_configs option support in mk
Bug: 163344047
Test: m -j HelloWorldHostTest hello_world_test HelloWorldTests
Change-Id: Ie63c2a80e01984ac9941d0bad4ad7948e0bb8ac0
2020-08-19 21:22:50 -07:00
Yo Chiang
15fbad3dfa Merge "Don't call $(my_path_comp) if $(dir $(LOCAL_PATH)) is TOP" 2020-08-12 03:55:57 +00:00