276 Commits

Author SHA1 Message Date
Cole Faust
16d227a725 Add default_visibility for soong modules
So that we don't get surprise usages.

Bug: 348717861
Test: m nothing
Change-Id: I47319a727092c1bd936cca88f5713ee977a48b48
2024-09-18 17:41:30 -07:00
Spandan Das
a7b916b50c Merge "Use -language-version 1.9 in the kotlinKythe build rule" into main 2024-09-12 19:52:30 +00:00
Spandan Das
3d6c6d9c76 Use -language-version 1.9 in the kotlinKythe build rule
There are some instances of .kt code in android platform that are not
fully compatible with kotlinc > 2. To account for this version skew when
generating xrefs, implicitly add `-language-version 1.9` to the args in
the .kzip file. The main kotlinc build rules remain the same.

This value has been picked manually by running
`external/kotlinc/bin/kotlinc -version` at ToT

Bug: 265428637
Test: verified that `-language-version 1.9` is added to the build
command of the .kzip files
Test: ran the indexer locally on the .kzip of `PermissionController-lib`
(this android_library contains .kt code that does not compile with
verison >2)

Change-Id: Icfb72800404d83f63204de23a1ec34b40ee05847
2024-09-12 18:20:59 +00:00
Spandan Das
6556d043bd Merge changes from topic "kotlin_kythe" into main
* changes:
  Add kotlin kzips to build_kzip.bash
  Create .kzip files for kotlin translation units
2024-09-12 18:14:14 +00:00
Spandan Das
1028d5a53f Create .kzip files for kotlin translation units
This CL creates the build rules to invoke the standalone kotlin
extractor and create .kzip files for each kotlin translation unit. These
will be indexed by the internal g3 kotlin indexers

Implementation details
- Create a `kotlinKytheExtract` static rule. Its inputs will be source
  .kt/.srcjar files and other verbatim args passed to kotlinc. The
extrator will serialize this information into a .kzip file. The .kzip
file should contain the necessary information to "replay" the
compilation
- Create a xref_kotlin phony rule to build all .kzip files corresponding
  to kotlin translation units.

This implementation has one limitation. Since the kotlin indexers
"replay" the compilation using its own version of kotlinc-jvm, there
might be indexing issues caused by kotlinc version skew between android
builds and indexing builds. `-kotlin-home` can likely solve that, but
this CL defers that for now.

Bug: 265428637
Test: Built the phony `xref_kotlin`, and ran the indexer locally using go/kythe-git-local-run#indexing-to-local-xrefs-server

Change-Id: Ifb370f2df8aa46f71df3fe1ae7d7aa5da773cc8b
2024-09-11 21:16:24 +00:00
Jihoon Kang
ca43c1fe44 Correct the name of the android.car.builtin module that is instrumented am: 6de6d7267f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3219097

Change-Id: I5b6630e12c928dcd6134ddb12c4c51fcda93e940
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-14 18:51:53 +00:00
Jihoon Kang
6de6d7267f Correct the name of the android.car.builtin module that is instrumented
java_sdk_library is not instrumented as it does not perform any
compilation actions. Instead, its submodule impl lib (with .impl suffix)
is instrumented.

Test: CI
Bug: 355514682
Bug: 339901608
Change-Id: I2f7b4a8cf14a592d268b6f5d44f72e43700b4907
2024-08-14 16:39:57 +00:00
Treehugger Robot
e6cf20d85f Merge "Add android.car.builtin to the Code Coverage instrumented list." into main am: 0cdc351829
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3192210

Change-Id: Ib78f8827e6dda2fcd8cec3bc6786f7d4aadf7124
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-07-24 22:42:40 +00:00
Filip Zakrzewski
c9f487b0e8 Add android.car.builtin to the Code Coverage instrumented list.
BUG=339901608

TEST=no

