Commit graph

204 commits

Author SHA1 Message Date
Joe Onorato
09e94ab074 When compiling with the lite protobuf option, pass the option to aprotoc to force the lite runtime.
Test: make
Merged-In: I450f89d144d496a6ddfccc6a6a5a679a05809595
Change-Id: I450f89d144d496a6ddfccc6a6a5a679a05809595
2017-12-15 08:40:27 -08:00
Colin Cross
e1731a5803 Export app certificates to Make for apkcerts list
Bug: 70669383
Test: m apkcerts-list contains framework-res.apk
Change-Id: I38af458e4262371c9c8368b5eebcff063a9bc359
2017-12-14 12:28:41 -08:00
Colin Cross
16056060d5 Add privileged app support in Soong
Allow apps to specify that they should be installed in priv-app,
and export the value to Make which normally handles installation.

Test: m checkbuild
Change-Id: I79a05e7bb6ec0df5c31429e2f4592c6fd57dab70
2017-12-14 11:25:45 -08:00
Colin Cross
7079856c62 Remove export_package_resources check when exporting apps to Make
All of the properties for Make were inside an incorrect
export_package_resources check, which only worked because
the only app so far was framework-res, which had the
property set.

Test: m checkbuild
Change-Id: Idd9be1f497c31b2bd38fee0a83bb4756c6e94305
2017-12-14 11:25:45 -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
Treehugger Robot
d4c03092cd Merge changes I13910647,Ie061e90c,I1c1cb098
* changes:
  Escape genrule commands
  Allow java binary wrapper files to reference filegroups
  Allow globs in tool_files
2017-12-11 23:55:57 +00: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
Tobias Thierer
06ae582000 Export makevars ANDROID_JAVA{8,9}_HOME.
These variables are published by config.go for use inside
.mk scripts. They are suitable for rules that need to be
pinned to a particular java/javac version because they do
not (yet) support the other.

Bug: 70286093
Test: Treehugger
Change-Id: Id407fca187fdf6c1947fc9d1ed7cd634fe089384
Merged-In: Id407fca187fdf6c1947fc9d1ed7cd634fe089384
2017-12-08 18:35:43 +00:00
Colin Cross
5beccee92c Split logtags implementations for cc and java
Logtags files in cc and java are treated fundamentally differently.
In cc, they are not used for compiling at all, but need to be passed
to Make to be combined into the global logtags list, and logtag files
are listed in a logtags property.  In java they are listed in srcs
and produce generated code that is compiled in, and so shouldn't
also need to be listed in a logtags property.

Move the logtags property to cc and export it to Make from there,
and have java extract logtags files from srcs to be exported to
Make.

Test: m checkbuild
Change-Id: I31d49289efe72db60d2f33566df771b4a3ebc8a0
2017-12-07 15:32:30 -08: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
Colin Cross
42f3a76f00 Fix apps build
Fix two problems with Soong's aapt2 rules that occur when
TARGET_BUILD_APPS is set.  Fix escaping the values passed to
--min-sdk-version, they are sometimes P-$$(cat out/build_number.txt).
Also use the correct path to the aapt2 prebuilt.

Bug: 69917341
Test: m TARGET_PRODUCT=full TARGET_BUILD_VARIANT=userdebug TARGET_BUILD_APPS=Camera2
Change-Id: I8660a62c4a87a74e0ac1b9d03d67103af93a0cbe
2017-12-03 00:26:39 +00:00
Colin Cross
b69301ee96 Sort compiled resources by output path
Soong was keeping the compiled resources in the same order as the
input resources, which are sorted lexicographically. Converting the
path names in pathsToAapt2Paths results in a list that is no longer
lexicographically sorted.

Make sorts the inputs to aapt2 link by compiled resource name, so
do the same in Soong.

