Commit graph

7993 commits

Author SHA1 Message Date
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
Ronald Braunstein
c654ad162c Merge "Add test_module_config_host" into main 2024-03-29 22:15:08 +00:00
Ronald Braunstein
1a6e7c032a Add test_module_config_host
This pairs with `test_module_config` but also works on the base is a
`java_test_host` module.
e.g.

	test_module_config_host {
	     name: "CtsOsHostTestCases_DERIVED_2566",
	     base: "CtsOsHostTestCases",
	     test_suites: ["general-tests"],
	     include_filters: [ "android.os.cts.StaticSharedLibsHostTests" ],
	     exclude_annotations: [ "androidx.test.filters.FlakyTest","org.junit.Ignore" ],
	}

The new module is composed of the previous and shares much of the same
code.

With respect to build size,
	Without this change, if you build CtsAppSecurityHostTestCases, there
	will be several copies of the jar (and related apks) :
	 *) 1 in framework
	     out/host/linux-x86/framework/CtsAppSecurityHostTestCases.jar
	 *) 1 in testcases for the test
	     out/host/linux-x86/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
	 *) 1 per compatibility suite testcases
		out/host/linux-x86/mts-documentsui/android-mts-documentsui/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
		out/host/linux-x86/mts-mediaprovider/android-mts-mediaprovider/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
		out/host/linux-x86/mts/android-mts/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
		out/host/linux-x86/cts/android-cts/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
		out/host/linux-x86/mts-mainline-infra/android-mts-mainline-infra/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar

	A dervived test using CtsAppSecurityHostTestCases as base adds one more
	to its testcases dir:
	  *) derived testcase.
	     out/host/linux-x86/testcases/CtsAppSecurityHostTestCases_presubmit_ExternalStorageApp/CtsAppSecurityHostTestCases.jar

Fixes: b/327280990
Test: m clean && m  CtsOsHostTestCases_DERIVED_2566# as above
Test: atest CtsOsHostTestCases_DERIVED_2566 --collect-tests-only
Test: migrated the 71 TestMapping instances to Android.bp and build them.
  Ran tests on some of them.
  Ran some original `test_module_config` tests derived from `android_test` as well

TODO: Add actions to validate the given filters are valid for the given
test apks/jars.

Change-Id: I115eedb6ff6ba8e72bb49e71867daf49d25ca0f1
2024-03-28 15:07:17 -07:00
Kiyoung Kim
9743bab964 Ensure java level inter partition dependency with VNDK deprecation.
Previously JAVA dependency over partition was checked only when device
VNDK version is not empty. This change updates logic to enforce inter
partition dependency despite of VNDK version based on VNDK deprecation.

Bug: 330100430
Test: AOSP CF build succeeded
Change-Id: I7444ad612aa6c525e61cc5c2a89f5421ab4465b4
2024-03-28 06:50:11 +00:00
Colin Cross
cde5534ccd Support transitive proguard specs in android_library_import
Add support for android_library_import to propagate the proguard specs
from its static dependencies.

Bug: 326265727
Test: TestExportedProguardFlagFiles
Change-Id: I174c1d7937a529958f8d240214b279062ef74868
2024-03-27 14:14:09 -07:00
Colin Cross
eee4ab12fa Disable use_resource_processor when producing a shared library
Passing --shared-lib to aapt2 causes it to add an extra
onResourcesLoaded method that rewrites resources IDs to include
the package ID determined at runtime.  ResourceProcessorBusyBox
has no equivalent functionality, so disable whenever --shared-lib
is found in aaptflags for now.

Fixes: 330646473
Bug: 331641946
Test: manual
Change-Id: Ibb0c2c7bf7a41ab294f5c84b4b6018cc8a63b0f4
2024-03-27 11:58:58 -07:00
Inseob Kim
5baf2cbcb6 Migrate buildinfo.sh script into Soong
To build system.img in Soong, we need all artifacts including
build.prop. This fully migrates buildinfo.prop file into Soong as a
first step to build build.prop on Soong.