Change-Id: I3457dd843f3ebcefda4253b128ed142a7fa13e82
2024-07-24 04:27:45 +00:00
Cole Faust
6aaa55d11a Remove "exported" ninja variables am: 8982b1c49e am: 50b1f9bd53
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3031205

Change-Id: Ib94fb0c07106eb2ae52e3f317c44656fddb9aab3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-09 20:07:31 +00:00
Cole Faust
8982b1c49e Remove "exported" ninja variables
There was infrastructure to export ninja variables to bazel. Now that
the bazel migration is cancelled, we don't need it anymore.

Bug: 315353489
Test: m nothing
Change-Id: I298cc2ac7ebd004557be3b30d75f7357cab0b7a0
2024-04-09 09:42:37 -07:00
Sorin Basca
6c47e664cc Revert^2 "Switch to JDK 21"
This reverts commit b832ae19d8.

Reason for revert: Reland Switch to JDK 21 when related issues are resolved.

Bug: 313924276
Change-Id: Ibb5031d9892d1ddc5bc4d2af9885c3192b8ac8ad
Test: TH
2024-03-11 12:31:30 -07:00
Sam Saccone
3379d4e3d8 Merge "Revert "Switch to JDK 21"" into main am: bfa20d7e15 am: e93ae387e8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2994633

Change-Id: Ibe79e815e6002c57e49794b2ebadd858dc5ccc57
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 18:59:35 +00:00
Sorin Basca
7f4fa82732 Merge "Revert^2 "Switch to JDK 21"" into main 2024-03-11 18:40:04 +00:00
Sorin Basca
5dfa238f22 Revert^2 "Switch to JDK 21"
This reverts commit b832ae19d8.

Reason for revert: Reland Switch to JDK 21 when related issues are resolved.

Bug: 313924276
Change-Id: Ibb5031d9892d1ddc5bc4d2af9885c3192b8ac8ad
Test: TH
2024-03-11 17:23:06 +00:00
Sam Saccone
bfa20d7e15 Merge "Revert "Switch to JDK 21"" into main 2024-03-11 17:05:56 +00:00
Treehugger Robot
b08153e781 Merge "Switch to JDK 21" into main am: 092c3a56fb am: f30930f404
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2920125

Change-Id: I5e89bce53c531700ad958fb583b2594e4d9168f4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-08 19:36:23 +00:00
Sorin Basca
b832ae19d8 Revert "Switch to JDK 21"
This reverts commit 5a2e36b755.

Reason for revert: Preparing revert to have it ready in case of breakages relating to using JDK 21.

Change-Id: I153c4933f6891c7fff43e522a4d128acad6b6d47
2024-03-07 21:22:00 +00:00
Treehugger Robot
092c3a56fb Merge "Switch to JDK 21" into main 2024-03-07 19:36:28 +00:00
Yangfan Deng
42a815d586 Merge "Add wear-sdk.impl to the InstrumentFrameworkModule list so that classes for wear-sdk.impl library can be exported inside jacoco-report-classes-all.jar" into main 2024-03-07 01:32:53 +00:00
yangfan deng
a90cd1e4b8 Add wear-sdk.impl to the InstrumentFrameworkModule list so that classes for wear-sdk.impl library can be exported inside jacoco-report-classes-all.jar
Ignore-AOSP-First: internal-only projects

Test: http://go/forrest-run/L55500030002341444
Bug: 298469315

Change-Id: Ib0943e8d472ee3005a6e240c83462b054c72f199
(cherry picked from commit 8e5dfaa98985a267278f17cf1600e3fb3668cfc5)
2024-03-06 05:39:19 +00:00
Sorin Basca
5a2e36b755 Switch to JDK 21
Bug: 313924276
Test: n
Change-Id: Ia9682181a6ce35ed0102d60bf7df1def8f876fd0
2024-02-29 11:44:09 +00:00
Xin Li
14a55a9b82 Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I763b033f0f5f275091db45ab62df6af48dcddc66
Change-Id: I65077e51b4a073f2628fb0995e80ad64368def26
2024-01-30 10:34:06 -08:00
Treehugger Robot
a6ba24bcfe Merge "Remove HideFlaggedApi() related logic and the related product variables" into main am: c0412f5d31 am: bd44b17537
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2911028

