Commit graph

52 commits

Author SHA1 Message Date
Colin Cross
54a71e229b Add missing dependency on common javalib.jar
Building $OUT/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar
is no longer updating the common intermediates:
out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jar
after I25163e91886cea6941afa25cdb529ed053278dcb.  Add the missing
dependency on common javalib.jar, which already depends on common
classes.jar.

Bug: 119412419
Bug: 121194944
Test: rm out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jar &&
      m core-tests &&
      ls out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jar

Change-Id: Id463d159e46c82656c364fdb2dbe53f33ee1a103
2018-12-18 11:06:25 -08:00
Colin Cross
6db5b0ea9a Move dexpreopting to Soong
Move the dexpreopting logic into Soong.  Make modules will be
dexpreopted by executing the Soong logic in the standalone
dexpreopt_gen binary, which will generate scripts that will
perform dexpreopting for each module.  Export global configuration
as JSON to $OUT/dexpreopt.config, which will be used by
dexpreopt_gen and Soong, and per-module JSON configuration that
will be used by dexpreopt_gen.

This relands I59b20c931ee3e5a8d35eb30da4148691c5095502,
I39d580999947ee54cfefe875b57a028be5333bd7,
Ie7daa94e107d53eff075ca58dbe721bd9d7fc8c2 and
Ica006a007d112c232311435aaac0c0e476232b67, with a minor
update to match the changes made to dexpreopt_gen arguments
and a fix to correctly keep dexpreopt disabled on mac builds.

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: I25163e91886cea6941afa25cdb529ed053278dcb
2018-12-17 13:46:17 -08:00
Colin Cross
b8901d7fb8 Revert "Move dexpreopting to Soong"
This reverts commit e736c58043.

Test: none
Bug: 119412419
2018-12-14 11:49:55 -08:00
Colin Cross
e736c58043 Move dexpreopting to Soong
Move the dexpreopting logic into Soong.  Make modules will be
dexpreopted by executing the Soong logic in the standalone
dexpreopt_gen binary, which will generate scripts that will
perform dexpreopting for each module.  Export global configuration
as JSON to $OUT/dexpreopt.config, which will be used by
dexpreopt_gen and Soong, and per-module JSON configuration that
will be used by dexpreopt_gen.

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: I59b20c931ee3e5a8d35eb30da4148691c5095502
2018-12-12 17:21:22 -08:00
David Brazdil
59b6fd541d Replace hidden API lists with a single CSV
Combine existing hiddenapi-* txt files into a single CSV containing
a list of all class members and their corresponding flags.

Test: m, phone boots
Change-Id: I67f1b5f331b262e9b681d9a3c78c9e4cbb5ea082
2018-11-29 15:48:56 +00:00
Paul Duffin
50537afe99 Merge "Allow UnsupportedAppUsage annotations to be in separate target" 2018-11-01 10:22:53 +00:00
Paul Duffin
79d8bf25ea Allow UnsupportedAppUsage annotations to be in separate target
Previously, all the UnsupportedAppUsage annotations were assumed to be
in the same target as was used at runtime. e.g. frameworks,
core-libart, etc. This change allows separate targets to be specified
in the EXTRA_HIDDENAPI_JARS. It is needed to avoid maintaining local
patches for those annotations in the libcore/ojluni/src/main/java code
which comes from upstream OpenJDK.

This was tested by making and then manually checking that the generated
out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt was the
same (after sorting) before and after this change.

Test: see above
Bug: 117818301
Change-Id: Icfadbe52601371f6a4cabef106750b16f6c6d4c8
2018-10-31 10:33:38 +00:00
Colin Cross
74e4cf10bf Store AAR path from Soong for dist
Store the path to the AAR file from Soong so that it will be picked
up by dist if requested in TARGET_BUILD_APPS.

Test: m checkbuild
Change-Id: Ifeaf2b5ca3f405fbe79a966ceee9989a38d77f6e
2018-10-30 15:48:33 -07:00
Colin Cross
fc782ad949 Reduce the propagation of LOCAL_DEX_PREOPT := nostripping
nostripping causes confusing double negatives, allow nostripping
in LOCAL_DEX_PREOPT and DEFAULT_DEX_PREOPT, but convert to
LOCAL_STRIP_DEX outside of dex_preopt_odex_install.mk.

Test: m checkbuild
Change-Id: I996e9258ce20c394900d9fe937d638bc2ab8589d
2018-10-23 22:33:07 -07:00
Mathew Inwood
8c96298a92 Write greylist annotation metadata to a csv file.
Also add support for merging these into a single file elsewhere in the
build.

