Commit graph

832 commits

Author SHA1 Message Date
Colin Cross
5c4791c71e Move TestEnforceRRO test cases into test function
The test cases will need to reference buildDir, which is not
yet set at global variable initialization time.

Bug: 123510624
Test: TestEnforceRRO
Change-Id: I0dda0184dfab496c820e11ed76b7594a60d5d587
2019-02-06 10:18:09 +00:00
Colin Cross
571cccfcbc Prepare for a type-safe OnceKey
Add an opaque OnceKey type and use it for all calls to Once in
build/soong.  A future patch will convert the arguments to
Once* to OnceKey once users outside build/soong have been updated.

Test: onceper_test.go
Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
2019-02-06 01:52:41 +00:00
Colin Cross
feec25b084 Move dexpreopt.Script to android.RuleBuilder
Move dexpreopt.Script to android.RuleBuilder so that the builder
style can be used in more places.  Also add tests for it.

Test: rule_builder_test.go
Change-Id: I92a963bd112bf033b08899e930094b908acfcdfd
2019-02-05 13:28:43 -08:00
Colin Cross
5f692ec219 Remove empty DepsMutator methods
Add an empty DepsMutator to ModuleBase so it doesn't have to be
implemented on every module that doesn't need it.

Test: all soong tests
Change-Id: I545a832a0dbf27386d3080377a75ea482cd9ce59
2019-02-01 17:17:58 -08:00
Colin Cross
a74ca046da Replace *[]string with []string in product variables
There is no need for *[]string, []string can already hold a nil
value to specify "not set".

Test: all soong tests
Change-Id: I85a51b042c12aee1565a9287d62924feeeafd486
2019-02-01 16:43:02 -08:00
Treehugger Robot
d0da240a2d Merge "Enable last released check for SystemApi" 2019-01-31 15:45:02 +00:00
Anton Hansson
704595aa60 Merge "Allow excluding specific overlay sub-directories" 2019-01-31 10:52:22 +00: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
Anton Hansson
94c93f37cb Allow excluding specific overlay sub-directories
This change allows PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS to
refer to subdirectories of directories in PRODUCT_PACKAGE_OVERLAYS,
e.g.:
PRODUCT_PACKAGE_OVERLAYS := foo/overlay
PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS := foo/overlay/packages/apps/HelloWorld

Bug: 118823052
Test: m nothing (soong tests)
Change-Id: Ic9f89c11d023ea1b4f6f2f6683d94c81aa7b8a1b
2019-01-30 16:07:56 +00:00
Adrian Roos
e8cc556bf7 Merge "Add last released API check to checkapi for public Android API" 2019-01-30 09:31:58 +00:00
Victor Hsieh
d181c8ba76 Rename preferCodeIntegrity to useEmbeddedDex
Test: build and run testing app
Bug: 112037137
Change-Id: Ia82c2c3ba7eb32117a4be078ac31ee2ba510f9eb
2019-01-29 13:09:10 -08:00
Colin Cross
15daf44967 Merge "Fix aar rules" 2019-01-26 04:55:03 +00:00
Colin Cross
f57c57825e Fix aar rules
aar files should build to the module out directory, not the root of
the out directory.  Also give the rules a description so they get a
better status line.

Test: m out/soong/.intermediates/frameworks/base/packages/SystemUI/SystemUI-core/android_common/SystemUI-core.aar
Change-Id: Ie8de0421427985c466d909f83c8e0146f7e0bea8
2019-01-25 13:29:12 -08:00
Jaewoong Jung
9d22a914bf Add a prod var to override package names.
Currently only java/app.go is affected by package name overrides. When
the var is used, the corresponding module's install APK name is changed
to the overriding name.

Bug: 122957760
Test: app_test.go + TreeHugger
Change-Id: Ie522da3d7280970d740d779cf2694560feae6180
2019-01-25 19:11:57 +00: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
d15d614214 Merge "Make boot classpath jars in apexes uncompressed." 2019-01-25 12:10:33 +00:00
Anton Hansson
7171ffa97f Merge "Parameterize RRO test" 2019-01-25 10:14:05 +00:00
Nicolas Geoffray
5921f75b7c Make boot classpath jars in apexes uncompressed.
Save some space on /system by avoiding a copy in the .vdex files.

Test: m && /system/framework/boot-*.vdex files doesn't contain dex code.
Change-Id: I10cdcfe46a36a49a75f7640e20d065912812ab9f
2019-01-25 09:04:15 +00:00
Colin Cross
44c29a8fe1 Clean up srcjar directories after each rule
The srcjar directories just confuse people looking for generated
files, clean them up after each rule.

Test: m checkbuild
Change-Id: If712ce7d4922619fd8420ae8f89830fe7824114d
2019-01-25 00:53:05 +00:00
Colin Cross
39c1679e69 Fix conflicting srcjar dir for current and last apicheck
Each rule needs its own srcJarDir.

