Commit Graph

158 Commits

Author SHA1 Message Date
Colin Cross 7cdc22edb9 Revert "Add core-lambda-stubs to classpath"
This reverts commit d9d7be0617.

Reason for revert: Broke unbundled builds.

Bug: 80428539
Change-Id: I2279dbd2b11a2f63e70ad89d0b3bc42bca2b676b
2018-05-30 05:45:09 +00:00
Colin Cross d9d7be0617 Add core-lambda-stubs to classpath
Add core-lambda-stubs to the bootclasspath for modules with no
sdk_version or with sdk_version: "current", and to the classpath
for modules that specify a specific sdk_version number.

Fixes compiling modules with lambdas against the SDK.

Bug: 80428539
Test: java_test.go
Change-Id: I5e700f2dd86f1a6b84b7a55dd9bfe21a448d3fb6
2018-05-29 23:47:50 +00:00
Colin Cross ae5caf554c Add support for android_test modules
android_test module are APKs that can be run as tests, either
as standalone unit tests or as instrumentation tests for another
APK.

Test: m checkbuild
Change-Id: I16661701637e4048fd99442029c3e195ebf373a4
2018-05-24 14:53:58 -07:00
Colin Cross 6af2e4980f Support platform_apis property
Add a platform_apis property.  The logic to verify it isn't
hooked up yet, but this will allow translating modules to
Soong without losing the annotation.

Test: m checkbuild
Change-Id: I75ff2d7b94247873f5bb1547a9b347a8e73c3191
2018-05-22 14:14:27 -07:00
Jiyong Park c678ad3f71 Adding java_sdk_library
java_sdk_library is to make a Java library that implements optional
SDK APIs to apps. It is actually a wrapper for several modules: 1) stubs
library that clients are linked against to, 2) droiddoc module that
internally generates API stubs source files, 3) the real runtime shared
library that implements the API, and 4) XML file for adding the runtime
lib to the classpath at runtime if requested via <uses-library>.

Note: this is only the initial CL for the feature. Followings are features
currently missing and under development.

1) check for API consistency
2) install stubs libs as the dist artifacts
3) ensuring that apps have appropriate <uses-library> tag
4) disallowing linking to the runtime shared lib
5) HTML generation

Bug: 77575606
Test: m -j

Change-Id: I4a4ccf6e730e041703c63bb275d8860d0de96887
2018-04-19 08:57:30 +09:00
Anton Hansson f66efeb4ef Migrate soong to use new sdk prebuilts.
Make is moved over in aosp/661963.

Bug: 77525052
Test: make
Change-Id: I04ea58964df3d4149ef09ab7ca9238336d338a06
2018-04-18 14:53:59 +01:00
Colin Cross a97c5d3f08 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
2018-04-16 15:24:47 -07:00
Colin Cross ff3ae9da74 Consistently use Bool instead of proptools.Bool
Use Bool instead of proptools.Bool and String instead of proptools.String.

Test: m checkbuild
Change-Id: I32d84add9f27128c7a65413e9612fd920613584f
2018-04-10 22:50:34 -07:00
Colin Cross 38b40dffd6 Use proptools.BoolDefault
Replace x == nil || *x with proptools.BoolDefault(x, true)

Test: m checkbuild
Change-Id: Icc5378cab3ea72d86544b40761c2f00b278cc0a1
2018-04-10 16:26:10 -07:00
Colin Cross 05638fc76f Add java_test and java_test_host
java_test is equivalent to a java_library with a default junit
dependency and marked as a test in Make for installation and
automatic AndroidTest.xml generation.

Bug: 70770641
Test: m checkbuild
Change-Id: I9ca97521e952d121db46abff6f24f274dd7a3ad7
2018-04-10 20:12:38 +00:00
Colin Cross f19b9bb981 Use built SDK stubs
Now that the SDK stubs are built in Soong, undo the hack that
uses the prebuilt stubs.

Fix the linktype checks to treat the various stubs libraries as
the correct type, since they can't be annotated with sdk_version.

