Prior to this change, setting that to "false" turned the default Java
language level back to 8. This change removes that option.
Bug: 115604102
Test: m java droid docs tests cts
Change-Id: I97bfd0dc8d941008b4071c6efe1c0c24950c4f1f
With this change, setting the environment variable
EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN=true switches from the OpenJDK 9
toolchain to the OpenJDK 11 one (prebuilts/jdk/jdk11).
Since the version of the java.base module has to match the version of
the jlink tool which consumes it, the --module-version argument to the
jmod create call is also switched.
Test: make
Test: EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN make
Bug: 131683177
Change-Id: I606d22538165f309fe5537bd67a26390b1dd5771
Move the logic from Make that uses prebuilts for more tools for
unbundled builds, and export the values back to make.
Test: m checkbuild
Change-Id: I8c7031e0feaa9328a2b73db6dc8e63e12d1d12f7
Use Kythe (https://kythe.io) to build cross reference for the Android
source code. ~generate the input for it during the build. This is done
on demand: if XREF_CORPUS environment variable is set, build emits a
Ninja rule to generate Kythe input for each compilation rule. It
also emits two consolidation rules (`xref_cxx` and `xref_java`),
that depend on all Kythe input generation rules for C++ and Java.
The value of the XREF_CORPUS environment variable is recorded in the
generated files and thus passed to Kythe. For the AOSP master branch it is
`android.googlesource.com/platform/superproject`, so the command to build
all input for Kythe on that branch is:
```
XREF_CORPUS=android.googlesource.com/platform/superproject m xref_cxx xref_java
```
Each Kythe input generation rule generates a single file with .kzip
extension. Individual .kzip files have a lot of common information, so
there will be a post-build consolidation step run to combine them.
The consolidated .kzip file is then passed to Kythe backend.
The tools to generate .kzip files are provided by Kythe (it calls them
'extractors'). We are going to build them in toolbuilding branches
(clang-tools and build-tools) and check them in as binaries into master
and other PDK branches:
For C++, `prebuilts/clang-tools/linux-x86/bin/cxx_extractor`
for Java, `prebuilts/build-tools/common/framework/javac_extractor.jar`
Bug: 121267023
Test: 1) When XREF_CORPUS is set, build generates Ninja rules to create
.kzip files; 2) When XREF_CORPUS is set, building
`xref_cxx`/`xref_java` creates .kzip files; 3) Unless XREF_CORPUS is
set, build generates the same Ninja rules as before
Change-Id: If957b35d7abc82dbfbb3665980e7c34afe7c789e
The droiddoc rules are ripe for converting to android.RuleBuilder,
they conditionally use many input files which is hard to track
with the standard blueprint.Rule style, as the argument and the
dependency have to be handled independently. Start converting
to android.RuleBuilder by converting the droidstubs module.
Test: m docs
Test: m checkapi
Test: m updateapi
Change-Id: I08713e91149471e88a40115f69824cf5eaf88fb6
JVM occasionally (0.5% time) crashes on entering a method with SIGSEGV.
It might be due to excessive load on the host machine. Reduce the number
of the compiler threads to 6, and do not start all the GC threads
immediately. If JVM crashes, copy full diagnostics to stderr.
Bug: 132766811
Test: treehugger
Change-Id: Ib7bfd568f6d32456bf623cbb615ffc990c326a34
This reverts commit d71dc6b5e0.
Reason for revert: ag/974065 fixes the problem that caused the revert
Change-Id: I3ba9eecdab34602aaf19fa518520ac932c9b97af
This reverts commit 9d6df2246c.
Reason for revert: This change set the value of JAVA make variable to a string containing "foo bar". When soong_ui is asked to evaluate such string, it drops the quotes, causing bash to treat 'foo' and 'bar' as separate command line arguments.
Change-Id: If4e3c4c950c305bb67a572de3d86119c2da81dc1
Add a tool that can check that the <uses-library> tags in an
AndroidManifest.xml file match a list provided by the build.
Bug: 132357300
Test: manifest_check_test
Change-Id: If15abf792282bef677469595e80f19923b87ab62
In preparation for making it use multiple files so that some
implementation can be shared with a new tool.
Also make manifest_fixer_test a python_test_host, and add it
to TEST_MAPPING.
Test: m checkbuild
Change-Id: Iaae177efcb978187b126d90359b82cdfd3176857
Found while executing the build actions remotely.
Bug: 130111713
Test: treehugger
Test: run actions remotely with given dependencies, they pass.
Change-Id: I2bff8fb8ccf50fde446d6bcef0f1dca9b2974b4b
Manifest merger is now a java_binary instead of a collection of jars,
it can use the single binary as the dependency.
Bug: 112607039
Test: m checkbuild
Change-Id: Iea6c97c99a3bb09952fed2b25437b644f4e863f8
Pass -XX:+TieredCompilation -XX:TieredStopAtLevel=1 to the JVM to
reduce the time spent JITing, which in local experiments reduced
the CPU time of R8 while increasing the wall time, and reduced the
total number of runnable threads.
Without the new flags:
$ time out/soong/host/linux-x86/bin/r8-compat-proguard -injars out/target/common/obj/APPS/Dialer_intermediates/classes.jar ...
real 0m30.090s
user 4m35.337s
sys 0m12.853s
With the new flags:
$ time out/soong/host/linux-x86/bin/r8-compat-proguard -JXX:+TieredCompilation -JXX:TieredStopAtLevel=1 -injars out/target/common/obj/APPS/Dialer_intermediates/classes.jar ...
real 0m35.674s
user 2m45.135s
sys 0m9.531s
The increase in wall time should be offset by the better parallelism from
the reduced CPU time.
Bug: 119270658
Test: m checkbuild
Change-Id: I8fc78b5ef1f8c6f51fd97a29461b96ae2b35cada
Rather than have a special white list to contain the names of modules
that provide additional hiddenapi for modules on the bootclasspath
this defines a convention that such modules must have a name which is
of the format <x>-hiddenapi, where <x> is the name of the module on the
bootclasspath.
Bug: 73711752
Test: make droid && flashall -w && atest -p cts/tests/signature
Change-Id: Ib2d69dea9541b60a9bb81496f00edb65036d1ebb
This reverts commit e5b5657f87.
The reverted change was added in order to gather the information about
the hiddenapi that is needed for the runtime to enforce the hiddenapi
accessibility rules. Without it the build broke with the following
error when the android.test.base library was not in the
PRODUCT_BOOT_JARS list:
AssertionError: Error processing: frameworks/base/config/hiddenapi-greylist.txt
The following entries were unexpected:
Ljunit/framework/TestSuite;->isPublicTestMethod(Ljava/lang/reflect/Method;)Z
Landroid/test/AndroidTestCase;->setTestContext(Landroid/content/Context;)V
Landroid/test/InstrumentationTestCase;->runMethod(Ljava/lang/reflect/Method;I)V
Landroid/test/AndroidTestCase;->getTestContext()Landroid/content/Context;
Ljunit/framework/TestCase;->fName:Ljava/lang/String;
Ljunit/framework/TestSuite;->isTestMethod(Ljava/lang/reflect/Method;)Z
Please visit go/hiddenapi for more information.
However, it turns out that the runtime does not currently enforce
access to the hiddenapi of libraries that are not on the
PRODUCT_BOOT_JARS list. Gathering hiddenapi information for a library
not on the PRODUCT_BOOT_JARS list breaks the
CtsHiddenApiBlacklistApi27TestCases and
CtsHiddenApiBlacklistApi28TestCases test modules which use that
information to ensure that correct runtime behavior.
This change is being reverted simply because it does not work.
Bug: 126519737
Bug: 73711752
Test: make REMOVE_ATB_FROM_BCP=true droid and make droid
Change-Id: I1b4a7786b1061effa0e2d37832afa8570953a06e
The build assumes (apart from one minor exception) that only modules
that are in the PRODUCT_BOOT_JARS list require processing as part of
the hiddenapi. Unfortunately, that is not true for android.test.base,
at least not when REMOVE_ATB_FROM_BCP=true.
This change adds a white list (containing android.test.base) of
additional modules that should be processed as part of the hiddenapi
and updates the hiddenapi.go file to use it.
It does not matter that android.test.base is a boot jar and in the
white list, the behavior is the same as it would be if it was only
in one.
Bug: 73711752
Test: make REMOVE_ATB_FROM_BCP=true droid and make droid
Change-Id: I1c64272f444e6866136c65fb7c48910d55811844
Move the rules that build hiddenapi-stubs-flags.txt,
hiddenapi-flags.csv and hiddenapi-greylist.csv into Soong.
Bug: 123645297
Test: m checkbuild
Test: m UNSAFE_DISABLE_HIDDEN_API_FLAGS=true
Change-Id: I90bf58710f6153ee8565994f799d3ec5699bc7fa
Enable the kotlin-annotation-processing plugin and pass annotation
processors to it.
Bug: 122251693
Test: m checkbuild
Test: TestKapt in kotlin_test.go
Change-Id: I841df454beaaa7edd263eea714ca0d958a03c9de
Perform hiddenapi CSV generation and dex encoding for Soong modules
in Soong. This fixes an issue where dexpreopting was happening on
a different jar than was being installed.
Bug: 122856783
Test: m checkbuild
Test: no change out/target/common/obj/PACKAGING/hiddenapi-flags.csv
Test: only ordering change to out/target/common/obj/PACKAGING/hiddenapi-greylist.csv
Test: cts/tests/signature/runSignatureTests.sh
Change-Id: I4fc481efc29e73cb2bdaacf672e86d5f6f0075ae
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules. The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.
This relands Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb and
I462182638bd57b1367b5bfb0718e975c11ae66f7, along with multiple fixes
to depsfile generation in dexpreopt_gen that caused .odex files for
modules in defined make to be missing dependencies on boot.art, and
a fix to not dexpreopt and strip tests.
Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
only expected changes to dexpreopt outputs on system_other
(.vdex files for privileged Soong modules no longer incorrectly
contain .dex contents).
Test: OUT_DIR=$PWD/out m
Test: NINJA_ARGS="-t deps out/target/product/sailfish/obj/APPS/Contacts_intermediates/dexpreopt.zip" m
Change-Id: I6bb2c971cee65d2338839753aa0d84939f335b1b
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules. The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.
Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
only expected changes to dexpreopt outputs on system_other
(.vdex files for privileged Soong modules no longer incorrectly
contain .dex contents).
Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
Add support for adding kotlinc files in the module.
Some flags are unnecessary as they are added by
default (-no-jdk and -no-stdlib), or are not needed
on an Android build (-include-runtime), or may
conflict with the build (-kotlin-home and
-Xintellij-plugin-root), so the error stops the
build if they are added.
Test: part of java/java_test.go
Change-Id: If3b2777062daaa490a20c014e9b1bb4b1cb0a8df
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sony.com>
Switch targets that don't explicitly specify an sdk_version
to using core.platform.api.stubs instead of the core library
implementations.
Note: the old core-oj target contained the source for
core-lambda-stubs too. The new core.platform.api.stubs
does not contain core-lambda-stubs so it is explicitly
added to the boot classpath list as part of the switch over.
Bug: 113148576
Test: build
Change-Id: I689d2127f6b69b4a7034fb96f3d9cf714f801794
To migrate the default compilation over to using
"core platform api" stubs we need to make the "before"
state as close to the "after" state as possible.
The stubs will include all "core libraries" so it
makes sense to include those that contribute to the
"core platform api": okhttp, bouncycastle and conscrypt.
(apache-xml is not included because it doesn't contribute
to the core platform API).
After this change all explicit dependencies to okhttp,
bouncycastle and conscrypt in situations where the
default boot classpath is used can be removed.
A knock-on of this change is that the conscrypt, bouncycastle
and okhttp targets need to be adjusted to explicitly
depend on core-oj / core-libart with no_standard_libs: true
to avoid a cycle.
Bug: 113148576
Test: treehugger
Change-Id: I1677af8d9d48fd026874ebce4c864f39ec1a5a3d
Metalava is supposed to treat all the args after
"--generate-documentation" as either Javadoc or Dokka commands, and it starts
seperate process to invoke javadoc or java -jar dokka...
Dokka doesn't support --bootclasspath in its args, so treat all the
bootclasspath as classpath.
Also continue to refactor code to seperate Dokka runs from Javadoc or
Metalava.
Test: m -j metalava-dokka-core-docs
Bug: b/72394196
Change-Id: I0f0f3dd80cb2dbb53f19da8fa11ae0b1d92ac5d7
Move the manifest merger config to Soong, and use it to merge
manifests of static dependencies of android_library and android_app
modules.
Bug: 110848854
Test: m checkbuild
Change-Id: Ib89e1f1a52a8b76157e4e0348baf42800412df0d
Remove support for compiling with javac from OpenJDK8.
We still target 1.8 by default, and OpenJDK8 prebuilts are still
required for the bootclasspath and running robolectric.
Bug: 38418220
Test: m java
Change-Id: I5686deb0ae4f9927192a039d08adc0117b2605dd
Use the OpenJDK9 javac to run ErrorProne by adding it to
-processorpath and using -Xplugin:ErrorProne.
Bug: 69485063
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I0496006b71b70766ef16d57753cbcf037897799c
Add a script that can inject a <uses-sdk minSdkVersion=""> into
AndroidManifest.xml files. This will help with merging
LOCAL_STATIC_ANDROID_LIBRARIES, because ManifestMerger treats
a missing minSdkVersion as minSdkVersion=1 and throws errors
if libraries use a larger minSdkVersion. It will also help
with cases where an app has a manifest that specifies an old
minSdkVersion, but the build system is compiling the app in
a way that is not compatibile with old devices, for example
using a newer dex format.
Bug: 110167203
Test: m java
Test: build/soong/scripts/manifest_fixer_test.py
Change-Id: I528d71a225feb86464c530e11b223babb0ea9edf
Test: Manually checked-in prebuilt metalava.jar to my local src tree and
compare the doclava based api file and metalava based api file.
Bug: b/78245848
Change-Id: Ib434f1e15403a78a0ccf89d9aacb70a6f8b05b2b
Add core-lambda-stubs to the bootclasspath for modules with no
sdk_version or with sdk_version: "current", and to the classpath
for modules that specify a specific sdk_version number. Use the
prebuilt sdk-core-lambda-stubs when using a prebuilt SDK.
Fixes compiling modules with lambdas against the SDK.
This reapplies I5e700f2dd86f1a6b84b7a55dd9bfe21a448d3fb6 with fixes
and tests for unbundled builds.
Bug: 80428539
Test: java_test.go
Change-Id: Ib7aaeebb93137270d7336a7293a08ed7064a3184
Add core-lambda-stubs to the bootclasspath for modules with no
sdk_version or with sdk_version: "current", and to the classpath
for modules that specify a specific sdk_version number.
Fixes compiling modules with lambdas against the SDK.
Bug: 80428539
Test: java_test.go
Change-Id: I5e700f2dd86f1a6b84b7a55dd9bfe21a448d3fb6
didn't remove the props: api_filename, removed_api_filename yet since
these two currently are used by java_sdk_library.
Bug: b/78034256
Test: m clean && m checkapi
Change-Id: Iebd014ef227487717b5b3819c80d630c34559983
If a static android library lib1 has static_libs: ["lib2"] then the
R.class files for packages in lib2 will be merged into the jar for
lib1. If an app has lib1 in its static_libs it will get the R.class
files from lib2 through lib1, instead of regenerating the R.java
files with numbering that matches the resource table of the app.
Pass transtive static android library dependencies on the aapt2
command line so that aapt2 will always regenerate the R.java
constants for those packages.
Also extract the packages that have R.java files after each aapt2
invocation. This is not necessary for Soong, but is passed to
make to let it force regenerating the packages using
--extra-packages.
Bug: 78300023
Test: m checkbuild
Change-Id: I0f3444af44d2a9f370d1f156c908972f8cc3a1ee
extract_srcjars.sh uses zipinfo and unzip, which fail with an
error on an empty zip file. Instead of trying to hack around
this (which is hard to make guarantees for since they are
non-hermetic host tools), replace them with a go tool to unzip
a set of zip files into a directory.
Bug: 73885582
Test: m checkbuild
Change-Id: I151fed347ed5196726e36866ffc27bc831799afb
So that the Path and similar functions can be used directly, without
manually adding something like configErrorWrapper (it just uses it all
the time now).
Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
Support Droiddoc to Soong based on core/droiddoc.mk. The non-std doclet
based droiddoc compilation output is a "real" stubs.jar instead of a
directory of java files and a timestamp file.
The std doclet based javadoc compilation output is a "empty" stubs.jar
instead of a timestamp file.
The stubs.jar will be exported to
out/target/common/obj/JAVA_LIBRARIES/$(LOCAL_MODULE)_intermediates/classes.jar
and out/target/common/docs/$(LOCAL_MODULE)-stubs.jar
A $(LOCAL_MODULE).zip file will be generated also, and is exported to
out/target/common/docs/$(LOCAL_MODULE)-docs.zip if property: installable is not set
to false.
Bug: b/70351683
Test: unittest + convert libcore docs Android.mk to Soong manually.
Change-Id: I1cffddd138a5d9d445f86a3d4a3fd4de88a2bc0f
(cherry picked from commit 78188ec622cb1ee24171455867fc58ffab91562e)
Rsp files are supported through helper script (gen-kotlin-build-file.sh)
that generates the kotlinc module/build xml file.
Since rsp files are supported, I've added ExtractSrcJarsCmd step
to handle srcjars extraction.
Minor reorderings to make sure that TransformKotlinToClasses
recives only .java and .kt files when called from Module.compile.
Bug: 73281388
Test: make -j hidl-doc
Change-Id: I5a40b914569018dc529903a7f2864a5aeae838e5