Commit graph

142 commits

Author SHA1 Message Date
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
Sundong Ahn
0926fae350 Add system_$(VER)
The system_$(VER) is added for vendor, similar to sdk.

Bug: 67724799
Test: build
Merged-In: I2545c92707591ca278066870c74e9f49e9825855
Change-Id: I2545c92707591ca278066870c74e9f49e9825855
(cherry picked from commit b8baff1fa3)
2017-12-01 00:41:59 +00:00
Colin Cross
5ab4e6d817 Allow building framework.jar and framework-res.apk
Update app support enough to build framework-res.apk, link
framework.jar against its generated files, and export it to
make.

Bug: 69917341
Test: m checkbuild tests docs
Change-Id: I7db29cd1f5fabb22e844483ecc7c38abfedbbe0a
2017-11-29 20:47:42 -08:00
Colin Cross
6510f91a1c Replace ModuleContext.AConfig() with Config()
AConfig() now duplicates Config().  Replace the uses of AConfig()
with Config().  Leave AConfig() for now until code in other
projects is cleaned up.

Test: m checkbuild
Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
2017-11-30 00:44:18 +00:00
Colin Cross
3bc7ffa59b Replace aapt support with aapt2
Use aapt2 instead of aapt to compile Android app resources.
Also generate all files into srcjars instead of individual
sources.

Test: m checkbuild
Change-Id: I5a67991a0daf0017e8159b46fcff7d5564a91468
2017-11-29 05:05:07 +00:00
Colin Cross
cb9335932f Add Jacoco support
Add support for instrumenting jars with jacoco.  Unlike in Make,
Jacoco in Soong is done entirely using jars.

Instrumentation is enabled by EMMA_INSTRUMENT=true, and affects
all apps.  If EMMA_INSTRUMENT_FRAMEWORK=true then it also affects
any java libraries listed in InstrumentFrameworkModules.

Bug: 69629238
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false
Change-Id: If699715b277529cd7322ffca67c23b0746e1cccd
2017-11-22 16:08:53 -08:00
Colin Cross
af05017b75 Add support for .srcjar files from genrules and srcs
Allow srcs to contain .srcjar files, which will be extracted just
before javac.  Also allow genrules and generated sources to directly
return .srcjar files.

Test: m checkbuild
Change-Id: Ie4cf60ecb9d2ec63a4c2275221544203b1383597
2017-11-17 11:22:08 -08:00
Colin Cross
ebe1a51c81 Fix java AIDL properties to match C/C++
The C/C++ aidl properties use:
aidl: {
    local_include_dirs: [],
    include_dirs: [],
}

But the Android.bp file was expecting:
aidl_include_dirs: [],
export_aidl_include_dirs: [],

Update java AIDL support to match the C support, which is
also what the androidmk conversion tool is creating.

Test: m checkbuild
Change-Id: I3df763d0b203b1b6556798a21b0553e7d35ad7d5
2017-11-17 11:22:08 -08:00
Nan Zhang
ea568a4a24 Change bool, and string properties to *bool, and *string for java,
python, and genrule.

Test: m -j checkbuild
Bug: b/68853585
Change-Id: Ic9a8083818e920dc399a4b00841e2aa496f70faa
2017-11-08 21:25:40 -08:00
Nan Zhang
61eaedbddf Support Javac sharding in Soong.
Test: m clean && m -j java and java_test.go

Change-Id: I110a0ff029448d3319aed2788d25d90a6c1a7fa0
2017-11-06 14:23:59 -08:00
Nan Zhang
3c807db06e Add default jar wrapper when wrapper property is not specified
Bug: b/68779881
Test: manually copied the jar-wrapper.sh to out/soong/host/linux-x86/framework
Change-Id: Idee1e7e64c6e3c89c89a8cd9c107a38533356b6c
2017-11-03 15:19:15 -07:00
Colin Cross
126a25cb3d Propagate PRODUCT_MINIMIZE_JAVA_DEBUG_INFO to soong and use it
Strip debug info in javac when PRODUCT_MINIMIZE_JAVA_DEBUG_INFO
is set.

Test: m with PRODUCT_MINIMIZE_JAVA_DEBUG_INFO=true
Change-Id: I167e742662801291c516bf1ff826486560d22147
2017-11-01 12:51:16 -07:00
Alex Light
2423717a0f Allow java_host_binary to be used with genrule.
This is done by implementing the HostToolPath interface for java
Binary objects.

Currently, in order for a java_binary_host to be used in this way the
java_host_binary must include:
    compile_multilib: "first"

Otherwise the genrule is unable to find the correct variant.

Test: ./build_test.bash
Test: Manual

Bug: 68397812

Change-Id: I6849488dc13fa8c383df69d00f62ad815ec17876
2017-10-27 22:07:48 +00:00
Colin Cross
8eadbf0aaf Fix source jars
Source jars were not working as designed because javac will only
compile files from the -sourcepath if there are references to them
starting from files on the command line.  Switch to extracting
the source jars into a directory and passing a list of the files
to javac.

Test: m checkbuild
Change-Id: I9f7d824f8538d081b2f5ad64ae3cbfd0e96213af
2017-10-26 01:00:46 +00:00
Colin Cross
5c6ecc179f Don't panic in turbine with no classes
ALLOW_MISSING_DEPENDENCIES=true can cause missing dependencies to be
hidden from GenerateAndroidBuildActions, which is triggering the
len(jars) == 0 check in compileJavaHeader.  For the
ALLOW_MISSING_DEPENDENCIES=true case the check is unnecessary, as the
build rules will be replaced with runtime errors.  On the off chance
the check would have been hit in a real build, allow merge_zips to
create an empty zip file if it is asked to.

Test: m ALLOW_MISSING_DEPENDENCIES=true
Change-Id: I3171f921d51229ddf38a1a647d32566658c673fa
2017-10-24 16:01:44 -07:00
Colin Cross
d11fcda940 Convert Visit*Deps from blueprint.Module to android.Module
Also adds checks that the dependencies are android.Modules and
are not disabled.

Test: m checkbuild
Change-Id: I05e945f38915d49cd3c0ab72a86576949bc7eff2
2017-10-24 13:01:03 -07:00
Colin Cross
1e45cb77a0 Fail when a module depends on a disabled module
Copy the logic from cc.go to fail when a module depends on a disabled
module.  A future change will refactor this to remove the duplication
and cover all other module types.

Test: m TARGET_BUILD_PDK=true doesn't panic
Bug: 67663308
Change-Id: Iab2b142cebdbd74df934e4733f0de83bd3334d86
2017-10-23 16:43:47 -07:00