Commit graph

6422 commits

Author SHA1 Message Date
Jihoon Kang
c05902cff9 Merge "Add phony rule for java_api_library module type" 2022-11-30 17:06:29 +00:00
Jihoon Kang
423d229c3b Add phony rule for java_api_library module type
Context
- Create phony rule for java_api_library module with its artifact
  (*.jar) as dependency
- Fix source directory base mislinkage issue for input text files passed
  from java_api_contributions modules

Test: m
Change-Id: I055332fd5bc7ef0d03e7b311b0efa93f4454102f
2022-11-29 23:37:55 +00:00
Paul Duffin
45c566591e Merge "Output min_sdk_version to snapshot" 2022-11-29 17:19:54 +00:00
Anton Hansson
805e0a53ef Ignore native bridge archs for apex selection
This leads to an arm64 apex being used on a device that is mixed
x86_64 with nativebridge=arm64. A device like that doesn't appear
to work with arm64 binaries. For example, the boringssl-self-check
binary crashes on boot.

Bug: 260115309
Test: unit test
Test: boot emulator with this combination
Change-Id: Ic4a91974290a05b1799f755fcf52ef226d68f4c2
2022-11-29 12:56:37 +00:00
Jiakai Zhang
2fbc355f47 Only dexpreopt system server jars for the primary arch.
This change stops the build system from dexpreopting system server jars
for the secondary arch. System server jars are only loaded by the system
server, so the artifacts for the the secondary arch are not used.

Bug: 260577273
Test: Build a system image and no longer see artifacts for the
  secondary arch.
Change-Id: I0b131a02e996ed50e7aec3bb0a221f8ceed9ce57
2022-11-28 15:38:23 +00:00
Paul Duffin
bb638eba50 Output min_sdk_version to snapshot
The min_sdk_version was added to the java_import in Tiramisu. This
change will propagate the min_sdk_version set on a java_library to the
java_import snapshot. If possible the min_sdk_version will be resolved
into a numerical version to ensure consistent behavior across build
releases.

Bug: 260560424
Test: m nothing
      BUILD_NUMBER=fixed packages/modules/common/build/mainline_modules_sdks.sh
      # Ran above before and after this change and made sure that only
      # Tiramisu, UpsideDownCake and latest were changed and those changes
      # were the addition of a min_sdk_version property.
      #
      # Ran the following command in tm-mainline-prod:
      #     lunch cf_x86_64_phone-userdebug
      #     m ART_MODULE_BUILD_FROM_SOURCE=false nothing`.
      #
      # It failed with:
      #     module "prebuilt_okhttp-norepackage" variant "android_common": should support min_sdk_version(33) for "AdServicesApk": min_sdk_version is not specified.
      #
      # Unpacked the Tiramisu art snapshot generated with this change into
      # tm-mainline-prod and reran the previous command and it succeeded.
Change-Id: I9d9d730845554fc175d17f38c038e4e3c7d39e07
2022-11-26 15:52:32 +00:00
Jihoon Kang
ad8c092c08 Merge "Fix java/fuzz_test.go post submit build breakage" 2022-11-22 23:26:11 +00:00
Jihoon Kang
a2d3947a4e Fix java/fuzz_test.go post submit build breakage
Context
- Fix build breakage in aosp-build-tools for darwin targets

Test: m
Bug: b/260020491
Change-Id: I892876cf1567b4464e86daca0b305510da0ab2fd
2022-11-22 17:51:23 +00:00
Spandan Das
53e680d2ae Merge "Add min_sdk_version to aidlCmd for droidstubs" 2022-11-22 17:09:26 +00:00
Colin Cross
262d65d481 Merge "Remove SettingsOverlay* from legacyCorePlatformApiModules" 2022-11-22 16:39:04 +00:00
Treehugger Robot
657ee23d83 Merge "Pass "-Xgc:CMC" to dex2oat when userfaultfd GC is enabled." 2022-11-22 15:10:20 +00:00
Spandan Das
757b666c7f Add min_sdk_version to aidlCmd for droidstubs
JavaDoc's implementation of `aidlFlags` omits `min_sdk_version`, and
therefore aidl compiler would default it to a default version.

To fix this, pass the min_sdk_version explicitly

