Commit Graph

8396 Commits

Author SHA1 Message Date
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
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
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
Jiakai Zhang
d7e3534def Merge "Propagate transitive missing optional_uses_libs." into main 2024-04-15 10:02:21 +00:00
Ronald Braunstein
c6b3eab537 Merge "Add "test-only" flag for java modules" into main am: 720146b2f2 am: d38b96ed96
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3040036

Change-Id: I4a9def65ea494698d62011db1aabee54207a9e64
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-12 23:54:48 +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
313714ce08 Merge "Add support for transitive resources to android_library_import" into main am: c5c54803e6 am: 7c1c3de7be
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3040832

Change-Id: Iaa438072ba7c8e1aa57df1dbd5fbb8b6dd1f6363
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-12 22:39: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
Colin Cross
607bbd64dd Add support for transitive resources to android_library_import
Collect and propagate resource jars from static dependencies of
android_library_import modules.

Bug: 288358614
Test: TestAndroidLibraryOutputFilesRel
Change-Id: I076f3c8e4ce42f71a52b612b77eb0265fa1e974c
2024-04-12 13:45:35 -07:00
Ronald Braunstein
cdc66f4268 Add "test-only" flag for java modules
As part of aosp/3022586 where we added the idea of "test-only" modules
and top_level_test_targets, this CL implements that for java modules.

We let users set "test-only" on java_library, but not on other modules
where the module kind is implicitly test-only, like java_test.
The implementation, not the user decides it is test-only.
We also exclude it from java_defaults.

	% 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 |
	+--------------------------+----------+

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

Test: m nothing --no-skip-soong-tests
Test: go test ./java
Test: m all_teams

Bug: b/327280661
Change-Id: I9c3ad947dc3d68d6427abada27449526d69daa6b
2024-04-12 11:42:10 -07:00
Jiakai Zhang
d2ce58d924 Merge "Refactor the contruction of the manifest check inputs." into main 2024-04-12 06:50:15 +00:00
Treehugger Robot
b1d555a77f Merge "Strip relative paths from java_import output files" into main am: 80214e550e am: 5b50be5aa9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3038158

Change-Id: I041eef99f5a14b0836a4f9d12dc6ee75d7d8d390
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-12 01:54:44 +00:00
Treehugger Robot
80214e550e Merge "Strip relative paths from java_import output files" into main 2024-04-12 01:22:10 +00:00
Colin Cross
5e87f349b8 Strip relative paths from java_import output files
androidx.annotation_annotation is used as a test data file, and
converting it from a java_library to a java_library_import causes
the relative path used in the test data path to change. Clear the
relative path in java_import the same way that other java based
modules do.

Bug: 288358614
Test: TestJavaLibraryOutputFileRel
Change-Id: I1f494110da32e916043ca94ac6ebeeafccc06f9a
2024-04-11 16:51:21 -07:00
Treehugger Robot
b71375ac31 Merge "Make app.go not executable" into main am: 0565fdc3cb am: 3ebc99c605
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3039820

Change-Id: I07d6bb4bcc0c2a9f72b74ff34bfb8060e4c0a1a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-11 23:04:55 +00:00
Treehugger Robot
0565fdc3cb Merge "Make app.go not executable" into main 2024-04-11 22:26:09 +00:00
Treehugger Robot
60d2dec9fc Merge "java_sdk_library: Use WriteFileRule for writing permissions.xml" into main am: 1065ed8fbd am: 5b5557773c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3036694

Change-Id: Ia586005e57a8556a200492273814cc07ad958264
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-11 21:35:39 +00:00
Cole Faust
7a51454f5b Make app.go not executable
Test: Presubmits
Change-Id: I983e58980cab2aa58797714c216851a1a7eb7f73
2024-04-11 14:13:20 -07:00
Treehugger Robot
1065ed8fbd Merge "java_sdk_library: Use WriteFileRule for writing permissions.xml" into main 2024-04-11 20:55:30 +00:00
Jihoon Kang
f4b835ccd9 Merge "Collect aconfig_declarations of the dependent java_aconfig_library modules" into main am: 033ffb9533 am: 1628b82c6f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3001319

Change-Id: I81e9d102c17bb5a1caf4400fc9d9513eb2be5c02
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-11 18:03:02 +00:00
Spandan Das
5bcf17db15 Merge "Revert "Add the implicit deps of javacRE"" into main am: d5b05655bb am: 0c5dee6f99
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3037722

