Commit graph

7027 commits

Author SHA1 Message Date
Treehugger Robot
31a5b2c1ef Merge "Don't create withres-withoutdex files for R8" into main 2023-10-04 17:32:52 +00:00
Treehugger Robot
c68afc4e9f Merge "Remove unnecessary flag for Kotlin compiles" into main 2023-10-04 17:07:22 +00:00
Anton Hansson
ddbfdb7f7e Merge "Support passing lint baseline to doclava" into main 2023-10-04 15:53:49 +00:00
Liz Kammer
e10fef75f1 Remove unnecessary flag for Kotlin compiles
This has been fixed in upstream Kotlin

Test: add /tmp/build.txt file and m metalava
Change-Id: I6d088548ee5a31452ad637bbdd75e26c8863926d
2023-10-04 10:37:05 -04:00
Treehugger Robot
72928074f5 Merge "Don't delete withres-withoutdex jar from R8 rules" into main 2023-10-03 19:17:56 +00:00
Colin Cross
8484082fad Don't create withres-withoutdex files for R8
The withres-withoutdex files were added in b/195558228 because D8
produced errors when given an input jar that contained both class
and dex files:
Error: com.android.tools.r8.internal.Cc: Cannot create android app from an archive 'out/soong/.intermediates/libcore/libcore-crypto-tests/android_common/withres/libcore-crypto-tests.jar' containing both DEX and Java-bytecode content

It turns out R8 doesn't have this problem, it defaults to ignoring *.dex
files unless the com.android.tools.r8.allowDexInputToR8 system property
is set.  Remove the withres-withoutdex files when using R8, but keep
it in place for D8 for now.

Bug: 302573555
Bug: 303264288
Bug: 303064127
Test: m checkbuild
Test: m Calendar && m Calendar
Test: m framework-minus-apex && m framework-minus-apex
Change-Id: Ib6410f7fef6faf5913476c6423cdd27215c68c45
2023-10-03 18:27:28 +00:00
Jihoon Kang
a7e5e29ec1 Merge changes from topic "expose_flagged_api_revert" into main
* changes:
  Revert^2 "Add flagged api hide conditional to droidstubs"
  Revert^2 "Add soong config variable Release_expose_flagged_api"
2023-10-03 17:55:16 +00:00
Yu Liu
7a90fcfa45 Merge "Convert java_aconfig_library to bazel." into main 2023-10-03 17:29:26 +00:00
Colin Cross
b716ceb832 Don't delete withres-withoutdex jar from R8 rules
R8 rules produce a depfile generated by R8.  R8 sees the withres-withoutdex
jar as an input, and so adds it to the depfile.  If the jar is deleted
after running R8 then ninja will always consider the rule dirty, as the
input file listed in the depfile is missing.

Fixes: 303064127
Test: m Calendar && m Calendar
Test: m framework-minus-apex &&  m framework-minus-apex
Change-Id: I5cbd780b56fc131b58598d6e569a8a78b7fe9395
2023-10-03 16:42:48 +00:00
Anton Hansson
b06bb5762e Support passing lint baseline to doclava
There are many issues in the docs, so allow specifying a baseline
file that allows existing lint errors in doclava.

Bug: 217734059
Test: m docs
Change-Id: I8997e47a497e1366247e8354be492805f300a16e
2023-10-03 12:15:19 +00:00
Jihoon Kang
c831389625 Revert^2 "Add flagged api hide conditional to droidstubs"
This reverts commit 1180919dda.

Test: go test ./java && m TARGET_PRODUCT=sdk TESTING_TARGET_RELEASE_NEXT=true nothing and inspect ninja command for generating stubs and verify the flag is included && m TARGET_PRODUCT=sdk TARGET_RELEASE=trunk_food nothing and inspect ninja command for generating stubs and verify the flag is not included
Bug: 299570421
Change-Id: I4967376c0236bad729398af80fa59b48dbab5f21
2023-10-03 01:04:00 +00:00
Thiébaud Weksteen
77b232da24 Merge changes from topic "linter_integration_tests" into main
* changes:
  Add .lint tagged output to Java modules
  Add lint.suppress_exit_code attribute
