Commit graph

317 commits

Author SHA1 Message Date
Colin Cross
5507bc7fc8 Use and export proguard flags from static dependencies
Export proguard flags from Android library modules, and use them
from static dependencies in Android apps when running proguard.
Also export them to Make.

Unlike Make, which concatentates all the exported flags from
dependencies, Soong dedups exported flags files.

Bug: 73724997
Test: m checkbuild
Change-Id: I8f86fecb09cbc591832ce67e8ecef551a6600349
Merged-In: I8f86fecb09cbc591832ce67e8ecef551a6600349
(cherry picked from commit 89c31581a5)
2018-05-03 14:38:12 -07:00
Colin Cross
6a43fdbc3b Remove product-specific flags from android_library modules
Static android libraries should not get the product-specific
flags.

Bug: 73724997
Test: m checkbuild
Change-Id: I89e8c0a3fb788b18ee6603e9d21c9b9a5275f42f
Merged-In: I89e8c0a3fb788b18ee6603e9d21c9b9a5275f42f
(cherry picked from commit e78dcd313c)
2018-05-03 14:38:12 -07:00
Colin Cross
42b96648ca Add support for android_library modules
Add support for compiling android_library modules into AARs,
and refactor app support on top of it.

Bug: 73724997
Test: app_test.go
Change-Id: I1dfac5fffe577c6680bc4709147b2061eb7d819c
Merged-In: I1dfac5fffe577c6680bc4709147b2061eb7d819c
(cherry picked from commit a97c5d3f08)
2018-05-03 14:38:12 -07:00
Colin Cross
e6c053388b Don't use AppsDefaultVersionName for framework-res.apk
Some builds set AppsDefaultVersionName() to include the build
number ("P-123456").  aapt2 copies the version name of
framework-res into app manifests as compileSdkVersionCodename,
which confuses things if it contains the build number.  Use the
DefaultAppTargetSdk ("P") instead.

Bug: 78324052
Test: m TARGET_BUILD_WITH_APPS_VERSION_NAME=true Dialer
      aapt dump badging $OUT/system/priv-app/Dialer/Dialer.apk | grep compile
      shows compileSdkVersionCodename=P
Change-Id: If67f40aae1066d4ff3bf97da1b2de2e1e250ad9c
Merged-In: If67f40aae1066d4ff3bf97da1b2de2e1e250ad9c
(cherry-picked from commit 402d5e0919)
2018-04-25 15:23:57 -07:00
Colin Cross
9ccbc6036d Reverse RRO dir paths when passing to Make
LOCAL_RESOURCE_DIRS puts the highest priority overlay first, but
aapt2 expects the highest priority overlay last.  Soong stores the
list in aapt2 order (low to high priority), but that means when it
exports to Make as LOCAL_SOONG_RRO_DIRS, which goes to
build_rro_package.mk and then package_internal.mk, it gets reversed
again and comes out backwards.

Bug: 78032566
Test: m checkbuild
Change-Id: If72bf929fbf1d126f9051a2f21ec1eb4e3030e6e
Merged-In: If72bf929fbf1d126f9051a2f21ec1eb4e3030e6e
(cherry picked from commit a140bb05f1)
2018-04-18 15:26:55 -07:00
Colin Cross
e20c1b1904 Fix aapt2 --min-sdk-version after finalized SDK
aapt2 --min-sdk-version was using AppsDefaultVersionName(), which
is OMR1 for a non-finalized SDK, but 8.1.0 after finalization.
Add PlatformSdkCodename() for non-finalized SDKs, use it for
DefaultAppTargetSdk(), and pass it for aapt2 --min-sdk-version.

Bug: 78224641
Test: TestAppSdkVersion in app_test.go
Change-Id: I622eaf92f8a940f79007c2a579536da325700b06
Merged-In: I622eaf92f8a940f79007c2a579536da325700b06
(cherry picked from commit d09b0b653b)
2018-04-18 12:48:02 -07:00
Dan Willemsen
cb3bff1b65 Expose ProductVariables from TestConfig
In preparation for unexporting ProductVariables, explicitly return a
pointer to the structure from TestConfig / TestArchConfig.

Bug: 76168832
Test: m blueprint_tools
Change-Id: Iccfb4c912f8e0ee3f620cc1ee00f0cdc5cba7735
Merged-In: Iccfb4c912f8e0ee3f620cc1ee00f0cdc5cba7735
(cherry picked from commit 674dc7f7f0)
2018-04-17 10:34:23 -07:00
Dan Willemsen
050ca73dbf Use Config/DeviceConfig functions to access ProductVariables
An upcoming change will stop exporting ProductVariables from Config, so
switch to using existing accessor functions, and add more when they're
missing.

