Commit graph

238 commits

Author SHA1 Message Date
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
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
Sorin Basca
cc9eee0af2 Emit record annotation
Test: m
Change-Id: Ic1aae5c8f9fbf46293dc7e97e2951be3f11f4bbb
2023-02-10 07:30:51 +00:00
Jared Duke
6587cecab3 Remove R8-specific flags from soong config
Instead, move them to R8Wrapper. Having all of these R8-specific flags
in a single location, bundled within the R8 repo, is easier to maintain.
This should be a no-op for generated code.

Test: m + validate identical dex output
Change-Id: Ibdeecef8ca5d311d353dd623c73fab608ccd2681
2023-01-31 12:45:00 -08:00
Jared Duke
a1b8b9bab9 Enable same-file policy for R8 optimizations
While this does increase dex size for optimized targets by limiting the
scope of class merging, it also
  1) improves actionability of unretraced stack frames
  2) improves accountability for size increases
  3) tends to decrease compiled code sizes for impacted targets
  4) marginally (~1%) decreases RSS

Improvements in tooling should mitigate (1) and (2), and more targeted
use of @NeverInline can mitigate (3). Until such time, the pros seem to
outweigh the cons, so we enable the policy as a temporary measure.

Bug: 264916934
Test: m
Change-Id: Id63a17955692b75b16c42d9c85b55bae409c0da4
2023-01-27 11:25:26 -08:00
Qing Shen
871c6f32dd Instrument ims-common for coverage
Bug: 257128599

Change-Id: Ib75fce4582da51d01762f0d338308c4f2410c562
2022-11-04 22:39:56 +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
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
Sorin Basca
7e094b33b7 Revert^2 "Use the toolchain from JDK 17"
This reverts commit be3a561aac.

Reason for revert: Reland switch to JDK 17
Bug: 233029164
Test: TH

Change-Id: Ifa69e3fd50b853153a9c23756269ff12e72d7e9f
2022-10-05 08:23:17 +00:00
Ken Sun
be3a561aac Revert "Use the toolchain from JDK 17"
Revert submission 2164342-use-jdk17

Reason for revert: DroidMonitor-triggered revert due to breakage b/250426490

Reverted Changes:
Ib1a24e7ea:Update path for libjli.so
I3375bd4e4:Use the toolchain from JDK 17
I9183e5511:Use the toolchain from JDK 17

Change-Id: I28fc32290dd337b7d44bb98bc52956ee84f01aaa
2022-10-03 03:12:41 +00:00
Sorin Basca
8eac0005c6 Use the toolchain from JDK 17
Bug: 233029164
Test: m
Change-Id: I3375bd4e4186c0049490ee3ddc0f85552d25b579
2022-09-29 11:34:52 +01:00
Rico Wind
6008155960 Merge "Add soong support for resource shrinking" 2022-09-24 05:19:33 +00:00
Rico Wind
351bac996c Add soong support for resource shrinking
This adds a new flag to the optimize section to allow invoking the resource shrinker

Bug: 246217952
Test: m
Change-Id: I2e7851af1189db2a6adf6f9f9f444a1d7f3a8d60
2022-09-23 19:11:11 +02:00
Sorin Basca
a1073a5ab5 Increase javac heap to 4096M
Bug: 246361502
Test: TH
Change-Id: I787871a8fe924857cde550700acd15682b924b8b
2022-09-14 11:33:58 +01:00
Sorin Basca
198c51c868 Pin javadoc to JDK 11
Bug: 240421555
Test: m sdk
Change-Id: I6fed538a3a0d05a3115dd930b860aa7769aa6d16
2022-09-08 17:15:18 +01:00
Cole Faust
bcc3d05aba Fix module-file name collisions
Bazel doesn't allow a module and file with the same name.

