Commit graph

7916 commits

Author SHA1 Message Date
Ronald Braunstein
c864b242da Prefer variants test-only:true attribute when grouping.
When looking at more details of modules that are marked test-only, I saw
that `java_test_host` modules were not in the list.

The test I wrote for it passes, but in a real run, there are two variants (one
windows, one linux) which causes it to fail.  The `all_teams` code visis
all variants, even not enabled ones. The windows variant, for which
GenerateAndroidBuildActions was not being called, did not have a
provider and its empty data was overriding the variant for which we had
data.

I changed the code to prefer variants where it is true.
Generally for "test-only", the value is logically true independent of variant, so
if one variant sets it true, it should be considered true for all
variants.
I think this is a slightly better check than preferring a variant with a
provider or that is enabled.

Prev CL
       % gqui from  "flatten(~/aosp-main-with-phones/out/soong/ownership/all_teams.pb, teams)" proto team.proto:AllTeams 'select teams.kind, count(*) where teams.test_only = true and teams.kind not like "%cc_%" group by teams.kind'
        +--------------------------+----------+
        |        teams.kind        | count(*) |
        +--------------------------+----------+
        | android_test             |     1382 |
        | android_test_helper_app  |     1680 |
        | java_fuzz                |        5 |
        | java_test                |      774 |
        | java_test_helper_library |       29 |
        +--------------------------+----------+

After
	 gqui from  "flatten(~/aosp-main-with-phones/out/soong/ownership/all_teams.pb, teams)" proto ~/aosp-main-with-phones/build/soong/android/team_proto/team.proto:AllTeams ' select teams.kind, count(*) where teams.test_only = true and teams.kind not like "%cc_%" group by teams.kind'
	+--------------------------+----------+
	|        teams.kind        | count(*) |
	+--------------------------+----------+
	| android_test             |     1382 |
	| android_test_helper_app  |     1680 |
	| csuite_test              |       16 |
	| java_fuzz                |       10 |
	| java_test                |      774 |
	| java_test_helper_library |       35 |
	| java_test_host           |      495 |
	+--------------------------+----------+

Test: go test ./android
Test: m all_teams
Test: m blueprint_tests
Change-Id: Idc5ed1c0375dc7390a0d58fcb4bf0d7fe1c7ab4f
2024-04-18 15:56:54 -07:00
Treehugger Robot
e25cc5c909 Merge "Revert^2 "Use Module interface in addRequiredDeps"" into main 2024-04-17 22:37:56 +00:00
Jihoon Kang
48a01ad142 Merge "Unify the behaviors of Shard*(...) utility functions" into main 2024-04-17 17:21:02 +00:00
Jiyong Park
f21dd65c08 Revert^2 "Use Module interface in addRequiredDeps"
This reverts commit bbcdaa0c32.

Reason for revert: relanding with a forward fix

Change-Id: I14b83010a4b8d9cb9cb317f2aa07875c17f6cdaa
2024-04-17 05:22:37 +00:00
Daren Liao
5ff02b5005 Merge "Revert "Use Module interface in addRequiredDeps"" into main 2024-04-17 03:28:48 +00:00
Daren Liao
bbcdaa0c32 Revert "Use Module interface in addRequiredDeps"
This reverts commit de18a3d55a.

Reason for revert: b/335332155

Change-Id: Ib5b74b1704c1446713466e8617c42b212c960d49
2024-04-17 03:07:53 +00:00
Jihoon Kang
cd5bfe2bf1 Unify the behaviors of Shard*(...) utility functions
This change introduces a generic version of Shard*(...) utility
functions to prevent future digressions of the methods.

Test: m nothing --no-skip-soong-tests
Change-Id: I825214f0d79fb0549573ce01f298eea5eb87cf17
2024-04-17 00:32:48 +00:00
Treehugger Robot
4e1cf60c15 Merge "Change the syntax for arch selecting and add os selecting" into main 2024-04-16 23:50:12 +00:00
Jiyong Park
8f8b695f6f Merge "Use Module interface in addRequiredDeps" into main 2024-04-16 23:13:06 +00:00
Treehugger Robot
2b11ced7cc Merge changes I4a044e86,Ibf8b0feb,I2e1d7ac7,Icc61f2c3 into main
* changes:
  Remove sort from mergeApexVariations
  Support reading Providers from TransitionMutator IncomingTransition and OutgoingTransition
  Set DebugMutators and DebugVariations when creating Transition variations
  Fix more tests when ANDROID_BUILD_TOP is set