Bug: 69917341
Test: no change to framework-res.apk when converting to Soong
Change-Id: I29e8339b9969b0d323d469dac140c7e172b7ebfa
2017-12-01 19:16:42 +00:00
Colin Cross
890ff551f7 Add enforced RRO support to Soong
Ignore overlay directories that have been selected for enforced RRO
by the product, and pass them to Make instead to be converted to
an auto generated RRO package.

Bug: 69917341
Test: m checkbuild
Change-Id: I8e2677f4c600acdd8dee0869bf4fbc3d5dbc8b44
2017-12-01 16:12:51 +00:00
Colin Cross
527012af07 Split up testJavaWithEnvFs
Instead of passing all the options to testJavaWithEnvFs, split it
up into testConfig, testContext, and run.  Tests that don't need
any special options can continue to use testJava, more complicated
tests can call the three functions manually.  This gives more
flexibility in complicated tests for the next patch.

Test: soong java tests
Change-Id: Ifd5dcb40cf08e4cbf69bf8e02c5698adbfbcdcb3
2017-12-01 16:12:03 +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
aabf67968c Make *Context.Config return a Config instead of a interface{}
In Soong, a Config() method will always return a Config.  Make
ModuleContext, SingletonContext, TopDownMutatorContext and
BottomUpMutatorContext's Config() methods explictly return
a Config to avoid having to type-assert everywhere.  Overriding
the Config method requires duplicating the list of methods in
blueprint.BaseModuleContext and blueprint.BottomUpMutatorContext,
following the same pattern used by the other *Contexts.

Config() obsoletes the AConfig() method used in some places, which
will be cleaned up in the next patch.

Test: m checkbuild
Change-Id: Ibe21efde933959811d52443496967ab8ce71215e
2017-11-30 00:44:11 +00:00
Colin Cross
44f066895d Fix aapt2
Fix some ninja variable issues in the aapt2 rules.  These were
caught by app_test.go, but that wasn't being run automatically,
so add it to testSrcs.

Test: app_test.go
Change-Id: Ia01dda45ba5ced9c304056939c0e69f170c15de3
2017-11-30 00:40:38 +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
0875c52de7 Wrap PackageContext and SingletonContext
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}.  The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.

SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does.  This requires
updating every Singleton to use the android-specific methods.

Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
2017-11-29 05:04:30 +00:00
Colin Cross
824bee347d Move java test resources in mock filesystem to a different directory
Move the java test resources from res to java-res to avoid confusion
with Android app resources that are implicitly expected in res.
Also allow tests to provide extra files.

Test: java_test.go
Change-Id: I13349a21da5c6d449cd23947c2628efbed3eb230
2017-11-24 11:22:21 -08: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
b4972e3d96 Fix passing dex_preopt value to make
dex_preopt defaults to true, only pass LOCAL_DEX_PREOPT := false
if dex_preopt is explcitly set to false.

Test: m, examine framework.jar
Change-Id: Ica6ce06d14bbc720da9c5b26559b9768a8a7f5a8
2017-11-22 16:08:34 -08:00
Tobias Thierer
96427d63bc kotlinc: Always pass -jvm-target 1.8
AOSP's current version of kotlinc only supports -jvm-target
1.8 or 1.6. Previously, we were passing the javaVersion
(the value passed to javac -target) but that would fail if
javaVersion was eg. 1.9.

This CL changes the kotlinc invocation to always pass
-jvm-target 1.8, regardless of javaVersion.

Bug: 69160377
Test: Treehugger
Change-Id: Ib12a8c2afbe908319513861a5380e70bf09d0be0
2017-11-18 04:11:59 +00:00
Colin Cross
b1bd1aabca Use logtags without merged file
Assume logtags files will have hardcoded tag numbers and don't
build against the merged file.  Simplifies the build when
logtags files are split across Make and Soong.

Test: m checkbuild
Change-Id: I1e995ec458690fcadb1b86d64864f277aa9fe3af
2017-11-17 11:22:08 -08:00
Colin Cross
1763da8eb9 Export extract-srcjars.sh to Make
Export extract-srcjars.sh to Make so that it can be used to add
srcjar support to droiddoc rules.