Bug: 76168832
Test: out/soong/build.ninja is identical
Change-Id: Ie0135bdbd2df3258ef3ddb53e5f8fc00aa9b97f7
Merged-In: Ie0135bdbd2df3258ef3ddb53e5f8fc00aa9b97f7
(cherry picked from commit 3fb1faeeb9)
2018-04-17 10:34:23 -07:00
Dan Willemsen
bf4f0a0965 Switch PackageContext functions to take a ctx
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).

Bug: 76168832
Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
Merged-In: I8cb524b09a84d0b8357d7c3501c71270af411e17
(cherry picked from commit 54daaf0371)
2018-04-16 19:27:14 -07:00
Martijn Coenen
4ed6f97d8f Merge "Add trace flag for cpp/Java AIDL generation." into pi-dev 2018-03-28 06:53:35 +00:00
Martijn Coenen
22071ca4b4 Add trace flag for cpp/Java AIDL generation.
The AIDL code generator can now include trace code in every generated
AIDL call. We don't want to enable this by default for all interfaces
for two reasons:
1) Potential performance overhead
2) For Java targets, the code depends on @hide APIs in android.os.Trace,
   and I haven't found a clean way to determine whether a target is
   allowed to use @hide stuff in the SDK. LOCAL_PRIVATE_PLATFORM_APIS
   is almost it, but it's not set for the core framework (which is
   exactly one of the things we'd like to trace).

Bug: 74416314
Test: verify correct code is generated when flag is set
Change-Id: Ic6ab8aee3e708207813da3e803911a844ff3e52b
Merged-In: Ic6ab8aee3e708207813da3e803911a844ff3e52b
2018-03-27 07:22:55 +00:00
Dan Willemsen
b785b61621 Allow proto properties in cc/java_defaults
(cherry picked from commit 6424d17a2d)

Bug: 73175642
Test: Add proto.canonical_path_from_root: true in a cc_defaults
Test: Add proto.canonical_path_from_root: true in a java_defaults
Merged-In: I9ddfc8af0025705a34b6e487225f1f98915054c3
Change-Id: I9ddfc8af0025705a34b6e487225f1f98915054c3
2018-03-22 20:51:04 -07:00
Logan Chien
7921d2d265 Merge changes I406c5bef,Ibde685d7,I1c09412d,I9bec563c,I34f06abd into pi-dev
* changes:
  Allow VNDK extensions under vendor or device
  Add unit tests for android/neverallow.go
  Extract failIfErrored() to android/testing.go
  RemoveFromList() should remove all matches
  Add unit tests for android/util.go
2018-03-22 07:36:51 +00:00
Colin Cross
0a7d85a896 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
Merged-In: I151fed347ed5196726e36866ffc27bc831799afb
(cherry picked from commit 436b76564d)
2018-03-20 11:21:42 -07:00
Colin Cross
f2986f067b Use turbine's native source jar support
Turbine doesn't need extract_srcjars.sh, just pass the source jars
with --source_jars.

Bug: 74339924
Test: m checkbuild
Change-Id: Ie7fe06f5a9f5e29287cf79c2d46b23a676a03d41
Merged-In: Ie7fe06f5a9f5e29287cf79c2d46b23a676a03d41
(cherry picked from commit 6981f658ef)
2018-03-20 11:21:42 -07:00
Logan Chien
d44aa3b5c8 Extract failIfErrored() to android/testing.go
Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests

Merged-In: I1c09412d5988dca2cc1c5f041893b313ab1c163a
Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
2018-03-16 17:45:42 +08:00
Dan Willemsen
f66010de07 Turn GlobFiles into a Glob for files, use it am: 540a78c1ce am: f49ff89266
am: a7070c158c

Change-Id: I06f6cc4481f826de7f7923630c2de344c84603a6
2018-03-02 00:29:39 +00:00
Dan Willemsen
540a78c1ce Turn GlobFiles into a Glob for files, use it
GlobFiles had allowed results to be anywhere in the source tree,
restrict it to results within the current module directory.

Then use it for ExpandSources and other places where we only want files.
This fixes using '*' in cc_test's `data` property, which can only
support files.

The only thing this changes today is that java_resource_dirs and
java_resources no longer pass directories to soong_zip's -f argument.
core-libart previously added some icu directories, now it only passes
files.

Bug: 71906438
Test: only expected changes in out/soong/build.ninja
Test: add data: ["**/*"] to a cc_test, build successfully
Change-Id: Iff1bd8c005a48e431c740706d7e23f4f957d8b1d
2018-03-01 14:05:20 -08:00
Dan Willemsen
003e0f3d2a Merge "Add droiddoc_template" am: f6366cc0a1 am: 1ba2989d4f
am: 6f535b5476