Bug: 123222452
Test: m checkbuild
Change-Id: I23c62b75c7532eca9320b12235a102141d6eeefa
2019-01-25 00:52:50 +00:00
Tor Norbye
60eed0ee25 Merge "122452571: Fix path to android.jar in prebuilts" 2019-01-25 00:00:53 +00:00
Colin Cross
7788c1283f Remove annotation_processors property
Now that there are no uses left of annotation_processors remove
the property.

If there are no annotation processor classes for javac for a module,
due to an empty "plugins" property or using kapt for annotation
processors, pass -proc:none to javac to ensure it does not try
to run any annotation processors found in the classpath.

Bug: 77284273
Test: plugin_test.go, kotlin_test.go
Change-Id: I3823d9fec8d3d07d2e49b1d97839f7fcbdd35647
2019-01-24 23:48:04 +00:00
Tor Norbye
ebcdfed262 122452571: Fix path to android.jar in prebuilts
The --android-jar-pattern flag passed to metalava is used to
find all the prebuilts for previous API levels such that
it can compute the exact API level for each class and member.

At some point the prebuilts must have been moved without this
code getting updated.

This fixes
Bug: 122452571: Can't build app with Q prebuilt SDK with minSdkVersion=21
Test: make sdk; inspect api-versions.xml

Change-Id: I25f6203725391dc5404cb8b6049479c9c3da1699
2019-01-24 11:09:16 -08:00
Anton Hansson
0375a4f481 Parameterize RRO test
Makes it easier to add more test cases.

Bug: 123300034
Test: m nothing
Change-Id: Ice5df7afbd55c3a4f9edf60e13bf6b850a485370
2019-01-24 17:49:20 +00:00
Jaewoong Jung
590b1ae37c Minor refactoring of generateAndroidBuildActions.
The function became a gigantic machine, so I decided to split it up to
smaller, logically self-contained pieces to provide better readability.

Test: app.go + TreeHugger
Change-Id: I50e5767ed779078b2d8c60c39c3951b0b5a191d7
2019-01-24 14:56:29 +00:00
Jaewoong Jung
2ad817c65d Enable certificate overrides with product vars.
Currently it is only for android_app, though it can be easily ported to
apex.

The make-side change will be made later, along with a real application.

Bug: 122957760
Test: app_test.go
Change-Id: I41f0be84f8b9f93e9518a16160e10eaa649388cd
2019-01-24 14:55:58 +00:00
David Brazdil
9d085dea9e Merge "Disable all-assigned check in hiddenapi on master-art" 2019-01-24 09:38:13 +00:00
Nicolas Geoffray
f343872a8d Align jar file after calling merge-zips when dex is uncompressed.
Noticed this while changing a some dex build rules.

Test: m
Change-Id: I9838e81e0e98be49d34554041a5a942b64259aaa
2019-01-24 06:38:14 +00:00
Colin Cross
3a3e94c09a Fix kotlin annotation processing after java_plugin
I37c1e80eba71ae2d6a06199fb102194a51994989 broke kotlin annotation
processing with a typo in the processors flag to kapt and by
passing -processor to javac with an empty processorpath.

Bug: 77284273
Bug: 122251693
Test: kotlin_test.go
Test: m checkbuild
Change-Id: I17c45d5b3f9df089231af5d2930646ad0e6bf9be
2019-01-23 16:14:21 -08:00
David Brazdil
91b4e3e78b Disable all-assigned check in hiddenapi on master-art
Master-art configurations do not have frameworks/base and therefore do
not have hidden API flags. Pass --no-force-assign-all to `hiddenapi`
when frameworks/base does not exist to disable the corresponding
assertion. This enables us to enforce the assertion on non-master-art
builds and also get rid of logspam about missing flags on ART buildbots.

Test: art/tools/buildbot-build.sh on master-art
Bug: 123143676
Change-Id: I074d9554fb11dab3eef904016375730520107ec2
2019-01-23 22:55:41 +00:00
Colin Cross
be9cdb8d64 Replace annotation_processors with plugins
Follow bazel's modules for annotation processors by introducing
a java_plugin module type that can contain extra metadata about
the annotation processor, the processor class and a flag to
specify if the annotation processor is compatible with the
turbine optimization.  Deprecate the annotation_processors
property, which took a list of java_library_host modules, in
favor of the plugins property, which takes a list of java_plugin
modules.  The annotation_processors property will be removed
once all uses have been replaced with plugins.

Bug: 77284273
Test: plugin_test.go
Test: m caliper
Change-Id: I37c1e80eba71ae2d6a06199fb102194a51994989
2019-01-23 20:17:51 +00:00
Steven Moreland
c4efd9cb55 jarjar_rules: accept file-group
This allows a jarjar rule to be shared among multiple targets in
different directories.

Bug: 86259915
Test: use filegroup jarjar_rules
Change-Id: I3fa476c4e87e2460ab9fabfb34229f471c80e6b0
2019-01-23 18:05:18 +00:00
Nicolas Geoffray
65fd8ba2fe Always do zipalign with uncompressDex.
Also preserve the alignment with hiddenapi.

