Commit graph

5543 commits

Author SHA1 Message Date
Treehugger Robot
6abfb33784 Merge changes I08ec0b44,I79b5a1fc,I469d6558
* changes:
  Allow java_sdk_library in an APEX to have higher min_sdk_version.
  Perform CheckMinSdkVersion for java_sdk_library.
  Add MinSdkVersion(ctx) method to ModuleWithMinSdkVersionCheck interface.
2021-12-08 17:58:24 +00:00
Allen Hair
9df0fa5e63 Merge "Revert "Set targetsdkversion to future level if TARGET_BUILD_APPS is not empty"" 2021-12-08 17:54:57 +00:00
satayev
758968a700 Allow java_sdk_library in an APEX to have higher min_sdk_version.
Inidividual boot or system server jars may have higher min_sdk_version
than the contianing apex, since the runtime respects the values of
min/max_sdk_version; e.g. runtime would not load a boot jar with
higher min_sdk_version. This allows shipping new boot jars via apexes
that target older platforms.

Bug: 190818041
Test: presubmit
Change-Id: I08ec0b4463a17bc8265b948fe09da55eb4e52ac3
2021-12-08 11:36:34 +00:00
satayev
8f088b09d8 Perform CheckMinSdkVersion for java_sdk_library.
In a follow up, apex would expect that any module that implements
ModuleWithMinSdkVersionCheck to have performed appropate checks on
min_sdk_version, to allow relaxing some of the existing conditions.

This change moves the responsibility of checking min_sdk_version
of java_sdk_library to java_sdk_library itself.

Bug: 205923322
Test: presubmit
Change-Id: I79b5a1fc34098fff60221e416db6e6e69e01f531
2021-12-08 11:36:34 +00:00
Jiakai Zhang
29e35e115d Stop installing a profile into an APEX if profiles are disabled.
Bug: 209630530
Test: art/tools/golem/build-target.sh
Change-Id: I0ac4e1860a47da20626b423b9b1f62dd49259deb
2021-12-08 11:05:19 +00:00
Kun Niu
131a5a13fe Revert "Set targetsdkversion to future level if TARGET_BUILD_APPS is not empty"
This reverts commit e33e25b4a5.

Reason for revert: may causing b/209301265,
Test: https://android-build.googleplex.com/builds/abtd/run/L66400000952203490
Change-Id: Ifcccdcfbfc014d4172f4d9488ea699380d3f3ebe
2021-12-08 00:44:07 +00:00
Romain Jobredeaux
4526269c2e Merge "Initial bp2build converter for android_app." 2021-12-07 20:14:29 +00:00
Jiakai Zhang
e6f63be764 Merge "Add ART boot image profile to the ART APEX." 2021-12-07 15:22:37 +00:00
Romain Jobredeaux
1282c42484 Initial bp2build converter for android_app.
The only supported attributes at this point are:
- srcs
- manifest
- package_name
- resource_dirs
as they most easily map to bazel's android_binary's srcs, manifest, custom_package, and resource_files respectively.
Allow-listing all apps that use these fields, along with sdk_version and dex_preopt. The latter 2 are ignored by the converter,
- sdk_version because we're currently relying on a single pre-built SDK,
- dex_preopt because,
   1. though it is not supported in Bazel builds yet, it doesn't prevent the apps from building, and
   2. the apps being converted only use the dex_preopt attribute to disable dex_preopt, which is what is happening anyway.

Change-Id: I4a4f771eeb8f60a1cd4844b2ac1ce3df7c070e73
Test: ./build/bazel/scripts/run_presubmits.sh
Bug: 198224074
Bug: 203688791
2021-12-07 09:41:49 -05:00
satayev
b3fd411465 Add ModuleWithMinSdkVersionCheck type.
This is to help following refactor for individual modules to have their
own version of checking where needed.

For example, apk in apex may want to enforce it's own version of
CheckMinSdkVersion.

Bug: 205923322
Test: presubmit
Change-Id: Ia2fad6c52af39e21f65385bcb283f1e3adab5548
2021-12-06 12:05:48 +00:00
Jiakai Zhang
49b1eb6b04 Add ART boot image profile to the ART APEX.
We will need the profile when we generate the primary boot image on
device.