Change-Id: Ifb4ee9667fd162cd4fbf2ab905b47026ccac2e88
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-11 18:02:12 +00:00
Jihoon Kang
033ffb9533 Merge "Collect aconfig_declarations of the dependent java_aconfig_library modules" into main 2024-04-11 17:37:58 +00:00
Spandan Das
d5b05655bb Merge "Revert "Add the implicit deps of javacRE"" into main 2024-04-11 16:53:12 +00:00
Anna Bauza
d0476e4652 Revert "Add the implicit deps of javacRE"
This reverts commit eaa475107d.

Reason for revert: This cl broke AOSP build, read more b/333846153

Change-Id: I5538a3c78617d7c2db98a11b60cb61269dcec8d3
2024-04-11 09:58:46 +00:00
Spandan Das
6936459dbb Merge "Add the implicit deps of javacRE" into main am: fc4d366e38 am: 0dce877166
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3034456

Change-Id: If2deccc7f2dd1f1e2a24a5f5cda50305d1806c97
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-10 20:31:53 +00:00
Spandan Das
fc4d366e38 Merge "Add the implicit deps of javacRE" into main 2024-04-10 20:20:43 +00:00
Paul Duffin
1816cde8ce java_sdk_library: Use WriteFileRule for writing permissions.xml
Use the `WriteFileRule` to write the permissions file for shared
libraries instead of generating a custom bash rule.

Test: TH
Change-Id: I904cf0742bfec46ed45ec7801bb9bd3dc3047185
2024-04-10 13:21:28 +01:00
Spandan Das
eaa475107d Add the implicit deps of javacRE
This includes
1. the prebuilt javac binary
2. the input .java files
3. the jars that are placed on the classpath during javac

(2) is passed via ${out}.rsp. This rsp file gets populated with the
input java files

For (3), this CL creates a new intermediate file whose content is
comma separated jars available on the classpath (this is the format
expected by rewrapper). This file is then registered in RSPFiles of
javacRE command, so that it gets passed to the rewrapper cmd as
`--input_list_paths`

(rspfiles are necesary for modules like framework-minus-apex to avoid
exceeding cmd line limits)

Bug: 308687455
Test: m framework-minus-apex; # verified that the relevant files are
added as `--inputs` of javac

Change-Id: I2ab9277fc394eb00454ef503c78a9f3451e596ac
2024-04-10 00:37:31 +00:00
Cole Faust
6aaa55d11a Remove "exported" ninja variables am: 8982b1c49e am: 50b1f9bd53
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3031205

Change-Id: Ib94fb0c07106eb2ae52e3f317c44656fddb9aab3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-09 20:07:31 +00: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
Nikolay Elenkov
c8170926f6 Merge "Add secretkeeper-v1-java to platform APIs" into main am: f28b5697b8 am: 196729ffda
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3003166

Change-Id: I6ed203fab98537ae18c51c9def19434acdbf20db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-09 02:20:53 +00:00
Nikolay Elenkov
f28b5697b8 Merge "Add secretkeeper-v1-java to platform APIs" into main 2024-04-09 01:59:35 +00:00
Treehugger Robot
926580047b Merge "Return the header jar of the implementation library in SdkHeaderJars()" into main am: 133a6d9e6f am: f68bf7d95b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3026823

Change-Id: I9943c80d7c530fa86ab8d2e81dfd64cb7ce5fdfa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-05 04:13:51 +00:00
Treehugger Robot
133a6d9e6f Merge "Return the header jar of the implementation library in SdkHeaderJars()" into main 2024-04-05 03:23:34 +00:00
Jihoon Kang
8479dea802 Return the header jar of the implementation library in SdkHeaderJars()
As part of the process to remove the compilation action in the top level
java sdk library, this change modifies SdkHeaderJars(...) (i.e. the
"magic") to return the header jar of the implementation library instead
of the header jar of the top level java sdk library when the
implementation jar is returned from the "magic".

This change also removes `SdkImplementationJars()` from the
SdkLibraryDependency interface, as it is not currently used anywhere
else.

Test: m nothing --no-skip-soong-tests
Bug: 332785297
Change-Id: Icc00af4b1485dc2b1b0981a3e56758d0306dea69
2024-04-05 00:37:37 +00:00
Jiakai Zhang
22154d8c3e 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.
Change-Id: Ied2821f11b6a5056ecf577e1e25765bc6dd212c0
2024-04-04 13:10:28 +01:00
Jiakai Zhang
3ef7283735 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.
Change-Id: I0de82e76c47995b54aba9efd41538d950256a95f
2024-04-04 13:10:26 +01:00
Jihoon Kang
ead7fd2ec4 Merge "Add API compatilibility flags to the exportable stubs" into main am: 32e1b930e9 am: 970a886318
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3018345

