Commit graph

278 commits

Author SHA1 Message Date
Nan Zhang
9cbe677024 Fix the issue for incorrect logic of "no_framework_libs"
Fortunately Android stubs jar generation didn't get affected by this
issue since "framework" and "ext" were explicitly added to the "libs"
property:

https://cs.corp.google.com/aosp-master/frameworks/base/Android.bp?rcl=72fa61b3250529504a9f5dab2e927a0d2e873f58&l=876

Test: m -j android_stubs_current and check the build.ninja to see if
addtional "framework" and "lib" are shwon there.
Bug: b/70351683

Change-Id: I9f1eec0d7f8baff6361efef064b7a09a5b2d4a58
2018-03-21 17:56:39 -07:00
Przemyslaw Szczepaniak
170ab730ec Merge "Add support for renamed kotlin stdlib." 2018-03-21 10:16:19 +00:00
Nan Zhang
28c68b9a76 Changes *api_filename properties droiddoc.go
Test: check build.ninja, and compare file content.
Bug: b/70351683
Change-Id: I385100f5c5c5354bec04a6435b735e92834a3512
Merged-In: I385100f5c5c5354bec04a6435b735e92834a3512
2018-03-20 11:40:50 -07:00
Przemyslaw Szczepaniak
66c0c4067f Add support for renamed kotlin stdlib.
Added new CompilerProperty flag, rename_kotlin_stdlib, which
allow to build kotlin libraries/binaries that use platform internal
version of kotlin stdlib (com.android.kotlin.*). This way, app-provided
kotlin standard library won't collide with version used internaly.

+ remove kotlinc-build.xml after compilation so it won't end up in the
result jar file

+ remove *.kotlin_module and *.kotlin_bultin filesfrom result jar file.
These files are needed only by kotlin-reflect library and
need more work to support kotlin-stdlib renaming.

Bug: 73281388
Test: java_test.go
Change-Id: Iae7ccb919e2ae9853b3f30f3dd447ebd01a1bed0
2018-03-20 12:55:19 +00:00
Colin Cross
21f8080d86 Merge "Replace extract-srcjars.sh with zipsync tool" 2018-03-19 20:33:08 +00:00
Logan Chien
45d4f09f2f Merge changes I406c5bef,Ibde685d7,I1c09412d
* changes:
  Allow VNDK extensions under vendor or device
  Add unit tests for android/neverallow.go
  Extract failIfErrored() to android/testing.go
2018-03-16 01:57:31 +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
Colin Cross
1eb9f090e0 Merge "Update turbine command line flags" 2018-03-15 22:39:28 +00:00
Logan Chien
4203971351 Extract failIfErrored() to android/testing.go
Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests
Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
2018-03-15 11:02:38 +08:00
Colin Cross
924a0aa7d5 Update turbine command line flags
The latest version of turbine requires a -- after the javac
options, and uses multiple --bootclasspath arguments instead
of a javac-style colon separated list.

Test: m javac-check
Bug: 74339924
Change-Id: Ib7096294a43e9bd30abc36751299bfac7879f765
2018-03-13 22:22:49 -07:00
Dan Willemsen
54daaf0371 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).

Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
2018-03-12 15:48:26 -07:00
Nan Zhang
b2b33de3c0 Fetch generated srcs from java libs for droiddoc.
api-stubs, system-api-stubs and etc need generated sources and srcjars from "framework",
so add a property that tell module to fetch srcs and srcjars from its
dependency libraries. The libraries in that property has to be in the
module's classpath.

Also add doc_defaults targets.

Bug: b/70351683
Test: m -j
Change-Id: I05831fbcad488037710950e4f05dc8fb2a12f403
2018-03-09 10:53:42 -08:00
Treehugger Robot
e9b02776f4 Merge "Rename stubsjar to stubsSrcjar for droiddoc" 2018-03-09 09:42:29 +00:00
Treehugger Robot
0343d020b3 Merge "Use turbine's native source jar support" 2018-03-09 03:35:22 +00:00
Nan Zhang
ccff0f78ba Rename stubsjar to stubsSrcjar for droiddoc
Test: m -j core-docs
Bug: b/70351683
Change-Id: I65f310d68a5a940fe88ccce4a22110548c15c306
2018-03-08 17:29:32 -08:00
Dan Willemsen
6424d17a2d Allow proto properties in cc/java_defaults
Test: Add proto.canonical_path_from_root: true in a cc_defaults
Test: Add proto.canonical_path_from_root: true in a java_defaults
Change-Id: I9ddfc8af0025705a34b6e487225f1f98915054c3
2018-03-08 13:34:34 -08:00
Colin Cross
6981f658ef 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
2018-03-07 15:14:50 -08:00
Treehugger Robot
984285de31 Merge "droiddoc supports no_framework_libs." 2018-03-06 23:10:22 +00:00
Colin Cross
300f038848 Only add SDK file dependencies on device builds
Dependencies on sdk_vcurrent, etc. should only be added to java
modules that are building for the device.

Test: aosp-build-tools build
Change-Id: I01abba94fed8b470085529092263f4634dec229c
2018-03-06 21:32:32 +00:00
Nan Zhang
e66c727392 droiddoc supports no_framework_libs.
follow: https://android-review.googlesource.com/c/platform/build/+/618046

