Commit graph

81560 commits

Author SHA1 Message Date
Jihoon Kang
5623e5425a Support passing multiple last api files to metalava in droidstubs
This change supports passing multiple last api files to metalava,
instead of emitting an error when multiple files are passed as inputs.

The last api file providing modules are filegroups or genrule modules
that output exactly one output file. This change modifies that behavior
so that the filegroups can output multiple api files.

The last api file providing modules are (mostly) generated from the
`prebuilt_apis` sdk module. However, these modules only provide a single
api scope txt files (e.g. system api scope last api file filegroup
would only provide last system api file, not system + public). This
change modifies `prebuilt_apis` by generating "combine" filegroup
modules, that include api files of the subset api scopes as well.

The ordering of the files are handled when generating the combined api
filegroup modules, and droidstubs module does not check whether the
passed api files are in order from the narrowest api scope to the widest
api scope.

Submission of this change will be done once metalava fully supports
handling multiple api files input for api lint and nullness migration.

Test: m nothing
Bug: 321827591
Change-Id: I2066e7ceb7ee7c6d0fd87cd43bfd08db906d4b8f
2024-04-19 10:56:32 +01:00
Paul Duffin
d3b020a8c3 Enable system and module-lib APIs in TestSnapshotWithJavaSystemModules
A follow-up change broke `TestSnapshotWithJavaSystemModules()` during
development. The code was fixed but it revealed an issue with the test
coverage of that test. That test only supported `public` APIs and the
fix could have had different behavior on `system` and `module-lib`
APIs. This change adds them to the test to make sure that the follow-up
change works correctly for them too.

Test: m --no-skip-soong-tests nothing
Bug: 321827591
Change-Id: I3b5570f5d4f0764ae365bfc448f287b50b9c2686
2024-04-19 10:56:32 +01:00
Phenix Chen
2ddb22ce99 Merge "Revert "Upgrade to clang-r522817"" into main 2024-04-19 06:35:35 +00:00
Phenix Chen
321dd23b34 Revert "Upgrade to clang-r522817"
This reverts commit dccbef36a4.

Reason for revert: Potential culprit for b/335755564

Change-Id: I3fd02f2b08ad94a4e022cbebcd96afc2fab2e1d8
2024-04-19 05:30:10 +00:00
Treehugger Robot
1f0aeb0644 Merge "Prefer variants test-only:true attribute when grouping." into main 2024-04-19 03:15:30 +00:00
Treehugger Robot
d4ad78f447 Merge changes from topic "lamont-build-tools-build-flag" into main
* changes:
  Bootstrap out/release-config early
  Add crunch-flags and build-flag binaries
  release_config: cleanup how we emit results
  Print a warning on redundant overrides
  Add description to release_config_map message
2024-04-19 00:57:39 +00:00
Ronald Braunstein
587c40f216 Merge "Implement test-only for python_ rules" into main 2024-04-18 22:59:54 +00:00
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
Yi Kong
7694cdd6ba Merge "Upgrade to clang-r522817" into main 2024-04-18 22:29:26 +00:00
LaMont Jones
e292efada4 Bootstrap out/release-config early
Bug: 328495189
Test: manual
Change-Id: I4e9d6eba21da128adc7d8eab097ade2e69b4cbcc
2024-04-18 11:21:03 -07:00
LaMont Jones
b9014c74f4 Add crunch-flags and build-flag binaries
- crunch-flags automates converting build flags from starlark to protobuf.
- build-flag is used to set, get and trace flag values.

Bug: 328495189
Test: manual
Change-Id: I941a4420a8bdfa2df73d94e52b3f34a6d1ea3278
2024-04-18 11:21:03 -07:00
LaMont Jones
14e2ac68e3 release_config: cleanup how we emit results
- Allow each of the formats (json, pb, textproto) to be individually
   controlled.
 - Include product and release in the name of the aritfact.

