369 Commits

Author SHA1 Message Date
Cole Faust
16d227a725 Add default_visibility for soong modules
So that we don't get surprise usages.

Bug: 348717861
Test: m nothing
Change-Id: I47319a727092c1bd936cca88f5713ee977a48b48
2024-09-18 17:41:30 -07:00
Colin Cross
1496fb1675 Wrap blueprint_go_binary and bootstrap_go_package into android.Modules
Depending on a blueprint_go_binary from a Soong module requires hacks
that allow Soong to support both blueprint.Module and android.Module.
Wrap the blueprint Go module types with ones that implement
android.Module, and delete all the related hacks.

Bug: 319288033
Test: m checkbuild
Flag: EXEMPT refactor
Change-Id: I9b62b450de09bd10288333fbc66aa71c867ae0b3
2024-09-11 21:16:25 -07:00
Cole Faust
65922b20fa Sandbox com.google.pixel.camera.hal.manifest
It's now taking advantage of the uses_order_only_build_number_file
feature of genrules, and doesn't need to be excempted from sandboxing.

Bug: 307824623
Test: Presubmits
Change-Id: I6ae5da7518990fbf4083aeac1aaba770210a4be1
2024-09-09 16:50:37 -07:00
Cole Faust
dc0187811f Add com.google.pixel.camera.hal.manifest to build number allowlist
So that it can be removed from the genrule sandboxing allowlist.
Because this is an internal module, I'm submitting this allowlist
addition first, then will make the genrule use it, then will remove
it from the sandboxing allowlist.

Bug: 307824623
Test: Presubmits
Change-Id: Ia7001d89a57fd1d2fbe3b0f79fb68fecf859fbb4
2024-08-28 11:14:35 -07:00
Cole Faust
80a6541647 Merge "Move aidl_camera_build_version to build number allowlist" into main 2024-08-28 16:59:54 +00:00
Cole Faust
b36d31d870 Add ctx argument to IDEInfo()
The IDEInfo() methods read properties. To make those properties
configurable, we need a context to evaluate them with.

Bug: 362579941
Test: m nothing --no-skip-soong-tests
Change-Id: I26d4b7084439b3006e50b02277298f74a929e1aa
2024-08-27 16:04:28 -07:00
Cole Faust
f23fdc048e Move aidl_camera_build_version to build number allowlist
This allows us to get most of the benefits of genrule sandboxing,
and defer deciding what to do about the build number until later.

Bug: 307824623
Test: m aidl_camera_build_version
Change-Id: Ib3f4dd6d270ac56d068593c95ee40db44962b845
2024-08-27 12:22:31 -07:00
Yu Liu
bad1eef6d8 Remove installFilesDepSet, packagingSpecsDepSet and licenseInstallMap
from ModuleBase.

The old packagingSpecsDepSet field is kept temporarily to bypass an
auto-merge issue, and will be removed in next change.

Bug: 358425833
Test: CI
Change-Id: I28b4933459c33224f756cc306cabc8088f9be862
2024-08-26 17:45:38 +00:00
Cole Faust
78f3c3a3ad Add $(build_number_file) support to genrules
Genrules that set uses_order_only_build_number_file: true will now
have the ability to reference a $(build_number_file) label that
will point to the build number file. It will also caused the build
number file to be added as an order-only dependency, which will make
it show up in the genrule sandbox.

This is needed for converting make code that references the build
number to soong, and for sandboxing the remaining unsandboxed genrules
that reference the build number.

Bug: 341873065
Test: m nothing --no-skip-soong-tests
Change-Id: I9092cbb0eb39c5449a79f0ee40a4202262cef206
2024-08-19 16:06:34 -07:00
Cole Faust
bf1d92ad20 Cleanup configurable getter usages
You don't have to call module.ConfigurableEvaluator(ctx) if ctx is
already a ModuleContext, you only need to do that for more restricted
contexts like SingletonContext.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I7612290d43dae7decfae283a341882d9016c98a3
2024-07-29 12:24:25 -07:00
Inseob Kim
2f73062d47 Make genrule's srcs property configurable
This allows using select statements with it.

Bug: 354824866
Test: m
Change-Id: If1d71ac177618ad3eb628cdec57469886ee27c88
2024-07-25 00:55:21 +00:00
Colin Cross
483b4c4b10 Support defaults for gensrcs modules
external/jemalloc/Android.bp has mulitple similar gensrcs, allow
using a defaults modules to simplify them.