Change-Id: I1b06464b5784e64825ffa81209971ba944b4be8c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-17 01:42:48 +00:00
Jihoon Kang
78b6b30aec Remove HideFlaggedApi() related logic and the related product variables
With the recent build changes to support generating mainlin module sdk
with flagged apis, the build no longer depends on the values of these
product variables in exposing the flagged apis, but these are determined
by the aconfig flags. Given that these variables are no longer used,
this change removes these variables and the variables dependent code.

Test: m nothing --no-skip-soong-tests
Bug: 320515715
Change-Id: I6af94da73cc7fc7ffce670928aad81cec5d383b4
2024-01-16 20:20:27 +00:00
Søren Gjesse
2278472256 Merge "Remove setting com.android.tools.r8.emitRecordAnnotationsExInDex" into main am: c97dfe42b9 am: fa139b17f9 am: b06eeb51fc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2881155

Change-Id: I3947862f85ad3ebc12d571fc88a162e70491d46c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-21 11:50:45 +00:00
Søren Gjesse
8a5b32d0cf Remove setting com.android.tools.r8.emitRecordAnnotationsExInDex
System property was removed in
https://r8-review.git.corp.google.com/c/r8/+/82140, as the
system property com.android.tools.r8.emitRecordAnnotationsInDex
is the only system property for not desugaring records.

Test: Existing
Fixes: b/316501817
Change-Id: I057a18c9e02a99365e910d3128890fd481e93541
2023-12-19 10:49:58 +01:00
Treehugger Robot
aca0c185fc Merge "Use --revert-annotation instead of --hide-annotation" into main am: 550a0dab0d am: f384a08950 am: 0e02a14a2b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2870808

Change-Id: If0e5da2148bc51ae4b952f47f92f6b941cbeb7bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-13 03:01:10 +00:00
Paul Duffin
7ac943f7e1 Use --revert-annotation instead of --hide-annotation
Use of `--hide-annotation android.annotation.FlaggedApi` was always an
intermediate solution until the required semantics for `@FlaggedApi`
was determined. The `--revert-annotation` option provides those
semantics. When the `@FlaggedApi` is applied to an existing API, e.g.
because it has moved from system to public, or because it has changed
in some way, e.g. modifiers, then the correct semantics for when that
API is not required is not to hide the API but to revert it to what it
was before the change necessitating the `@FlaggedApi` annotation was
made.

Use --revert-annotation instead of --hide-annotation

Use of `--hide-annotation android.annotation.FlaggedApi` was always an
intermediate solution until the required semantics for `@FlaggedApi`
was determined. The `--revert-annotation` option provides those
semantics. When the `@FlaggedApi` is applied to an existing API, e.g.
because it has moved from system to public, or because it has changed
in some way, e.g. modifiers, then the correct semantics for when that
API is not required is not to hide the API but to revert it to what it
was before the change necessitating the `@FlaggedApi` annotation was
made.
Use --revert-annotation instead of --hide-annotation

Use of `--hide-annotation android.annotation.FlaggedApi` was always an
intermediate solution until the required semantics for `@FlaggedApi`
was determined. The `--revert-annotation` option provides those
semantics. When the `@FlaggedApi` is applied to an existing API, e.g.
because it has moved from system to public, or because it has changed
in some way, e.g. modifiers, then the correct semantics for when that
API is not required is not to hide the API but to revert it to what it
was before the change necessitating the `@FlaggedApi` annotation was
made.

Bug: 314196587
Test: ./gradlew
Change-Id: Ic97f29dd2b9f598ba0851f5f622c2a2724f18037
2023-12-13 00:33:25 +00:00
Colin Cross
5c298e2c36 Merge "Remove ConvertWithBp2build implementations" into main am: a72573a727 am: cd4b2f21cd am: 8bb537ba9c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2864663