Bug: 328495189
Test: manual
Change-Id: Ia08e7224200a48994bea882a61b8199d53576d38
2024-04-18 11:21:03 -07:00
LaMont Jones
7ac07deb9b Print a warning on redundant overrides
Bug: 328495189
Test: manual
Change-Id: I35bff9d6751e9aa304e4c2d7e24b9a44a3994264
2024-04-18 10:25:25 -07:00
LaMont Jones
f018d726ca Add description to release_config_map message
Bug: 328495189
Test: manual
Change-Id: Ifff2dc9a2f33595bde9ef57e407bbb4b529f6e08
2024-04-18 10:25:25 -07:00
Yi Kong
dccbef36a4 Upgrade to clang-r522817
Bug: 322868540
Change-Id: Ia75c1e71574b0c0dfc11d5d4e9d06cf855f28c36
2024-04-18 14:11:37 +09:00
Treehugger Robot
17b9a5b8b4 Merge "Allow dexpreopt of source sdklib in prebuilt apex builds" into main 2024-04-18 01:25:15 +00:00
Spandan Das
5ae65ee6e0 Allow dexpreopt of source sdklib in prebuilt apex builds
aosp/2984037 disabled dexperopt of the source apex system server jars
when prebuilts are selected. This was done to prevent duplicate
installation and dex2oat deps.

AOSP art has some additional variants like com.android.art.debug. In
source builds, this apex should contain service-art.jar and
service-art.jar.prof (a dexpeopt artifact). We have a test to check this
(`art_apex_test.py`). If we disable dexpreopt of source sdlib when
prebuilts are selected, this test needs to be disabled. This is the
behavior at ToT.

This CL changes the behavior to enable running this test even when
com.google.android.art prebuilt is active in a specific release
configuraiton. To prevent collisions that prompted aosp/2984037, this CL
special-cases the installation and dex2oat rules instead of disabling
dexpreopt of the source sdklib altogether.

b/331665856 tracks the principled solution to prevent duplicate
dexpreopt rules.

Implementation:
Add a new copyApexSystemServerJarDex arg to GenerateDexpreoptRule API.
If true, the dexjar file will be copied to
out/soong/system_server_jars/. For soong modules, the value of this will
be the inverse of disableSourceApexVariant. Since none of the apex
system server jars are in make, this will be a noop in dexpreopt_gen

Bug: 331665856
Test: modified trunk_staging.scl locally to select
art.google.contributions.prebuilt; mmma art; (with the sibling CL in
topic)

Change-Id: Idb59e424f83d126cdc8b1671dde358745979bd8d
2024-04-17 23:15:20 +00:00
Treehugger Robot
e25cc5c909 Merge "Revert^2 "Use Module interface in addRequiredDeps"" into main 2024-04-17 22:37:56 +00:00
Treehugger Robot
7bfe1377af Merge "Remove extractEncodedDexJarsFromModules" into main 2024-04-17 20:46:34 +00:00
Jihoon Kang
6d6d067c37 Remove extractEncodedDexJarsFromModules
The usages of this function have been removed with
https://r.android.com/2816477 and https://r.android.com/2816578, and
this function is currently unused.

Test: Presubmits
Change-Id: Ic1ae71ade16b930b777fa251febc4d071c0dd65e
2024-04-17 18:19:14 +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
Ronald Braunstein
c4cd7a11a1 Implement test-only for python_ rules
Similar to: aosp/3040036 and aosp/3035329, implements a test-only
property for python_library and sets it for python_host.

This combined with aosp/3045317 produces:
	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(*) total, sum(teams.test_only) as test_only, sum(teams.top_level_target) as top_level, where teams.kind like "%py%"  group by teams.kind'
	+-----------------------------+-------+-----------+-----------+
	|         teams.kind          | total | test_only | top_level |
	+-----------------------------+-------+-----------+-----------+
	| cpython3_cc_defaults        |     1 |         0 |         0 |
	| cpython3_cc_prebuilt_binary |     4 |         0 |         0 |
	| python_binary_host          |   222 |         0 |         0 |
	| python_defaults             |    27 |         0 |         0 |
	| python_library              |    38 |         0 |         0 |
	| python_library_host         |   131 |         0 |         0 |
	| python_test                 |     5 |         5 |         5 |
	| python_test_host            |   172 |       172 |       172 |
	+-----------------------------+-------+-----------+-----------+

Change-Id: Iea14fcdbfd782d37ac0a3c780820deeed5f1923d
Test: m blueprint_tests
Test: go test ./python
2024-04-16 17:09:43 -07: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
LaMont Jones
76e05c8cac Merge changes If068597b,Icbadbe6d into main
* changes:
  release_config: make the code more sharable
  release_config: add namespace to proto
2024-04-16 19:02:21 +00: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
Colin Cross
7b0975d42f Fix more tests when ANDROID_BUILD_TOP is set
The bpfix code (also used by androidmk) reads the ANDROID_BUILD_TOP
environment variable, causing the tests to fail when it is set.  Clear
it in the bpfix and partner androidmk tests the same way the main
androidmk tests do.