2024-04-16 22:25:31 +00:00
Colin Cross
9132ced405 Remove sort from mergeApexVariations
Remove the sort from mergeApexVariations, and instead sort before
calling it as sorting will break the next change that calls
mergeApexVariations on a provider field that must not be modified.

Also remove the unused ctx PathContext parameter, and use
slices.SortFunc.

Bug: 319288033
Test: Test_mergeApexVariations
Change-Id: I4a044e86a8eb262b54af50afe14c678616c499d1
2024-04-16 14:09:36 -07:00
Cole Faust
1a8906d938 Merge "Update the ConfigurableEvaluator for typed selects" into main 2024-04-16 18:09:59 +00:00
Colin Cross
af333f5aed Support reading Providers from TransitionMutator IncomingTransition and OutgoingTransition
Add a provider method to IncomingTransitionContext and
OutgoingTransitionContext so they implement ModuleProviderContext
and can be passed to android.ModuleProvider.

Bug: 319288033
Test: go test ./...
Change-Id: Ibf8b0feb78e4062fc044c321a23adcb68373e2f8
2024-04-16 09:32:24 -07:00
Colin Cross
d67425d763 Set DebugMutators and DebugVariations when creating Transition variations
DebugMutators and DebugVariations are set by CreateVariations, but
TransitionMutators don't call CreateVariations.  Set them in
TransitionMutators.Mutate instead.

Bug: 319288033
Test: go test ./...
Change-Id: I2e1d7ac7a04f1ae669602f6c0642cfa5333ada3c
2024-04-16 09:32:24 -07:00
Linus Tufvesson
ba270c503a Update soong to use flag for min supported sdk
Test: Build and flash
Test: adb shell getprop ro.build.version.min_supported_target_sdk
Bug: 297603927
Change-Id: I5123c58c8397ae44f163c2c2ee557dce9b0437c1
2024-04-16 08:08:59 +00:00
Jiyong Park
de18a3d55a Use Module interface in addRequiredDeps
Previously, addRequiredDeps directly called RequiredModuleNames directly on
ModuleBase. As a result, it failed to correctly track the dependencies
for the modules which are overriding RequiredModuleNames. cc_* were
those.

Fixing this by calling RequiredModuleNames via the Module interface.

Bug: 321626681
Test: go test ./... under filesystem
Change-Id: I79de616606b88277da0b3e86b21316ee83e0ec71
2024-04-13 10:51:18 +09:00
Treehugger Robot
06485000db Merge "Let deps property be conditional on debuggability" into main 2024-04-13 00:43:04 +00:00
Treehugger Robot
ef0cbf11a6 Merge "Remove duplicates in PathsAndMissingDepsRelativeToModuleSourceDir" into main 2024-04-12 23:39:04 +00:00
Jihoon Kang
0e3a5352e1 Remove duplicates in PathsAndMissingDepsRelativeToModuleSourceDir
This change prevents duplicate paths from being returned when resolving
filepath, glob and ":name{.tag}" syntax to android.Paths. Once all
existing modules are cleaned up to remove duplicates in the source
files, the duplicates removal can be converted into an error so that
passing duplicate source files in the module definition is restricted.

Test: patch to git_main, inspect ninja commands
Bug: 326674683
Change-Id: I38a4ce9238da25cd67968f6bc8058bc9facc4551
2024-04-12 21:57:05 +00:00
Jiyong Park
62532d7d62 Let deps property be conditional on debuggability
This allows us to add dependencies only for debuggable builds.

Bug: N/A
Test: add product_variables.debuggable.deps to the android_system_image
module.