2023-10-02 23:26:39 +00:00
Yu Liu
f2b94010c8 Convert java_aconfig_library to bazel.
Bug: 297357579
Test: Unit test and AconfigJavaHostTest
Change-Id: Icf944cc0b2a7382107923d49b2d2ff0eb4113638
2023-10-02 15:04:19 -07:00
Thiébaud Weksteen
d054436434 Add .lint tagged output to Java modules
The linter output can be referenced in other modules for further
processing.

Bug: 302400088
Test: m nothing
Change-Id: I1809b70d8d98ced5d8f3d5f068c6639c782ebebc
2023-10-02 10:12:30 +11:00
Treehugger Robot
956f79c5d4 Merge "Delete temporary files after d8 and r8 rules" into main 2023-09-29 13:27:57 +00:00
Colin Cross
56e2840a57 Delete temporary files after d8 and r8 rules
Delete files created within the d8 and r8 rules that are not considered
output files by ninja.  This should reduce disk space usage without
affecting incremental build performance.

Bug: 302573555
Test: m checkbuild
Change-Id: Ifea86888c2f385415735ade7d80cf315bc4d057e
2023-09-28 17:43:35 -07:00
Thiébaud Weksteen
9c0dff9ae5 Add lint.suppress_exit_code attribute
The Android lint --exitcode parameter can be skipped using
ANDROID_LINT_SUPPRESS_EXIT_CODE. Expose a similar attribute to Java
modules to ignore the exit code.

This is useful for integration testing. It is possible to build
libraries that report an error when linted. Othewise, such module would
break the checkbuild target.

Bug: 302400088
Test: m nothing
Change-Id: I372c42184f40d25753a688c380c0c63e9758ca00
2023-09-29 10:24:13 +10:00
Anton Hansson
0843b79d8c Merge "Make the srcjar for bcp available in OutputFiles" into main 2023-09-28 17:09:50 +00:00
Anton Hansson
c38757d0c0 Merge "Add srcjar output for platform_bootclasspath" into main 2023-09-28 16:56:55 +00:00
Anton Hansson
9231132099 Merge "Collect transitive source files for java modules" into main 2023-09-28 16:46:30 +00:00
Zi Wang
2201343fce Merge "Always drop deps from android_library with no srcs" into main 2023-09-28 16:16:51 +00:00
Anton Hansson
b3738ed1f4 Make the srcjar for bcp available in OutputFiles
This makes it possible for Android.bp files to depends on the srcjar.

Bug: 151360309
Test: m platform-bootclasspath.srcjar
Change-Id: Id42cc3cff89c084b55c7fb0726ad84ecd4f50f58
2023-09-28 13:22:39 +00:00
Anton Hansson
57162c515e Add srcjar output for platform_bootclasspath
This output contains all the transitive sources that are contained in
the bootclasspath.

It's currently limited to source-built bootclasspath components. Future
work will make this deal with sdk_library prebuilts.

Bug: 151360309
Test: unit test, as well as manual inspection of platform-bootclasspath
Change-Id: Ie05d8125e19736d8b4b9ebafb70b88a0a40069d5
2023-09-28 13:21:21 +00:00
Anton Hansson
0e73f9ee6d Collect transitive source files for java modules
This new entry in the JavaInfoProvider lists all the transitive source
files contained within the library. That is, the source files of the
module and all its static dependencies.

Bug: 151360309
Test: unit test in java_go + some manual testing
Change-Id: I7fe3035b9e46774095c0e9196cd77fa1027adf6d
2023-09-28 13:20:49 +00:00
Maxim Siniavine
4aa82a13db Merge changes from topic "revert-2755310-HIIDCMFNIU" into main
* changes:
  Revert "Add soong config variable Release_expose_flagged_api"
  Revert "Add flagged api hide conditional to droidstubs"
2023-09-28 01:08:44 +00:00
Maxim Siniavine
1180919dda Revert "Add flagged api hide conditional to droidstubs"
Revert submission 2755310

Reason for revert: Broken build b/302407753

Reverted changes: /q/submissionid:2755310

Change-Id: I56306fc3b7e5608d21dbefe18d6a886561599f40
2023-09-28 01:01:59 +00:00
Romain Jobredeaux
641b62b205 Merge changes from topic "bazel_framework_res" into main
* changes:
  bp2build support for framework-res
  Keep rules_testing BUILD files
