Commit graph

75 commits

Author SHA1 Message Date
Colin Cross
2f63457354 Avoid conflicts between architectures in prebuilt_renderscript_bitcode
The NDK build has 4 architectures, x86 and arm 32-bit architectures and
x86_64 and arm64 64-bit architectures.  Multilib on its own is not
enough to prevent collisions in install locations.  Detect conflicts
and add the architecture to the path the same way cc/installer.go does.

Bug: 308212344
Test: OUT_DIR=out build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: If7a1b062035dda87f5f8129062778c41c43de17b
2023-11-13 12:12:06 -08:00
Colin Cross
f17e2b55f1 Support prebuilt_renderscript_bitcode modules
Support installing a *.bc file into /system/lib or /system/lib64
with a prebuilt_renderscript_bitcode module.

Bug: 308212344
Test: m libclcore
Change-Id: Ie0cb7879835260c537a8a9dfd558c43ad7f4abea
2023-10-30 15:17:25 -07:00
Zi Wang
11bd9d4c39 Add detail string for the module marked bp2build unconvertible
This change is only for the unconvertible modules types
from prebuilt_etc.go

Test: CI

Bug: 303725325
Change-Id: I06d8c1325c158c0669740abe7188281370655265
2023-10-19 09:54:29 -07:00
Zi Wang
040541496a Support prebuilt_root_host in bp2build
Also fix a bug that filename string may contain wild card

Test: Added unittest and CI

Bug: 303725325
Bug: 304590341
Change-Id: I5de9c195343328981a4154024c0fe4e14969ce79
2023-10-11 12:16:26 -07:00
Christopher Parsons
c331812a59 Merge "Have ConvertWBp2build use Bp2buildMutatorContext" into main 2023-09-20 17:56:24 +00:00
Chris Parsons
637458d326 Have ConvertWBp2build use Bp2buildMutatorContext
This no-op refactoring facilitates some upcoming functional changes for
"bp2build allowlist v2". The work requires that the bp2build conversion
mutator be changed from a TopDown mutator to a BottomUp mutator.
Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext
makes it easier to make this functional change without touching tens of
files and multiple projects.

Bug: 285631638
Test: m bp2build
Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
2023-09-20 14:49:35 +00:00
Liz Kammer
9e2a5a7d6d Don't panic for unhandled product vars
Instead, we return an error. This allows us to access some product
variable information earlier when it will not be used as an attribute
without panicing

Test: m nothing
Change-Id: Id094b2b9e1364a8d174d99b3824fa149fb235b3e
2023-09-19 15:58:22 -04:00
Liz Kammer
d5d12d028b bp2build: block src == name for prebuilt_* modules
src == name causes circular dependency errors, instead mark these as
unconverted and don't create modules for them.

Test: m bp2build and verify boringssl_self_test.zygote64.rc unconverted
Change-Id: I5d5fdd7e14830cd685816064cd0377998d07293c
2023-09-07 12:26:22 -04:00
Cole Faust
dff9c14148 Add install_symlink soong module type
This can be used to install symlinks to arbitrary locations/targets
on the device. Used to replace a make-built symlink.

Bug: 205632228
Test: built and ran the emulator observed the /system/bin/hwservicemanager symlink is still there
Change-Id: I6df922c8d919e6d56fa79702815a89c98f4d65ed
2023-09-01 17:18:48 -07:00
Spandan Das
756d3400d6 Mixed builds support for prebuilt_* targets
These targets do not have any build actions per se, but return a
PrebuiltFileInfo provider. Parse this info from cquery and generate the
appropriate installation rules and androidmk entries

Details
- Support the bp2build available properties. Not all properties have
  been converted by bp2build yet, and those are being tracked in b/207489266
- Create a addInstallRules helper function to reduce duplication between
  GenerateAndroidBuildActions and ProcessBazelQueryResponse

Test: unit test
Bug: 280094612
Change-Id: Ia67986af1dd2ff4712586dbec86ee9fda380f726
2023-06-07 22:08:35 +00:00
Justin Yun
8bd3afe68c VSDK: etc snapshot may have sub_dir for relative_install_path
prebuilt_etc may use sub_dir property to define a relative install
path. Use SubDir() to read either sub_dir or relative_install_path
property.