Bug: 198619163
Test: Presubmits
Change-Id: Ie9731b627945d2ff221d3a5d08a32a5a172f9dcd
2022-09-01 15:20:00 -07:00
Jordan Demeulenaere
c33f79996f Increase R8 max heap size to 4GB.
Bug: 241220562
Test: Manual
Change-Id: I983ded61b3a588e3d3b5c8e71596f80aaa2d59e6
2022-08-08 11:40:15 +02:00
Ian Zerny
dc2893aeea Use R8 wrapper target and flags.
Bug: b/227746536
Test: atest --host r8retrace-check-retraced-stacktrace
Change-Id: Ia0f65180181df19f5c043cc371893cfe45d248a9
2022-06-23 12:23:18 +02:00
Rico Wind
1cd1729011 Disable deferred tracing in R8
Bug: 227455445
Bug: 233630328
Test: m -j77 SystemUI + disasm grep mStatusBarWindowCallback
Change-Id: I2d6bb859e74c1afc398e629e53d2ce541ef27642
2022-05-30 12:54:25 +00:00
Ian Zerny
727ab9033a Replace DEX_FLAGS by flags for D8 and R8.
This adds the heap space flag currently set in wrappers.

Bug: b/227746536
Test: manual
Change-Id: Ic3cb8feb7a09d690ecd309162236e49a8d1e52c6
2022-04-25 11:17:07 +02:00
Jared Duke
0cf7c9686d Limit JIT tier for D8
Standalone D8 invocations tend to be shorter-lived than R8 invocations
that involve deeper layers of bytecode optimization. Introduce a
separate set of JVM flags to pass to D8 invocations which limit the
runtime JIT tiering, reducing overall compile times and significantly
reducing total CPU consumption for D8 build workloads.

Representative incremental build times with this change:
 * real 6m1.388s
 * user 63m32.412s
and without:
 * real 6m30.624s
 * user 79m12.626s

Bug: 205303544
Test: time m
Change-Id: Ic568a4316325c6a4e0da41ffebbb07f0c5f7e8e3
2022-04-21 18:24:52 +00:00
Treehugger Robot
a2a7b57924 Merge changes from topic "export-vars"
* changes:
  export Java variables to Bazel
  refactor Bazel variable export
2022-04-08 17:31:23 +00:00
Sam Delmerico
932c01cf9e export Java variables to Bazel
Test: build/bazel/bp2build.sh
Change-Id: Ia06f9265c9f96e6add6edbd0cee925fe37b430d3
2022-04-08 14:15:43 +00:00
Colin Cross
93d65fb60d Merge "Enable kotlin's jvm-abi-gen plugin to generate header jars" 2022-04-05 23:32:54 +00:00
Anton Hansson
51bbac2137 Remove apex framework jars from hard-coded list
All apex jars get auto-instrumented since
I2b1c0736202de26c5ea88c0ab14574bd7207a5fb

Test: $ EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m nothing && \
      $ grep LOCAL_MODULE.*framework-sdkextensions.com.android.sdkext$ \
            out/soong/Android-aosp_coral.mk  -A9 -B2 | grep JACO
Change-Id: I1de5ba6673bef93b16c302412f920d93129d4420
2022-04-05 09:00:57 +00:00
Colin Cross
220a9a1245 Enable kotlin's jvm-abi-gen plugin to generate header jars
Kotlin's jvm-abi-gen plugin can generate header jars similar to the
turbine output for java sources, which can be used to avoid recompiling
downstream modules when the ABI hasn't changed.  Unlike turbine, the
plugin runs as part of the main kotlinc invocation, so it doesn't allow
the downstream modules to start compiling any sooner.

A future possible optimization is to use turbine to compile the kapt
stubs, at least for the  kotlin+annotation processor modules that already
generate them, which would allow compiling downstream modules before
invoking kotlinc or javac, as well as invoking kotlinc and javac in
parallel with each other.

