Commit graph

96 commits

Author SHA1 Message Date
Jaewoong Jung
ccbb393651 Add android_app_import.
This is an initial version that handles the most basic cases.

Bug: 128610294
Test: app_test.go + prebuilt webview.apk
Change-Id: Ic525559aad5612987e50aa75b326b77b23acb716
2019-05-01 10:06:47 -07:00
Treehugger Robot
02cbe8f1c6 Merge changes Id93bcaea,Ia8f9f910
* changes:
  Pass --remove-tools-declarations to manifest merger
  Don't use merged manifest for android_library modules
2019-04-25 14:47:37 +00:00
Colin Cross
226586ca3c Merge "Support target.hostdex.required" 2019-04-25 00:06:00 +00:00
Colin Cross
90c25c6893 Don't use merged manifest for android_library modules
Don't use the merged manifest for android_library modules.  We
still have to run manifest merger for android_library modules
because Make can't handle transitive dependencies, so it will
continue to merge the manifests at each library, and then merge
the manifests of direct dependencies into the final application.

Bug: 113294940
Test: m checkbuild
Change-Id: Ia8f9f910bd0a134730ddf2d542460eeddbc0a075
2019-04-24 14:40:14 -07:00
Colin Cross
7f87f4fdeb Support target.hostdex.required
Hostdex modules sometimes need extra required modules, add
target.hostdex.required.

Bug: 131167818
Test: manual
Change-Id: I599f3499f0b738556baeb27185371a42b4c2701b
2019-04-24 20:43:14 +00:00
Colin Cross
e8a7dc987c Export proguard_dictionary for java_library modules
Move exporting LOCAL_SOONG_PROGUARD_DICT from AndroidLibrary
to Library so that it is exported for java_library modules.

Test: m checkbuild
Change-Id: I27ea08ad8ba9072d0648c141cdbaf447c5268f91
2019-04-24 12:52:42 -07:00
Jaewoong Jung
9aa3ab1f3f New AndroidMk authoring system based on entry map.
The new system collects all Android.mk variable assignments using a map
and writes them to io.Writer. Compared to the previous system, which
directly writes all entries to buffers, this new system is more robust
and test-friendly.

Test: Built without prebuilt_etc.go change and diffed the mk output.
Test: prebuilt_etc_test.go
Change-Id: Idd28443d129ff70053295015e69328a8fa3eca47
2019-04-22 15:32:44 -07:00
Vladimir Marko
0975ee0de3 Check package restrictions for Java libs.
Test: m checkbuild; inspect verbose log.
Test: Manual - compile with unmet restrictions.
Bug: 122937705
Change-Id: I9360ae8b6d9ce016b7827be5e8ffc6eb521809b7
2019-04-08 14:02:14 +01:00
Sasha Smundak
b6d230515e Implement host_required and target_required properties.
They are counterparts of LOCAL_HOST_REQUIRED_MODULES and
LOCAL_TARGET_REQUIRED_MODULES respectively.

Fixes: 128693436
Test: treehugger, convert cts/hostsidetests/devicepolicy/Android.bp
Change-Id: Id66ffca6edffe18993ac51e8930f1d0e78178249
2019-04-04 11:24:01 -07:00
Paul Duffin
42df144fd4 Add java_test_helper_library
Extracts testSuiteComponent() function to reduce duplication.

Bug: 128969758
Test: atest CtsJdwpTestCases
Change-Id: I23746b18112d22f8670666f429a665b34b1955fd
2019-03-25 11:48:01 +00:00
Anton Hansson
53c88448fd Separate device and product overlays
This change adds book-keeping of whether an overlay came from
DEVICE_PACKAGE_OVERLAYS or PRODUCT_PACKAGE_OVERLAYS. This is
later used when writing the output to soong_app_prebuilt.mk, to
use either LOCAL_SOONG_[DEVICE|PRODUCT]_RRO_PACKAGES depending
on the original source.

This change is intended to be a noop on its own, but allows a
follow-up make change to customize the location of the auto-generated
RRO packages.

Bug: 127758779
Test: verify noop on presubmit targets
Change-Id: Ib24fe1d05be132c360dd6966f7c83968c9939f77
2019-03-21 11:25:46 +00:00
Colin Cross
42be761ebd Add dex_import module type
Add a module type for importing a prebuilt jar that contains
classes.dex files.

Test: m with a prebuilt jar that contains classes.dex files in
      PRODUCT_BOOT_JARS
Test: java_test.go, dexpreopt_test.go, dexpreopt_bootjars_test.go
Bug: 124804356
Bug: 125517186