Bug: 282080219
Test: m vendor-image
Change-Id: I07a21c5aeb87b403854ed32976d26e70b046b8c1
2023-05-12 15:53:06 +09:00
Justin Yun
1db9748805 Include license information for vendor and host snapshots
In addition to the license text files, include license kinds
information to json file. Also, use the original paths of license
text files that are copied to NOTICE_FILES directory.
This will be used when generating snapshots from the snapshot build.

Bug: 271539873
Test: m vendor-snapshot
Change-Id: I0c0427bb66f2c1fca322d5554aa66220a3b62fb3
2023-04-25 18:03:32 +09:00
Cole Faust
912bc8862e Use product variables from the overridden apex
override_apex's bp2build converter had a bug where it was looking at
the product variables for the override_apex module itself instead of
for the base module it is overriding.

Fixes: 271424349
Test: go test
Change-Id: If1e2653d3751fa908faf0ab97dfa2e943ebe98ec
2023-03-08 12:29:50 -08:00
Wei Li
598f92d704 Export Soong module type to LOCAL_SOONG_MODULE_TYPE to Make for SBOM generation.
Bug: 266726655
Test: CI

Change-Id: If5b1a77930a591b6061ca2749c9c5ad29b4491fb
2023-03-06 22:51:03 +00:00
Miguel
32b0280098 Add conscrypt updatable certificates.
This cl adds a new PrebuiltEtcCaCertsFactory used by ca_certificates_apex in order to create the prebuilts used by the conscrypt apex.

Test: TrustedCertificateStoreTest
Change-Id: Iecac0e4b7ccdce77abb5140db944ea6f42c7d77f
2022-12-15 15:53:42 +00:00
Colin Cross
725eac60a2 Add AllowMissingDependencies support for prebuilt_etc module with no src property
Arch-specific prebuilt_etc modules may be missing source files for new
architectures.  Allow build analysis to continue when there is no
source file when AllowMissingDependencies is set.

Bug: 250918230
Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing
Test: TestPrebuiltEtcAllowMissingDependencies
Change-Id: I647c7305339e3ed80283be5e59e6f4ef15ae2384
2022-10-04 16:38:14 -07:00
Alix
5918d649a4 Implement bp2build for prebuilt_etc_xml
Bug: 237039154
Test: xml_conversion_test.go & bp2build
Change-Id: I1f2c57b9532138f73041d8fc08feea3f66b2ebbc
2022-09-22 20:17:19 +00:00
Alix
bbfd538326 product_variables srcs in prebuilt_etc
bp2build conversion handles product_variable srcs

bug: 228353067
Test: prebuilt_etc_conversion_test.go
Change-Id: I82d3a384ee14d4e981d502dd9eb824c87d5ae2c7
2022-09-09 20:52:09 +00:00
Alix
993872a5d7 Handle filename variations for prebuilt_etc in bp2build
Bp2build now handles these cases:

-filename is specified as a property
-if filename is not specified and filename_from_src = true,
	filename is set as the src
-filename defaults to the module name otherwise

Bug: 228353188
Test: bp2build/prebuilt_etc_conversion_test.go
Change-Id: Ia4c9b2c89f100e4ed9363dc3ba20ea501b776216
2022-09-01 18:42:10 +00:00
Colin Cross
d079e0b270 Reformat build/soong for go 1.19
Test: none
Change-Id: I132368f0fcbdb5ea088b5b84dbe4ccfdd9e94cad
2022-08-17 10:43:13 -07:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
c78604e6a4 Use prebuilt_file for prebuilt_{etc,usr_share}
Bug: 215723302
Test: TestPrebuiltEtcNoSubdir
Test: bp2build.sh
Test: mixed_{libc,droid}.sh
Change-Id: I006bfe12beb770e11153c52eddf34a6ec7f9e363
2022-03-21 12:29:26 -04:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
b81f77ed24 Abstract prebuilt_etc into prebuilt_file
Bug: 215723302
Test: bp2build.sh
Test: mixed_{libc,droid}.sh
Change-Id: I0dab7a6209320e31cfdfe1ce28cacd4f37c11024
2022-03-21 11:21:59 -04:00
Liz Kammer
e9ecddc972 Add support for a prebuilt_root_host type.
Test: art-tests
Change-Id: If013e46d2bbd9cc937a11fe7cf3b67eb8b262b55
2022-01-06 12:14:59 -05:00
Liz Kammer
a923442da6 Add prebuilt_etc_host to bp2build conversion.
Test: bp2build.sh
Change-Id: I976a7f325f00d65867c27e0c3feba34ff217975f
2022-01-05 13:52:33 +00:00
Chris Parsons
58852a05f3 Handle the 'enabled' property in bp2build
Also fix some bugs pertaining to configurable attribute handling of bool
attributes and label sttributes, so that they may support values across
multiple different axes at the same time.