Bug: 203492478
Test: Run `banchan com.android.art x86_64 && m` and see
  `$ANDROID_PRODUCT_OUT/apex/com.android.art/etc/boot-image.prof`.
Test: Run `lunch aosp_cf_x86_64_phone-userdebug && m` and see both
  `$ANDROID_PRODUCT_OUT/apex/com.android.art/etc/boot-image.prof` and
  `$ANDROID_PRODUCT_OUT/system/etc/boot-image.prof`, in different
  sizes.
Test: Start Cuttlefish with the built image and see both
  `/apex/com.android.art/etc/boot-image.prof` and
  `/system/etc/boot-image.prof` on device.
Change-Id: Id879dc49b234133dfbb9563814328661a1f4a6c0
2021-12-03 20:02:10 +00:00
Spandan Das
16ce4801ef Merge "Set targetsdkversion to future level if TARGET_BUILD_APPS is not empty" 2021-12-03 18:08:41 +00:00
Spandan Das
e33e25b4a5 Set targetsdkversion to future level if TARGET_BUILD_APPS is not empty
manifest_fixer transforms an AndroidManifest.xml file for use in aapt2.
For TARGET_BUILD_APPS builds, set targetSdkVersion to a FutureApiLevel

Test: In build/soong, go test ./java
Test: TH

Test: In internal, TARGET_BUILD_APPS=xyz m
out/soong/.intermediates/packages/providers/MediaProvider/MediaProvider/android_common_MediaProviderGoogle_apex30/package-res.apk
&& aapt2 dump badging
out/soong/.intermediates/packages/providers/MediaProvider/MediaProvider/android_common_MediaProviderGoogle_apex30/package-res.apk
| grep targetSdkVersion # targetSdkVersion:'10000'

Test: In internal, m
out/soong/.intermediates/packages/providers/MediaProvider/MediaProvider/android_common_MediaProviderGoogle_apex30/package-res.apk
&& aapt2 dump badging
out/soong/.intermediates/packages/providers/MediaProvider/MediaProvider/android_common_MediaProviderGoogle_apex30/package-res.apk
| grep targetSdkVersion # targetSdkVersion:'Tiramisu'

Bug: 204107787

Change-Id: Ic6f21111d5a8c61ae789a7a3a001f669257a39b2
2021-12-02 19:55:25 +00:00
Artur Satayev
ee594919ea Merge "Use textproto format for classpaths.proto generation." 2021-12-02 15:43:47 +00:00
Artur Satayev
fb0a7234d7 Merge changes Ieb9aef29,I6985ebb6
* changes:
  Propagate min and max sdk versions to classpaths.proto configs.
  Introduce max_sdk_version device property.
2021-12-02 14:53:48 +00:00
Colin Cross
c01a5cd705 Merge "Only get dexpreopt config for device modules" 2021-12-02 05:28:36 +00:00
Treehugger Robot
5e4637dc1b Merge "Adding configuration support for Java 11" 2021-12-01 22:18:41 +00:00
Colin Cross
38310bb4ac Only get dexpreopt config for device modules
Calling dexpreopt.GetGlobalConfig can return errors, move the checks
that don't depend on dexpreopt.GetGlobalConfig first to avoid
breaking all modules when the global config is invalid, for example
in a partial branch that is missing the BootProfileImages file.

Bug: 207813628
Test: tradefed branch builds
Change-Id: Id1689de3f1ef986a41a60622cb357edb9d323b8a
2021-12-01 12:32:11 -08:00
satayev
48dae67a76 Use textproto format for classpaths.proto generation.
Test: presubmit
Change-Id: I3fea94153939f05329f02091ca4fa838ee9df93f
2021-12-01 18:24:09 +00:00
satayev
cca4ab762e Propagate min and max sdk versions to classpaths.proto configs.
These attributed define a range for dessert releases where the jars
should be active, and included in corresponding CLASSPATH varibles by
derive_classpath.

Bug: 190818041
Test: presubmit
Change-Id: Ieb9aef29657ad0694d48a63019f93faca2678252
2021-12-01 17:58:41 +00:00
satayev
0a420e771a Introduce max_sdk_version device property.
Artifacts that go into apexes should only be active on certain SDK
versions. There is now a need to upper bound the range to support
expressiong statements like "this jar should only run on platforms
30-31".