Test: m checkbuild
Change-Id: I203ba6dad731ec9167eb8706bbfb345a484f024b
2017-11-17 11:22:08 -08:00
Colin Cross
d243091381 Remove partial javastream proto support
javastream proto is rarely used and tricky to support directly
in java because it depends on an extra host tool.  It can be
supported with a genrule, so just remove the partial built-in
support.

Test: m checkbuild
Change-Id: Iffe75e7040cb889ca17fdd85ef3e8e64fc3aa9e9
2017-11-17 11:22:08 -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
Colin Cross
d5dbfb78a0 Fix proto flags in java
Compute the common proto flags and pass them to the protoc invocation
when generating java files.

Test: m checkbuild
Change-Id: I0d4c23ad001d01eab03b404545383f009214106d
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
Jeff Gaston
d3e141de80 Pass results of Finder into Blueprint
Bug: 64363847
Test: m -j

Change-Id: I79db8c524af6e77c35a0199ec1876e5eb94e8971
2017-11-08 23:48:44 +00:00
Dan Willemsen
d9e8f0a95a Setup java paths in soong_ui
This way config.mk no longer needs to check which java is in PATH and
fix it. It'll be consistent for all build steps under soong_ui.

Also unify handling of ANDROID_JAVA_HOME / JAVA_HOME with
OVERRIDE_ANDROID_JAVA_HOME / EXPERIMENTAL_USE_OPENJDK9.

Test: m nothing
Test: build/soong/soong_ui.bash --make-mode nothing (w/o envsetup.sh)
Test: aosp_arm ninja files are the same before/after
Test: before/after ninja files match with OVERRIDE_ANDROID_JAVA_HOME
Test: before/after ninja files match with EXPERIMENTAL_USE_OPENJDK9
Change-Id: Icdb65093d9c346524074de239a4f895e4230a24d
2017-11-08 00:44:47 -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
Alan Leung
a39899edb9 Merge "Always use installed version of d8-compat-dx" 2017-11-06 18:54:53 +00: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
Treehugger Robot
76530ec6f7 Merge "Import AAPT-related product variables from make" 2017-10-31 23:39:24 +00:00
Yohann Roussel
2e19cd8959 Always use installed version of d8-compat-dx
Also adapt to the renaming of d8 to d8-compat-dx.

Test: USE_D8=true m -j16 PRODUCT-aosp_arm64-eng showcommands core-oj
Change-Id: Ic7aaa6a5da34a6a5706c20f53922a83cb1de1100
2017-10-31 13:29:07 -07:00
Colin Cross
face4e4563 Import AAPT-related product variables from make
Test: m checkbuild
Change-Id: I22113c17d240ff26652cea7df801a183343faebd
2017-10-30 17:36:41 -07:00
Treehugger Robot
047a24ac5c Merge "Allow java_host_binary to be used with genrule." 2017-10-28 00:01:53 +00: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
Alan Leung
899f3742b8 Use D8 by default
The min-sdk-version issue is solved.

Same goes for the ART layout gtests failure found on the art host bots.

Bug: 67569208
Test: m checkbuild / tests
Change-Id: I88c7f5e9ea5c5c5d1b13404ba5db1479f9f7f2f7
2017-10-27 11:51:01 -07:00
Colin Cross
715d7110f7 Fix kotlin -classpath argument
kotlinc expects -classpath, not --classpath.

Also add a test that uses only .kt files to exercise the code when
there are no java sources.

Test: java_test.go
Change-Id: Ifa5a007b460b40ea2188d0907570fbdca6c48da7
2017-10-26 14:47:40 +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
Nan Zhang
9a36418089 Use prebuilt turbine jar for unbundled javac builds.
Test: m -j
Change-Id: If2ab85f8591fe7ab275a1d4fefdd80d871f2c36d
2017-10-25 11:11:37 -07:00