Commit graph

98 commits

Author SHA1 Message Date
Adam Vartanian
fa62cfc2aa Add Conscrypt to coverage
Bug: 73156932
Test: manual coverage run
Change-Id: I20dc1595ba55d8425bf16770c1f2e6e4fa8bffae
2019-03-13 13:46:14 +00:00
Colin Cross
87ecbfe107 Update manifest merger to use binary
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
2019-03-04 22:02:01 +00:00
Colin Cross
6db4d4e613 Optimize CPU time when running d8 and r8
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
2019-03-01 15:28:19 +00:00
Paul Duffin
d2acecaeb7 Improve hiddenapi processing so it does not require white list
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
2019-02-28 16:13:20 +00:00
Paul Duffin
c02e834ad6 Revert "Support libraries (not just boot jars) that have hiddenapi"
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
2019-02-27 12:49:21 +00:00
Paul Duffin
e5b5657f87 Support libraries (not just boot jars) that have hiddenapi
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
2019-02-15 14:35:30 +00:00
Colin Cross
f24a22a98a Move hiddenapi singleton rules to Soong
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
2019-02-06 11:23:40 -08:00
Colin Cross
afbb1734f6 Pass annotation processors to kotlinc
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
2019-01-22 21:47:19 +00:00
Colin Cross
8faf8fc060 Move hiddenapi to Soong
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
2019-01-17 22:19:28 +00:00
Neil Fuller
9b0d1f47fa Remove references to core-simple
core-simple was a demonstration jar and is being removed.

Bug: 119301609
Test: build
Change-Id: Ieb5e12ce0ce96f597da92660ea83dbf0e1860edb
2019-01-14 16:01:01 +00:00
Colin Cross
43f08db29e Dexpreopt soong modules inside soong
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
2018-12-15 19:07:54 -08:00
Colin Cross
4ff85ebeb7 Revert "Dexpreopt soong modules inside soong"
This reverts commit 29ff88741e.

Test: none
Bug: 119412419
2018-12-14 11:49:58 -08:00
Colin Cross
29ff88741e Dexpreopt soong modules inside soong
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
2018-12-13 15:53:54 +00:00
Zoran Jovanovic
8736ce29e8 Enable kotlinc flags in blueprint files
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>
2018-11-14 15:02:46 +00:00
Neil Fuller
bf210f7ea3 Build platform with core library stubs by default
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
2018-10-12 22:41:00 +01:00
Neil Fuller
1fee9f3dd0 Include all core libs in default boot classpath
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
2018-10-10 08:42:12 +00:00
Nan Zhang
4c819fb590 Add jetifier support in Soong.
This is a blocker for droiddoc targets migration under vendor/.

Test: N/A
Bug: b/72552006
Change-Id: If85a0917c1ac0d88b9d5b488216a638b4dabd39f
2018-08-29 11:37:32 -07:00
Neil Fuller
6095259f5b Track changes to add core-simple to the boot cp
See the change in build/make for details.

Bug: 113148576
Test: make checkbuild / Treehugger
Change-Id: I6f7901642c6b907b1e8e9dd31ced3bf1ea6dfd4d
2018-08-28 13:16:19 +01:00
Nan Zhang
86d2d55ade Support Dokka in Soong.
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
2018-08-10 13:37:24 -07:00
Colin Cross
cfae5a6e2c Use manifest merger in Soong
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
2018-07-11 05:52:26 +00:00
Colin Cross
7a5fe2bb7e Merge "Always use OpenJDK9 for building"
am: 5c733856bd

Change-Id: Ica65b1cc467db3bd5223aa1dd017e31728f93ca2
2018-06-21 14:56:43 -07:00
Colin Cross
5711acde4d Merge "Run ErrorProne in OpenJDK9"
am: 8eb0ad15bf

Change-Id: Ia4ceec4cc2fcb4bdd8565230d74bdb0cf972b89a
2018-06-21 13:57:26 -07:00
Colin Cross
997262f506 Always use OpenJDK9 for building
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
2018-06-21 12:25:50 -07:00
Colin Cross
6654810f37 Run ErrorProne in OpenJDK9
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
2018-06-20 21:03:16 -07:00
Colin Cross
3b20009ae0 Merge "Add a script to inject values into manifests"
am: f269dbee54

Change-Id: I4bd044917c098d15c8b394c3e7413004c003261b
2018-06-15 22:42:49 -07:00
Colin Cross
8bb10e8f8a Add a script to inject values into manifests
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
2018-06-14 14:54:27 -07:00
Colin Cross
7a72575d6d Merge "Revert "Revert "Remove desugar support""" am: 38462a6881
am: 216c4c8a7a

Change-Id: I4f148400379525f68e9f116ddcdb4b4ee36910a1
2018-06-07 15:49:11 -07:00
Andreas Gampe
331efc81ca Merge "Soong: Update for explicit warning change" am: 8a9f5da905
am: 24de8d76cd