Test: builds
Flag: NONE
Change-Id: If71a860c830e9502720caaf495b395ea28dd6983
2024-06-28 10:31:05 -07:00
Jihoon Kang
47e918450f Move vendor and product variant generation logic from cc package to android package
Although image variation generation logic has moved out of cc package to
the android package, the vendor and product partition variants
generation logic is still specific to cc package. Therefore, in order to
create a product or vendor variant, they have to specified in
`ExtraImageVariants`. In order to avoid such confusing behaviors and
enforce modules to specify product and vendor installation rules, this
change moves the vendor and product variant generation logic to
android.ImageInterface.

Test: m nothing --no-skip-soong-tests && diff contents of out/soong/Android-{product}.mk
Change-Id: I9e14f3739d9dea94167ee6a91e92b2f942055aba
2024-06-21 07:45:09 +00:00
Zi Wang
d838795450 Merge "Use OutputFilesProvider on genrule" into main 2024-06-17 21:07:22 +00:00
mrziwang
4514ef26e2 Use OutputFilesProvider on genrule
Test: CI
Bug: 339477385
Change-Id: I06955584517ce0ec7402047ffdac0e07b954e93e
2024-06-17 11:12:54 -07:00
Jihoon Kang
7583e835f7 Cleanup ImageInterface.SetImageVariation
This change modifies the interface method of
ImageInterface.SetImageVariation so that the image variation is set
directly at the caller image variation module, instead of passing the
pointer to set the image variation.

Test: m nothing
Change-Id: I8eadb5149365530243e19a8cd37eb49d335fbeef
2024-06-13 21:56:23 +00:00
Aleks Todorov
1eb06c4a67 genrule: Make cmd configurable
Bug: 325067608
Bug: 325444956
Test: m
Test: m [custom genrule with select]
Change-Id: I3a2307a8d0f65ee419b935a30742f96e5733a81f
2024-06-04 18:20:29 +01:00
Justin Yun
40182b6ff3 Remove duplicated CollectDependencyAconfigFiles()
android.ModuleBase already calls aconfigUpdateAndroidBuildActions()
that is the same with CollectDependencyAconfigFiles(). Remove the
CollectDependencyAconfigFiles() to avoid duplication with
aconfigUpdateAndroidBuildActions().

To make the aconfig information available in
GenerateAndroidBuildActions() of all modules, call
aconfigUpdateAndroidBuildActions() before calling
GenerateAndroidBuildActions() of each module.

Also, we don't need SetAconfigFileMkEntries(), which is a duplicate
of aconfigUpdateAndroidMkData()

Bug: 335363964
Test: diff `adb shell printflags` before and after the change.
Change-Id: I52808e442e9fed7db1eae7b7c5ed0b1c5ba74f5d
2024-05-10 10:00:14 +09:00
Cole Faust
a963b94cde Make the enabled property configurable
This allows using select statements with it.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I6f3efaaa3d82505e38a91ee4ba0e18e404360191
Merged-In: If355d24506e3f117d27b21442a6c02bca3402dc7
2024-05-02 15:41:24 -07:00
yangbill
6d032dd911 Add a new property trim_extension for gensrcs
In order to provide a more flexible ability for gensrcs's output, due to
current output_extension property will only allow to replace the string
after the last "." of input, in order to handle input with multiple dot
in file name, provide a way to trim the suffix of input string.

Bug: 335536003
Test: cd build/soong/genrule ; go test -run TestGenSrcs
Test: cd build/soong/genrule ; go test -run TestGenSrcsWithTrimExtAndOutpuExtension
Test: cd build/soong/genrule ; go test -run TestGenSrcsWithTrimExtButNoOutpuExtension
Test: cd build/soong/genrule ; go test -run TestGenSrcsWithOutpuExtension
Test: cd build/soong/android ; go test -run TestPathsForModuleSrc

Change-Id: I033bbe1d225f207f0f6bdc140df308884f214b51
2024-04-30 05:06:56 +00:00
Jiyong Park
74ff1f80bc Merge "Ensure that genrule's host tool deps are for host" into main 2024-03-22 23:33:48 +00:00
Jiyong Park
8fb0e9734c Ensure that genrule's host tool deps are for host
Previously, when gathering transitive dependencies of genrule's host
tool, TransitivePackagingSpecs() was used if available. However, when
using this, it didn't check whether the dependencies are for host or not
(i.e. device). This was fine because host module can only depend on host
modules.

