Commit graph

6400 commits

Author SHA1 Message Date
Paul Duffin
6fcb32258a Merge "Revert "Improve error reporting when depending on prebuilt implementation jar"" 2022-11-21 17:20:03 +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
Colin Cross
9e8ab16fae Merge "Remove modules form legacyCorePlatformModules that build in internal master" 2022-11-18 03:35:52 +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
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
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
Zi Wang
ca65b40fa0 Generate a default wrapper for device java_binary
Any device java_binary that doesn't have a specific wrapper must
have a main_class property, which is used to generate its default
wrapper. Otherwise its build should fail.

Bug: 250851599
Test: TestDeviceBinaryWrapperGeneration in java_test.go
Change-Id: Ice4c580bcfc1b92f95e217b39e984c55d25a3a02
2022-10-27 11:19:53 -07:00
Orion Hodson
b2d3c8cac6 Allow all of libcore to have NewApi warnings
Required due to minor refactor of libcore projects.
Bug: 208656169
Bug: 255273691
Test: TH
Change-Id: Ifd2ef6d3553ade5a059880398075c70635d428dd
2022-10-26 15:07:11 +00:00
Liz Kammer
748209cb6b Disable all filegroups in mixed builds
Rather than individually denylisting filegroups until we prioritize a
solution for mixed builds that will correctly integrate into uses such
as proto, aidl, gensrcs, etc.

Test: mixed_droid
Change-Id: Iddbd391af7dd7cabc892b2b26dbc68e3aa506471
2022-10-24 11:11:58 -04:00
Sasha Smundak
706d35fe7c Add --add-exports= options to the java extractor invocation.
Long live Java modules system.

Fixes: 254752344
Test: run build_kzip.bash
Change-Id: I9c807afd22d7b2abc2af1f6ac7a0c1e4c8a8b3e1
2022-10-23 15:23:55 -07:00
Rex Hoffman
54641d2aec Enable new_robolectric
Allow new robolectric to break soong's exepected machine type restrictions

Test: mma in /external/robolectric
Bug: 244627502

Change-Id: If58a36b2d84804d586d9c8a773e2e739867fa987
2022-10-21 17:53:40 +00:00
Muhammad Haseeb Ahmad
c0edf32732 Merge "Output shared dependendencies of JNI libs for Java fuzzers" 2022-10-20 19:16:20 +00:00
Jingwen Chen
6817bbb3c8 Introduce BazelStringOrLabelFromProp.
Soong supports string properties, but they are overloaded, and can mean
one of three things:

* path reference
* module reference
* string literal

Bazel has different types: label and string attributes. Thus there needs
to be a way to categorize them correctly in bp2build.

This CL introduces a new function to be used on properties like
apex_key.private_key / apex_key.public_key, as well as
android_app.certificate / apex.certificate.

It is important to disambiguate the prop betenn a string literal
attribute or file/rule target label attribute, so this functions does
just that.  The new attributes are then further handled by their
respective macros (apex_key, android_binary, apex).

Bug: 253557437
Fixes: 253557437
Test: presubmits, new tests

Change-Id: Id8111cdd60d3aabcae7d17fe9da84d0ee3966023
2022-10-20 14:57:37 +00:00
Jiyong Park
2f83b31af7 Don't add unused properties to android_test_import
android_test_import is to import prebuilt test apks into the build rule.
It doesn't support properties like test_config, test_config_template,
and etc, but those properties were anyhow added to the module type and
setting those properties didn't trigger any error.

Fixing this surprising behavior by adding only the properties that are
actualy being used.

Bug: N/A
Test: N/A

Change-Id: I93e821e108861fa1249bc5e0882d706849bcf43f
2022-10-20 20:19:41 +09:00
Muhammad Haseeb Ahmad
431ddf9b76 Output shared dependendencies of JNI libs for Java fuzzers
Test: m example_java_jni_fuzzer
Bug: 252846698
Change-Id: Ib583de335482350bfe293f9c3d021a595edd4f44
2022-10-20 00:55:58 +00:00
Treehugger Robot
d1c40db794 Merge "Revert "Pin javadoc to JDK 11"" 2022-10-17 21:47:49 +00:00
Sorin Basca
4ad3dc66c3 Revert "Pin javadoc to JDK 11"
Revert submission 2211596