Bug: 253122520
Test: TH
Test: go test ./java
Change-Id: Ia8f639174f8361136596d0e7b3286606f84705cd
2022-11-21 22:59:38 +00:00
Nikita Ioffe
663e060c64 Merge "Propagate stub_only_libs to the invocation generating stub sources" 2022-11-21 22:55:46 +00:00
Jihoon Kang
f33d92603e Merge "Add java/fuzz_test.go to test sources" 2022-11-21 19:29:58 +00:00
Jihoon Kang
ba36441424 Merge "Update java_api_library prop name" 2022-11-21 18:03:12 +00:00
Matt Gilbride
0e2c2aaa60 Merge "lint: always run module specified in ANDROID_LINT_CHECK_EXTRA_MODULES" 2022-11-21 17:38:21 +00:00
Paul Duffin
6fcb32258a Merge "Revert "Improve error reporting when depending on prebuilt implementation jar"" 2022-11-21 17:20:03 +00:00
Nikita Ioffe
d732da7251 Propagate stub_only_libs to the invocation generating stub sources
In some cases the java_sdk_library needs to compile against hidden
platform APIs, in order to do so it needs to add impl_only_libs
dependency on the framework library, and set the sdk_version property to
the "core_*" one (e.g. core_platform).

However, if this java_sdk_library depends on the Android SDK in it's
stable API surface, then the setup above will break the stubs srcs
generation, as it uses the sdk_version of the java_sdk_library (e.g.
core_platform), which doesn't have symbols from the Android SDK.

This chage solves the problem by propagating the stub_only_libs to the
invocation that generates the stub sources. It allows the
java_sdk_libraries to add a stub_only_libs dependency on the
android_module_lib_stubs_current stubs library to fix their stubs build.

For more context see another change in this topic:
https://android-review.git.corp.google.com/c/platform/packages/modules/Virtualization/+/2310569

Bug: 243512044
Test: builds
Test: m nothing
Change-Id: Id745cfb2789901672561050c1c3f8bb163922379
2022-11-21 15:51:40 +00:00
Paul Duffin
7ed6ff8c76 Revert "Improve error reporting when depending on prebuilt implementation jar"
This reverts commit c61783b20d.

Bug: 257969510
Reason for revert: b/255275437 - breaks checkbuild target

Change-Id: I01f88053cc24dbc1a4eb5c009f15473bdff3d565
2022-11-21 10:57:30 +00:00
Colin Cross
a54f4b5262 Use missing.x509.pem instead of missing.pem for faked missing certificates
sign_target_files_apks and check_target_files_signatures require that
certificates have a .x509.pem extension and reject missing.pem.  Using
missing.x509.pem instead.

Bug: 259861670
Change-Id: I0b2367213a8cbe390c231a8609bb04df2b125eda
2022-11-21 04:35:55 +00:00
Jihoon Kang
60d4a09cb5 Update java_api_library prop name
Context
- Update java_api_library module's prop name from api_providers to
  api_contributions to adjust to module rename
- Update variables name correspondingly to enhance readability

Test: m
Change-Id: I93b941a572e04bed6084109d151ba83a82715651
2022-11-19 01:03:03 +00:00
mattgilbride
e17645fe30 lint: always run module specified in ANDROID_LINT_CHECK_EXTRA_MODULES
Before this change, ANDROID_LINT_EXTRA_CHECK_MODULES was only read if
ANDROID_LINT_CHECK was also set.  This change allows an entire module of
checks to be added to lint without having to specify all of the
individuals with ANDROID_LINT_CHECK.

This is part of a workaround to run some lint checks globally, but is
useful to provide more flexibility generally.

Bug: 236558918
Test: manually tested with AndroidFrameworkLintChecker
Change-Id: I2d3ec8a997d902c9d00a577a56f4b152b10e078a
2022-11-18 20:56:05 +00:00
Colin Cross
9e8ab16fae Merge "Remove modules form legacyCorePlatformModules that build in internal master" 2022-11-18 03:35:52 +00:00
Jihoon Kang
5cb82e36be Add java/fuzz_test.go to test sources
Context
- fuzz_test.go is not listed in the soong/java test sources and is not
  running on CI.

Implementation
- Fix fuzz_test.go and add to test sources

Test: m
Change-Id: If2685c646dec4885fc42d7760992309bfa9da382
2022-11-17 21:46:48 +00:00
Colin Cross
148917e5ab Merge "Remove modules from legacyCorePlatformApiModules that build without it" 2022-11-17 18:28:00 +00:00
Jihoon Kang
067e62e49f Merge "Create java_api_contribution and java_api_library module" 2022-11-17 03:55:43 +00:00
Jihoon Kang
0ac87c21bd Create java_api_contribution and java_api_library module
Context
- Droidstubs module is currently responsible not only for java api stubs
  generation, but also for checking api equality and compatibility.
- Generating stubs with incomplete api text file that does not list
  entire api surface is done through metalava implicitly adding unlisted
  methods from java source files to the stubs in droidstubs module.
- These factors make java stubs generation harder to debug, thus
  introduce `java_api_contribution` and `java_api_library` modules to make java
  api stubs and jar generation more explicit in Android.bp level and
  eventually easier to debug.