2023-09-27 20:52:50 +00:00
Zi Wang
1066479258 Always drop deps from android_library with no srcs
android_library does not accept deps when there are no srcs because
there is no compilation happening. The libs of android_library module
are unnecessary as deps on the android_library since they aren't
being propagated to any dependencies.
So we can drop deps here.

Test: the updated test case and CI

Bug: 302290600

Change-Id: Ib43a1c273a5f3b3e0aa6f29f4e8569ad3487e451
2023-09-27 12:36:36 -07:00
Jihoon Kang
d91a8e806a Add flagged api hide conditional to droidstubs
APIs annotated with @FlaggedApi should not be included in the artifact
when building sdk target products in the "next" release configuration.

This change adds such logic by passing additional flag to metalava in
droidstubs.

The flag does not need to be passed to metalava invocation done in
java_api_library, as java_api_library generates stubs using api
signature files (i.e. *-current.txt files), and they will not contain
apis marked @FlaggedApi. The metalava invocation in droidstubs is
responsible for removing such apis.

Test: go test ./java && m TARGET_PRODUCT=sdk TESTING_TARGET_RELEASE_NEXT=true nothing and inspect ninja command for generating stubs and verify the flag is included
Bug: 299570421
Change-Id: Ia4b699b6e3ff6324f050eecc9ff5b622fdc04621
2023-09-26 22:46:05 +00:00
Romain Jobredeaux
832e131725 Merge "Do not convert android_library_import with no aars." into main 2023-09-26 20:08:04 +00:00
Romain Jobredeaux
9c06ef353b bp2build support for framework-res
Change-Id: I5b32a702e02b5f1ec08d5608d766a8a0c08d845c
Bug: 276928228
Bug: 297356405
2023-09-26 15:06:50 -04:00
Colin Cross
b983ceac33 Merge "Shard srcjars when sharding javac compilation" into main 2023-09-26 18:01:49 +00:00
Jingwen Chen
256c389608 Improve optimize bp2build conditional.
Follow up from https://android-review.git.corp.google.com/c/platform/build/soong/+/2757255/comment/fdcf5795_943a04d5/

Test: soong unit tests
Change-Id: I63334bfd19469060673e9a9a239050590934b089
2023-09-26 05:56:54 +00:00
Colin Cross
a052ddbb7e Shard srcjars when sharding javac compilation
java_library rules with javac_shard_size set split the sources into
shards to invoke javac multiple times, but were using a single javac
invocation for all srcjars.  For fraemwork-minus-apex, this srcjar
shard was the long pole at 15.7 seconds, containing 266 srcjars with
1542 java files with a total of 614593 lines.

Use a rough approximation of 5 sources per srcjar to determine the
number of shards to split the srcjars into based on javac_shard_size.
This results in splitting the srcjars for frameworks-minus-apex into
8 shards, with the longest taking 10.5 seconds to compile.

The longest shard contains most of the aidl srcjars, which have been
generated by sharded groups of 50 aidl files and have a much higher
average number of sources per srcjar (a mean and median of 27).  A
future improvement could be to shard those separately assuming a
higher number of sources per srcjar.

Bug: 302033097
Test: USE_RBE=false m frameworks-minus-apex
Change-Id: I85e740c7fcf5651cf18c0cdc90ab8c6ee39cb47b
2023-09-25 21:46:58 -07:00
Jihoon Kang
534e2e504d Merge changes from topics "remove_api_files", "remove_naming_convention" into main
* changes:
  Remove naming conventioned based file sorting in java_api_library
  Remove api_files property from java_api_library
2023-09-25 22:31:53 +00:00
Jingwen Chen
65229207d1 Enable/disable optimize for android_test and android_test_helper_app by default.
Follow up to https://android-review.git.corp.google.com/c/platform/build/bazel/+/2727853/comment/f2c5802e_245fd302/

Test: New unit tests, presubmits
Test: `atest-dev HelloWorldTests --roboleaf-mode=dev`