Change-Id: I496848f9dca11f758d49b1cb68168cec7f8e1718
2019-03-20 19:29:59 +00:00
Colin Cross
e560c4aabc Support package_splits
Pass the package_splits list from the property to aapt2 as
--split arguments, sign the extra outputs, install them, and
add them as extra output files for SourceFileProducer.

Bug: 127921149
Test: TestAppSplits
Change-Id: Id94a53ae6a8a68ec81e98abba2fefc9c23feaa7a
2019-03-19 23:33:47 +00:00
Colin Cross
deabb94380 Add RuleBuilder.Installs().String()
Add a RuleBuilderInstalls type for a slice of RuleBuilderInstalls,
and give it a String() method that returns the list of installs
in the format that is convenient for passing to Make.

Test: rule_builder_test.go
Change-Id: I2e9cd9abf4dfb0ad312d0a6662f1567baf9cd222
2019-02-13 08:03:29 -08:00
Jaewoong Jung
9109d72785 Add Android.mk lines for package name overriding.
This ensures the overriding/overridden packages are processed as intended
when producing the final system image.

Bug: 122957760
Test: Manual tests with Browser2, BrowserGoogle, and Chrome
Change-Id: Ica05e53601b27c73de7f5c3bfcb9000103a11db6
2019-02-07 07:15:45 -08:00
Adrian Roos
62e34b9f38 Enable last released check for SystemApi
Test: make droid
Bug: 123222452
Change-Id: I952ec3d64a51fb892b14146a7fe38db358bea476
2019-01-30 19:51:39 +01:00
Adrian Roos
e3fe481c5a Add last released API check to checkapi for public Android API
Test: make droid
Bug: 123222452
Change-Id: I2b0b6c9196bfb963bd6085554ff6fdcc9cb53942
2019-01-25 17:18:18 +00:00
Nicolas Geoffray
4bdea39ad2 Don't install java libraries that are already in an apex.
This need to have -hostdex rules not look at the installFile.
In the near future, all -hostdex files come from jars that are in an apex.

bug: 119868597
Test: m
Change-Id: I4423626c5ced5d098ddd97c122fbfced54f817fc
2019-01-21 14:02:17 +00:00
Colin Cross
56abb83628 Set LOCAL_PREBUILT_MODULE_FILE for hostdex modules
Java modules with hostdex: true have to manually create an extra
androidmk entry, which was missing LOCAL_PREBUILT_MODULE_FILE.

Test: m checkbuild
Change-Id: I9ecb853e149c83282738178f74c1c3a263d203cc
2019-01-17 22:19:21 +00:00
Sundong Ahn
054b19a131 Support core library
To support core library, "Openjdk9", "No_standard_libs" and metalava
properties are added to java_sdk_library.
If core_lib is true, dist paths are changed to
apistubs/core/....
impl library name is changed to {module_name}.jar instead of
{module_name}.impl.jar

Bug: 110404779
Test: m -j
Change-Id: Ieb6248ea714b4260333d8bf61573d4f3413f7f24
Merged-In: Ieb6248ea714b4260333d8bf61573d4f3413f7f24
(cherry picked from commit af4907fed7)
2019-01-16 22:00:17 -08:00
Colin Cross
ebb83dfdde Revert "Set LOCAL_PREBUILT_MODULE_FILE for hostdex modules"
This reverts commit 462963b513.

Reason for revert: broke emma turbine build

Change-Id: I2e49bb127e1eb5006e7e27a59c4e85efa63bb38e
2019-01-16 01:38:56 +00:00
Colin Cross
462963b513 Set LOCAL_PREBUILT_MODULE_FILE for hostdex modules
Java modules with hostdex: true have to manually create an extra
androidmk entry, which was missing LOCAL_PREBUILT_MODULE_FILE.

Test: m checkbuild
Change-Id: I0fb50196fe01ba9eb0c4aef446e7c8f28bbaec12
2019-01-14 14:13:51 -08:00
Colin Cross
12fc2af30c Export dex jars from java binaries
Set LOCAL_SOONG_DEX_JAR and LOCAL_SOONG_BUILT_INSTALLED for
java binaries to install the jar with classes.dex and the
preopted files.

Bug: 122831369
Test: m deployagent
Change-Id: I6018aee25491e0c77a5f6dc464668d2bf6c317c0
2019-01-14 12:46:44 -08: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
Pete Gillin
581d608468 Add check_nullability_warnings support to droidstubs.
This takes the warnings file written by metalava and diffs it against
the expected (checked-in) file, in a manner similar to the checking
and updating of the signature files. This makes it possible for a
developer adding a large API surface (e.g. by moving to a new version
of upstream sources for ojluni) to do so without being blocked on
adding the annotations, while ensuring that at all times there is an
up-to-date record of the API surface which is missing annotations.