Test: unit tests for bp2build
Test: mixed_droid

Change-Id: I411efcfddf02d55dbc0775962068a11348a8bb2c
2021-12-21 16:37:32 -05: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
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
Martin Stjernholm
dc6525e553 Make all the PrebuiltEtc modules defaultable.
Test: m nothing
Change-Id: I69d73ebf2f0761787c6e71241344a43d3b9d49f8
2021-10-14 00:55:53 +01:00
Liz Kammer
ba26bdc316 Merge "Handle arch-variant in prebuilt_etc" 2021-10-06 15:36:57 +00:00
Liz Kammer
dff00ea509 Handle arch-variant in prebuilt_etc
For cc_binary, changing the handling of version_script to no longer be a
LabelAttribute, which reduces test coverage of that type. Expand
prebuilt_etc to handle arch-variant srcs and correct a bug in
LabelAttribute.

Test: build/bazel/ci/bp2build.sh
Change-Id: I620bc3a43b28c1873f335e30099844ca79ce94c1
2021-10-04 13:44:34 -04:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
447f6c99c9 Bp2Build common properties auto-handling
Introduce `commonAttributes` & `fillCommonBp2BuildModuleAttrs used in
CreateBazelTargetModule

Adapt `bp2BuildInfo` to use `commonAttrs` instead of `Name`.
And thus also all downstream users of `CreateBazelTargetModule`.

As initial user, the Soong `required` property will be
translated to Bazel's `data`.

Bug: 198146582, 196091467
Test: build_converstion_test.go:TestCommonBp2BuildModuleAttrs
Test: go test
Test: mixed_{libc,droid}.sh
Change-Id: Ib500e40f7e2cb48c459f1ebe3188962fc41ec124
2021-10-04 14:43:04 +00:00
Rob Seymour
f6c37cc87d Merge "Add module based host-tools snapshot" 2021-09-14 14:47:03 +00:00
Rob Seymour
925aa09ea1 Add module based host-tools snapshot
Add new module:
host_snapshot {
    name: "host-snapshot"
    deps: [
      (list of host tools)
    ],
    ...
}

Package host tools using android.PackagingBase to capture host tools and transitive packaging data.
Add JSON meta data to snapshot that allows snapshot to be installed via development/vendor_snapshot/update.py

Add support to generate a fake host snapshot of all host modules that is used to detect required
modules via development/vendor_snapshot/update.py.

Bug: 192556798
Bug: 194799048
Bug: 192896149
Test: m HOST_FAKE_SNAPSHOT_ENABLE=true host-fake-snapshot dist -- check snapshot exists in dist

Change-Id: I849c4db801cd858408f6fe6a3ce69262a23a5be9
2021-09-13 21:29:14 +00:00
Liz Kammer
2ada09a546 Don't create a new module for bp2build conversion.
A performance improvement for bp2build as Blueprint/Soong no longer have
the overhead of additional modules. The creation of these modules
results in:
* traversal of additional modules for each subsequent mutator
* synchronization over a go channel to collect newly created modules:
https://cs.android.com/android/platform/superproject/+/master:build/blueprint/context.go;l=2594,2600;drc=1602226f23181b8c3fbfcaf3358f0297e839d7d3

We avoid both of these by storing the information directly in the
underlying module.

Also as a fringe benefit, removes some necessary boilerplate for
conversion.

For benchmarks, reduces runtime ~1% for 1% converted, ~24% for 100%
converted. See more: go/benchmarks-for-https:-r.android.com-1792714

Test: ran benchmarks/tests in bp2build
Test: build/bazel/ci/bp2build.sh
Change-Id: Ie9273b8cbab5bc6edac1728067ce184382feb211
2021-08-17 15:57:09 -04:00
Kiyoung Kim
754b9cce24 Merge "Create new module type 'snapshot_etc'" 2021-07-29 01:27:11 +00:00
Rupert Shuttleworth
378fc1b410 Add initial bp2build convert for prebuilt_etc modules.
Test: Added unit test.

Change-Id: Ie63674e4a867e355e4667b4240979b822f0f3c86
2021-07-28 08:22:25 -04:00
Kiyoung Kim
ab9a31c9bc Create new module type 'snapshot_etc'
It requires new module type to generate 'prebuilt_etc' modules in the
snapshot, because of name conflict with existing modules. This change
defines new module type 'snapshot_etc' as prebuilt of 'prebuilt_etc', so
it can replace original module on certain conditions.

Bug: 192430376
Test: Tested with snapshot_etc of ld.config.recovery.txt module
Change-Id: Ia4d27ce2077a10591597d2614c7c29c23a245149
2021-07-27 10:36:30 +09:00
Colin Cross
78fd15f7d6 Merge "Replace android.BuildOs with Config.BuildOS" 2021-07-23 00:07:01 +00:00
Colin Cross
0c66bc615b Replace android.BuildOs with Config.BuildOS
Replace the android.BuildOs constant with Config.BuildOS so that it
can vary based on the product config.

Bug: 190084016
Test: all Soong tests
Change-Id: Ia67f872d8b2ab788747a22e3a9659dc21c9775cd
2021-07-20 12:46:48 -07:00
Kiyoung Kim
ae11c233b5 Update prebuilt_etc available for snapshot
Make prebuilt_etc module available for the snapshot. This change
includes implementing snapshot interface for the prebuilt_etc module so
it can be added to the snapshot from the fake snapshot, or when the
module is specified in the list.

Bug: 192430376
Test: m nothing passed
Test: Checked if the module is included in the snapshot properly
Change-Id: I3574d2a1b8f8f4e5f083f3913e8768f5088d0c46
2021-07-20 11:24:03 +09:00
Inseob Kim
1e27a14545 Add prebuilt_defaults for prebuilt etc modules
Bug: 33691272
Test: build
Change-Id: I9af232e9ed9b0815c4cc70dfae2ec44e87b6d114
2021-05-06 11:46:11 +00:00
Treehugger Robot
cbaef6ff0f Merge "Add debug ramdisk variant." 2021-05-02 23:54:40 +00:00
Colin Cross
8d0ed7ebd5 Merge "Add prebuilt_rfsa module type" 2021-04-30 16:35:20 +00:00
Inseob Kim
08758f08e9 Add debug ramdisk variant.
A module will be installed to /debug_ramdisk if debug_ramdisk is set to
true.

This is a reland of f84e9c05e2, with a fix
that removes /first_stage_ramdisk.

Bug: 184004542
Test: soong test
Change-Id: I739de63cfec6b0fec5a90f7c4741fc4d884d209c
2021-04-29 22:58:17 +09:00
Inseob Kim
aeb6bad073 Revert^3 "Add debug ramdisk variant"
836a8f3d61

Change-Id: If59529238e26a197bc33b10245b88f538f280ed0
2021-04-22 23:14:58 +00:00
Florian Mayer
836a8f3d61 Revert^2 "Add debug ramdisk variant"
78ea2f5eac

Change-Id: I6a6a2ee82e2807045364bab105ec03a1934b411f
2021-04-22 16:38:47 +00:00
Bowgo Tsai
78ea2f5eac Revert "Add debug ramdisk variant"
This reverts commit f84e9c05e2.

Because this breaks the usage of boot-debug.img and
vendor_boot-debug.img

Bug: 185970130
Bug: 185990198
Test: make bootimage_debug
Change-Id: I7886c971982faae1d5bc34688643de8d94d6e201
2021-04-22 09:49:24 +08:00
Treehugger Robot
017a1bb7c9 Merge "Add prebuilt_root module" 2021-04-15 06:31:53 +00:00
Inseob Kim
f84e9c05e2 Add debug ramdisk variant
A module will be installed to debug_ramdisk (or
debug_ramdisk/first_stage_ramdisk if recovery as boot is true) if
debug_ramdisk is set to true.

Bug: 184004542
Test: soong test
Change-Id: Ic5a4d27407e506fffa462de2149e0785f11b2ac7
2021-04-15 00:56:30 +00:00
Inseob Kim
27408bf32c Add prebuilt_root module
prebuilt_root supports installing files directly under root.

Bug: 181728482
Test: soong test, manual
Change-Id: Ib1f9a4fd4c9a47094d5f41106fc12696741e2ff1
2021-04-14 13:19:29 +09:00