Bug: 190818041
Test: presubmit
Change-Id: I6985ebb671841cdd9f0f37f916267ac5ed76e4f4
2021-12-01 17:51:22 +00:00
Jiakai Zhang
cee9e19a51 Add entries for STANDALONE_SYSTEMSERVER_JARS to systemserverclasspath.pb
This CL updates platform_systemserverclasspath,
systemserverclasspath_fragment, and
prebuilt_systemserverclasspath_fragment to write entries for
STANDALONE_SYSTEMSERVER_JARS to systemserverclasspath.pb. A new property
`standalone_contents` is aded to `systemserverclasspath_fragment` and
`prebuilt_systemserverclasspath_fragment` to list the standalone system
server jars in the APEX, and entries will be written to
systemserverclasspath.pb accordingly at build time.

To add more context, these entries will be consumed by derive_classpath
in order to generate an environment variable
PRODUCT_STANDALONE_SYSTEM_SERVER_JARS. The environment variable will
then be comsumed by odrefresh to determine what jars to preopt on early
boot.

Note that the variable should not end with "CLASSPATH" because the list
is not used by runtime as a classpath. It is just a colon-separated list
of jars. System server loads the jars separately with paths hardcoded in
the code.

Bug: 203198541
Test: manual -
  1. Add some jars to PRODUCT_STANDALONE_SYSTEM_SERVER_JARS
  2. Add some other jars to PRODUCT_APEX_STANDALONE_SYSTEM_SERVER_JARS
     and standalone_contents.
  3. Build an image.
  4. Flash the image to a device.
  5. adb shell echo \$STANDALONE_SYSTEMSERVER_JARS
  6. See the correct list of jars.
Change-Id: I09a6fd1d3db85c194330da9b751702a9bf069e26
2021-11-30 10:51:10 +00:00
Sorin Basca
c0244da203 Adding configuration support for Java 11
Bug: 195387073
Test: m
Change-Id: Ibf26f35b83b300acacae800f9962a00916869412
2021-11-26 17:26:33 +00:00
Treehugger Robot
b0879c843f Merge "Do not pass --compiler-filter=speed-profile with --profile-file." 2021-11-25 20:42:31 +00:00
Pedro Loureiro
ba6682fabf Fix attribute names in generated permissions.xml
Previously it would write min_device_sdk whereas the correct name should
be min-device-sdk. This happened for all shared libs attributes.

Test: m nothing
Test: manually installed an apex with a shared lib and made sure PM used
the attributes as expected

Bug: 191978330

Change-Id: Iecf7edd6bae98c7af908d3f320f10ae4973d0396
Merged-In: Iecf7edd6bae98c7af908d3f320f10ae4973d0396
(cherry picked from commit bde653e5fd)
2021-11-24 17:09:20 +00:00
Pedro Loureiro
c362142438 Perform validation of shared library attributes
Perform consistency checks as per http://go/updatable-shared-libraries

These include:
  * no attribute can specified can be less than T
  * max-device-sdk can't be less than min-device-sdk
  * min and max-device-sdk need to be at least the module's
  min_sdk_version
  * using on-bootclasspath-before implies that the module's
  min_sdk_version is at least T or the library has min-device-sdk of at
  least T

Test: m nothing

Bug: 191978330

Change-Id: Iaca5cf23fb0bc7e65effb3529c8e829560894c2e
Merged-In: Iaca5cf23fb0bc7e65effb3529c8e829560894c2e
(cherry picked from commit f9e584dd20)
2021-11-24 17:09:19 +00:00
Pedro Loureiro
9956e5e281 Add support for new permissions library tag attributes
We are expanding PackageManager's supported attributes and this change
enables the developer to define them in the .bp file.

Test: m nothing

Bug: 191978330

Change-Id: I01d579190fb585662086a7fc456f3b33cb89fb57
Merged-In: I01d579190fb585662086a7fc456f3b33cb89fb57
(cherry picked from commit 826863c8e0)
2021-11-24 17:09:18 +00:00
Martin Stjernholm
9fdd87d7e4 Do not pass --compiler-filter=speed-profile with --profile-file.
It is the default, and hence unnecessary to pass explicitly. This
allows some other compiler filter to be passed through BootFlags.

Test: m out/host/linux-x86/apex/art_boot_images/javalib/x86_64/boot.oat
  on master-art and check that it doesn't change