Test: m, inspect generated greylist.csv
Bug: 117314178
Change-Id: If28110fc1ed090222e55c274e8363110753d10f1
2018-10-16 12:06:02 +01:00
Mathew Inwood
edb1c84f03 Support for adding dark greylist members from annotations.
Currently, we support maxTargetSdk values of 26 & 28, corresponding to
the P blacklist (existing dark grey list) and upcoming Q blacklist.

For now, just put the two into the same list, as the runtime support to
distinguish between the two does not exist yet.

Bug: 114361293
Test: m
Change-Id: I2f8d206e8dd22afc6c0e98fb5e53b1d78a534125
2018-09-07 16:52:16 +01:00
David Brazdil
b67402ecce Support hidden API whitelist generated by class2greylist
Libcore has support for annotating a virtual method which is known
to change its return type in a future release. This annotation is
recognized by the dexer and a future-proof bridge method is created.
This patch integrates changes in class2greylist to support this
annotation into the build system and generation of hidden API lists.

Calling class2greylist on each boot classpath module now produces two
text files instead of one: signatures for greylisting and now also
whitelisting. They are passed on to the hidden API list generating rules
in frameworks/base.

Bug: 112186571
Test: m appcompat, diff public-list.txt whitelist.txt
Change-Id: I9861203e6e07a17d50850892ec13880971457d11
2018-08-23 10:38:03 +01:00
Colin Cross
7a504334cd Fix java soong_to_convert data
soong_to_convert looks for modules with no unconverted deps, but
the list of converted modules was not being updated for java and
app prebuilts.  That meant soong_to_convert only reported modules
with no deps at all.

Test: examine soong_to_convert.txt
Change-Id: I136e6fa74153a80df5ecd767642bb2feb2ddb9dc
2018-08-16 22:55:43 -07:00
Colin Cross
521b22cf66 Add soong_droiddoc_prebuilt.mk
Soong droiddoc modules were using soong_java_prebuilt.mk, but they
don't need any of the java logic from it, and it includes
base_rules.mk which was not included by droiddoc.mk.  Add
soong_droiddoc_prebuilt.mk that just installs the droiddoc
outputs without including base_rules.mk.

Fixes building docs modules in mm, mma, and m checkbuild.

Bug: 112388925
Test: m docs
Change-Id: I4f7262e2c3b1afbee44c1cc306330885b687a074
2018-08-09 11:24:11 -07:00
Mathew Inwood
48a7929962 Merge "Build rules to derive greylists from annotations." 2018-07-26 07:37:29 +00:00
Nan Zhang
28af1e7484 Merge "Copy annotations.zip to out/target/common/obj/PACKAGING/" 2018-07-24 22:44:12 +00:00
Mathew Inwood
04c58dea0b Build rules to derive greylists from annotations.
Uses the new class2greylist tool to extract API descriptors from .class
files.

Also add these generated greylist.txt files as dependencies of
INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST so they can be merged later in
the build.

Bug: 110868826
Test: m
Change-Id: I406587732b537f9b56768ad9909039dfab34c334
2018-07-24 15:48:42 +01:00
Dan Willemsen
7a1da0e43e Mark more targets as PHONY
So that we can start restricting non-phony targets to $OUT_DIR and
$DIST_DIR.

Test: add --writable=out/, see fewer warnings
Change-Id: I411fe4af732b1bce35d4a4c1e2a47b5f8a15e6b8
2018-07-24 01:21:12 -07:00
David Brazdil
a94e4ca2c6 Make classes.jar the output of uninstallable Soong Java modules
The soong_java_prebuilt.mk file used to assume that if a Soong module
defines a dex jar, it is the output of the module and the module is
installable. This may now not be true if the module uses 'compile_dex'
to define a secondary build rule for a dex jar. If the module is not
installable (LOCAL_UNINSTALLABLE_MODULE=true), do not attempt to preopt
and copy classes.jar to the modules output destination.

Bug: 79409988
Test: on related CL
Change-Id: Ica958ac793e09a0e52125448b44e7cd36e7f35d5
2018-07-03 17:10:54 +01:00
Nan Zhang
77a8b394ee Copy annotations.zip to out/target/common/obj/PACKAGING/
Test: m out/target/common/obj/PACKAGING/metalava-api-stubs-docs_annotations.zip
Bug: b/78245848
Change-Id: I283e046afb0c6e420d251e9c974835a4ec2fbad4
2018-06-26 13:25:18 -07:00
Colin Cross
375d9618f6 Merge "Merge LOCAL_STATIC_ANDROID_LIBRARIES manifests" 2018-06-20 23:24:52 +00:00
Jiyong Park
1cf8ee619b Export SDK library names
A java module exports SDK library names that it is using directly or
indirectly via its dependencies. Manifest fixer uses the SDK lib names
to automatically add <uses-library> tags for the apk.