Change-Id: I83324c0727741921d549b4435916b98087b07a83
2018-03-01 18:16:27 +00:00
Nan Zhang
429b71ea11 Change name of droiddoc target output to *-stubs.srcjar am: 3bb14200e2 am: b1e6641a77
am: 7f5686aee1

Change-Id: I81aa0f094cad9f7c00fa7dcbc77c758fccd2d4c4
2018-03-01 02:30:12 +00:00
Dan Willemsen
cc09097359 Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:

* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.

So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.

Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.

Test: m core-docs
Test: out/soong/build.ninja is nearly identical
      - line numbers in comments
      - adds directories to droiddoc template dependency lists, which
        is more correct, since we need to rerun on added or removed
	files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-03-01 02:10:51 +00:00
Nan Zhang
3bb14200e2 Change name of droiddoc target output to *-stubs.srcjar
Test: m -j core-docs
Bug: b/70351683
Change-Id: If8c00a9992d262b7cd4c95794073591dcc245bd2
2018-02-28 16:15:05 -08:00
Colin Cross
761955541f Merge changes I84868c92,If1690a70,Ia9aeb2ff am: d2092dbc0d am: 113265ec4c
am: a544914e5f

Change-Id: I5ffddc29b0006e763fef2cb2c4c315306a8a36d1
2018-02-24 01:08:43 +00:00
Colin Cross
d2092dbc0d Merge changes I84868c92,If1690a70,Ia9aeb2ff
* changes:
  Use PathForSource instead of PathsForSource
  Move AllowMissingDependencies check from PathsForSource to PathForSource
  Pass nil instead of []string{} to ctx.Glob* functions
2018-02-24 00:39:56 +00:00
Dan Willemsen
6c3ba6c46c Merge "Add proto.canonical_path_from_root" am: 7c695eb797 am: c530837d4c
am: fb408c8e6d

Change-Id: I6bfe260cc2c8d67f73bdbb1eb70ee1df6bf33de4
2018-02-23 21:00:53 +00:00
Dan Willemsen
7c695eb797 Merge "Add proto.canonical_path_from_root" 2018-02-23 20:38:10 +00:00
Colin Cross
480cd76672 Use PathForSource instead of PathsForSource
This reapplies If1690a708393964d3030cb908beaf7b6897c0084.

PathForSource does the AllowMissingDependencies check now, use it
instead of PathsForSource.

Test: m checkbuild
Change-Id: I84868c92ee43779f9b5c8b285dac92f5f87b018c
2018-02-23 11:31:45 -08:00
Colin Cross
77b3dc4172 Merge "Revert "Use PathForSource instead of PathsForSource"" am: 0c18d451d2 am: be6724dd30
am: dd5d40eb37

Change-Id: I0cabaeee1add960ea94ba2b06985655dcfe9efe8
2018-02-23 07:52:06 +00:00
Colin Cross
0c18d451d2 Merge "Revert "Use PathForSource instead of PathsForSource"" 2018-02-23 07:32:19 +00:00
Colin Cross
5a49e1c65e Revert "Use PathForSource instead of PathsForSource"
This reverts commit 9d37831dd3.

Reason for revert: Broke builds with ALLOW_MISSING_DEPENDENCIES=true

Change-Id: Ibff79642f747b83364c83d6b298334121028e02d
2018-02-23 07:08:43 +00:00
Colin Cross
10c7d51f6d Merge changes If1894fd9,Id7925999,I4fe11c3f,Iea2b0781,Id2c0a503 am: 1b5599e462 am: b3407069ee
am: 945aebf48e

Change-Id: Ie14264d306d957f92beca7070867d947773692b1
2018-02-23 02:44:01 +00:00
Treehugger Robot
1b5599e462 Merge changes If1894fd9,Id7925999,I4fe11c3f,Iea2b0781,Id2c0a503
* changes:
  Use PathForSource instead of PathsForSource
  Move AllowMissingDependencies check from PathsForSource to PathForSource
  Propagate errors out of validatePath
  Add t.Run and t.Helper to paths_test.go
  Remove unused intermediates parameter from ExistentPathForSource
2018-02-23 02:28:35 +00:00
Dan Willemsen
ab9f4268c0 Add proto.canonical_path_from_root
Historically, we've always passed '-I .' as the first argument to
protoc, essentially treating all proto file package names as their full
path in the android source tree. This would make sense in a monorepo
world, but it makes less sense when we're pulling in external projects
with established package names.

So keep the same default (for now), but allow individual builds to opt
into using local paths as the default names with
'canonical_path_from_root: false'. A cleanup effort and/or large scale
change in the future could change the default to false.

As part of this, run protoc once per input proto file, since the flags
may need to change per-file. We'll also need this in order to specify
--dependency_out in the future.