Bug: 222095735
Test: TestKotlin
Test: m SystemUI
Change-Id: Ib1bb2ecea47c851a108a26f9ed4f827f289d1321
2022-04-04 16:42:46 -07:00
Colin Cross
c2d504873f Prevent kotlinc from reading /tmp/build.txt
Pass -Didea.plugins.compatible.build=999.SNAPSHOT to kotlinc and kapt
to prevent it from reading /tmp/build.txt and failing with an obscure
exception:
exception: java.lang.ExceptionInInitializerError
	at com.intellij.openapi.util.BuildNumber.currentVersion(BuildNumber.java:297)
...

Bug: 222162908
Test: m metalava with /tmp/build.txt present
Change-Id: I5faced4a2e94561ce3aa37bfaacf5bd7d988a4f0
2022-03-18 20:48:51 +00:00
Colin Cross
59c1e6ac0e Support experimental building with OpenJDK 17
Use EXPERIMENTAL_USE_OPENJDK17_TOOLCHAIN=true to build with OpenJDK 17
while still targeting java language version 11.

Bug: 219098645
Test: m EXPERIMENTAL_USE_OPENJDK17_TOOLCHAIN=true
Change-Id: I89fb04ecde4dbd1e102098f316692624dd67f8a2
2022-03-04 21:40:02 +00:00
Colin Cross
8bf6cad170 Increase errorprone heap size
Increase the size of the errorprone heap to fix OOM exceptions.

Bug: 221480398
Test: forrest
Change-Id: Ia74fd4ecc57f08bcbaa1388e0734ee0cce8ae1a4
2022-02-28 13:10:50 -08:00
Jared Duke
0849c14aea Limit JIT tier for javac
javac is generally a short-lived JVM invocation that doesn't greatly
benefit from deep JIT tiering. As such, favor faster startup time
by limiting to tier 1 JIT for javac execution. This should greatly
reduce overall CPU usage from Java compilation for an arbitrary
Android build (~20%), and deliver a small but modest improvement in
overall Java build times (~5%).

Representative incremental build times with this change:
  * real 18m3.507s
  * user 563m4.838s
and without:
  * real 19m11.909s
  * user 751m27.790s

Follow-up changes will apply similar flags for other short-lived JVM
build commands.

Bug: 205303544
Test: m
Change-Id: Ic6315b976063f4330902930a6cf5e5cb394c554c
2022-01-28 11:39:47 -08: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
3e3eda6eb6 Temporarily add method to get java binary tool
cc binaries are moving from out/soong/host/linux-x86/bin to
out/host/linux-86/bin first, to be followed by java binaries.
Temporarily add a method that gets the java binary path while
it is different from the cc binary path.

Bug: 204136549
Test: m checkbuild
Change-Id: I04a7e741436da6be68078f23d074870413a5bb5e
2021-11-04 10:28:58 -07:00
Colin Cross
a832a04db2 Revert "Time out and dump stacks from R8 processes after 30 minutes"
This reverts commit 29c294b2cf.

The deadlock in R8 was fixed, and the timeout causes problems when
RBE is enabled and the R8 action gets stuck in a queue for 30
minutes.

Test: checkbuild
Change-Id: Ia0c3826aea3288e9db3bdbd4955e1e16c0a38fe3
2021-08-05 17:04:06 -07:00
Colin Cross
29c294b2cf Time out and dump stacks from R8 processes after 30 minutes
R8 processes are sometimes hanging on the build servers.  Wrap R8 with
run_with_timeout to dump the stacks with jstack and kill the process
after 30 minutes.  Switch from running with the r8-compat-proguard
shell script to running the jar directly so that jstack gets the pid
of the java process.

Bug: 181095653
Test: m checkbuild
Test: m NetworkStackNextIntegrationTests
Test: m USE_RBE=true RBE_R8=true RBE_R8_EXEC_STRATEGY=remote NetworkStackNextIntegrationTests
Change-Id: If6996bd8eb39c7a8453d79e825004339c009ade2
2021-04-30 14:14:46 -07:00
Colin Cross
d47f4ac828 Silence kotlinc JDK9 warnings
Silence the "Illegal reflective access" warning from kotlinc tracked
by https://youtrack.jetbrains.com/issue/KT-43704