The SDK library names are exported via exported-sdk-libs file in make.
From Soong, they are exported via LOCAL_EXPORT_SDK_LIBRARIES flag.

Bug: 77575606
Test: m -j

Change-Id: I4e7a9bdc5bf845af85168abf55f8063900bacc72
2018-06-20 11:50:06 +09:00
Colin Cross
16f1dbc43c Merge LOCAL_STATIC_ANDROID_LIBRARIES manifests
Pass LOCAL_STATIC_ANDROID_LIBRARIES to ManifestMerger, and copy
manifests for prebuilts AARs and static android libraries to
$(intermediates.COMMON)/manifest/AndroidManifest.xml.

Bug: 78447299
Test: m java
Change-Id: I02ac29d3445fcd591101ff0ce215e60dd0997224
Merged-In: I02ac29d3445fcd591101ff0ce215e60dd0997224
Merged-In: Ib20aa4849978283f1da1ce601b28199fc0183e05
2018-06-16 07:55:41 -07:00
Colin Cross
43c247e181 Regenerate R.java files from LOCAL_STATIC_ANDROID_LIBRARIES
If a static android library lib1 has LOCAL_STATIC_ANDROID_LIBRARIES
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
LOCAL_STATIC_ANDROID_LIBRARIES 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.

This was worked around for support libraries by keeping a
fix_dependencies.mk that added transitive static support libraries
to the direct static dependencies of apps.  Instead, propagate
the packages that aapt2 generated R.java files for up as
--extra-packages arguments to the next aapt2 invocation, which
will force aapt2 to regenerate the R.java files for those packages.

Bug: 78300023
Test: m checkbuild
Change-Id: I7375e13241b4c4f2933032409fb7935abe133bfc
2018-05-02 13:11:08 -07:00
Colin Cross
42669e6dc7 Allow Soong to export multiple proguard flags files
Soong uses lists of proguard flags files from dependencies instead
of a single concatenated file.  Allow Soong to pass the list to
make, which will concatenate it.

Move the check inside ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
in case Soong exports an Android library with an empty
LOCAL_SOONG_EXPORT_PROGUARD_FLAGS.

Bug: 73724997
Test: m checkbuild
Change-Id: Ia8f229ec5f9fc99a23bd471dfa70c9de7316de94
2018-04-30 16:03:57 -07:00
Colin Cross
a90f4b297f Fix echo when copying package-res.apk
Bug: 73724997
Test: m checkbuild
Change-Id: Iad9f46e01c40d1993e279c6ea6dd9c60932064c8
2018-04-19 15:28:59 -07:00
Nan Zhang
0aa96a05fb Add dist-for-goals for droiddoc docs.zip
Old droiddoc will install the *-docs.zip & API files to the dist.

And also remove INTERNAL_PLATFORM_*API_FILE variables from config.mk and
get rid of the dependencies on api-stubs, system-api-stubs, test-api-stubs
timestamp.

Test: m -j api-stubs-docs
Bug: b/70351683
Change-Id: I08923bb5f62d2f55961d9a2865723d7b3fae7206
Merged-In: I08923bb5f62d2f55961d9a2865723d7b3fae7206
2018-03-20 11:42:23 -07:00
Treehugger Robot
d29f3e7026 Merge "Rename stubsjar to stubsSrcjar for droiddoc" 2018-03-09 09:42:29 +00:00
Nan Zhang
89f12b00f0 Rename stubsjar to stubsSrcjar for droiddoc
Test: m -j core-docs
Bug: b/70351683
Change-Id: I90e4df3ba002c7488f3a80066bf3723b6f299b04
2018-03-08 17:29:16 -08:00
Treehugger Robot
0b4b321565 Merge "Remove unnecessary link-type check" 2018-03-09 00:21:21 +00:00
Jiyong Park
98a4f52c28 Remove unnecessary link-type check
Modules from Soong do not have dependency specified (via
LOCAL_JAVA_LIBRARIES). So, link-type check 'from' them doesn't make
sense. Resetting my_warn_types and my_allowed_types