Test: go test ./...
Change-Id: Icc61f2c3ebdbecab34c1d18399c6846db207c6dd
2024-04-16 09:32:24 -07:00
Treehugger Robot
9a8255f48e Merge changes from topic "cherrypicker-L27000030003160683:N90900030051335582" into main
* changes:
  Propagate transitive missing optional_uses_libs.
  Refactor the contruction of the manifest check inputs.
2024-04-16 13:35:54 +00: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
LaMont Jones
ac79679f77 release_config: make the code more sharable
This will allow the `build-flag` command to use release_config_lib code.

Bug: 328495189
Test: manual
Change-Id: If068597b1d68c52c941788931997b7f77c73d2b3
2024-04-15 17:41:44 -07:00
Ronald Braunstein
6a08d4915a Add test-only for test-per-src cc modules
When testing test-only validations, I noticed that some cc_test modules
where not reporting that they were test-only.

This happened because test-per-src variations were short-circuiting
writing out the provider.

The `all_teams` target is using the first variation for a module, but
it possibly should see if any variation is test-only.
For now, just making this fix to cc.

Test: m all_teams  && gqui from  "flatten(out/soong/ownership/all_teams.pb, teams)" proto build/soong/android/team_proto/team.proto:AllTeams ' where teams.kind = "cc_test" and teams.target_name="libnativebridge-tests"'
Test: go test ./cc
Change-Id: I6d44a521f5f2457527049399509d979559d7dc17
2024-04-15 23:21:23 +00:00
LaMont Jones
e6f5468ef2 release_config: add namespace to proto
flag_declaration needs to include the namespace, and origin is not
needed.

Bug: 328495189
Test: manual
Change-Id: Icbadbe6d9888323874c07d84ccd6f50c284e1a1c
2024-04-15 14:05:15 -07:00
Colin Cross
935b4db4cb Merge "rust: Remove unnecessary escaping in grep call" into main 2024-04-15 17:35:10 +00:00
Jiakai Zhang
369370818f Propagate transitive missing optional_uses_libs.
Bug: 331528424
Test: m --no-skip-soong-tests
Ignore-AOSP-First: Depends on internal changes. Will cherry-pick once merged.
Merged-In: Ied2821f11b6a5056ecf577e1e25765bc6dd212c0
Change-Id: Ied2821f11b6a5056ecf577e1e25765bc6dd212c0
2024-04-15 12:16:21 +00:00
Jiakai Zhang
f98da19a07 Refactor the contruction of the manifest check inputs.
This is a no-op change for a majority of cases.

Before this change, the contruction of the manifest check inputs is
confusing. It mutates uses_libs properties in place just for the
manifest check, by replacing module names with library names for
direct dependencies and merging library names from CLC for both direct
denpendencies and transitive denpendencies, and then constructs manifest
check inputs from those mutated uses_libs properties. This is
error-prone and leads to insistency: the goal is to check that the CLC
matches the manifest, but the inputs to the check don't reflect the CLC.

After this change, we no longer mutate uses_libs properties in place.
Instead, we maintain a separate list of missing denpendencies, and then
construct manifest check inputs directly from the CLC for all existing
libraries, no matter they are direct or transtive, and from the separate
list of missing libraries. This change makes the logic more
consistent and straightforward, and it also allows us to easily do the
next change, which is to propagate transtive missing denpendencies.

In fact, this change revealed several bugs around library optionality
and order in CLC construction, and fixed them.

Bug: 331528424
Test: m --no-skip-soong-tests
Ignore-AOSP-First: Depends on internal changes. Will cherry-pick once merged.
Merged-In: I0de82e76c47995b54aba9efd41538d950256a95f
Change-Id: I0de82e76c47995b54aba9efd41538d950256a95f
2024-04-15 11:15:41 +00:00
Hsin-Yi Chen
c0df1afc07 Merge "Pass system include dirs to header ABI checker" into main 2024-04-15 05:34:44 +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
9a7898d800 Merge "Allow override of -Wno-error=format" into main 2024-04-12 23:43:06 +00:00
Treehugger Robot
ef0cbf11a6 Merge "Remove duplicates in PathsAndMissingDepsRelativeToModuleSourceDir" into main 2024-04-12 23:39:04 +00:00
Ronald Braunstein
720146b2f2 Merge "Add "test-only" flag for java modules" into main 2024-04-12 23:13:51 +00:00
Treehugger Robot
c5c54803e6 Merge "Add support for transitive resources to android_library_import" into main 2024-04-12 22:04:27 +00:00