Don't build agianst framwork libs when "no_framwork_libs" set to true.

Test: m -j
Bug: b/70351683
Change-Id: If6d37fac20c2b401aa30c31c14f1463300623a0e
2018-03-06 12:59:27 -08:00
Przemyslaw Szczepaniak
e3d26bf978 Pass bootclasspath to kotlinc
Lack of bootclasspath causes lack of libcore classes when compiling
code that would run on a device.

Bug: 73281388
Test: make hidl-doc
Change-Id: I2172740c4e318a7e24d0a40d967ccc91b7226338
2018-03-05 16:06:42 +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
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
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
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
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
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
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
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
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
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
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
Nan Zhang
674dd932d8 Add Respfile support for soong_zip.
Sometime the size of our command line passed to soong_zip go program
exceeds the cmdline size limit. So add an RespFile support with "@" special
character prefix.

The args in the cmdline will be considered together with the
args in RespFile during soong_zip running.

Test: real tests in my local machine, and compare the
res/libphonenumber.jar before and after changes.

./cmd -o test.zip '""'-C -> [./cmd,-o,test.zip,""-C]
./cmd -o test.zip '-C -f -> [./cmd,-o,test.zip,-C -f]
./cmd -o test.zip '\"'-C -f -> [./cmd,-o,test.zip,\"-C -f]
./cmd -o test.zip '\\'-C -f -> [./cmd,-o,test.zip,\\-C -f]
./cmd -o test.zip '\a'-C -f -> [./cmd,-o,test.zip,\a-C -f]

./cmd -o test.zip \'-C -> [./cmd,-o,test.zip,'-C]
./cmd -o test.zip \\-C -> [./cmd,-o,test.zip,\-C]
./cmd -o test.zip \"-C -> [./cmd,-o,test.zip,"-C]

./cmd -o test.zip "'"-C -> [./cmd,-o,test.zip,'-C]
./cmd -o test.zip "\\"-C -f -> [./cmd,-o,test.zip,\a-C -f]
./cmd -o test.zip "\""-C -f -> [./cmd,-o,test.zip,"a-C -f]

Bug: b/72484223

Change-Id: I83c3630b70c8396c8e8a3f266244d868d754c4e8
2018-02-13 15:13:01 -08:00
Tobias Thierer
f5801db4cc Merge "Revert "Support filegroup in exclude_srcs"" 2018-02-09 09:56:59 +00:00
Tobias Thierer
606e9de344 Revert "Support filegroup in exclude_srcs"
This reverts commit f36a3d9b6d.

Reason for revert: Broke several builds. I'm acting build cop, reverting.

Bug: 70351683

Change-Id: I775ada4e9cb6473519d51420b41b818af163da44
2018-02-09 09:46:11 +00:00
Treehugger Robot
a9e0fabae1 Merge "Support filegroup in exclude_srcs" 2018-02-09 06:49:28 +00:00
Colin Cross
f91a08caca Disable duplicates warnings when merging jars
There are too many duplicates warnings, disable them until someone
is actually looking at them.

Bug: 69316739
Test: m checkbuild
Change-Id: I7b3315f999dff1c01b6df37ab5ca83f7b8a60bd9
2018-02-08 01:15:39 +00:00
Nan Zhang
f36a3d9b6d Support filegroup in exclude_srcs
Test: add unit-test, m -j32
Bug: b/70351683
Change-Id: Iff83c56d45dd668d9df6131c7df2e23e5c73a21b
2018-02-07 10:18:41 -08:00
Sundong Ahn
8222d3b31e Change the naming policy of system_$(VER)
The module name of system_$(VER) prebuilt file is system_sdk_v$(VER).
But this is inconsistent with sdk_v$(LOCAL_SDK_VERSION) in
prebuilts/sdk.
So, system_sdk_v$(VER) is changed to sdk_vsystem_$(VER) to use the same
naming policy.

Bug: 72031391
Test: build
Change-Id: I3f18b7969dda208beeefdcaefadcc42db5c1577e
2018-02-06 23:51:14 +00:00
Jiyong Park
750e557011 Support 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 other sdk  (e.g.
current) or without sdk.

Bug: 72206056
Test: m -j
Change-Id: I778e7b4fcb9456a12b418ffd633ea78e29951e84
2018-02-07 07:35:36 +09:00
Nan Zhang
5f8cb424aa Add property to enable adding tools.jar to bootclasspath.
Converting Doclava to Soong need tools.jar as one of its bootclasspaths.

Test:  m doclava
Bug: b/70351683
Change-Id: I0ac65fcbe1eadfc57239cde2e83b80cf441a9b69
2018-02-06 11:01:51 -08:00
Nan Zhang
ffe2c1c369 Change syntax for jacoco filter wildcard params.
originally:
.* -> /**/*.class
now:
.* -> /*.class
.** -> /**/*.class

Also add NinjaAndShellEscape to allow filtering inner classes with $ in
the name.

Test: unittests.
Bug: b/71889972
Merged-In: Ifb8d7daa22bee02346885171edb15180af18f0de
Change-Id: Ifb8d7daa22bee02346885171edb15180af18f0de
(cherry picked from commit c61066684d5c8ddf600af602852c32fce6e6c6f4)
2018-01-29 12:46:26 -08:00