Commit graph

57 commits

Author SHA1 Message Date
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
Colin Cross
83ebf23a0d Add prebuilt_rfsa module type
Add a prebuilt_rfsa module type that can install firmware files to
vendor/lib/rfsa.

Bug: 181289338
Test: TestPrebuiltRFSADirPath
Change-Id: I9dcf6a2188e60f361673bf876a52e985ab709d2e
2021-04-09 10:27:03 -07:00
Paul Duffin
89648f98fa Remove usages of FixtureFactory from misc packages
These packages have already been migrated to use per test build
directory so have no need for a FixtureFactory.

Bug: 183235980
Test: m nothing
Change-Id: I667d1d992caaf0f615de91f89efdae11c44986c2
2021-03-22 18:31:53 +00:00
Paul Duffin
5f9f771dab Migrate etc package to a per test build directory
Bug: 182885307
Test: m nothing
Change-Id: I0f516efdf3344ba4c5d70c2fcc8d322f56e12a86
2021-03-16 12:46:52 +00:00
Paul Duffin
e84b1338c5 Migrate from result methods to function Asserts
Bug: 181070625
Test: m nothing
Change-Id: Iadb85270290acb52c55f2ad70c9f145f1c34b611
2021-03-12 22:24:51 +00:00
Paul Duffin
921fac7cf9 Convert etc tests to use test fixtures
Bug: 181070625
Test: m nothing
Change-Id: Ic248e233f57f966164284d7cab813398305482c9
2021-03-10 09:51:30 +00:00
Paul Duffin
1172fed8eb Support test fixtures in etc package
Restructures the etc package test setup code to create FixturePreparer
instances for setting up a test fixture.

Bug: 181070625
Test: m nothing
Change-Id: I6f269c9cb3f4ab2756beddd13a719f9b222f7156
2021-03-09 23:06:00 +00:00
Treehugger Robot
277303f042 Merge "Add ctx to AndroidMkExtraEntriesFunc" 2021-02-22 22:40:31 +00:00
Colin Cross
aa2555387d Add ctx to AndroidMkExtraEntriesFunc
Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to
access providers.

Test: m checkbuild
Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
Merged-In: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
2021-02-19 23:05:40 +00:00
Inseob Kim
916901e361 Allow uninstallable prebuilt_etc to be packaged
Till now, prebuilt_etc has to be installable to be packaged. With this
commit, packaging modules like filesystem now can include uninstallable
prebuilt_etc. This can help when prebuilt_etc can conflict with other
partitions e.g. system.

Bug: 179340780
Test: build filesystem with uninstallable prebuilt_etc
Change-Id: Id981fe7ce41f1189eb0f85f2d1677d973004423c
2021-02-18 09:27:53 +09:00
Jiyong Park
76a42f5c25 prebuilt_etc is OutputFileProducer
This allows us to add prebuilt_etc modules to the properties like
java_test_host.data

Bug: N/A
Test: atest VirtualizationHostTestCases
Change-Id: Id4f691ff324daa86b25f32599b62edfaebed1a7d
2021-02-16 06:58:57 +09: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
Yo Chiang
f0e19fec28 prebuilt_etc: Refactoring
* Replace `android.(Bool|String)` with `proptools.(Bool|String)`
* Remove `PrebuiltEtc.DepsMutator` and move the property check to
  `PrebuiltEtc.GenerateAndroidBuildActions`, so the property user is the
  checker.
* Add description to `PrebuiltEtcModule` interface.
* Wrap some very long comments.

Bug: 173379413
Test: TH presubmit
Change-Id: I3bb1375ff2b04909221a277ee0b384e2f5eeb42a
2020-11-19 16:16:15 +08:00
Yo Chiang
9d445fabfd Merge "prebuilt_etc: Improve comments and slight refactoring" 2020-11-19 05:44:46 +00:00
Yo Chiang
803c40daa2 prebuilt_etc: Improve comments and slight refactoring
Comment changes:
* Add top level package description.
* Clarify `OutputFileProducer` usage for `prebuilt_etc.src` field.
* Clarify output file basename selection rule.

Refactor changes:
* Don't emit superfluous `LOCAL_UNINSTALLABLE_MODULE := false` lines.
* `for _, i := range list { entry.AddStrings(prop, i) }` =>
  `entry.AddStrings(prop, list...)`

Bug: 173379413
Test: TH presubmit
Change-Id: Iab90aea5ff2497525ebe1600d3ce5a480923760a
2020-11-17 15:46:07 +08:00
Colin Cross
ae8600b507 Pass Config to NewTestContext instead of ctx.Register
Prepare for using Config when adding singletons by passing
Config to NewTestContext and NewContext instead of to ctx.Register.
This will enable a followup change to store SingletonMakeVarsProviders
registered on the Context in the Config, which is necessary to run
multiple tests in parallel without data races.

Test: all soong tests
Change-Id: Id229629a4e42ff4487d317241673837726c075fc
2020-11-12 10:07:49 -08:00
Yifan Hong
39143a941f Fix path conflict for vendor_ramdisk_available
... and ramdisk_available modules. If a module is both
vendor_ramdisk_available and ramdisk_available, on a device
that mark recovery_as_boot and move_recovery_resources_to_vendor_boot
simultaneously (and incorrectly),
both will be installed to recovery/root/first_stage_ramdisk. Fix the
path conflict of the two variants by moving the vendor_ramdisk variant
to vendor-ramdisk/first_stage_ramdisk instead.

Also update comments for Vendor_ramdisk_available.

Test: m nothing -j
Bug: 156098440

Change-Id: I2b776b6fd8f5a2c361c0f6a89231e3cebc2646f0
2020-10-26 12:50:05 -07:00
Yifan Hong
60e0cfb5cb Add vendor-ramdisk image to Soong.
Add vendor_ramdisk_available and vendor_ramdisk attribute to
various rules. When a vendor_ramdisk variant of a module is
generated, it is installed to $OUT/vendor-ramdisk.

It is similar to a ramdisk image.
Test: m nothing -j

Change-Id: Ib2d16459f3094dbe21c3bdb7c016cb4b2bf62765
2020-10-22 10:26:26 -07:00
Jiyong Park
f9f680595b Install prebuilt_etc modules to out/soong
prebuilt_etc* modules emit build rules to install their output to
out/soong. This is required for the cvd_host_package module to gather
installed files (not built files) of prebuilt_etc* modules.

Bug: 168086242
Test: m

Change-Id: I065640c7e6f188b0c19e70f081e82bdc30d7e752
2020-10-13 14:57:24 +09:00