Java libraries were writing lists of files that changed whenever
transitive dependencies changed to Android-${TARGET_PRODUCT}.mk, causing
Kati analysis to rerun whenever a dependency was changed in Soong.
In both cases, Make would immediately use the list to write a single
output file. Write the files in Soong and pass the path to the file
to Make instead, which will both reduce the size of
Android-${TARGET_PRODUCT}.mk and skip Kati analysis more often.
Bug: 309006256
Test: m checkbuild
Change-Id: I5dff16c6fb7cca8c6da927b37c612c7b1d0954e6
So that we don't erroneously add skip_preprocessed_apk_checks
everywhere.
Bug: 185811447
Test: Presubmits
Change-Id: Icb1c6163d170ca4181c5c6a814b51fda4777746f
When targetSdk is >= 30, the system verifies that you use a valid
signature V2+ certificate. Uncompressing ndk/dex files or aligning
the zip file will break a signature V2, so these apks should really
just set preprocessed: true.
Fixes: 185811447
Test: Presubmits
Change-Id: Id89c42bcd5b5daa6eda1716bff4023423298036b
javac produces a directory containing class files, which is then zipped
with soong_zip into a jar file. The class files are never used outside
of the rule, so delete them after zipping them. This should save 19 GB
of disk space in checkbuilds.
Do the same for kotlinc/classes directories for consistency.
Bug: 293352015
Test: treehugger
Change-Id: Id1e889cfbee47eab552a5bb27134fa4b3b4c4d14
If a header jar couldn't be built (for example when an API generating
annoation processor is in use) the implementation jar is reused as the
header jar. If the implementation jar contains an annotation processor
listed in META-INF/services/javax.annotation.processing.Processor then
later javac executions with the implementation jar in the classpath
could attempt to run the annotation processors unexpectedly. Remove
the META-INF/services directory when using an implementation jar as
a header jar.
Bug: 290933559
Test: builds
Change-Id: I40d48644bc5a09a9564dc2c4b38f627edd00fcf8
The Java compiler may generate sources when processing annotations.
These sources are currently not included in the IDE project model, which
results in unresolved symbols when using Hilt and other annotation
processors. These sources are not passed to the Java compiler for
compilation, so they cannot be handled like other Java module sources.
This change archives the generated sources and appends them to the
existing srcjar list in module_bp_java_deps.json.
Test: go test .
Test: Verified that module_bp_java_deps.json contained srcjar entry
Test: with path/to/android_common/javac/anno.srcjar.
Test: Verified that IntelliJ can resolve generated symbols after
Test: invoking aidegen.
Change-Id: I6a3011f9140fd25f785178baee0cd6074ad94600
Also add unit tests for the rest of device_config
Bug: 283475679
Test: m nothing (soong unit tests)
Change-Id: Iee18a1f2f2cbb23e8c8d84c54e903b32be29a693
Setting the preprocessed flag will now also verify that the apk is
zip-aligned and does not have compressed JNI libs or dex files.
Bug: 185811447
Test: m nothing
Change-Id: I01b7c25f390345b14385f6f9e1640f48a5d9dc93
Add skip-sdk-check to skip checking the SDK version when extracting an
APK/APEX from an App Set Bundle. This can be used when the platform SDK
version is not defined and the APEXs/APKs use SHA based SDK versions.
This check should not be set to true for non Beta dessert releases
Bug: 274518686
Test: # Add SHA targeting modules to platform
m SOONG_SKIP_APPSET_SDK_CHECK=true #Build Passes
m SOONG_SKIP_APPSET_SDK_CHECK=false #Build Fails
m #No config supplied, build fails
Change-Id: I1919437d3410f09c991e1de39031bd88e1f8246a
This reverts commit c6ef485370.
Reason for revert: Multiple systemui presubmits are broken due to this change
Bug: 228262695
Change-Id: I1efed519c49d8d0583815c7bf2b3801bf0ba12fa
When compling kotlin code with annotation processors we are generating
java stubs for the kotlin sources using kapt, and parsing them in
turbine when running the annotation processors. Passing --output
to turbine will also compile the stubs into a header jar that can
be used as a dependency to javac, allowing the javac and kotlinc
rules to run in parallel. The turbine-apt header jar can't be used
as the header jar for downstream modules as it doesn't contain the
kotlin metadata needed by kotlinc rules, so the kotlinc gen-jvm-abi
plugin output is still used for the module's final header jar.
Test: TestKapt
Bug: 222095735
Change-Id: I82d0900f3dc30f3e3ebd7cab0693dfe741d9b955
Follow Bazel by using turbine instead of kapt to run annotation
processors. This still requires using kapt to generate java stubs
of kotlin soruces, then uses turbine to run annotation processors
on the java stubs and any java sources to generate sources and
resources, and passes the annotation processor generated sources
to kotlinc and javac.
Bug: 225013372
Test: m checkbuild
Test: TestKapt
Change-Id: I9c6fc496a9fba64658bb062538bc5f7b9478b07a
Turbine sets dates to 2010 and doesn't need ziptime any more, and
ignores the --temp_dir flag.
Bug: 225013372
Test: m checkbuild
Change-Id: I6122f27d873ca671050e4dc0d65641bb52e90e99
r8 gets the static libs in the program jar, it shouldn't also get
them as library jars. Keep a separate classpath for dexing that
includes libs but not static_libs.
Bug: 222468116
Test: m checkbuild
Test: TestD8
Test: TestR8
Change-Id: Icca3393f496cbcadcc633f3b156761e6c145f975
Extract and install the primary apk normally, and then unzip the rest
of them as a post install command.
Bug: 204136549
Test: app_set_test.go
Change-Id: I17437ff27f49df6bc91bdbbea6173b46c7d3ec4e
When a module depends on the compose runtime add a -Xplugin argument
to the kotlinc flags that enables the compose compiler plugin.
Bug: 196351110
Test: TestKotlinCompose
Change-Id: I423a3c4d12df42804a24b672a40a165bc8dd165f
Currently, errorprone is only run if the RUN_ERROR_PRONE
enviornment variable is true. Add a flag that individual
modules can use to always enable errorprone.
In a followup cl, I plan to add another flag that will
force all errorprone checks to be errors, so that modules
can be confident that they're not ignoring any errorprone
checks.
Bug: 190944875
Test: New unit test and manually
Change-Id: Iab0c81642ed22a736add054147829e91a891d179
rewrapper supports a comma separate list of rsp files, replace
REParams.RSPFile with REParmas.RSPFiles.
Test: remoteexec_test.go
Change-Id: I7850c071c23d368d6fad4480dd527d146c13c6d3
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
KYTHE_JAVA_SOURCE_BATCH_SIZE environment variable controls this setting.
The limit is 1000 if this variable is not set.
Fixes: 179932118
Test: run prebuilts/build-tools/build-prebuilts.sh, use it to build kzips, check
Change-Id: I9ad57dfd1d2c2dce5cff755b1bd61cf933420bd3
Jarjar doesn't exit with a nonzero return code when there is a syntax
error in a rules file and doesn't write the output file. Without a
nonzero return code ninja prints a warning but continues, which leads
to stale results on incremental builds where the output file already
exists, or delayed errors on clean builds whre the output file didn't
exist.
Delete the output file before running jarjar, and then check if it
exists after running jarjar.
Fixes: 119516143
Test: m out/target/common/obj/APPS/TeleService_intermediates/classes.jar
Change-Id: I7e9f7ff34de565a986ab0dc6e375f606c91c3846
It looks like there is a bug in rewrapper/reproxy that makes it upload the
output file as an input if it still exists in the output tree. This causes
unnecessary cache misses on incremental builds, and can also cause the
action to fail remotely (depending on the service). By removing the output
file at the beginning of the action, we ensure that it can't be uploaded.
Test: ran against a remote execution server; actions no longer fail remotely
Change-Id: I98fcc0cf105553a9920b0e96965a438e052d7c05
The android.WriteFile rule takes careful escaping to produce the
right contents. Wrap it in an android.WriteFileRule that handles
the escaping.
Test: compare all android.WriteFile outputs
Change-Id: If71a5843af47a37ca61714e1a1ebb32d08536c31
Soong and Make have no ways to figure out what splits will be outputted
from a given android_app_set, so it's impossible for them to provide
full PACKAGES.$(LOCAL_MODULE).CERTIFICATE entries, which are required to
build a final apkcerts.txt. This change makes extract_apks produce
apkcerts.txt files for each input modules instead. The Make-side
counterpart of this change merges all local apkcerts.txt into a final
one.
Fixes: 160119159
Test: main_test.go
Test: m apkcerts-list
Merged-In: I321e80fd636a955213761f56a3ac64bfe7f7f7c0
Change-Id: I321e80fd636a955213761f56a3ac64bfe7f7f7c0
This reverts commit 91206d9ed1.
Reason for revert: package-check.sh doesn't work on mac
Bug: 158081251
Bug: 157649935
Change-Id: I50af71d54d5f1f8b516bfcf1efbcf6217e89c83a
Previously, the package check was only run when building checkbuild or
the phony target created for a specific module. It would not run when
building a module that depended upon a library with the
permitted_packages property. That was because the package check was
only run when the package-check.stamp file was built and that was only
added to the phony and checkbuild targets.
Instead of touching a separate package-check.stamp file to indicate
that the check has been performed this change copies the input jar file
to the package check to a separate ../package-check/<jar> file which is
then treated as the output of the library and is the input for any dex
processing. So, any modules that depend on this library will
transitively depend on the output file produced by the package check
command and so will ensure that the package check is always run.
Test: Removed "android.net" from the permitted_packages for
"framework-tethering", build "framework-tethering" which
triggered and failed the package check and
"com.android.tethering" which did not.
Made this change.
Built "com.android.tethering" which triggered and then failed the
package check.
Removed change to "framework-tethering"
Bug: 157649935
Change-Id: Ib01aa09e13f80282218049270eb7a58ec5f9f605
Test: Ran a build with `RBE_JAR="true" RBE_JAR_EXEC_STRATEGY="remote"
RBE_ZIP="true" RBE_ZIP_EXEC_STRATEGY="remote" ... use_rbe m` and that
succeeded.
Bug: b/156765207
Change-Id: Ia17b532fbb282be414adf879914870082dd0841b
Test: Ran a sample turbine action with:
RBE_TURBINE_EXEC_STRATEGY="remote" RBE_TURBINE="true" ... use_rbe m out/soong/.intermediates/external/protobuf/libprotobuf-java-micro/android_common/turbine/libprotobuf-java-micro.jar
and checked in reproxy_log.txt that remote-metadata had status SUCCESS.
Bug: b/156765475
Change-Id: I85c334e6998c6dd2a68460b3580d50fffd900e6f
kapt claims to support a comma separated list of annotation
processors, but it errors if multiple annotation processors
are given. Surrounding the the list with {} does not error,
but it also doesn't even warn if the second element in the
list is garbage, so it may not be running the second
processor. Repeat the processor argument for each
annotation processor class instead.
Bug: 154736649
Test: TestKapt
Test: m checkbuild
Change-Id: I4c7c161dbf867d7fba1aaf16fd5e502647e3f682
Set a system property to enable Android specific transformer that drops
UnsupportedAppUsage annotation for repackaged classes to avoid adding
unneeded hidden api symbols on jarjar.
Bug: 146418363
Test: m, manual diff hiddenapi-flags.csv
Exempt-From-Owner-Approval: patch approved by owner
Change-Id: I10b49feb15257301574162b5d389cbc30277f672
goma can't handle the --system argument that Android must pass to
javac.
Bug: b/143658984
Test: treehugger
Change-Id: I207668d8baa4ab28160938732a38f696aeac3f44
This CL adds RBE support to javac, r8, and d8 rules which is only
enabled if respective environment variables are set.
Test: an aosp_crosshatch build with and without the new variables.
Change-Id: Ic82f3627944f6a5ee7b9f3228170c2709b1bfcb8
We were passing "--classpath foo.jar --classpath bar.jar" to turbine,
it now wants (and may always have expected?)
"--classpath foo.jar bar.jar".
Test: m checkbuild
Change-Id: Ib7e0ca64a34e236110f7b785d6a0fb51ed75567e
Java language was set for 1.8 for anything building against the
current SDK because the stubs were not built in Soong, so the
system modules could not be built. The stubs have been built
in Soong since Iabd32b30954b3f4a6d9a779fde52a032b684807e, but
I5e870c34dd0ebc8ae3f888ec627da590c846a76f missed updating
this TODO.
Use 1.9 when building against the stubs, but continue using
1.8 for unbundled builds until we have prebuilt system modules.
Always use the core-current-stubs-system-modules to avoid
splitting android.* packages between the system modules and
the classpath, which would cause new classes in android.*
packages in classpath jars to be ignored. Add a new
java9Classpath field to sdkDep that will contain the stubs jar
when targeting Java language level 1.9, and plumb it through
to javac and turbine. Rename the modules field to bootclasspath.
Bug: 142896162
Test: m checkbuild
Change-Id: Icfd32d0a863b2303a997c7cf03cb3708aade4724
turbine supports taking system modules on the command line,
now that we target Java language level 1.9 and use system modules
by default switch turbine to match javac.
Test: m javac-check
Change-Id: Ieee07502151da0d5693bb8929213d495c039106b
Remove the hardcoded checks against "1.9" by making javaVersion
an enum and implementing javaVersion.usesJavaModules().
Test: TestClasspath
Change-Id: I559eeb1f45880bb8177269c6d977ee4dfbadce57
Android builds by default put artifacts into out/ subdirectory of
the source tree, causing the extractor to record their names as
relative. The indexer considers such files as sources, which is wrong.
Fortunately, the extractor can be fed a set of filename rewriting
rules (see build/tools/vnames.json).
Also, undo previous unsuccessful attempt use to absolute path for the
output directory to distinguish between source code and artifacts.
Bug: 141385476
Test: run the build, inspect compilation units of the kzip file
Change-Id: I89ec3aed8fd14f43ea6e0b226d54f643346f6125