Test: m SystemUI
Change-Id: I98eaf530c69cc4d3cefe09f5feab54c764352912
2021-03-31 13:17:42 -07:00
Colin Cross
77cdcfdeaf Move android package on top of remotexec
Remove the references to the android package in remotexec so that
the android package can reference the remoteexec package.  This
will allow RuleBuilder to integrate directly with remoteexec.

Bug: 182612695
Test: m checkbuild
Change-Id: I15be5ef126d8aacbd605518638f341daf6f31bb3
2021-03-18 16:17:34 -07:00
Bob Badour
02040de891 Add LOCAL_LICENSE_KINDS to build/soong
Added SPDX-license-identifier-Apache-2.0 to:
  Android.bp
  android/Android.bp
  android/soongconfig/Android.bp
  androidmk/Android.bp
  apex/Android.bp
  bazel/Android.bp
  bp2build/Android.bp
  bpf/Android.bp
  bpfix/Android.bp
  cc/Android.bp
  cc/config/Android.bp
  cc/libbuildversion/Android.bp
  cc/libbuildversion/tests/Android.bp
  cc/ndk_api_coverage_parser/Android.bp
  cc/ndkstubgen/Android.bp
  cc/symbolfile/Android.bp
  cmd/dep_fixer/Android.bp
  cmd/diff_target_files/Android.bp
  cmd/extract_apks/Android.bp
  cmd/extract_jar_packages/Android.bp
  cmd/extract_linker/Android.bp
  cmd/fileslist/Android.bp
  cmd/host_bionic_inject/Android.bp
  cmd/javac_wrapper/Android.bp
  cmd/merge_zips/Android.bp
  cmd/multiproduct_kati/Android.bp
  cmd/path_interposer/Android.bp
  cmd/pom2bp/Android.bp
  cmd/pom2mk/Android.bp
  cmd/sbox/Android.bp
  cmd/soong_build/Android.bp
  cmd/soong_env/Android.bp
  cmd/soong_ui/Android.bp
  cmd/zip2zip/Android.bp
  cmd/zipsync/Android.bp
  cuj/Android.bp
  dexpreopt/Android.bp
  dexpreopt/dexpreopt_gen/Android.bp
  env/Android.bp
  etc/Android.bp
  filesystem/Android.bp
  finder/Android.bp
  finder/cmd/Android.bp
  genrule/Android.bp
  jar/Android.bp
  java/Android.bp
  java/config/Android.bp
  kernel/Android.bp
  linkerconfig/Android.bp
  linkerconfig/proto/Android.bp
  makedeps/Android.bp
  partner/Android.bp
  phony/Android.bp
  python/Android.bp
  python/tests/Android.bp
  remoteexec/Android.bp
  rust/Android.bp
  rust/config/Android.bp
  scripts/Android.bp
  sdk/Android.bp
  sh/Android.bp
  shared/Android.bp
  symbol_inject/Android.bp
  symbol_inject/cmd/Android.bp
  sysprop/Android.bp
  tradefed/Android.bp
  ui/build/Android.bp
  ui/logger/Android.bp
  ui/metrics/Android.bp
  ui/metrics/proc/Android.bp
  ui/status/Android.bp
  ui/terminal/Android.bp
  ui/tracer/Android.bp
  xml/Android.bp
  zip/Android.bp
  zip/cmd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  finder/fs/Android.bp
  third_party/zip/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work

Change-Id: Ia47ca14f16b8c9f84f9d533a07e5b00e2c04e8d4
2021-02-06 04:23:21 +00:00
Xin Li
65cb5c69ea Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: Ifca7b65f4e27bf14cdc30f72f790b0de90130bae
Change-Id: I3a39be5f0b8736de4822c6a14072c78d4e4ad89d
2020-08-29 01:17:45 -07:00
Treehugger Robot
90905c0c68 Merge "Make the default exec strategy for javac/r8/d8 remote local fallback." 2020-08-18 00:54:03 +00:00