Test: m droid
  on master and check that
  out/soong/.intermediates/art/build/apex/com.android.art/android_common_com.android.art_image/image.apex/javalib/x86_64/boot.oat
  and out/target/product/vsoc_x86_64/system/framework/x86_64/boot-framework.oat
  are identical.
Bug: 174746397
Change-Id: Ie281e55aaa641d5fd8dcc5c7e201c7870cc934c1
2021-11-22 19:05:17 +00:00
Treehugger Robot
07549129e2 Merge "Make CompOS library optional in PRODUCT_APEX_SYSTEM_SERVER_JARS" 2021-11-22 10:31:59 +00:00
Colin Cross
3d56ed5605 Prepend header jar for sharded javac compilation
When compiling without sharding javac will prefer classes built from
source over classes in the classpath.  Compiling with sharding puts
the header classes for all the sources onto the classpath, including
the sources that are not part of the current shard.  Emulate the
behavior when building without sharding by putting the header jar
first on the classpath so classes are resolved from the rest of
the sources before the real classpath.

Also switch to using the header jar without static libs dependencies
merged in, as those will already be present in the classpath.

Test: m framework-minus-apex
Test: m services.core
Test: TestSharding
Change-Id: Id11b39c15d89ce70da27d746a5c7e6b603c3c0f9
2021-11-19 21:57:21 +00:00
Colin Cross
50ed1f9ccb Install android_app_set modules in Soong
Add support for installing extra files from a zip file when installing
a primary file, and use it to support installing android_app_set modules,
which install a primary APK and then an unknown set of additional splits
APKs.

Test: app_set_test.go
Test: install test android_app_set
Bug: 204136549
Change-Id: Ia92f7e5c427adcef3bcf59c82a2f83450905c01d
2021-11-17 19:55:33 -08:00
Colin Cross
ffbcd1d8a0 Extract primary apk from apk set zip
Extract and install the primary apk normally, and then unzip the rest
of them as a post install command.

Bug: 204136549
Test: app_set_test.go
Change-Id: I17437ff27f49df6bc91bdbbea6173b46c7d3ec4e
2021-11-17 19:55:33 -08:00
Alan Stokes
bcd567ea12 Make CompOS library optional in PRODUCT_APEX_SYSTEM_SERVER_JARS
CompOS is an optional module so it may legitimately be omitted from
some products.

Bug: 199147668
Test: Builds if PRODUCT_ISOLATED_COMPILATION_ENABLED not set
Change-Id: I4e031ca6184d920b64f9c370d35b5525ecbe8a1f
2021-11-17 15:37:14 +00:00
Treehugger Robot
a7f0c39214 Merge "Update platform_apis error message" 2021-11-17 01:29:28 +00:00
Spandan Das
60999344a2 Update platform_apis error message
The updated error message is more descriptive about the incompatibility
between platform_apis and sdk_version. Implemented as per the discussion
in b/204447559#17

Test: In build/soong, run go test ./java
Bug: 204447559
Change-Id: I826f0ce47313b337f1754a1b6bc11ce65c837a41
2021-11-16 04:15:33 +00:00
Trevor Radcliffe
8dae331d4a Merge "Document possible values of sdk_version" 2021-11-15 18:28:00 +00:00
Trevor Radcliffe
347e5e4307 Document possible values of sdk_version
Fixes: 205166295
Test: Look at docs
Change-Id: Ice6cf61b8628c529dc28c3b02e83bec93e952461
2021-11-11 15:36:53 +00:00
Treehugger Robot
45da465ef6 Merge changes I9e38ac73,I9412147f
* changes:
  Honor PreventInstall for APKs and dexpreopt files
  Add dependency from hostdex installed module to Make intermediates
2021-11-11 06:10:26 +00:00
Treehugger Robot
008d17612a Merge "Dump deps for native and java to json files." 2021-11-11 04:48:16 +00:00
Colin Cross
fa9bfcd0d2 Honor PreventInstall for APKs and dexpreopt files
Native coverage builds create a second variant of APKs and set
PreventInstall on the non-coverage variant.  Skip calling
ctx.InstallFile for APKs and in dexpreopt when PreventInstall
is set.