Bug: 69899800
Test: m -j checkbuild on aosp_walleye, aosp_sailfish
Test: build/soong/build_test.bash --dist
Change-Id: I2a409e64f388bd8cb9336be589bf6af33e48a6f4
2018-03-08 15:23:08 +09:00
Colin Cross
7874138a8a Allow soong java libraries to include exported resources and proguard flags
Test: m checkbuild
Change-Id: Ia02f816084d0eb1c0e0f20e1ecd57aaf3778874c
2018-03-07 09:48:33 -08:00
Nan Zhang
78c19aa9ef Fix the incorrect turbine flag.
Test: m -j java TURBINE_ENABLED=false
Change-Id: Id6ca380c97bbcd3731c815e37513b7e949cccdfb
2018-03-05 13:35:45 -08:00
Nan Zhang
9c98cb4815 Change name of droiddoc target output to *-stubs.srcjar
Test: m -j core-docs
Bug: b/70351683
Change-Id: I3fa696517175764b64a3b66d25ab04f02e561e51
2018-02-28 16:11:47 -08:00
Nan Zhang
cf9d50302a Export Make config vars to Soong to support Droiddoc
export Android.mk config vars to Soong, and export stubs.jar to Make
after compiling Droiddoc from Soong.

Bug: b/70351683
Test: Convert libcore docs Android.mk to Soong manually.

Change-Id: I749b4b3e1e50abce8a757130987c18d7135a3859
2018-02-15 16:10:21 -08:00
Treehugger Robot
c82c0a81ec Merge "Support LOCAL_SDK_VERSION := core_current" 2018-02-06 22:37:16 +00:00
Jiyong Park
5ebca30d21 Support LOCAL_SDK_VERSION := core_current
core_current is a pseudo SDK version which is a core Java API subset of
the Android API. It is expected to be mainly used for external Java
projects which are agnostic to Android; such as junit, guava, etc.

A module built with this SDK version can only link to java modules of
the same kind. It can't depend on modules built with LOCAL_SDK_VERSION
:= current or without LOCAL_SDK_VERSION.

Bug: 72206056
Test: m -j
Change-Id: I34a9696393aa6704fd6684a40ea5b05d3fb46b23
2018-02-01 17:14:55 +09:00
David Brazdil
b8fa6dd104 Revert "Revert "Apply hiddenapi build tool on boot jars""
This reverts commit 4a2926a44e.

Reason for revert: The original CL caused two issues:
1) Increased app startup because `profman` failed to verify boot
jars and created an empty profile for the boot image. All methods
in the framework therefore ran interpreted/JITed. New flag
"--skip-apk-verification" has been added to `profman` to fix
the issue in CL Iad614e47feada293218c11cff985a8012ca49a0f.
2) Caused a crash in Mockito CTS tests because jvmti did not
remove hiddenapi access flags from boot jars before using them.
This has been fixed with CL Ibc9a96a6b541c06844f276db009ac29514f7a3bb.

Bug: 64382372
Bug: 72550707
Test: make test-art-host
Change-Id: Ie8c58714455662f042f56b2977b01b75c5ec7d2f
2018-01-30 18:25:46 +00:00
Alex Light
4a2926a44e Revert "Apply hiddenapi build tool on boot jars"
This reverts commit b7f00ed2af.

Bug: 72550707
Bug: 64382372
Test: atest CtsInlineMockingTestCases

Reason for revert: Causing invalid dex files to be passed to jvmti
                   agents. This causes CtsInlineMockingTestCases and
                   other tests to fail.

Change-Id: I50129e94791b9e2bef919fe398b4250ae461195b
2018-01-26 18:16:52 +00:00
David Brazdil
b7f00ed2af Apply hiddenapi build tool on boot jars
Restrictions on usage of private APIs require encoding new information
into the dex files of the boot class path. ART now contains a new build
tool called `hiddenapi` which takes three lists of class member
signatures (blacklist, light and dark greylist), finds the class members
in their respective dex files and modifies their access flags in place.

This patch invokes the `hiddenapi` tool on all JARs in
PRODUCT_BOOT_JARS. For Java libraries built with Makefiles the tool is
invoked after the dexer directly on DEX files. For Soong-built
libraries, the build system has to unzip the JAR produced by Soong,
apply `hiddenapi` and rezip again. This is due to the fact that the
PRODUCT_BOOT_JARS variable is not available to Soong.