Change-Id: I33918e5766d798a56c77b236a3e18041e231d0b7
2018-06-07 15:36:57 -07:00
Treehugger Robot
38462a6881 Merge "Revert "Revert "Remove desugar support""" 2018-06-07 20:31:22 +00:00
Treehugger Robot
8a9f5da905 Merge "Soong: Update for explicit warning change" 2018-06-07 19:55:54 +00:00
Andreas Gampe
05f08543d3 Soong: Update for explicit warning change
Add ErrorProneChecksWarning.

Bug: 72971960
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I92169ed4aa8e7dc52b84ddb005cd07e2bf6dcbe2
2018-06-06 16:38:45 -07:00
Colin Cross
0b16af4039 Merge "Revert "Remove desugar support"" am: 7302905413
am: ecf35d00ea

Change-Id: Ib829111904db2eeb3ec19b2d59c0c7bfe331b505
2018-06-06 16:26:14 -07:00
Colin Cross
d4bf7d9f89 Merge "Remove desugar support" am: 0d39cb1179
am: 406aa5fa90

Change-Id: I9555559eacb92cf0e7e89bf787b15967f748e327
2018-06-06 15:24:46 -07:00
Colin Cross
bafb897de7 Revert "Revert "Remove desugar support""
This reverts commit 7576916efc.

Reason for revert: includes art veridex fix this time

Change-Id: Ia8da00b5ec8ed3dc3ce2a2521f0a7b2b2b131960
2018-06-06 21:46:32 +00:00
Colin Cross
7576916efc Revert "Remove desugar support"
This reverts commit 000280bb0e.

Reason for revert: broke art veridex build

Change-Id: I9f7d7cdbe8e34671614687ac0b34c0338ef240e7
2018-06-06 21:42:39 +00:00
Colin Cross
000280bb0e Remove desugar support
Desugaring is always handled by d8 now.

Test: m checkbuild
Change-Id: I29e8f68e51b194a4090866acc63f19f0605e318d
2018-06-06 10:05:06 -07:00
Nan Zhang
7a9601ca8a Merge "Integrate Metalava to Soong Build" am: f181bc9733
am: ca96388e60

Change-Id: I97d233a78706c2a0964f125c4978a262642b9048
2018-06-06 01:16:41 -07:00
Nan Zhang
79614d1c14 Integrate Metalava to Soong Build
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
2018-06-05 14:44:43 -07:00
Colin Cross
fca70ee9af Add core-lambda-stubs to classpath am: 86a60ae6fa
am: d4ef9dd148

Change-Id: I30d8fe073e9956725d91b239138016adc52d4f0a
2018-05-30 16:00:01 -07:00
Colin Cross
86a60ae6fa Add core-lambda-stubs to classpath
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
2018-05-30 16:47:00 +00:00
Colin Cross
7588ddcfca Merge "Revert "Add core-lambda-stubs to classpath"" am: 6c2e97364e
am: 0668619db7

Change-Id: I95d37c8cc23d5079e4348d176c2206c38773de57
2018-05-30 00:35:23 -07:00
Colin Cross
7cdc22edb9 Revert "Add core-lambda-stubs to classpath"
This reverts commit d9d7be0617.

Reason for revert: Broke unbundled builds.

Bug: 80428539
Change-Id: I2279dbd2b11a2f63e70ad89d0b3bc42bca2b676b
2018-05-30 05:45:09 +00:00
Colin Cross
9781882d24 Add core-lambda-stubs to classpath am: d9d7be0617
am: 417824868d

Change-Id: Ia01d156c82c29042b160e844b34e70a4450de071
2018-05-29 20:30:26 -07:00
Colin Cross
d9d7be0617 Add core-lambda-stubs to classpath
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
2018-05-29 23:47:50 +00:00
android-build-prod (mdb)
2d8ea6cd06 Merge "Apicheck Support in Soong" am: 3a621d3a86
am: 2658508416

Change-Id: I9f93d174a97cbeb23bfaa451c3e6f830e69fb74a
2018-05-08 23:09:49 -07:00
Nan Zhang
61819cef14 Apicheck Support in Soong
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
2018-05-08 16:24:07 -07:00
Colin Cross
33dce942f2 Merge "Regenerate R.java files from LOCAL_STATIC_ANDROID_LIBRARIES" am: 93b4818201
am: c368d6196c

Change-Id: Iea1fb5b38ec54ed28b6f8b3c31aba3b43ec05b98
2018-05-02 15:03:20 -07:00
Colin Cross
66f78820e1 Regenerate R.java files from LOCAL_STATIC_ANDROID_LIBRARIES
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
2018-05-02 13:11:01 -07:00
Colin Cross
01801b3f50 Merge "Replace extract-srcjars.sh with zipsync tool" am: 21f8080d86
am: c48f545d17

Change-Id: Ia3f9cfd8f5d2e9ec11e64c8ef3cd63d1d5742ff2
2018-03-19 21:01:57 +00:00
Colin Cross
436b76564d Replace extract-srcjars.sh with zipsync tool
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
2018-03-15 16:42:43 -07:00