Change-Id: I1f4b8b9caf0f0f9916bf9fc720f5f75b9bf9a9ff
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-03 16:10:32 +00:00
Jihoon Kang
32e1b930e9 Merge "Add API compatilibility flags to the exportable stubs" into main 2024-04-03 15:34:43 +00:00
Treehugger Robot
b861dc6489 Merge "Strip relative paths from android_library_import output files" into main am: eabd1ef484 am: b6be0f2d91
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3023204

Change-Id: Ide5e5eb99072c8ee31373a9d6d63bd721c3eda93
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-02 21:46:47 +00:00
Treehugger Robot
eabd1ef484 Merge "Strip relative paths from android_library_import output files" into main 2024-04-02 21:01:45 +00:00
Colin Cross
28ac2ffc80 Strip relative paths from android_library_import output files
androidx.annotation_annotation is used as a test data file, and
converting it from an android_library to an android_library_import
causes the relative path used in the test data path to change.
Clear the relative path in android_library_import the same way that
android_library and other java based modules do.

Also change the name of classes-combined.jar to the name of the
module so that the output file has the right name if there are no
static dependences that require running the merge_zips step.

Bug: 288358614
Test: TestAndroidLibraryOutputFileRel
Change-Id: I28210aa370a742d789102ff71db3685ca744878f
2024-04-02 12:21:34 -07:00
Zi Wang
ddb2ee512c Move jarjar repackage action before combine action
With this change, the jarjar repackage actions are only on
the local classes of each module instead of the combined jar
that contains the static libs. The static libs don't need
jarjar repackage action on this module level because it has
been repackaged when building itself.

This change also removes the skip_jarjar_repackage property
since it's incompatible with this change. Actually skipping
jarjar repackage on a dep may result in incomplete repackage
on the module output.

Test: CI and observing the build time of SystemUIGoogle
Bug: 328067025
Ignore-AOSP-First: Will cp to aosp
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:78ffdd47a658dec4bf79e63d11a5f0f3b94876a4)
Merged-In: I476d959af025c46d2ba6d3f48ea378a086666a33
Change-Id: I476d959af025c46d2ba6d3f48ea378a086666a33
2024-04-02 16:44:02 +00:00
Zi Wang
74ef029da4 Merge "Move jarjar repackage action before combine action" into main 2024-04-01 16:33:53 +00:00
Ronald Braunstein
a5ebfad436 Merge "Add test_module_config_host" into main am: c654ad162c am: 105e57aaff
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3004867

Change-Id: Ic271f84645a97b6d1bd66e3374b0417847fe631b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-29 22:51:23 +00:00
Ronald Braunstein
c654ad162c Merge "Add test_module_config_host" into main 2024-03-29 22:15:08 +00:00
Kiyoung Kim
34aaf87104 Merge "Ensure java level inter partition dependency with VNDK deprecation." into main am: b54c4b4a96 am: eaf1e016f3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3016326

Change-Id: I23bd6a6eba850360a520dac6c3b75be70d18d7fd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-29 01:15:52 +00:00
Jihoon Kang
3921f0b356 Collect aconfig_declarations of the dependent java_aconfig_library modules
droidstubs module require aconfig_declarations modules to be specified
when the module depends on the java_aconfig_library module in order to
generate the "exportable" stubs. This adds burden to the droidstubs or
java_sdk_library module owners, as module should specify both the
java_aconfig_library and aconfig_declarations modules to genreate the
"exportable" stubs, although the necessary information from the
aconfig_declarations module can be provided from the
java_aconfig_library modules.

In order to resolve such burden, this change enables the intermediate
cache files from the associated aconfig_declarations module of a
java_aconfig_library module to be propagated to its reverse dependencies
without having the specify the aconfig_declarations modules in the
droidstubs or java_sdk_library modules definitions.

This does not mean that the intermediate cache files of every transitive
dependencies of the java_sdk_library or the droidstubs will be passed to
aconfig to retrieve the state of the aconfig flags.

Specifically, only the java_aconfig_library modules or the java_library
modules that have static dependency on java_aconfig_library modules that
are passed to droidstubs via `libs` or `srcs` (using
":module_name{.tag}" syntax) will provide the intermediate cache files
to generate the "exportable" stubs. For java_sdk_library, all modules
listed as `libs`, `static_libs`, `stub_only_libs`, and `apiScope.libs`
are passed as `libs` and all modules listed as `api_srcs` and `srcs` are
passed as `srcs` to the droidstubs modules dynamically generated in
java_sdk_library module per api scope, thus these properties will be
affected.

Note that the test is being added in the apex package. This is because
trying to register the codegen package build components in the java
package leads to circular dependency between the codegen and the java
package, as codegen package imports the java package.

Test: m nothing --no-skip-soong-tests
Bug: 329284345
Change-Id: I7953ab64776f6947808321ce8a3598154501bcfe
2024-03-29 01:11:32 +00:00