Change-Id: I88efcf72fbcb717d05e71ba50ba7802c3bece816
2023-09-25 15:27:33 +00:00
Zi Wang
7c5b6d5273 Merge "Pass java_library libs and static_libs to java_*_proto_library" into main 2023-09-23 03:45:48 +00:00
Romain Jobredeaux
afc5d27ab0 Do not convert android_library_import with no aars.
Bug: 301007952
Change-Id: Ia32d47eeb1a888ea2555d5ca08f56f191c040bc7
2023-09-22 15:52:59 -04:00
Chris Parsons
6666d0f6b1 Switch bp2build mutator to bottom up
This should be no-op, as the underlying mutator has not changed yet.

Some other refactoring is required and done in this CL:

- Delete some old, dead ApiBp2build code
- Fix casting to TopDownMutator when it's not necessary

This change is required to prepare for allowlist v2 work, as only
BottomUp mutators can AddDependency.

Bug: 285631638
Test: m nothing
Test: presubmits
Change-Id: I5212a5f5634cc13056195783e6df37ff8eb000da
2023-09-22 19:19:22 +00:00
Zi Wang
4dbd0e8688 Pass java_library libs and static_libs to java_*_proto_library
If a java_library module has proto srcs, a java_*_proto_library target
will be created for it. Proto sources are generated and then compiled
by a java_library target. We need to pass the libs and static_libs of
the java_library module to this java_library target so that
the compile-time classpath is correct.

Test: updated unit tests and CI

Bug: 301469542
Change-Id: I05b2efce6fda2223e85728b3c4c7b1815d04c3dd
2023-09-22 11:20:06 -07:00
Jihoon Kang
a96a7b1e13 Remove naming conventioned based file sorting in java_api_library
With api_files property being removed from java_api_library, all api
files are passed to java_api_library via java_api_contribution, which
provide api_surface information. Instead of relying on the naming
convention of the api files, java_api_library can utilize this
information to sort the api files from narrower api scope to the wider
api scope.

Test: m --build-from-text-stub
Bug: 295429988
Change-Id: Idd832778833c072c6b7e9d1f775533e5f4e2af00
2023-09-22 16:55:43 +00:00
Alix Espino
c62b27a7ea Merge "Mark android_* modules with java_resources as unconvertible" into main 2023-09-22 14:56:18 +00:00
Jihoon Kang
6be0f00671 Remove api_files property from java_api_library
java_api_contribution provides api_surface information, but files
directly passed to java_api_library do not possess such information.
Currently, the api surface is assumed via naming convention for api
files passed via api_files property, but this is fragile.

This change removes the api_files property from java_api_library and
enforce all api files to be passed via java_api_contribution

Test: m nothing --build-from-text-stub
Bug: 300964421
Change-Id: If01d9ed978fe469d4ee0d685582a51629ebecc56
2023-09-21 21:02:39 +00:00
Romain Jobredeaux
2c11851598 Merge "Use raw {min,target}_sdk_version properties in android_app converter" into main 2023-09-21 20:58:16 +00:00
Jingwen Chen
6528999872 Revert^2 "bp2build converter for android_test_helper_app."
2395286cda

Change-Id: I698c1e62b87f3d8338d8d207d06f62ec680d71c9
2023-09-21 15:16:59 +00:00
Jingwen Chen
38b7be9d29 Merge "Revert "bp2build converter for android_test_helper_app."" into main 2023-09-21 15:14:29 +00:00
Jingwen Chen
2395286cda Revert "bp2build converter for android_test_helper_app."
Revert submission 2757525-android_test_helper_app

Reason for revert: broke builds

Reverted changes: /q/submissionid:2757525-android_test_helper_app

Change-Id: I0e5f55078221d7f2151f1bbaa55bebdf5051c03c
2023-09-21 15:12:19 +00:00
Jingwen Chen
72e22018c3 Merge "bp2build converter for android_test_helper_app." into main 2023-09-21 15:09:06 +00:00
Romain Jobredeaux
1c4048e08d Merge "Bp2build support for JNI deps of android_app." into main 2023-09-21 14:36:02 +00:00
Alix
ee51bd6588 Mark android_* modules with java_resources as unconvertible
Change-Id: I9da921feaf9edb5fe7d1b1cb733494f90d8c64b3
BUG: 300470246
2023-09-21 03:58:24 +00:00