Bug: 73448108
Test: See the other change in this topic.
Change-Id: If9ed470ef3355a0d713bb556b5561fb255e4e277
2018-11-01 15:28:04 +00:00
Colin Cross
a54974c806 Pass AAR to make
Pass the output AAR file to make, where it will be copied to the
dist directory if requested by an unbundled build.

Test: m checkbuild
Change-Id: I126a81bd4b8ad0eeade99638ce9c2aa4579935bb
2018-10-31 14:39:47 +00:00
Colin Cross
f623721c08 Create bundle modules suitable for bundletool
Create a bundle module in addition to creating an APK, which can
then optionally be merged with bundle modules from builds for
other architectures and then be passed to bundletool to create an
app bundle.

Bug: 117295826
Test: tapas RecoveryLocalizer && m dist
Change-Id: I98a17d7407dc56823ece9ec88c087780185a6555
2018-10-31 14:39:16 +00:00
Jiyong Park
c00cbd9e7b APEXs are signed with apk signer
The entire APEX (which is a zip file) is signed with the apk signer.
Certificate can be specified via the 'certificate' property just like
ordinary apps. Note: multiple additional certificates are not supported.

Bug: 115721587
Test: m apex.test
Test: jarsigner -verify -verbose -certs .../apex.test.apex shows the
certificate info

Change-Id: Ia4c898d3427779a3809fdc683b85d7661ca65137
2018-10-31 10:13:54 +09:00
Colin Cross
252fc6f422 Add android_test_helper_app
Add a module that can build an APK that will be used by a test.
The APK will be sideloadable, and can be added to a test suite,
but will not autogenerate a test config file.

Test: m checkbuild
Change-Id: Idf325b1c9a2cbcd16b126da3331671e4aed4b3da
2018-10-08 15:26:00 -07:00
Colin Cross
a4f08813a3 Add support for JNI libraries to android_app modules
Make android_app modules a MultiTargets module, which means the
common variant will have a list of Targets that it needs to handle.
Collect JNI libraries for each Target, and package them into or
alongside the APK.

Bug: 80095087
Test: app_test.go
Change-Id: Iabd3921e1d4c4b4cfcc7e131a0b0d9ab83b0ebbb
2018-10-08 15:20:56 -07:00
Nan Zhang
d23ac69a35 Export Api-versions.xml generated by Soong
Test: m -j
out/target/common/obj/PACKAGING/api-stubs-docs_generated-api-versions.xml
Bug: b/78245848

Change-Id: I951ac6294b1cdab3904009897efb8139c7c4f1a2
Merged-In: I951ac6294b1cdab3904009897efb8139c7c4f1a2
2018-09-19 05:39:46 +00:00
Nan Zhang
71bbe63526 Add jdiff support for Soong
Test: api-stubs-docs-diff
Bug: b/78245848
Change-Id: I069f6f8b1f9aa74ae1425cd5b792643d05b26820
2018-09-18 14:07:30 -07:00
Nan Zhang
1598a9e099 Split doclava run from metalava target.
Originally when metalava sees arg: "--generate-documentation", it will
create a seperate process to invoke javadoc/dokka.

Now this is handled by our build system. Basically metalava target will
only generate a .srcjar file. Any other droiddoc target which generates
docs can depend on this metalava target.

By doing this, if multiple doc targets depending on the same metalava
sources. The metalava won't need to be re-run by multiple times which
could cause quite some timing overhead.

Test: m clean && m -j core-docs and
compare the results using md5sum between the old and new content.
also m clean && m -j core-current-stubs-gen-docs and
compare the results using md5sum  between the old and new content.
Bug: b/78245848

Change-Id: If7deef0da738645efe7d3a8376ff2bb3dec92c01
2018-09-11 15:41:50 -07:00
Mathew Inwood
ebe29ce4c6 Adapt special case framework support.
I'm adding a annotation processor to the framework target that does not
run as part of the main build, but only for a parallel build target
framework-annotation-proc, which is identical to framework except that it
also runs an annotation processor. Update build rules to be aware of this
target so that it builds successfully.

Test: m framework-annotation-proc
Bug: 113853502

Change-Id: I8b20758dc8bd0e8cb2542414d7a45a2cd7d2e158
2018-09-04 14:57:44 +01:00
Nan Zhang
66dc236781 Add support for dumping proguard api file.
Test: ref go/ag/4783442
Bug: b/70351683
Change-Id: I0aedd41686535c9a662b935003b80634e56663e0
Merged-In: I0aedd41686535c9a662b935003b80634e56663e0
(cherry-picked from commit: 26c055258b)
2018-08-22 13:59:48 -07:00
Colin Cross
331a1213b0 Don't pass resources to r8
R8 complains when it gets dex files in the input jar, but some tests
use dex files or dex jars as resources.  Keep resources separate
from classes until after r8 has been run.