Reason for revert: No longer needed after aosp/2215568

Change-Id: Ia770525501d89baa25e22c2df4fb098d056743f6
2022-10-17 07:56:00 +00:00
Spandan Das
91e8d3d00c Merge "Update documenation for default value of sdk_version" 2022-10-15 04:13:32 +00:00
Treehugger Robot
78a966cadb Merge "Bump up errorprone heap size" 2022-10-15 02:40:25 +00:00
Cole Faust
5aab68524c Bump up errorprone heap size
ag/19500070 causes errorprone to fail with out of memory errors.
Also in aosp/2215048 the regular javac heap sized was increased
to 4096MB, so the errorprone heap size wasn't any larger anymore.

Bug: 240473481
Test: m RUN_ERROR_PRONE=true SystemUIGoogleScreenshotTestsLib on internal master
Change-Id: Ie6bdce9f2e7620c076213f4c3313960fd537967b
2022-10-14 15:54:13 -07:00
Spandan Das
1ccf57474d Update documenation for default value of sdk_version
Follow-up to aosp/2065271. "private" is a Soong internal `SdkKind`
definition and is probably more meaningul for devs who work on
the build system. Changing it to "private platform APIs" should
hopefully make it more meaningful to a wider audience.

(Context: https://yaqs.corp.google.com/eng/q/4927173287831666688)

Test: None
Change-Id: Ied7198bb529eeaa85bc741177b414e06a7262365
2022-10-14 17:25:13 +00:00
Muhammad Haseeb Ahmad
fb7d5c8553 Merge "Build and package Java fuzzers for device" 2022-10-14 06:33:55 +00:00
Muhammad Haseeb Ahmad
eb14ff2a06 Build and package Java fuzzers for device
Bug: 246398305
Test: SANITIZE_TARGET="fuzzer hwaddress" build/soong/soong_ui.bash --make-mode -j86 haiku-java-device dist DIST_DIR="/usr/local/google/home/mhahmad/Desktop/android2/OUT"
Test: SANITIZE_HOST="fuzzer address" build/soong/soong_ui.bash --make-mode -j86 haiku-java-host dist DIST_DIR="/usr/local/google/home/mhahmad/Desktop/android2/OUT"
Change-Id: I52c1a6292f5555490aabcb97a449b6c32d57c074
2022-10-13 16:42:43 +00:00
Cole Faust
49a9bfd8fd Merge "Add system-server sdk type to droidstubs" 2022-10-12 22:49:06 +00:00
Chaohui Wang
7233dac59e Merge "Support Kotlin in Robolectric test" 2022-10-12 01:39:14 +00:00
Colin Cross
1b9e68389d Create suggested-fixes.zip before exiting on error
suggested-fixes.zip is useful even when lint is exiting with an
error.  Save the exit code from the lint executable, create the
zip file, then re-exit with the exit code.

Bug: 216456886
Test: Introduce lint error, verify suggested-fixes.zip is created.
Change-Id: I0ba6190e3de0744e53b2a59ba3016861f2f115e2
2022-10-11 11:22:24 -07:00
Cole Faust
051fa91513 Add system-server sdk type to droidstubs
Needed to generate the system-server api database.

Bug: 193460475
Test: go test
Change-Id: I8c6bb3cc1d16ae128b7bcd2513fce4a83e852a5e
2022-10-11 10:54:11 -07:00
Chaohui Wang
dcbe33ced2 Support Kotlin in Robolectric test
Currently, Robolectric test written in Kotlin may not run, especially
when shards are in used, for example SettingsRoboTests has 10 shards.

This is because Robolectric test currently only recognize java files,
adding kt files to fix.

Rename current uniqueSrcFiles to uniqueJavaFiles, and compiledJavaSrcs
to uniqueSrcFiles. uniqueSrcFiles will contains both Java and Kotlin
files.

Note: android.FirstUniquePaths cannot be used, seems the behavior is
different and cause build error.

Bug: 252355400
Test: cd build/soong && mm
Test: m RunSettingsRoboTests with Kotlin tests
Change-Id: Id530ae4dcabffe01a06f44fe4234ffc67b73a601
2022-10-11 18:14:10 +08:00