Change-Id: Id90646fff8a8a91c5e768418b9881e93228ec2a5
2024-04-12 16:16:28 +09:00
Cole Faust
fc57d40bf1 Change the syntax for arch selecting and add os selecting
This changes the syntax from select(variant("arch"), {...}) to
select(arch(), {...}) to make it shorter and to make it clear that
we can restrict what variants you can select on.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: Iafe05b5f455895313a563ed6292f4016b58180b0
2024-04-11 12:09:44 -07:00
Cole Faust
fdbf5d476b Update the ConfigurableEvaluator for typed selects
See the blueprint cl for more information.

Also added tests for both multivariable and typed selects.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I00c1a3c56d34affb88f4b4d911c318b28ffe7695
2024-04-11 11:40:02 -07:00
Paul Duffin
7f5073a94a Remove unused writeFile var
Test: TH
Change-Id: I09922d8f837f41dad01bc64192fa174d988eb39a
2024-04-10 13:21:28 +01:00
Hsin-Yi Chen
1edffe1dc4 Merge "Filter ABI dumps by LLNDK headers and version scripts" into main 2024-04-10 08:36:07 +00:00
Ronald Braunstein
c560309e30 Add test-only and test-target fields to all_teams proto.
The `test-only` flag designates the module contains test-only, not
production code.  In order to generate code-coverage reports, we wanted
a way to filter out code (like java_library) that is test-only and
doesn't need to be in the report.
   The XXX_test modules will have test-only set automatically.
   For modules like `java_library`, users will be a able to set this in
   the Android.bp file.
   As a follow-up, I'll run some queries to find modules that are only
   reachable from top level test targets and mark them test-only as
   appropriate.

`test-only` is being added to the team.proto and will be written via the
`all_teams` target.

Currently, it is challenging to find "all top level test targets".
I'm adding another field to mark the target as a "top level test
target" if it is a XXX_test or XXX_test_host module.  The goal is to
mark all modules the user intended to run as a test, either with
tradefed or directly as a native test.

I added 'module-type/kind' to the proto so I can do some queries:

 gqui from  "flatten(out/soong/ownership/all_teams.pb, teams)" proto team.proto:AllTeams 'select teams.kind, count(*) where teams.top_level_target = true group by teams.kind'
+--------------+----------+
|  teams.kind  | count(*) |
+--------------+----------+
| android_test |     1379 |
| art_cc_test  |       56 |
| cc_benchmark |       68 |
| cc_fuzz      |      515 |
| cc_test      |     3519 |
| cc_test_host |        6 |
| java_fuzz    |        5 |
| java_test    |      773 |
+--------------+----------+

% gqui from  "flatten(~/aosp-main-with-phones/out/soong/ownership/all_teams.pb, teams)" proto team.proto:AllTeams 'select teams.kind ,count(*) where teams.test_only = true group by teams.kind'
+--------------------------+----------+
|        teams.kind        | count(*) |
+--------------------------+----------+
| android_test             |     1379 |
| android_test_helper_app  |     1678 |
| art_cc_test              |       56 |
| art_cc_test_library      |       13 |
| cc_benchmark             |       68 |
| cc_fuzz                  |      515 |
| cc_test                  |     3519 |
| cc_test_host             |        6 |
| cc_test_library          |      484 |
| java_library             |        2 |
| java_test                |      773 |
| java_test_helper_library |       29 |
+--------------------------+----------+

All modules can be seen here: https://docs.google.com/spreadsheets/d/1Zqbh7lDDdlI1xVmrN9fZ8bm8XD7EoORjjiPqbMvAKgQ/edit#gid=396553017

FOLLOW UP cls:
  *) Add more top level tests, like sh_test and python_test
  *) Add validation so that only modules currently marked test-only
     can depend on modules marked test-only
  *) Remove test_spec, code_metadata, TestModuleProviderKey: aosp/2928500

Test: go test ./java ./cc ./android
Test: m blueprint_tests
Test: m nothing --no-skip-soong-tests
    !!  android already failing on selects_test
Test: m all_teams  && gqui from  "flatten(out/soong/ownership/all_teams.pb, teams)"