Bug: 64382372
Test: m
Change-Id: I6ce897d204459c8b6f46ed49e0909ff76c08a9ed
2018-01-25 09:22:08 +00:00
Colin Cross
8cd412feee Add dependency on jacoco-report-classes.jar
jacoco-report-classes.jar is found by a glob, so there is no
explicit dependency on it.  Add a dependency to javalib.jar so
that it gets installed.

Bug: 70295664
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true WITH_DEXPREPOT=false
Change-Id: Ia7feaa132879539f88c08a49148e4bbb5a141eab
2017-12-06 16:12:39 -08:00
Colin Cross
d2e54d2362 Fix dex_preopt with profile on a soong module
The oreo merge to AOSP master added a new variable that must
be set when dex preopting a java module with a profile.

Test: m checkbuild
Change-Id: Ib917761ea4fea481e32f3fb663a18b882a13f4a1
2017-12-06 16:12:39 -08:00
Sundong Ahn
5a44d1f069 Add LOCAL_SDK_VERSION := system_$(VER)
The system_$(VER) can be set in LOCAL_SDK_VERSION, and the apk will use
android_system.jar at build time.
If LOCAL_SDK_VERSION is not defined and this module is installed in
vendor.img, LOCAL_SDK_VERSION is set to system_current.

Bug: 67724799
Test: 1. build && run on taimen
2. LOCAL_SDK_VERSION:=system_27 in ims.apk && build ims.apk && check
the vsdk_v27_intermediates.

Merged-In: I5b11c78b8fcd4a2f2a5e3b141527cd34dbe80018
Change-Id: I5b11c78b8fcd4a2f2a5e3b141527cd34dbe80018
(cherry picked from commit ef212cbe8d)
2017-12-01 00:39:07 +00:00
Colin Cross
6d0ca1f6cc Copy soong java prebuilts to classes-pre-proguard.jar
Some robolectric rules assume that classes-pre-proguard.jar
exists.  Soong doesn't support proguard yet, so copy classes.jar
to classes-pre-proguard.jar for now.

Bug: 69917341
Test: m checkbuild tests
Change-Id: I818363ec13c2e5e1c4ab5bd6389ea4687de953eb
2017-11-29 20:46:32 -08:00
Colin Cross
3fec81d978 Add support for jacoco in soong
Use jacoco values exported from soong and copy
jacoco-report-classes.jar to where the jacoco-report-classes-all.jar
rule can find it.

Bug: 69629238
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false
Change-Id: If05381f415fb52a575746b8be0bfcd03d55b2153
2017-11-24 20:23:36 -08:00
Colin Cross
460205568f Add dependencies on classes.jar for soong modules
Make javalib.jar files copied from soong modules depend on the copied
classes.jar files.

Test: rm classes.jar && m modulename && ls classes.jar
Test: rm classes.jar && m javalib.jar && ls classes.jar
Change-Id: I5ab77960a43b07c214969834cb3472ed121c8828
2017-10-20 11:36:13 -07:00
Colin Cross
abfa40776f Add hostdex support for soong
When LOCAL_IS_HOST_MODULE is set LOCAL_BUILT_MODULE is the same
as common_javalib.jar, and dexpreopting shouldn't be enabled.

Bug: 67600882
Test: m -j checkbuild
Change-Id: I7397fa430ebc18d5cb6ba71b06e343180f09ae08
2017-10-09 17:37:49 -07:00
Colin Cross
f229de4a4b Enable dexpreopt and dex stripping in soong jars
Dexpreopt jars from soong, which also strips classes.dex from
javalib.jar.

Test: m -j checkbuild
Test: unzip -l $OUT/system/framework/core-oj.jar
Change-Id: I06b8efa8993f6c44f0ad8c988e57a3cba08e17ad
2017-10-06 14:36:38 -07:00
Colin Cross
7dc9043546 Allow disabling turbine
m -j TURBINE_ENABLED=false will build without turbine.  This is
primarily useful for A/B comparisions of turbine builds, but will
also be used to temporarily disable turbine for unbundled builds
until we have turbine prebuilts.

Bug: 64308460
Test: m -j TURBINE_ENABLED=false java
Test: m -j java
Change-Id: Ie48746c8bfc60c361be9634cb1805ca1c09aa1fe
2017-09-26 16:23:00 -07:00
Colin Cross
dcd6b243ac Add missing copy back to soong_java_prebuilt.mk
javalib.jar needs to be copied to both $(intermediates.COMMON)
and $(intermediates).

Test: m -j checkbuild
Change-Id: Ic2944691dced35c1e74d12f9948904cf748fe402
2017-09-20 18:07:41 -07:00