Bug: 322090587
Test: compare build.prop before and after
Test: build multiple times and see build.prop isn't rebuilt
Change-Id: Icaa7e1fdab2a8c169ac00949d3aaf6c8212a1872
2024-03-26 05:55:49 +00:00
Colin Cross
dad2a361ef Revert^2 "Support static_libs for java_import modules"
c6c9c7354b

Change-Id: Id011aca133d7bb45023a63c0f53d84a4d694cc2f
2024-03-23 04:43:41 +00:00
Colin Cross
9055e21914 Revert "Revert "Support transitive dependencies through android_..."
Revert submission 3010297-revert-3008874-OJOKRLYEZJ

Reverted changes: /q/submissionid:3010297-revert-3008874-OJOKRLYEZJ

Change-Id: I885a449ddc284052f9d4ec0c030d5fc61247b522
2024-03-23 04:43:41 +00:00
Colin Cross
567b9d707b Merge changes from topic "revert-3008874-OJOKRLYEZJ" into main
* changes:
  Revert "Support transitive dependencies through android_libary_i..."
  Revert "Support static_libs for java_import modules"
2024-03-22 18:25:30 +00:00
Colin Cross
44841aada3 Revert "Support transitive dependencies through android_libary_i..."
Revert submission 3008874

Reason for revert: b/330903911
Reverted changes: /q/submissionid:3008874

Change-Id: Ie056a7f90803ab2d8e39e07eddf6c9c68e41ff3d
2024-03-22 18:16:57 +00:00
Colin Cross
c6c9c7354b Revert "Support static_libs for java_import modules"
Revert submission 3008874

Reason for revert: b/330903911
Reverted changes: /q/submissionid:3008874

Change-Id: I34cca9d021d9c806e28bb6a6a6da78efd61cde27
2024-03-22 18:17:00 +00:00
Colin Cross
77be51bcab Merge changes from topic "no_more_nodeps" into main
* changes:
  Support static_libs for java_import modules
  Support transitive dependencies through android_libary_import modules
2024-03-22 16:55:47 +00:00
Thiébaud Weksteen
d3348dbaaa Merge "Support multiple sources for prebuilt_etc" into main 2024-03-21 23:14:48 +00:00
Colin Cross
a174d2e987 Support static_libs for java_import modules
Remove the need to wrap java_import modules with a java_library
just to include static dependencies.

Bug: 288358614
Test: TestJavaImport
Change-Id: I888aecc6c0efc696a397fc1dd5d0ef5fd644bebc
2024-03-21 15:36:01 -07:00
Treehugger Robot
7f75245402 Merge "Add aconfig flag support for runtime_resource_overlay" into main 2024-03-21 19:03:24 +00:00
Jihoon Kang
5a87a9ac1c Merge "droidstubs depend on the combined last api filegroup modules" into main 2024-03-21 17:34:00 +00:00
Rico Wind
bd71657e91 Merge "Add flag for optimized resource shrinking with R8" into main 2024-03-21 14:45:13 +00:00
Rico Wind
a2fa263786 Add flag for optimized resource shrinking with R8
If the flag is set we will:
 - pass --optimized-resource-shrinking to the r8 invocation
 - use non final fields for the generated R classes
 - not pass the aapt2 generated proguard rules, R8 will do the tracing of xml files

Bug: 325905703
Test: This is simply passing the flag through to R8, this is off by default
Change-Id: Ib2043f3201578c3bcd39c1de9a524fd78f6d795c
2024-03-21 12:33:53 +01:00
Treehugger Robot
b291690bc4 Merge "Export JavaBootLibsSdkMemberType and JavaSystemserverLibsSdkMemberType" into main 2024-03-21 02:47:59 +00:00
Thiébaud Weksteen
00e8b31ee6 Support multiple sources for prebuilt_etc
Keep the Src attribute for compatibility. The new attribute (Srcs) is
mutually exclusive with Src.