Bug: 70704330
Test: aosp/master build-aosp_arm.ninja is identical
Test: aosp/master soong/build.ninja has expected changes
Test: m
Test: Build protobuf test
Change-Id: I9d6de9fd630326bbcced1c62a4a7e9546429b0ce
2018-02-22 16:48:35 -08:00
Colin Cross
ddaecb786b Soong AAR prebuilt support am: fabb608b27 am: cb7137994f
am: dc425fe743

Change-Id: Icecd172a1bae483d0aad04f68dba30832a4b2dd3
2018-02-22 23:36:27 +00:00
Colin Cross
a833f3c1cc Add aapt includes for prebuilt SDK jars am: 9ca6942956 am: 022c52e269
am: 380c9a1f87

Change-Id: I1c5c4b13ffe7390953c9763e3090639b5eedd154
2018-02-22 23:36:22 +00:00
Nan Zhang
bfef411697 Droiddoc Support in Soong am: 581fd21e91 am: 2ea76706b3
am: a400bb400c

Change-Id: I5c317052e5b1cba68e04720db75cb07cdd7ca0f7
2018-02-22 23:25:14 +00:00
Colin Cross
fabb608b27 Soong AAR prebuilt support
Add support for android_library_import modules that take an
aar file.

Bug: 73724997
Test: m checkbuild
Change-Id: I670b56f0a3b7501d9478a6064a04d0cb9c1bb611
2018-02-22 14:54:47 -08:00
Colin Cross
9d37831dd3 Use PathForSource instead of PathsForSource
PathForSource does the AllowMissingDependencies check now, use it
instead of PathsForSource.

Test: m checkbuild
Change-Id: If1894fd98d8d757ebc3c1635d5fcea86f81bfc4a
2018-02-22 14:43:36 -08:00
Colin Cross
32f3898f0b Remove unused intermediates parameter from ExistentPathForSource
Test: m checkbuild
Change-Id: Id2c0a5039c2ec3b3795385c135ffec022ccd691e
2018-02-22 14:43:36 -08:00
Colin Cross
9ca6942956 Add aapt includes for prebuilt SDK jars
Add -I arguments to the aapt link command line if sdk_version is
set to a numbered SDK prebuilt jar.

Test: m checkbuild
Change-Id: Ieeadf84bc131ba94e0e4ee1b9eec7d1e80b31b19
2018-02-22 14:36:24 -08:00
Nan Zhang
581fd21e91 Droiddoc Support in Soong
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)
2018-02-22 11:14:13 -08:00
Colin Cross
aa008b4cb2 Merge "Use android.InList for inList" am: e35ad13004 am: 20b350b433
am: 3ef40fd3e4

Change-Id: Iaf540c0d55cbbf9780fcf2721f0a67de43902948
2018-02-22 04:20:12 +00:00
Colin Cross
0d0ba59ec3 Use android.InList for inList
Remove duplicate implementations of inList.

Test: m checkbuild
Change-Id: I6943b95f6d47e6722b9ff1ab61ab14c429fe33a0
2018-02-21 11:02:16 -08:00
Colin Cross
164315f4e9 Fix comment on how java rules handle unknown output files am: f7eac7a2ac am: a14eee8e4a
am: 4bc286eca9

Change-Id: I19e6cd473f0bd854e35a2e6ccc70fe2bccc02ed5
2018-02-20 18:20:49 +00:00
Colin Cross
f7eac7a2ac Fix comment on how java rules handle unknown output files
Test: none
Change-Id: I985e7961c87dd145d6eb2bd94cb8bdc43becc360
2018-02-20 17:54:00 +00:00
Nan Zhang
73ca4ec589 Merge "Revert "Revert "Support filegroup in exclude_srcs""" am: f28e32a2a5 am: 3aa79ee5f5
am: 6df794ebb4

Change-Id: If6f3707008c217dec95f991f3c8fa3585ce42b0b
2018-02-19 18:35:36 +00:00
Nan Zhang
27e284d2b0 Revert "Revert "Support filegroup in exclude_srcs""
This reverts commit 606e9de344.

Reason for revert: <try to fix the broken build yesterday>

Change-Id: I2963b9af63c7c7398159e5e9a1e448266e1c81d5
Test: unittest
2018-02-15 14:38:40 -08:00
Przemyslaw Szczepaniak
23c743abcc Add rsp and srcjar support to kotlinc build rule am: 4b5fe9d1b4 am: dae5bb8f25
am: 73d1deeea4

Change-Id: I1e065377fe78a39bb942a5dbcc781687490509c8
2018-02-15 12:03:46 +00:00
Przemyslaw Szczepaniak
4b5fe9d1b4 Add rsp and srcjar support to kotlinc build rule
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
2018-02-14 20:47:17 +00:00
Pete Gillin
dcb5234d13 Merge "Enable jacoco instrumentation of core-libart." 2018-02-14 10:46:32 +00:00