Bug: 70351683
Bug: 77285514
Test: m checkbuild
Change-Id: I5e870c34dd0ebc8ae3f888ec627da590c846a76f
2018-04-10 17:06:21 +00:00
Colin Cross 559795114d Remove deviceProperties from BinaryHostFactory
java_binary_host should not include the device-only properties.

Test: m checkbuild
Change-Id: Ief6b0a0e98310f7a4f3684c4632f618d73f10bdd
2018-04-10 14:43:59 +00:00
Jiyong Park 2d4929464b Link type check for Android.bp defined Java modules
Link-type is also checked among Java modules defined in Soong. Until
now, the check has been done in between Soong/Make and Make/Make.

With this, a Java module can't depend on another Java module built with
larger API surface. For example, a java library built with Android SDK
(sdk_version: "current") can't link to a library built without SDK.

Bug: 73829976
Test: m -j

Change-Id: I64277be6e65e8535aad951b4f08f8d10b67abe66
Merged-In: I64277be6e65e8535aad951b4f08f8d10b67abe66
(cherry picked from commit f3586661e8)
2018-03-28 16:20:15 -07:00
Martijn Coenen eab15645fe 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-26 09:59:02 +02:00
Jiyong Park 924d35b926 Handle prebuiltDepTag for java modules
When there is a prebuilt java lib defined and there is a java library
with the same name, the reverse dependency from the java lib to the
prebuilt lib is added. However, the java library didn't recognize the
dependency type and causes error. Fixing the problem by not panicking on
such dependency.

Test: m -j
Test: m -j dist DIST_DIR=out/dist ANDROID_BUILDSPEC=vendor/google/build/app_build_spec.mk
Merged-In: I79673b2bb382100e42c5336e8041daa8c86fa857
Change-Id: I79673b2bb382100e42c5336e8041daa8c86fa857
(cherry picked from commit 46dbf9c63e)
2018-03-24 15:12:37 +09: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
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
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 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
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
Colin Cross 32f3898f0b Remove unused intermediates parameter from ExistentPathForSource
Test: m checkbuild
Change-Id: Id2c0a5039c2ec3b3795385c135ffec022ccd691e
2018-02-22 14:43:36 -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
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
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
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
Andreas Gampe f3e5b558e7 Soong: support Errorprone javacflags
Add support for an errorprone block in Java modules that accepts
additional javacflags for the errorprone build.

Sample:

    errorprone: {
        javacflags: ["-Xep:EqualsNaN:WARN"],
    },

Bug: 72004718
Test: m RUN_ERROR_PRONE=true
Test: manual - add block with ERROR to a project
Test: androidmk_test
Change-Id: I502248fe76c26aa19102f413af72a7324c35b7f4
2018-01-23 20:30:01 -08:00
Jiyong Park 1a5d7b1539 Add PLATFORM_SYSTEMSDK_VERSIONS and BOARD_SYSTEMSDK_VERSIONS
PLATFORM_SYSTEMSDK_VERSIONS is the list of System SDK versions that the
platform is supporting. Contrary to the public SDK where platform
essentially supports all previous SDK versions, platform support only a
few recent System SDK versions, since some of old System APIs are
gradually deprecated, removed from the following SDKs and then finally
deleted from the platform. This will be part of the framework manifest.

The list can be specified by setting PLATFORM_SYSTEMSDK_MIN_VERSION. If
it is set to an old version number, then System SDKs from the version
to the current version (PLATFORM_SDK_VERSION) are considered to be
supported by the platform. If PLATFORM_SYSTEMSDK_MIN_VERSION is not set,
only the latest System SDK version is supported.

Next, BOARD_SYSTEMSDK_VERSIONS is the list of System SDK versions that
the device is using. This is put to the device compatibility matrix
device is using. The device and the platform is considered as compatible
only BOARD_SYSTEMSDK_VERSIONS in the device compatibility matrix are
in the PLATFORM_SYSTEMSDK_VERSIONS in the framework manifest.