However, this is preventing Soong from implementing the installation of
the required modules by itself. Then a host module may depend on a
device module or vice versa (because that's the symantics of the
property).

To prevent the issue, check the partition of the transitive dependencies
of the host tool and filter out ones whose partition is not "" (which
means host).

Bug: 321626681
Test: builds
Change-Id: I296a920b3b88e7601315a4e1768af9727d0061e6
2024-03-20 16:17:21 +09:00
Treehugger Robot
1f4ffda2ed Merge "Support multilib property for cc_genrule" into main 2024-03-20 02:38:30 +00:00
kellyhung
750334a0c0 Support multilib property for cc_genrule
Change genrule Out to `android:"arch_variant"` for supporting
multilib variants.

Bug: 323295272
Test: go test -run TestMultilibGenruleOut

Change-Id: I102d64b45a5a2a5193f813001fc32da0d1fe9d36
2024-03-20 09:25:41 +08:00
Cole Faust
e762b94fe7 Remove SandboxingDenyPathList
It's no longer used.

Bug: 307824623
Test: m nothing --no-skip-soong-tests
Change-Id: I181de9d852f4025c6c5829cc4941ffb705f7cb50
2024-03-15 19:50:03 +00:00
Cole Faust
5549257422 Remove depfile support from genrules
All usages of it have been removed.

Bug: 307824623
Test: Presubmits
Change-Id: I9502b328a5aaa6840653f46011ca6bd05f3cba99
2024-01-25 18:05:18 -08:00
Cole Faust
4cb1155368 Denylist com.google.pixel.camera.hal.manifest
This is an internal-only genrule, that was previously included in
a denylist in vendor/google/build. However, not all partners have
that file, so some products ended up setting
BUILD_BROKEN_GENRULE_SANDBOXING when that file didn't exist. Moving
it to the aosp allowlist lets us remove those build broken flags.

I checked with krzysio@ and yromanenko@ and they're ok with putting
this name in aosp.

Bug: 307824623
Test: Presubmits
Change-Id: Ia3f24a5c8c8efc62bdc84435343cafd1dac9afed
2024-01-12 16:23:56 -08:00
LaMont Jones
afe7baf47d Propagate aconfig providers for more modules.
Bug: 308625757
Test: manual
Change-Id: Iaf6d45a4259f1c6c34476c34c431344283ae2830
2024-01-10 14:03:30 +00:00
Cole Faust
9734cff08c Merge "Sandbox chre_atoms_log.h" into main 2023-12-20 18:43:12 +00:00
Cole Faust
30e32f67fc Merge changes I8b352305,Iadf9e324 into main
* changes:
  Sandbox CtsApkVerityTestDebugFiles
  Include "soong" in sandboxed out paths
2023-12-20 01:35:40 +00:00
Cole Faust
81f2ac35f1 Sandbox CtsApkVerityTestDebugFiles
go/android-busy-beavers-sandboxing

It still has a diff in the generule_sandbox_test, but it's just the
addition of "./" in front of all the paths, which is fine.

Bug: 307824623
Test: ./build/soong/tests/genrule_sandbox_test.py CtsApkVerityTestDebugFiles
Change-Id: I8b352305cfb339bc5a09a2305e10a187723d754d
2023-12-19 15:35:02 -08:00
Cole Faust
afc3e38658 Sandbox chre_atoms_log.h
go/android-busy-beavers-sandboxing

Bug: 307824623
Test: m chre_atoms_log.h
Change-Id: I3b4fcf6365e5571484964a4f9f344ed26f8f9afd
2023-12-18 15:02:38 -08:00
Colin Cross
51428c451a Merge changes I6f116385,Id77f514d,I73479de1,If58f4b53 into main
* changes:
  Convert ModuleProvder to generic providers API
  Convert OtherModuleProvider to generic providers API
  Convert Provider to generic providers API
  Convert SetProvider to generic providers API
2023-12-18 22:43:45 +00:00
Colin Cross
402130276c Convert SetProvider to generic providers API
Convert all of the callers of SetProvider to use the type-safe
android.SetProvider API.

Bug: 316410648
Test: builds
Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
2023-12-14 16:12:20 -08:00
Cole Faust
776146b3f4 Sandbox camera-its
It was fixed with aosp/2866315.