Keep SourceFilePath and OutputFile for compatibility with other modules.
These can be removed in a follow up change.

Bug: 328313691
Test: presubmit
Test: m blueprint_tests
Test: prebuilts/build-tools/build-prebuilts.sh (on build-tools branch)
Change-Id: I5d5b2657715a7180a829c7ed0f501872d561b662
2024-03-21 11:30:15 +11:00
Colin Cross
8179496764 Support transitive dependencies through android_libary_import modules
Fix dependencies of android_library_import modules so that the -nodeps
modules created by pom2bp are no longer necessary.  Provide transitive
manifests (b/288358614), combine static dependencies into the output
jars, and propagate uses_libraries and optional_uses_libraries from
dependencies.

Bug: 288358614
Test: TestManifestMerger
Test: TestAndroidResourceProcessor
Change-Id: Ief45169d04217826fbb21ba283602b38ef0dd3f6
2024-03-20 16:09:14 -07:00
Jihoon Kang
9f442dc5d4 Add aconfig flag support for runtime_resource_overlay
This change adds the support that was added to android_app in
https://r.android.com/2854663 for runtime_resource_overlay modules.

Implementation details:
- Add flags_packages as dependencies of runtime_resouce_overlay modules
- Pass the collected aconfig intermediate cache files to the
  aconfigBuildActionOptions.

Test: m nothing --no-skip-soong-tests
Bug: 330222981
Change-Id: I3e20f18e58be689ca32852f7bf0b7ea16024856b
2024-03-20 22:18:17 +00:00
Spandan Das
159b264873 Export JavaBootLibsSdkMemberType and JavaSystemserverLibsSdkMemberType
build/soong/sdk will use these tags to differentiate the sdk and non-sdk
contents of bootclasspath and systemserverclasspath fragments.

Test: go build ./java
Bug: 326246905

Change-Id: Ia8352c09fcbbca06988eb57153e5986801eb45a5
2024-03-20 21:41:49 +00:00
Jihoon Kang
748a24dd6e droidstubs depend on the combined last api filegroup modules
This change creates a "combined" filegroup module, which will contain
all api files of the subset api scopes in the followup change. In this
change, the "combined" filegroup is identical to the currently existing
last api filegroup module in that it only contains the api file /
removed api file of the specific api scope.

This change also passes the "combined" filegroup to the droidstubs
module generated from the sdk_library modules, but this currently does
not lead to any functional changes as the "combined" filegroup is
identical to the currently existing last api filegroup.

Test: m nothing --no-skip-soong-tests
Bug: 321827591
Change-Id: If73a7229f2f970f7e74cd010a8b4808dc9018344
2024-03-20 21:29:39 +00:00
Treehugger Robot
bd339315ca Merge "Modify dist artifact dependency to respect the RELEASE_HIDDEN_API_EXPORTABLE_STUBS build flag" into main 2024-03-20 11:33:11 +00:00
Jihoon Kang
0216805aae Modify dist artifact dependency to respect the RELEASE_HIDDEN_API_EXPORTABLE_STUBS build flag
Currently, the "exportable" stubs and the api files are copied to the
dist directory during SDK builds regardless of the value of the
RELEASE_HIDDEN_API_EXPORTABLE_STUBS build flag. This change modifies
such behavior that the "exportable" artifacts are copied to the dist
directory only when the RELEASE_HIDDEN_API_EXPORTABLE_STUBS flag value
is set to true.