Implementation
- `java_api_contribution` module is included in api domains' directory and
  lists api text file directory to be added to the api surface
- `java_api_library` collects all api text file that forms the api surface
  and creates stubs invoking metalava. Generated java stub files are
  converted into `.srcjar`, and eventually `.jar` file which is the complete
  api surface.

Test: m
Change-Id: I86f097cc8592334a5eaa900cec12764c5fcc09e7
2022-11-16 23:05:41 +00:00
Colin Cross
bf29be8f19 Merge "Remove modules that don't exist from legacyCorePlatformApiModules" 2022-11-16 18:09:07 +00:00
Colin Cross
e4b131a5da Merge changes I0886baa4,I584f98f9
* changes:
  Sort legacyCorePlatformApiModules
  Remove SystemUI from legacyCorePlatformApiModules
2022-11-16 17:02:01 +00:00
Alix Espino
3044987181 Merge "bp2build for java_library with .kt srcs or common_srcs" 2022-11-16 15:40:55 +00:00
Jiakai Zhang
616be0695e Pass "-Xgc:CMC" to dex2oat when userfaultfd GC is enabled.
This change is a no-op change. It doesn't enable userfaultfd GC by
default. ENABLE_UFFD_GC=true can be passed to the build system to enable
userfaultfd GC for testing purposes.

Bug: 242553398
Test: -
  1. lunch aosp_oriole-userdebug
  2. ENABLE_UFFD_GC=true m
  3. See "--runtime-arg -Xgc:CMC" in .invocation files.
Change-Id: I789b49a71b9604fd41bf1ef77d0ac5bac4cbdf25
2022-11-16 12:04:53 +00:00
Alix
8062f4dee7 bp2build for java_library with .kt srcs or common_srcs
java_library modules with .kt srcs or common_srcs will be converted into
module type kt_jvm_library

Test: m bp2build, manually inspected build files for allowlisted modules
Bug: 258688914
Change-Id: I8293a11c8247b4b76358d0991f82c6b61b58adc3
2022-11-15 20:01:29 +00:00
Parth Sane
d96735d5cc Merge "Add android.SdkModule to Sdk Versions that have AIDL traces generated" 2022-11-15 13:04:42 +00:00
Paul Duffin
c61783b20d Improve error reporting when depending on prebuilt implementation jar
The sdk snapshot must not be including implementation code for boot
libraries, the implementation is provided by dex jars within the
corresponding APEX. However, the snapshot does need a module for each
boot library so that the build can seamlessly access the dex files from
the APEX.

A java_library boot library (like core-oj) is represented in the
snapshot by a java_import module which requires a jar file to be
provided, otherwise it is disabled. However, that is provided purely
to keep Soong happy and should never be used.

Previously, the snapshot would contain an empty file for the jar. As
an empty file is an invalid jar any tool (like compiler) that tried
to consume it would fail which was the correct behavior. Unfortunately,
the error message that was produced was not very helpful, it was just
some variant on `invalid file` which lead to a lot of bugs being
raised.

This change replaces that empty file with a reference to the output
from a genrule which runs a script which produces a more useful error
message, with information on how to fix the issue, and fails the build.

It also adds a Name() method to the SdkMemberProperties type as that is
needed in AddInternalModule() to construct the name of the additional
module.

Tested as follows:

In AOSP/master make the following changes:
1. Temporarily set visibility on core-oj and core-libart to
   //visibility:public.
2. Run packages/modules/common/build/mainline_modules_sdks.py to create
   the snapshots.

For each of the S, T and latest snapshots I did the following in the
s-aml-prebuilt-test, t-aml-prebuilt-test and aosp/master branches:

1. Created an Android.bp file containing the following:
  java_library {
    name: "broken",
    static_libs: [
      "prebuilt_core-libart",
      "prebuilt_core-oj",
    ],
  }

2. Fix the visibility issues and run `m broken` where it fails with an
   invalid file.

3. Delete the contents of the prebuilts/module_sdk/art/current/sdk
   directory.

4. Unpack the relevant version of the art-module-sdk snapshot into the
   directory.

5. Run `m broken` where it fails with the helpful message.

6. Test the instructions on how to use the ninja -t path tool to
   identify the cause of the problem and fix it.

Bug: 257969510
Test: See above.
Change-Id: I125bde2d7202afff84c97daebcef37e21c548a3a
2022-11-14 10:14:10 +00:00
Colin Cross
fe999896d1 Remove SettingsOverlay* from legacyCorePlatformApiModules
Bug: 161973015
Test: go/abtd
Change-Id: I64e44f6892c28313656b834c2a9af4c12c726b89
2022-11-11 20:14:57 -08:00
Colin Cross
f1b91e09ff Remove modules form legacyCorePlatformModules that build in internal master
Remove all modules from legacyCorePlatformApiModules that exist
in internal master and build without the legacy stubs in an
aosp_sunfish-userdebug build.