Change-Id: I86ea781dcc4761078a49ee825c47d11fde9d91be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-12 00:29:45 +00:00
Colin Cross
8ff105860d Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-08 13:51:05 -08:00
Treehugger Robot
33658590bc Merge "Support experimental building with OpenJDK 21" into main am: 8f7ee30d21 am: 26539fd5e8 am: a334a87934
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2853425

Change-Id: Iace8a28440c7ca1d374465b761abeddaa9b16e8b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-29 22:16:43 +00:00
Sorin Basca
0760c89882 Support experimental building with OpenJDK 21
Use EXPERIMENTAL_USE_OPENJDK21_TOOLCHAIN=true to build with OpenJDK 21
while still targeting java language version 17.

Bug: 313924276
Test: m EXPERIMENTAL_USE_OPENJDK21_TOOLCHAIN=true
Change-Id: Idc892bb7519e597f1e280ca0765c1a281bb29955
2023-11-29 19:13:55 +00:00
Anton Hansson
eaaaee2ca4 Merge "Re-enable the AnnotationExtraction error" into main 2023-11-17 16:25:29 +00:00
Anton Hansson
a6ae274e3b Re-enable the AnnotationExtraction error
This prevents errors in typedef definitions. Re-enable it.

Ignore-AOSP-First: This error is not being re-enabled in AOSP yet
Bug: 309971481
Test: m checkapi
Change-Id: If9f0e580cda62d0021e82b1831746b3d15d1bfbd
2023-11-10 16:19:27 +00:00
Anton Hansson
d972a088d9 Re-enable the InvalidNullabilityOverride check
It's been disabled previously due to pre-existing failures. Baseline
those and remove the disabling.

Ignore-AOSP-First: This error is not being re-enabled in AOSP yet
Bug: 222738070
Test: m checkapi
Change-Id: I3382152186d7d8f63da7c1cc95d3ef962f422642
2023-11-10 09:57:55 +00:00
Anton Hansson
b3a9fcf664 Re-enable the bannedThrow check
It's been disabled previously due to pre-existing failures. Baseline
those and remove the disabling.

Bug: 222738070
Test: m checkapi
Ignore-AOSP-First: This error is not being re-enabled in AOSP yet
Change-Id: Ia4f91f1470a5bce332df1896b81550276c4b174d
2023-11-09 10:06:04 +00:00
Anton Hansson
59ef1ec1f5 Stop suppressing the ChangedDefault error
This will prevent future breakages of this kind, so reenable the check.

Bug: 223382732
Test: m checkapi
Change-Id: I5e67ed45e3a78b90de6884a0d7b0b1c91d58b6f5
2023-11-07 15:44:14 +00:00
Colin Cross
f059b2f2fc Remove obsolete java version environment variables
jdk9 and jdk11 are no longer used, remove ANDROID_JAVA9_HOME and
ANDROID_JAVA11_HOME.

Bug: 221270882
Test: treehugger
Change-Id: Iad566bff21055c5e2acd62642ccd579507e21fef
2023-11-01 20:58:30 +00:00
Liz Kammer
e09e20ec47 Share constants for droidstubs btw Soong & Bazel
Test: m bp2build && verify constants
Change-Id: I04865414fb627672821b10d8bcc736379dc3da86
2023-10-17 09:10:08 -04: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
Colin Cross
4eae06dcc9 Move android_library resource handling to Bazel's ResourceProcessorBusyBox
The R.Java files generated by aapt2 link --no-static-lib-packages
cause scaling problems by combining all resources into every package
listed in a dependencies' AndroidManifest.xml file.  For SystemUI-core
this results in 74 R.java files, each with 76k lines, and takes 20
seconds to compile in javac.

Both AGP and Bazel have workarounds for this that avoid using the
R.java files generated by aapt2, instead generating more efficient
R.class files directly based on the R.txt file.