Test: lunch aosp_arm-trunk_staging-eng && m sdk dist and inspect ninja graph to verify that the "everything" artifacts are copied to the dist directory
Bug: 330417789
Change-Id: I3b83375610eb172d7b9da7ea831a74cd427b696c
2024-03-20 07:45:29 +00:00
Treehugger Robot
5c0a491e0a Merge "Add aconfig flag support for android_library" into main 2024-03-20 01:23:50 +00:00
Treehugger Robot
064b145365 Merge "Change java stem attribute for both device and host" into main 2024-03-20 01:05:50 +00:00
Jihoon Kang
6e739b9b4d Merge "Propagate intermediateCacheFiles in java modules and filegroup" into main 2024-03-20 00:08:50 +00:00
Jihoon Kang
9049c2725a Add aconfig flag support for android_library
This change adds the support that was added to android_app in
https://r.android.com/2854663 for android_library modules.

Implementation details:
- Move `Flags_packages` to aaptProperties, so that it can be utilized
  for both android_app and android_library.
- Wrap `VisitDirectDeps` of aconfig_declarations to a function that
  takes a ModuleContext as an input, so that it can be utilized in the
  `GenerateAndroidBuildActions` of both android_app and android_library.

Test: m nothing --no-skip-soong-tests
Bug: 330222981
Change-Id: I8a755f5ca615c8a1651afcd2ec441fc9fbd82c61
2024-03-20 00:06:05 +00:00
Jihoon Kang
705e63e362 Propagate intermediateCacheFiles in java modules and filegroup
This change propagates the intermediateCacheFiles generated by the
aconfig_declarations to the static rdeps that are java modules or the
rdeps that are filegroups.

Test: m nothing
Bug: 329284345
Change-Id: I02431336c1aa0378d03248f3bb6edf2f57ec3b7f
2024-03-19 20:54:05 +00:00
yangbill
2af0b6edd7 Change java stem attribute for both device and host
Bug: 329762127
Test: cd build/soong/java ; go test -run TestJavaLibHostWithStem
Test: cd build/soong/java ; go test -run TestAppStem
Test: cd build/soong/java ; go test -run TestAndroidAppImport_ArchVariants
Test: cd build/soong/java ; go test -run TestOverrideAndroidAppStem
Test: cd build/soong/java ; go test -run TestOverrideAndroidApp
Test: cd build/soong/java ; go test -run TestPackageNameOverride

Change-Id: I8fbdc82116f9a0c68121fbbeb1ef4f78f2b6fea3
2024-03-19 09:11:59 +00:00
Treehugger Robot
84fedd36a4 Merge "Revert^9 "Enable dex container (DEX v41) for the whole system"" into main 2024-03-19 01:20:15 +00:00
Yuncheol Heo
113654faca Revert^9 "Enable dex container (DEX v41) for the whole system"
This reverts commit b92a4e1ca9.

Reason for revert: tracking the test failure b/329907267

Change-Id: Id3fa8471f073e0ec705fd0aba653b032ff82f9ad
2024-03-18 17:41:12 +00:00
Spandan Das
c36d579c2b Merge "Support mechanism to select a specific version of module sdk prebuilt" into main 2024-03-18 15:55:51 +00:00
Spandan Das
e4c911e6fc Support mechanism to select a specific version of module sdk prebuilt
This CL is the platform_compat_config equivalent of aosp/2928483.

{prebuilt_}_platform_compat_config are collated by
`global_compat_config` via a singleton. The collated data is then used
in some CTS tests. At ToT, we ensure that the collation ignores the
platform_compat_config of prebuilt when source is selected, and vice
versa.

With trunk stable, multiple versions of prebuilt apexes and prebuilt
platform compat configs might exist in the tree. This CL uses
`Source_module_name` to hide the platform compat configs of the
unselected prebuilt apexes.

Bug: 322175508

Test: Added a unit test
Change-Id: Iafdde8fc0458b37b3ccde25433070936f144915c
2024-03-16 01:41:12 +00:00
Treehugger Robot
ce1b16313e Merge "Create rule to generate the exportable api files when checkapi is disabled" into main 2024-03-15 23:58:13 +00:00
Jihoon Kang
36c3d96b65 Create rule to generate the exportable api files when checkapi is disabled
WITHOUT_CHECK_API environment variable enables the checkapi to be
removed from the critical path. The variable is rarely used within AOSP,
but the downstream vendors may depend on it, in order to improve the
build performance given that the api signature file through metalava is
a resource costly task.