Bug: 307824623
Test: ./build/soong/tests/genrule_sandbox_test.py camera-its
Change-Id: Iaf3871682e99ceb7161c159acb757ce2949f5b3d
2023-12-13 15:15:26 -08:00
Cole Faust
27609f15ff Update wording on depfile property error
Bug: 307824623
Test: Presubmits
Change-Id: I25919150d2ee2483099e7cb710330dc259d57e66
2023-12-12 18:10:36 -08:00
Colin Cross
a72573a727 Merge "Remove ConvertWithBp2build implementations" into main 2023-12-11 23:12:53 +00:00
Colin Cross
8ff105860d Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-08 13:51:05 -08:00
Cole Faust
bcfc299575 Remove art/test from genrule allowlist
go/android-busy-beavers-sandboxing

Bug: 307824623
Test: mm in art/test
Change-Id: Ic37343ad873f71461db984b030f6beda5279207c
2023-12-08 10:57:27 -08:00
Cole Faust
ce74a59bb2 individually escape results of $(locations)
proptools.ShellEscape escapes mostly by surrounding the string in
quotes. This makes all the files from a $(locations) be passed as
one shell argument if escaping was needed. Escape them individually
so that they're still passed as separate arguments.

Bug: 307824623
Test: running art tests with aosp/2860435
Change-Id: I9940941f4a7bb4d29d9388e4d57f8cbd732b6d32
2023-12-08 10:53:59 -08:00
Aditya Choudhary
4c3e2df157 Merge changes from topic "code_metadata" into main
* changes:
  Add source file provider for genrule/srcs, python libraries and rust libraries.
  Add Code Metadata rule to soong/testing.
2023-12-06 07:37:50 +00:00
Aditya Choudhary
26df39fe44 Add source file provider for genrule/srcs, python libraries and rust libraries.
Change-Id: I2d7d4684a10c15aeecc27b8db800ab27a807d2e2
2023-12-05 19:56:26 +00:00
Hugo Drumond Jacob
afadb164fd Revert "Sandbox chre_atoms_log.h and deqp_spvtools_update_build_version"
This reverts commit 12dcc8649e.

Reason for revert: See b/314904106

Bug: 314904106
Change-Id: Icb048d86a66a5f0492c3ae017314f4cdcd3ffabe
2023-12-05 17:49:50 +00:00
Colin Cross
2998c33d43 Merge "Add TestContext parameter to ContentFromFileRuleForTests" into main 2023-12-05 00:29:10 +00:00
Colin Cross
f61d03d241 Add TestContext parameter to ContentFromFileRuleForTests
The next CL will need a TestContext parameter in
ContentFromFileRuleForTests in order to retrieve the file rule contents
from the Config.  Add it and update all the tests that use it in order
to simply review of the next CL.

Bug: 306029038
Test: go test ./...
Change-Id: Ia4b4c9854017ea3472fa2f8ba42cf7f72720496e
2023-12-03 17:22:56 -08:00
Cole Faust
b5bfebf19b Sandbox libcore-non-cts-tests-txt
Bug: 307824623
Test: m sandbox_libcore-non-cts-tests-txt and diffed the files before/after
Change-Id: If564e438d1e886419e435e24f52e0f0e2ec479d2
2023-11-30 14:53:21 -08:00
Cole Faust
e6698b06c3 Sandbox swiftshader_spvtools_update_build_version
Sandboxing produces this diff:
  1c1
  < "v2023.2", "SPIRV-Tools v2023.2 android-u-beta-1-gpl-587-g9d167f845"
  ---
  > "v2023.2", "SPIRV-Tools v2023.2 unknown hash, 2023-11-30T17:54:23"

But the git repository is already not garunteed to exist on CI, and
the genrule is consequently commented with a FIXME about that.

Bug: 307824623
Test: ./build/soong/tests/genrule_sandbox_test.py swiftshader_spvtools_update_build_version
Change-Id: I98e65781bd49137662ed020927940b0f3e4d645b
2023-11-30 09:55:20 -08:00
Treehugger Robot
3766553866 Merge "Sandbox vm-tests-tf-lib" into main 2023-11-30 13:53:46 +00:00
Cole Faust
141314e11a Sandbox aidl-golden-test-build-hook-gen
Bug: 307824623
Test: m aidl-golden-test-build-hook-gen
Change-Id: I71ebe9d16702be15a8dc98b10dedf685114daed8
2023-11-29 17:47:12 -08:00
Treehugger Robot
7d7d94ffd2 Merge "Sandbox chre_atoms_log.h and deqp_spvtools_update_build_version" into main 2023-11-29 18:36:10 +00:00