Bug: 161973015
Test: builds
Change-Id: I2e6248ec0cde0d751f66f32bc7e787b7adbfb75b
2022-11-11 20:14:57 -08:00
Colin Cross
276c7f6243 Remove modules from legacyCorePlatformApiModules that build without it
Remove all modules from legacyCorePlatformApiModules that exist
in AOSP and build without the legacy stubs.  The remaining modules
that exist in AOSP in all products and still need the legacy stubs are:
framework-jobscheduler
framework-minus-apex
framework-minus-apex-intdefs
FrameworksCoreTests
services
services.core.unboosted
Settings-core
SettingsLib
SettingsRoboTests
telephony-common
TeleService

The remainder of the modules still in the list either only exist in
internal master or are product-specific.

Bug: 161973015
Test: builds
Change-Id: I8995670aaaa8dce8e4a870ec1700d1dd7be7c95e
2022-11-11 20:14:55 -08:00
Colin Cross
027e98d756 Remove modules that don't exist from legacyCorePlatformApiModules
Remove modules that don't exist in an internal master
aosp_sunfish-userdebug build and also have no references in
codesearch.

Bug: 161973015
Test: builds
Change-Id: I4372f140b3fc7d6a9cda01a243f200fe084ef099
2022-11-11 20:14:11 -08:00
Colin Cross
b13abbfd9c Sort legacyCorePlatformApiModules
Sort the modules in legacyCorePlatformApiModules to simplify removing
unnecessary entries.  Also remove a comment that doesn't add any value
and makes it harder to run scripts against the list.

Bug: 161973015
Test: builds
Change-Id: I0886baa42209600cfd1e16e5d4919a784efe29ab
2022-11-10 21:47:08 -08:00
Colin Cross
5176044dcc Remove SystemUI from legacyCorePlatformApiModules
SystemUI seems to build fine against the stable core platform API.

Bug: 161973015
Test: m SystemUI-core SystemUISharedLib SystemUI-tests
Change-Id: I584f98f991e0b9c8b1a5dba1fcc1bef0745dbdc0
2022-11-10 16:19:13 -08:00
Parth Sane
a114ac9e75 Add android.SdkModule to Sdk Versions that have AIDL traces generated
Test: manual
Change-Id: Ic5fbe9a6e7dc2c898c0ac3b405d46735ab8c3e32
Bug: 236441443
2022-11-10 15:37:47 +00:00
Qing Shen
871c6f32dd Instrument ims-common for coverage
Bug: 257128599

Change-Id: Ib75fce4582da51d01762f0d338308c4f2410c562
2022-11-04 22:39:56 +00:00
Treehugger Robot
1265bfdfbd Merge "Add .hjar output file tag" 2022-11-02 18:39:58 +00:00
Colin Cross
9f09316ffc HACK: use arm64 prebuilts from apex sets for riscv64
There are no riscv64 prebuilts in apex sets, use arm64 ones for
now.

Test: lunch aosp_riscv64-userdebug && m droid dist
Change-Id: Iee2d669e01d93504642223939857634b7fd1c1ba
2022-11-01 23:16:14 +00:00
Sam Delmerico
af9dbb30f6 Merge "move logtags rule from //build/make to //build/bazel" 2022-11-01 13:50:10 +00:00
Colin Cross
ab50deaefd Add .hjar output file tag
Allow genrules to access the turbine header jar outputs
from java_library modules using the .hjar output file
tag.

Bug: 251871740
Test: m checkbuild
Change-Id: Ib1ec9734323a51583057fb458f791e1e0bd0d767
2022-10-31 17:17:25 -07:00
Treehugger Robot
0fc368cff7 Merge "Generate a default wrapper for device java_binary" 2022-10-31 20:13:10 +00:00
Alix Espino
35ac313c32 Merge "Bp2build Java libs for java_binary -> java_import edge" 2022-10-31 14:04:54 +00:00
Treehugger Robot
6ae9b508bf Merge "Don't add unused properties to android_test_import" 2022-10-31 06:57:45 +00:00
Alix
b4e09a0ada Bp2build Java libs for java_binary -> java_import edge
Since Bazel's java_import requires a jars attribute to be specified,
the generated neverlink-duplicated module is of type java_library

Change-Id: I14a866dfc583507a9462add50d95060cbfe540c5
Bug: 244210934
Test: m bp2build, go test ./bp2build, manual inspection of generated Build and jar files
2022-10-28 20:26:38 +00:00