Currently, the exportable api files / removed api files are not
generated when checkapi is disabled, but a module may depend on the
exportable api files when a checkapi is disabled. In order to prevent
the missing build rules error in this case, generate the rule to copy
the checked in api file / removed api file to the exportable api file /
removed api file to prevent build errors.

This change also fixes the error message when the OutputFiles(string)
api file is null, to correctly inform the user the error.

Test: m BUILD_FROM_SOURCE_STUB=true WITHOUT_CHECK_API=true && inspect ninja path and verify that "non-updatable-exportable-current.txt" depends on the generated exportable api file.
Bug: 329374072
Change-Id: I24f88d450fb46b6ea9d5920d83617d8228edd34b
2024-03-15 22:30:56 +00:00
David Srbecky
d10d54af71 Merge "Revert^8 "Enable dex container (DEX v41) for the whole system"" into main 2024-03-15 15:42:48 +00:00
Treehugger Robot
f34748af55 Merge "Delete jmod workDir" into main 2024-03-15 02:35:04 +00:00
Cole Faust
7ef61d76f8 Delete jmod workDir
Files in this directory aren't exposed to the rest of the build, so
deleting them saves some space. The `jmod create` command was also
producing non-deterministic files, which are not relevant because
they're not used anywhere else, but it makes it easier to find
non-determinism that matters if we delete them.

Test: Presubmits
Change-Id: I5d57826b438368f24a7a2a7ab1ccd6c16f240124
2024-03-14 18:15:28 -07:00
Treehugger Robot
4e4939665e Merge "Generate info about the selected app variant in platform builds" into main 2024-03-14 22:05:43 +00:00
Treehugger Robot
f11f786571 Merge "Add exports for JDK 21 to Kythe extractor" into main 2024-03-14 18:43:02 +00:00
Yu Liu
f509eba41d Merge "Validate aconfig libs are built with the correct modes." into main 2024-03-14 18:39:12 +00:00
Spandan Das
3490dfd23f Generate info about the selected app variant in platform builds
This is a followup to aosp/2999198 and adds information about apps.

Each app will have an entry in this file with the following properties
- Name, mandatory
- Is_prebuilt, mandatory
- Prebuilt_info_file_path, optional

Implementation details
- Move prebuiltInfoProvider out of build/soong/apex to
  build/soong/android. This allows build/soong/java to use it.
- Introduce a new `prebuilt_info` prop to `android_app_set` and
  `android_app_import`
- All app module types will set a prebuiltInfoProvider in
  GenerateAndroidBuildActions, including the source app module types

Test: m nothing --no-skip-soong-tests
Test: m out/soong/prebuilt_info.json
Test: ls -l out/soong/prebuilt_info.json --human-readable
-rw------- 1 spandandas primarygroup 317K Mar 11 23:46 out/soong/prebuilt_info.json

Test: #modified trunk_staging.locally to select prebuilts of some
mainline apps. Spot-checked that `is_prebuilt` and
`prebuilt_info_file_path` get populated appropriately

Bug: 327480225
Change-Id: I5078e0ec26c9568194550909962b90111a5223f7
2024-03-14 18:12:30 +00:00
Sorin Basca
79b7ca1e7a Add exports for JDK 21 to Kythe extractor
Change-Id: Ie977f08f8aee59ea21dcbfe7c9c07dc0dc535775
Fixes: 328877412
Test: TH
2024-03-14 16:59:49 +00:00
David Srbecky
b92a4e1ca9 Revert^8 "Enable dex container (DEX v41) for the whole system"
This reverts commit 43668c6f13.

Reason for revert: Reland

Bug: 317744117
Bug: 329465418
Test: Device boots
Change-Id: I4b0478030c6a4980f33087ec5764018295691bac
2024-03-13 18:49:34 +00:00