Test: java_test.go
Test: m checkbuild
Change-Id: I1d9164d60d6b054ebb138648da07d80ee769177f
2018-08-16 17:03:56 -07:00
Colin Cross
d96ca35779 Support data properties in java_test and android_test
Files in the data property will be passed to
LOCAL_COMPATIBILITY_SUPPORT_FILES in Make.

Test: m checkbuild
Change-Id: Ifc074317f957aba8f55daa30abc5b9737d1eceac
2018-08-14 15:44:39 -07:00
Colin Cross
303e21f695 Move autogenerated test config into Soong
Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.

Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
2018-08-14 15:44:08 -07:00
Jason Monk
d4122be915 Support overrides for android_app
Test: use it
Change-Id: I61b933b757081f08a417e66a8c02d62916bd3f8b
2018-08-10 09:52:36 -04:00
Colin Cross
5fa9d6f445 Use 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.  Use
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: I8ccbcd34adf268a830ee1a203270b955ea696701
2018-08-08 21:48:39 -07:00
Julien Desprez
e146e39fa6 Support 'test_config' into soong modules
Test: make general-tests
Bug: 110982517
Change-Id: Ib2eab2653fdfce6f699b85c9fbc64558b6d40363
2018-08-07 15:51:21 -07:00
Dan Willemsen
a03c43a4a7 Mark soong-generated phony rules as PHONY
Test: add --writable=out/ to kati, see fewer warnings with this change
Change-Id: I4beb47f41888e3743b298c90edfeb38fcc0b3d32
2018-07-25 04:27:10 +00:00
Nan Zhang
03b733c936 Use Metalava based android.jar for SDK
Define LOCAL_DROIDDOC_ANNOTATIONS_ZIP to export zip file.

Test: m out/target/common/obj/PACKAGING/metalava-api-stubs-docs_annotations.zip
Bug: b/78245848
Change-Id: I66ca2a50adc095cc8a8a1a10620427a91480a9bc
2018-07-24 11:16:56 -07:00
Colin Cross
9ae1b927d4 Don't install java libraries by default
Very few java libraries need to be installed, most are statically
included in other modules.  Device modules that are not installed
also don't need to be dexed, saving checkbuild time.  Change the
default for java_library to not be installed, and allow libraries
that should be installed to specify installed: true.  This makes
java_libary and java_library_static identical.  It also simplifies
some corner cases when converting from Make to Soong if a module
is built for the host (which doesn't differentiate between static
and non-static/installable) and statically for the device, which
couldn't be represented in a single java_library in soong.

Bug: 110885583
Test: m checkbuild, compare presubmit target files
Change-Id: Idc0841c39a17cebd7bac3559c9408596d167a393
2018-07-11 05:35:59 +00:00
Colin Cross
83bb3167f6 Add support for min_sdk_version
Add min_sdk_version properties and use it for aapt2
--min-sdk-version and --target-sdk-version flags.  Add an sdkContext
interface that any function that needs an sdk version can take in
order to get the values for the current module.

Bug: 110848854
Test: m checkbuild
Change-Id: Ic69f1f935d8b865ec77689350407df08bfac5925
2018-07-09 12:42:01 -07:00
Jiyong Park
1be9691910 Export SDK library names
java_library, java_import, and android_library export SDK library names
that they are using directly or indirectly via its dependencies. When
building an apk, the manifest fixer uses the SDK lib names to
automatically add <uses-library> tags.

The SDK lib names are exported to the make world via
LOCAL_EXPORT_SDK_LIBRARIES flag.

Bug: 77575606
Test: m -j
Change-Id: I4fe606eb7ed23843c58eebe6a324405fe1da34e5
2018-06-20 12:13:33 +09:00
David Brazdil
fbe4cc32ed Support new Doclava flag
CL I5f92a54d718749f8ddef9472f3b6387a3debd385 adds a new "-dexApi" flag
to Doclava, which generates the public API as a list of Dex signatures.
Add support for this flag to Soong and expose it in the droiddoc rule.

Bug: 80461842
Bug: 64382372
Test: make out/target/common/obj/PACKAGING/hiddenapi-blacklist.txt
Change-Id: Iadf09f17bb783209a6555ce5289c381bf025a01c
2018-06-07 09:44:31 +00:00
Colin Cross
10f7c4a268 Export manifest to Make
I5d439353d46ba6659ec8d16967693d2b9e62ab5a will need the manifests
from android libraries to merge into modules that reference them
with LOCAL_STATIC_ANDROID_LIBRARIES.

Bug: 3434784
Test: m checkbuild
Change-Id: I47b9def5b9c2ecc423550eb8a988cce96038a81e
2018-05-24 15:24:12 -07:00