Change-Id: Ib97dca60989aa9d7f000727c92af2e354926f072
2024-04-09 16:36:29 -07:00
Cole Faust
8982b1c49e Remove "exported" ninja variables
There was infrastructure to export ninja variables to bazel. Now that
the bazel migration is cancelled, we don't need it anymore.

Bug: 315353489
Test: m nothing
Change-Id: I298cc2ac7ebd004557be3b30d75f7357cab0b7a0
2024-04-09 09:42:37 -07:00
Hsin-Yi Chen
64b2d0389c Filter ABI dumps by LLNDK headers and version scripts
This commit changes the parameters to create LLNDK ABI dumps for 202404
and later versions. Soong invokes header-abi-linker with LLNDK headers
and version script rather than the implementation library's parameters.
The output dump contains more precise ABI information.

When soong compares the ABI with the prebuilt dumps in old versions,
it creates the source ABI dumps with the old parameters.

Test: make findlsdumps
Bug: 314010764
Change-Id: I228736188d07029ee1588b3502fd7c0061c104b9
2024-04-09 18:45:03 +08:00
Treehugger Robot
ccd5b5545b Merge "fix: required property doesn't track deps to java, apex, ..." into main 2024-04-09 03:12:39 +00:00
Cole Faust
42a8b256af Merge changes from topics "replace_instead_of_append", "selects_get_and_get_default" into main
* changes:
  Rename Evaluate() to Get() and add GetDefault()
  Add tests for android:replace_instead_of_append
2024-04-08 20:45:55 +00:00
Treehugger Robot
ed2adb879f Merge "Remove Device VNDK version usage from Soong" into main 2024-04-08 19:24:36 +00:00
Jiyong Park
73e5babafe fix: required property doesn't track deps to java, apex, ...
This change fixes a bug that the required property doesn't track
dependencies to modules whose arch is common.

Bug: 321000103
Bug: 321626681
Test: go test ./...
Change-Id: I3d2b3ad8cb2a9f1c5c3d5345bf05402a787f011a
2024-04-05 15:12:16 +09:00
Kiyoung Kim
4e765b1bfc Remove Device VNDK version usage from Soong
As of VNDK deprecation, Device VNDK version should no longer be used
from build. This change removes all references on Device VNDK version
and related logic with it.

Bug: 330100430
Test: AOSP CF build succeeded
Change-Id: Ibc290f0b41e8321f80c75c69f810223989af68dc
2024-04-05 01:57:32 +00:00
Spandan Das
29cd82b714 Merge "Reland "Use cp instead of install for ndk_headers"" into main 2024-04-05 01:25:05 +00:00
Spandan Das
f280b23fe5 Reland "Use cp instead of install for ndk_headers"
This relands aosp/3026027 with fixes for ndk_library. ndk_library
uses ctx.InstallFile to copy the stubs from an intermediate dir to
out/soong/ndk/sysroot/. The copy rule was created in
out/soong/installs-<product>.mk. This would cause issues when soong_ui
is run in `--soong-only` mode

To fix this, the cp rule is created entirely in soong. The stub library
is marked uninstallable to prevent creation of duplicate rules when
`--soong-only` mode is not used

Test: presubmits
Test: lunch ndk-trunk_staging-userdebug &&
ALLOW_MISSING_DEPENDENCIES=true build/soong/soong_ui.bash --soong-only
out/soong/ndk.timestamp