Test: conscrypt apex has its conscrypt.jar zipaligned.
Change-Id: I43cc0eadb9548c3d8055e12c077fb7bbe1935fe6
2019-01-23 06:36:48 +00:00
Colin Cross
e153382e17 Merge changes from topic "kapt"
* changes:
  Pass annotation processors to kotlinc
  Move kotlin to it's own file
2019-01-23 02:18:12 +00: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
Jaewoong Jung
de4c02f855 Minor code/comment cleanup for app.go.
1. We no longer need AndroidApp.extraLinkFlags.
(https://r.android.com/c/platform/build/soong/+/691332)
(https://r.android.com/c/platform/build/soong/+/792280)
2. Early break in the for loop to find --product flags.
3. Minor var name / comment updates for readability.

Test: app.go / TreeHugger
Change-Id: Iecea3e7cd319267c680422343ded5f7f8e69d0cd
2019-01-22 11:24:50 -08:00
Colin Cross
21fc9bbe19 Move kotlin to it's own file
kapt is going to make kotlin a little more complicated, move the
rules and tests to their own files.

Bug: 122251693
Test: m checkbuild
Change-Id: Ieed78b97995ced210b710bd50c357514cc8e3bc6
2019-01-22 16:32:11 +00:00
Nicolas Geoffray
f8c06c159e Merge "Don't install java libraries that are already in an apex." 2019-01-22 07:48:05 +00:00
Colin Cross
2c77ceba34 Build java_sdk_library modules when UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true
java_sdk_library modules are usually disabled in favor of prebuilts
when TARGET_BUILD_APPS is set.  Keep them enabled when
UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true, which is used by some unbundled
builds built from a full source tree like mainline modules.

Bug: 123183568
Test: m TARGET_PRODUCT=mainline_modules_arm UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true TARGET_BUILD_APPS=com.android.media
Change-Id: Ifa940769e467ca4b7ad3b95106e184c00680d2ae
2019-01-21 12:18:39 -08:00
David Brazdil
0f670a22df Replace hiddenapi-{public,private}-list.txt with a CSV file
`hiddenapi` is being refactored to work with a single CSV file as
opposued to a multitude of text files (one per flag). This patch
changes the singleton rule for listing public/private APIs from
stubs to expect a CSV as an output.

Bug: 119068555
Test: compiles, hiddenapi-flags.csv unchanged
Change-Id: I622521d59979a6b01ecc8065a278412fedf7b9bc
2019-01-21 14:30:49 +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
Tor Norbye
76c875a796 Update signature files to the new format
The new format is described in tools/metalava/FORMAT.md.

Fixes: 116589402 Switch signature files over to the v2 format
Fixes: 112626813 Drop "synchronized" modifier from the signature format
Fixes: 122358225 Omit overriding methods that only differ in final [...]
Fixes: 73088715 API Review: Need doclava to output nullability
Fixes: 79739773 API Review: Metalava enforcing constants are constant
Exempt-From-Owner-Approval: Large-scale tooling change
Test: make sdk, make update-api, make checkapi
Merged-In: I8314f4e7099fa92e4f8ed7d283ccf836cc9a84a0
Change-Id: I828ec5ea2f879ebf8dd4ead651e9c9d2345f52e0
2019-01-19 21:36:07 -08:00
Colin Cross
cd964b3ea1 Maintain uncompressed dex through hiddenapi encode
hiddenapi encode unzips and rezips the dex jar.  Pass uncompressDex
into it so that it doesn't make classes.dex compressed in the dex
jar when it was previously uncompressed.

Bug: 123100239
Test: m checkbuild
Test: zipinfo $OUT/system/framework/conscrypt.jar shows uncompressed classes.dex
Change-Id: If36cde330eb0bcb1e1db3c582452c5faebc8ff29
2019-01-19 06:10:00 +00:00
David Brazdil
9fc36a68d0 Restore UNSAFE_DISABLE_HIDDENAPI_FLAGS functionality.
It got broken with the move to hiddenapi to Soong.

Test: UNSAFE_DISABLE_HIDDENAPI_FLAGS=true m -j32
Change-Id: Id369bfae8e118907b1f12faa7e4207494904edda
2019-01-18 11:12:33 +00:00
Colin Cross
5a1af88dd5 Use module name as intermediates name for android_app modules
Use foo.apk instead of package.apk for the intermediate package for
a module named foo.

Fixes: 122996822
Test: m checkbuild
Change-Id: I38058a54038e1c2eeaefc0f0e7f450a74a3e96a7
2019-01-17 14:57:50 -08: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
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
Jaewoong Jung
a4d4570e91 Merge "Enable arch variant properties in prebuilt_etc." 2019-01-17 20:59:00 +00:00
Jaewoong Jung
b9a11518bc Enable arch variant properties in prebuilt_etc.
Bug: 122332178
Test: Soong unit tests + TreeHugger.
Change-Id: Ia8fab0add09478599398e8cbb703debc39f658f6
2019-01-17 09:02:34 -08:00
Ashley Rose
e36efcfa93 Relax restriction on sharded annotation processors
Bug: 77284273
Test: m framework
Change-Id: If617bcf65b5d04ecb81227a9a8b76bbd78ea8598
2019-01-17 11:29:09 -05:00