When BOARD_SYSTEMSDK_VERSIONS is set, a Java app or library in vendor or
odm partitions which didn't specify LOCAL_SDK_VERSION  is forced to use
System SDK. Also, the build system does the additional integrity check
to ensure that LOCAL_SDK_VERSION is within BOARD_SYSTEMSDK_VERSIONS or
PLATFORM_SYSTEMSDK_VERSIONS (if BOARD_SYSTEMSDK_VERSIONS isn't set).

Bug: 69088799
Test: m -j
Test: BOARD_SYSTEMSDK_VERSIONS=P m -j
Change-Id: Id38f02b4be86710411be22bc28109e6894f8a483
2018-01-19 15:42:18 +09:00
Sundong Ahn b5b5b2667d change vsdk_v$(ver) to system_sdk_v$(ver)
The vsdk name is change to system sdk, so vsdk_v$(ver) need to
change to system_sdk_v$(ver)

Bug: 67724799
Test: build & boot on taimen
Change-Id: I9ac508f5ed2602fbf827e0b0e4c205ab01915525
2018-01-16 09:51:03 +09:00
Colin Cross 3144dfc966 Add EMMA_INSTRUMENT_STATIC support
Add jacocoagent when instrumenting with EMMA_INSTRUMENT_STATIC.

Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true
Change-Id: I451bb9d16b7f0a66fd06c2da576062b28830e470
2018-01-04 14:52:45 -08:00
Colin Cross 84c3882e64 Fix jacoco_cli invocation
jacoco_cli --dest takes a directory, not a jar name, and assumes
an output file with the same name as the input jar in that
directory.  Rename jacoco-report-classes.jar to
jacoco-report-classes/modulename.jar, and generate to
jacoco/tmp/modulename.jar before combining to the final output file
at jacoco/modulename.jar.

Bug: 69669951
Test: m EMMA_INSTRUMENT=true
Change-Id: Ia7dd881d2819ae09dfb60a00b4c1b8396629cd9a
2018-01-03 16:02:47 -08:00
Colin Cross 66dbc0bc32 Add R8 support
Add support for R8 to optimize apps and java libraries.

Test: m checkbuild
Change-Id: I2afd5d7a84912d3ab613c32c599bd1ebe60562e0
2018-01-03 14:15:57 -08:00
Colin Cross f0056cb2ed Refactor dexing
Move dexing support into java/dex.go, including the rules and logic
from builder.go and the function from java.go.

Test: no change to build.ninja
Change-Id: I098d2a9774e28079ba44791679a0db6f876fe3e6
2018-01-02 18:23:43 -08:00
Colin Cross e6ddff68be Move jacoco before desugar
R8 will replace desugar+proguard+dx, which will mean jacoco has to
run before desugar.  In preparation, move jacoco before desugar now.

Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false tests
Change-Id: I5d98d2300ce83496f9b82c9b973f679701448474
2018-01-02 18:23:43 -08:00
Colin Cross 7fdd2b788c Pass OpenJDK 8's bootclasspath for host tools targeting <= 1.8.
Follow the Make change in I9b6081edfdd2c3e9a450ae8a39c4e32c3d2cda92
to explicitly pass the OpenJDK 8 bootclasspath when targeting <= 1.8.

Bug: 70862583
Test: java_test.go
Test: javap -c -p out/soong/.intermediates/external/guava/guava/linux_glibc_common/javac/classes/com/google/common/hash/AbstractStreamingHashFunction\$AbstractStreamingHasher.class  | grep ByteBuffer.flip
      shows java/nio/Buffer return type in signature.

Change-Id: Ief66bbf6e3a4220b3afb2e02009bd0157d4c7fae
2018-01-02 18:23:43 -08:00
Colin Cross 7b60cdd6e5 Strip module-info.class files when combining jars
Combining static jars from dependencies may bring in module-info.class
files, which don't make sense once multiple modules have been combined,
and sometimes confuse downstream tools like desugar.  Strip them out
like make does when combining jars.

Test: m checkbuild
Change-Id: I560c5acfcc6e1be9adf604c22cf200581f92f702
2017-12-21 14:29:56 -08:00
Colin Cross c5de1b6cb2 Remove --no-locals -> --release translation
--no-locals is never used any more, remove the translation.

Bug: 70886092
Test: m checkbuild
Change-Id: Ie89aaad618c12c288d7e7bca863834cf7ee824fb
2017-12-21 13:01:49 -08:00
Colin Cross 7a3139e05d Add jacoco filter tests
Add tests for converting jacoco filters to command line arguments
to soong_zip.

Bug: 64836607
Test: jacoco_test.go
Change-Id: I969fa877e4be19bb92dcab5a796a4e4ec3fc166a
2017-12-21 04:34:26 +00:00
Alan Leung c37c6343e2 Prep D8 default instead of CompatDX in build/soong
Bug: 69329508
Test: m checkbuild tests
Change-Id: Ibaa2d787c644cf25104af78305a6eed16028dcf0
2017-12-18 23:56:30 -08:00
Colin Cross 0f2ee15576 Support output params in java proto
Allow java modules using proto to specify output params to be
passed to the proto generator.

Test: m checkbuild
Change-Id: I8a06f07218073236f4f85996ea5f09fb3702ed1a
2017-12-15 13:42:09 -08:00
Colin Cross 366938f268 Allow java manifest property to reference filegroups
Also factor out ExtractSourceDep and ExpandSource.

Test: m checkbuild
Change-Id: Ibc253514bc3109d84ec388a05c66b8108af5d6ab
2017-12-11 16:30:14 -08:00
Alan Leung 9f319118e1 Add USE_D8_DESUGAR option in build/soong
Add an option to use D8's desugar instead of the standalone version.

USE_D8_DESUGAR=true m would trigger DCHECK in dex2oat unless
https://android-review.googlesource.com/c/platform/art/+/562595 is
patched in as well.

Bug: 69329508
Test: m && USE_D8_DESUGAR=false m

Change-Id: I864d88e257a2ba0b7f19aa5cced537301950e963
2017-12-11 16:05:51 -08:00
Colin Cross c331599a88 Allow java binary wrapper files to reference filegroups
Also allow commands with no tools for the case when standard
shell utilities are used to munge an input file.

Test: m checkbuild
Change-Id: Ie061e90cafe1a0a0db004a89e9a17fb48709cb03
2017-12-11 23:54:35 +00:00
Colin Cross 1bd8780881 Add more dex_preopt properties
Move dex_preopt to dex_preopt.enabled, and add dex_preopt.app_image,
dex_preopt.profile_guided, and dex_preopt.profile.  These values will
be passed back to Make if provided to control dex preopting.

Test: m checkbuild
Change-Id: I54a4b1de697a08be20ab65d2a5dc43ce0046692d
2017-12-06 13:27:56 -08:00
Colin Cross 6b4a32d771 Split java_binary modules into common and binary variants
Add a common_first multilib type and use it for java.Binary
so that the java part is compiled as a "common" arch type
but the wrapper script is installed as a "linux_glibc" arch
type.  This allows java_binary to be used as a tool dependency
for a genrule.

Bug: 68397812
Test: TestJavaBinary
Change-Id: I809060839ce8878300da3fb76426ceb1ea6b0e8e
2017-12-06 04:16:21 +00:00
Colin Cross 5425090a4f Add java_genrules to use jars as inputs and outputs
Add a java_genrule that has the right multilib flags to be a
dependency of a java rule.  Make java libraries implement
SourceFileProducer so that their classes jar can be used as an
input to a java_genrule.  Allow libs and static_libs dependencies
to be a java_genrule.

Test: TestJarGenrules
Change-Id: Ib1b31ef9c0b7e72eeed2c9ecc4ce8a1088e0b1c9
2017-12-06 03:55:20 +00:00