Change-Id: I6f8b87d88d8ca5ec9a3327e1f11e9aa654f8cdce
2024-04-04 22:39:45 +00:00
Cole Faust
b78ce43ae3 Rename Evaluate() to Get() and add GetDefault()
Part of the design of property structs is that they were easy to access.
In keeping with that spirit, use a shorter and easier to spell name
for the getter, and add GetDefault() so that you don't need to pass
the result of Get() to one of the
proptools.StringDefault/BoolDefault/etc functions.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I0b8df151de59f2cd9463425c6666cbfda6bf47f2
2024-04-04 15:09:18 -07:00
Cole Faust
02dd6e5640 Add tests for android:replace_instead_of_append
Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: Ideb739b3f1a6a5854453db7d51bdee73a3979fd4
2024-04-04 15:09:04 -07:00
Cole Faust
683316a2b0 Rename default select branch to 'default' keyword
Previously I was using an underscore to denote the default branch
because I was thinking that I would allow variable bindings in the
select branches, and 'default' could be mistaken for the name of a
variable. But I think it's better to just introduce alternate syntax,
like `default @ my_var: "foo" + my_var,` to do the variable bindings,
so that we can have a clearer name for the default case.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I8cbded97a029c06782fb5313d8c0e67f22951482
2024-04-04 11:24:24 -07:00
Cole Faust
767a1fe663 Merge "Add tests for "unset" select statements" into main 2024-04-04 18:21:55 +00:00
Spandan Das
b00d52d523 Merge "Convert BuildIgnoreApexContritbutions variable to a boolean" into main 2024-04-04 17:50:48 +00:00
Spandan Das
6f591bf8fb Merge "Revert "Use cp instead of install for ndk_headers"" into main 2024-04-04 17:49:05 +00:00
Cole Faust
12c8ed4601 Add tests for "unset" select statements
See the blueprint cl for more information.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I3a0302f370e8e498556b219cbda70bdb0255f6ef
2024-04-04 10:41:43 -07:00
Spandan Das
c299c3f913 Revert "Use cp instead of install for ndk_headers"
This reverts commit 1202729cb2.

Reason for revert: Breaks aosp-main/ndk builds

Change-Id: I453792f7f974dc336d5f6775adfc5899b8d34d7b
2024-04-04 17:11:43 +00:00
Spandan Das
e5e0fb0fe5 Merge "Use cp instead of install for ndk_headers" into main 2024-04-04 16:39:58 +00:00
Spandan Das
1202729cb2 Use cp instead of install for ndk_headers
ndk_headers currently use ctx.Install to install headers in
out/soong/ndk/sysroot. The files are subsequently used to compile ndk
variants of cc libraries on host.

Since these headers are not actually installed on device, use android.Cp
to assemble the NDK sysroot. By itself, it should be a no-op, but
androd.Cp is more friendly with restricting the installation rules to
PRODUCT_PACKAGES.

To make it explicit that the sysroot is not a typical installation path,
this CL also modifies the type to OutputPath

Test: m
Bug: 332778109
Change-Id: I1131c3c764443cbaac525c6022cd09c47695d275
2024-04-04 01:58:21 +00:00
Spandan Das
0d24adea73 Convert BuildIgnoreApexContritbutions variable to a boolean
(This relands aosp/3007754. The previous sdk build failures have been
resolved now)

The ignore list is burdensome to maintain once we start adding the
module sdk contents to apex_contributions. Convert the variable to a
boolean. When set to true, all contents in `apex_contributions` will be
ignored

Bug: 308187268
Test: m nothing on aosp,google and google_fullmte devices
Merged-In: Ibdd1e0d0d4f08f4f5251b9c4baa1aaf42e7df34f
(cherry picked from commit f3df7305d653471c70d131177e773b4723247e3a)
Change-Id: I9d57d899c6a9a321e2eb3579c954641f2cb04709
2024-04-03 01:02:00 +00:00
Kiyoung Kim
6954bd2337 Merge "Remove PlatformVndkVersion property" into main 2024-04-03 00:48:04 +00:00
Spandan Das
a9cf0c8f5b Add a warning that Use_source_config_var is being deprecated.
Bug: 308188211
Test: None # documentaiton change
Change-Id: I28c7d84ed25e1aa51648c3b29cf04b1309f9a498
2024-04-01 22:37:38 +00:00
Cole Faust
488868ddf4 Merge "Add tests for new boolean addition behavior" into main 2024-04-01 18:01:15 +00:00
Kiyoung Kim
fa13ff194c Remove PlatformVndkVersion property
Platform VNDK version is no longer available based on VNDK deprecation.
Remove all code using Platform VNDK version.

Bug: 330100430
Test: AOSP CF build succeeded
Change-Id: I7d0f7e23eff5d153346890f242a94b78bad6736b
2024-04-01 16:37:20 +09:00
Jiyong Park
4d4eb59a2b Merge "fix: required deps of phony modules are correctly tracked" into main 2024-03-30 13:48:48 +00:00