Fixes: 205865567
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS="*" NATIVE_COVERAGE_EXCLUDE_PATHS="art bionic/libc device external/compiler-rt external/clang external/llvm external/swiftshader/third_party/llvm-10.0"
Change-Id: I9e38ac737315db12475e8f9bfb3e0e7c0327fc06
2021-11-10 16:42:38 -08:00
Colin Cross
3108ce17b0 Add dependency from hostdex installed module to Make intermediates
The art tests rely on a dependency existing from
out/host/linux-x86/framework/core-oj-hostdex.jar to
out/host/common/obj/JAVA_LIBRARIES/core-oj-hostdex_intermediates/classes.jar,
override LOCAL_SOONG_INSTALLED_MODULE for the hostdex modules so that
soong_java_prebuilt.mk adds the dependency.

Test: art/tools/buildbot-build.sh --host && art/tools/run-libcore-tests.sh '--mode=host' '--variant=X64' --debug
Change-Id: I9412147fc66d5e5f0dae52d522868a37251f781e
2021-11-10 14:38:50 -08:00
Treehugger Robot
8a709b149b Merge changes from topic "soong-java-install"
* changes:
  Revert "Temporarily add method to get java binary tool"
  Move java module installation into Soong
  Fix ctx.InstallFile calls for java modules
  Make HostJavaToolPath use pathForInstall
2021-11-10 17:05:51 +00:00
Jooyung Han
a5b538394c Merge "Pass --min_sdk_version to aidl compiler" 2021-11-10 00:31:54 +00:00
Jooyung Han
07f70c0e92 Pass --min_sdk_version to aidl compiler
cc/java modules can have .aidl files as srcs. Pass min_sdk_version to
the aidl compiler so that it can check some features against it.

For example, ParcelableHolder AIDL type is available since 31.

Bug: 205338951
Test: soong test && m
Change-Id: I7ecab913e00c9b6a3ce870dacbe9773d2ddb7e93
2021-11-06 07:31:50 +09:00
Colin Cross
c899d7808e Revert "Temporarily add method to get java binary tool"
Java binaries and cc binaries are in the same directory again, the
separate method can be removed.

Bug: 204136549
Test: m checkbuild
Change-Id: I2e7ca82448aba5c7e54d3c3c376fe14a953ef4af
2021-11-05 14:26:53 -07:00
Colin Cross
24cc4be60b Move java module installation into Soong
Move java module installation rules into Soong by overriding
InstallBypassMake.  Update the locations that find host java tools
to look in the Make installation directory instead of the Soong
installation directory, which will no longer be used.

Bug: 204136549
Test: m checkbuild
Change-Id: I5af6d764c97e7ddb5ee121fc9830166c25d831b1
2021-11-05 14:24:51 -07:00
Colin Cross
1d0eb7a9d0 Fix ctx.InstallFile calls for java modules
Call ctx.InstallFile on the primary install file last so that the
primary install file can depend on the extra install files, and so that
the primary install file can be inferred from the last installed file.

Add missing ctx.InstallFile calls for the dexpreopt and hostdex outputs.

Fix the install subdirectory for modules installing to the testcases
directory.

Bug: 204136549
Test: m checkbuild
Change-Id: I7edd7647be27439d3ca0ecc589ca5e89d4ba8474
2021-11-05 14:20:28 -07:00
Colin Cross
ae5330a2d9 Make HostJavaToolPath use pathForInstall
Use pathForInstall instead of PathForOutput for HostJavaToolPath
so that it internally produces an InstallPath that can later support
being converted to Make installpath.

Bug: 204136549
Test: m checkbuild
Change-Id: If4f5d3552b27ffe6b9bc709c4a08d9513c49ef7d
2021-11-05 14:20:28 -07:00
Colin Cross
fc06a59904 Merge changes from topic "soong-cc-install"
* changes:
  Move cc module installation into Soong
  Temporarily add method to get java binary tool
2021-11-05 17:14:59 +00:00
Jim Tang
c44ba2a6f9 Dump deps for native and java to json files.
Abandon the use of SOONG_COLLECT_CC_DEPS and SOONG_COLLECT_JAVA_DEPS,
soong can generate module_bp_cc_deps.json and module_bp_java_deps.json
without passing any variables.

BUG: 204397180

Test: rm out/soong/module_bp*json
"m nothing" should see both json files were generated.

Change-Id: If30ad5dbabb6709f834134cbc9a513a9bdc9d9de
2021-11-05 12:06:15 +08:00