Bazel uses the ResourceProcessorBusyBox tool that is already present
in our tree to process the resources.  Reuse the same tool in Soong
to create the R.jar.

The more efficient R.class files require modifiying source files
that use incorrect packages to refer to resources.

Bug: 284023594
Test: TestAndroidResourceProcessor
Change-Id: I026073b40dabcfdb10e5d7a52e9348205b0e9a66
Merged-In: I026073b40dabcfdb10e5d7a52e9348205b0e9a66
2023-07-25 21:30:21 +00:00
Colin Cross
039d8dfb67 Move android_library resource handling to Bazel's ResourceProcessorBusyBox
The R.Java files generated by aapt2 link --no-static-lib-packages
cause scaling problems by combining all resources into every package
listed in a dependencies' AndroidManifest.xml file.  For SystemUI-core
this results in 74 R.java files, each with 76k lines, and takes 20
seconds to compile in javac.

Both AGP and Bazel have workarounds for this that avoid using the
R.java files generated by aapt2, instead generating more efficient
R.class files directly based on the R.txt file.

Bazel uses the ResourceProcessorBusyBox tool that is already present
in our tree to process the resources.  Reuse the same tool in Soong
to create the R.jar.

The more efficient R.class files require modifiying source files
that use incorrect packages to refer to resources.

Ignore-AOSP-First: merge conflict
Bug: 284023594
Test: TestAndroidResourceProcessor
Change-Id: I026073b40dabcfdb10e5d7a52e9348205b0e9a66
2023-07-20 21:39:37 +00:00
Jihoon Kang
6c0df88809 Cleanup remaining android.JavaApiLibraryName() references
Since the name of the java_library generated from sdk_library per api
scope does not depend on the build configuration anymore, all
dependency switching "magic" via android.JavaApiLibraryName() can be
removed.

This change also removes from-text-build-specific test cases, as those
test cases depend on build configurations.

Test: m nothing && m nothing --build-from-text-stub
Bug: 287340610
Change-Id: I3bac35259e0cbaa16432a46cb2b128951c9bc075
2023-06-15 19:42:34 +00:00
Jared Duke
3e65f2a53c Increase R8 max heap size to 4GB
The size was increased for D8 in an earlier change, but is more
critical for R8. Match the D8 configuration.

Bug: 241220562,283888124
Test: m
Change-Id: I3b98bf6098f2196c87a97f6c8f7308d9299170d8
2023-05-23 17:32:30 +00:00
Jihoon Kang
b507831b71 Utilize from text core platform api surface jar in build
Use JavaApiLibraryName function to redirect the usage
of core platform api stubs from .txt files based on config.

Test: m --build-from-text-stub
Change-Id: I926a0a455fed301ba4ff9dfa509d4dbbbd076029
2023-04-06 18:34:32 +00:00
Victor Chang
397e7e2e89 Add com.android.tools.r8.emitRecordAnnotationsExInDex flag
It enables annotations for record components.

Bug: 272698028
Test: m droid
Change-Id: I9b45526c2dcdb2de458d874a0c222108a69eee71
2023-03-31 11:01:41 +01:00
Sorin Basca
de8d7a2f39 Enable annotations for sealed classes
Bug: 233029164
Test: m
Test: atest ClassTest
Change-Id: I688d86404adf5bcce9df8324d4775f73056d44d4
2023-03-11 09:15:08 +00:00
Sorin Basca
93bca1585e Merge changes from topic "java17-record-support"
* changes:
  Allow java.lang.runtime in boot image
  Emit record annotation
2023-03-03 15:12:28 +00:00
Cole Faust
a5f64f0396 Convert RuleBuilder to static rule in buildRuleToGenerateIndex
This saves ~34kb from the build.ninja file.

Test: Presubmits
Change-Id: I8fa4974e4f1509be7938c774e536d15a63534753
2023-02-14 17:50:31 -08:00