Commit graph

75337 commits

Author SHA1 Message Date
Colin Cross
56b4d45341 Remove global include paths for modules built against NDK
Modules built against the NDK shouldn't get the global or arch-specific
include paths, all headers will be provided by depenendencies or the
NDK.

Change-Id: I13b9530a365e11e9cf6bd2b99b756b36944e0a9e
2015-04-21 17:38:44 -07:00
Colin Cross
41c187b3d4 Support relative_install_path for cc modules
Support specifying an install path relative to the default install
path for cc libraries and binaries.

Change-Id: I47a97de9beaedde27d99c498c3f26c9d36358d94
2015-04-21 17:37:37 -07:00
Colin Cross
30e076af2e Add support for building android apps
Add support for running aapt to generate R.java and Manifest.java,
compiling java into jar, adding resources to the jar to convert it
into an apk, signing the apk, and zipaligning the apk.

Change-Id: I7a73fef590d07f35b3d0b56a8571780c09bb10ae
2015-04-20 14:12:30 -07:00
Colin Cross
b7a63247ed java: modify base java rules for android app builds
Store the jar output file for the app build to use.
Allow module types built on top of javaBase to provide filelist files
containing source files.
Allow module types built on top of javaBase to insert dependencies through
JavaDynamicDependencies.
Allow any java module to depend on framework-res.apk.
Move the install rule from javaBase to JavaLibrary.

Change-Id: I46e7e80139845ef7cc89daf180bddbdf77125555
2015-04-20 13:55:27 -07:00
Colin Cross
efb9ebe14f java: add default libraries for device builds
Add implicit libraries core-libart, core-junit, ext, and framework
to device java builds.

Change-Id: I8b4e1e54bfd4bc89fbcd211ab8da6bbcf092c523
2015-04-20 13:55:27 -07:00
Colin Cross
e7a9f3f7ed java: add one-off build logic for frameworks/base
framework.jar needs to compile against R.java and Manifest.java from
framework-res.apk.  Rather than complicating the Blueprints properties
with values that will only be used once, add one-off logic to
collectDeps to extract the rJarSpec out of the framework-res module.

Change-Id: I1195b1b5e07badc583703479382ceba35300b8fd
2015-04-20 13:55:27 -07:00
Colin Cross
276284f577 Rename resource_dirs to java_resource_dirs
Java vs. Android resource directories are already confusing enough,
rename resource_dirs to java_resource_dirs to make room for
android_resource_dirs.

Change-Id: Iffd087860b98df29e81d8d2f823be87c8227e614
2015-04-20 13:52:55 -07:00
Colin Cross
d560a9e192 androidmk: add support for ifdef USE_MINGW
Change-Id: Ib3436cb4fd2469f5be2f7ee1525709eb1e143dbf
2015-04-16 14:06:12 -07:00
Colin Cross
d0a3da2d88 androidmk: add all-subdir-java-files
Change-Id: I7f3458231abcf7fb03595bb0f9277a0820ceb4f7
2015-04-16 14:06:12 -07:00
Colin Cross
c1e86a3896 Fix race condition in config.Getenv
The envDeps map may be accessed concurrently by multiple modules
in GenerateBuildActions, wrap the accesses in a mutex.

Change-Id: I18abf2687997c045a99b987908623f7d8c2ea344
2015-04-15 12:41:44 -07:00
Colin Cross
c215ca203e Update build.ninja.in for blueprint changes
Change-Id: Ibc2bf4919f780b1fefefa9c5a2a02166b326b57a
2015-04-15 10:57:34 -07:00
Colin Cross
f03c82b8fa Optimize javacFlags and aidlFlags in ninja files
aidlFlags gets specified for every aidl file.  Use a module scoped
ninja variable to hold the aidl flags, and while we're at it do the
same for javacFlags.

Change-Id: I980f0006c41918154ab0479d56387630a7e1d677
2015-04-13 17:31:25 -07:00
Colin Cross
aa8630ba09 Move SDK prebuilts to new prebuilt_sdk module type
SDK prebuilts need to be treated differently than other prebuilts.
They are used like a normal Java prebuilts when compiling java files,
but they are also used as aapt includes when compiling apps, and they
provide prebuilt aidl files when compiling aidl sources.  Create a
new module type so dependers can determine what kind of dependency
they are.

Change-Id: If426da63cfadcb4b14abda58c7b346554912a07a
2015-04-13 17:31:25 -07:00
Colin Cross
f05fe97df6 Add logtags source file support
Add support for converting logtags files to source files.  Each
.logtags file is converted to a .java file, but only after all
.logtags files have been combined into a merged text file by
the logtagsSingleton.

Change-Id: I375d82874029bd26a7c528e46add2a638ba123f9
2015-04-13 12:25:40 -07:00
Colin Cross
6d1e72d7c6 Fix multi-dex builds
Building with --multi-dex requires passing an output directory
instead of an output file to dx.

Change-Id: I9ffcfe8ff6b96dbdda3eec1076124cd38ae5077f
2015-04-13 12:25:40 -07:00
Colin Cross
2097830df7 Extract classes out of jarjar jar for static java libraries
jarjar modifies the .class files in a jar, when using static java
library dependencies we need to use the modified class files and
not the ones that javac produced.  If jarjar is enabled, use
the prebuilt jar extractor to get the classes out of classes-jarjar.jar
and export them through j.classJarSpecs.

Change-Id: Ia2854f1c26d630da12cab7c421007aad4f793ecd
2015-04-10 17:49:44 -07:00
Colin Cross
9b6826f7cf Quote glob exclude options
Put quotes around the glob exclude options to avoid accidentally
expanding globs during execution.

Change-Id: Ia6fc7fa7dbe1d75e97d6039642e1c89be027689a
2015-04-10 16:12:49 -07:00
Colin Cross
24679676ca Fix soong scripts to support directories with spaces
Using a path with a space to execute soong is unlikely, but it
might as well work.  Quote all the paths in the soong scripts.

Soong and blueprint will still both fail if the relative path between
the soong script and the source directory has a space in it, but this
is even more unlikely.

Change-Id: I8986f10115209d69b09b82ffea26e4b10d29c197
2015-04-10 15:50:37 -07:00
Colin Cross
c3c0a49622 Remove Config interface
Replace the Config interface with a struct that wraps the real
*config object.  This keeps the existing pointer behavior without
having to list all of the available config functions in the interface.

Change-Id: If55a622b5a112ca5dc7193ebd59f2931b3a8e6cd
2015-04-10 15:50:37 -07:00
Colin Cross
8cf1334116 Miscellaneous fixes for java compiling
Remove java out directory before compiling to avoid incremental compile
issues.  Move the rspfile out of the out directory so it doesn't get
deleted.  cc->javac in the javac rule.  Don't call javac if there
are no source files.

Change-Id: I0bb06c214da54a587bd9e7c9d17caaf0ed1e595e
2015-04-10 15:50:37 -07:00
Tim Kilbourn
9679302dfa Update root.bp for additional libs
Change-Id: Ib1ea8c0117a21350224e284cf8e67eef53dba3eb
2015-04-09 15:09:36 -07:00
Colin Cross
10787d046d Fix running soong from different directory
${BOOTSTRAP} already contains ${BUILDDIR}

Change-Id: Ie1303e4b2a5ce415f565ffc4b6125071e427bd43
2015-04-09 00:13:44 +00:00
Colin Cross
c0b06f191f Add aidl file support to java builds
Add support for aidl files listed in srcs for java builds, and
an aidl_preprocess module type for framework and sdk aidls.

Change-Id: I3aa537f4483822e5b534c74d0b35f13a938f8947
2015-04-08 16:37:31 -07:00
Colin Cross
6cbb127564 Fix missing bootclasspath error in java compiles
If a java library only links against the same jar as bootclasspath,
the jar was being added to classpath and not bootclasspath, leaving
bootclasspath blank and using the default bootclasspath.  Reverse
the order so that bootclasspath takes effect.

Change-Id: Ib9fbf01897314a57228013d4aef52606390b0aca
2015-04-08 15:19:36 -07:00
Colin Cross
fce532760f Support subtracting sources from globs
Support -file or -path/glob in file lists that contain globs to
subtract files from the resulting glob.  Also move source file
prefixing and handling into a common function.

Change-Id: Ib6d74ce22f53cae7348c4ba35b779976d90359a6
2015-04-08 15:19:30 -07:00
Colin Cross
1332b0035c Move config into common and provide helper
Using ctx.Config().(Config) everywhere is a mouthful, and it is
inefficient to do the type assertion.  Put the Config interface into
the context, and provide an AConfig() to return the Config already
converted to the right type.

Change-Id: I301a1fd7d2a005580aabca7866a37c5d42ad8c69
2015-04-08 15:19:24 -07:00
Colin Cross
8df14ac3f0 Add rpath to host executables
Host executables need rpath set so they can find their shared
libraries.

Change-Id: I297682d3266bb436af0f594e8164ee4b9e7ab234
2015-04-08 15:17:45 -07:00
Colin Cross
581c189988 Add yacc and lex support
Add support for yacc (.y or .yy) and lex (.l or .ll) files.  Also
tweak locations of .o files for normal and generated sources to
makes sure they don't collide.

Change-Id: I03172cddbdc022525bf392a81d72050406b8cdb3
2015-04-08 15:17:45 -07:00
Colin Cross
65bf4f231c Add jarjar support
If jarjar_rules is set, pass the compiled jar through jarjar to
produce a new intermediate jar.

Change-Id: Ied596433fd5c49d05f07c04245f3abe8b9aadc5e
2015-04-08 15:15:15 -07:00
Colin Cross
e1d62a8b1f Add support for using prebuilt libraries as static dependencies
Extract files out of prebuilt libraries and create list files
for classes and resources in order to allow including them in
other jars.

Change-Id: I9269d1fd6e0f570811a00bf319098ac1f7cdc816
2015-04-03 16:53:05 -07:00
Colin Cross
16daa921e3 androidmk: support translating all-java-files-under
Change-Id: I4c343f6d8d23d42dddc256ff022016b595bb3841
2015-04-03 16:51:45 -07:00
Colin Cross
2fe6687847 Support java libraries, binaries, and prebuilts
Add support for compiling java libraries (.jar files with
or without .dex), java binaries (.jar files with a wrapper
script to run them), and java prebuilts (for the SDK .jars)

Change-Id: Id624da64c92cf20c6d9577c6bb06e5b212af0d1b
2015-04-03 16:24:44 -07:00
Colin Cross
35cec12a11 Clean up installing
Use the config to get paths to install to, allow installing
a file to a different file name than the intermediate file,
and allow dependencies between installed files.

Change-Id: I37ac32d2fa1458150b6d54f6ec9cdac70a0259e8
2015-04-03 15:55:08 -07:00
Colin Cross
3e8ec07787 Support excludes in globs
Java resource support requires globbing directories while ignoring
specific filenames.  Add support for multiple -e options to
soong_glob to specify filenames to exclude, and split out Glob
into GlobRule to insert a rule to generate a glob file list.

Change-Id: Ia911dd68bd1638452881d18378572d015fd4e31a
2015-04-03 15:55:08 -07:00
Colin Cross
c77f9d1404 Add global tags properties, remove resourceDirs
Add tags to the global properties, but ignore it for now.  Remove
resourceDirs, we don't use it.

Change-Id: I1862573d3ac02e539492c8ff95bacbab3588bfc4
2015-04-02 14:49:33 -07:00
Colin Cross
139b815875 androidmk: use map to hold module types
Reduces the number of places that need to be edited when adding
new module types.

Change-Id: Id35d16f005e377e1e3bb955348ed92a4a2c392bb
2015-04-02 14:49:06 -07:00
Colin Cross
7d21c4430d Use @files for ld and ar
ld and ar command lines often end up larger than ARG_MAX, use Ninja's
rsp file support to automatically write the object files to a temporary
file and pass it in using @file support.

This isn't going to work on Darwin host builds, where the host
toolchains don't support @.

Change-Id: Ida2f4e114ab02df6967e863577fa324e197827d5
2015-04-02 14:48:55 -07:00
Colin Cross
577f6e4baf Fix ndk and stl compiling
Move ndk linking against libc and libm out of system shared libraries
so that static libraries that link against the ndk can depend on
libc and libm, which is required to get the ndk sysroot include path.
Also make ndk stl versions only apply to the device variant of
multi-target builds.

Change-Id: I6926541da17b9baf3aa7f811a839c3b65c5d804d
2015-03-27 18:24:14 -07:00
Colin Cross
df6f7ae064 androidmk: add BUILD_OS conditionals
Some Android.mk files use BUILD_OS instead of HOST_OS for selecting
options when building host tools.

Change-Id: Ic4869cdee01da050364bb21b47f3de8fd8adaa96
2015-03-27 17:56:34 -07:00
Colin Cross
5890b58b21 Allow bionic to specify its own root Blueprints
subdirs = ["bionic/*"] in the root Blueprints causes blueprint to
search subdirectories of bionic for Blueprints files instead of
searching the bionic directory itself.  Replace it with
subdirs = ["bionic"] and allow bionic/Blueprints to specify its
subdirs.

Change-Id: Iac9d2407a3d4c87b3c23390f887b187f276ee72f
2015-03-27 17:56:34 -07:00
Colin Cross
bbcb4963d6 androidmk: support conditionals on HOST_OS == linux
Add HOST_OS == linux to the supported conditionals, and replace
a manual list with a map lookup.

Change-Id: I0c26e3a854d1011870f41c05fc400d68334cd45f
2015-03-27 17:56:34 -07:00
Colin Cross
24e6aef941 androidmk: print unsupported $(call) and $(eval) lines
Unsupported top level lines were getting silently dropped, print
an unsupported translation error instead.

Change-Id: I1a8ac13966116c997c2a3be923f3c3ba6fbe2258
2015-03-27 17:56:34 -07:00
Colin Cross
28d76590f1 Use ContainsProperty to support default values
Instead of setting a string property to magic default value and then
checking for it later, call ctx.ContainsProperty to determine if it
was set.  Use the same method on the clang bool property, which
couldn't be set to a magic value.

blueprint's ModuleContext.ContainsProperty only works on a single
property, not on all arch variant properties -
ModuleContext.ContainsProperty("clang") will return false if
clang was not set but arch.arm.clang was set - so track which
properties were extended inside extendProperties, and override
ModuleContext.ContainsProperty in AndroidModuleContext to also
check the extended properties.

Change-Id: I03cbe71dc69344972e23d6c794da9be05e720c45
2015-03-27 17:54:50 -07:00
Colin Cross
c940435029 Fix checkbuild files on last variant
The context checkbuild files were not copied to the module checkbuild
files before calling generateModuleTarget, which would cause them
to not be considered, and in the case of a module with a single
variant, cause a build failure when the checkbuild target was skipped.

Change-Id: I77faafdc1a8a866e3c2c1157f987015b553acf01
2015-03-27 15:58:25 -07:00
Colin Cross
1f8f234c33 Support cc_test_host
Support cc_test_host for gtest tests compiled for the host.

Change-Id: I632d2c211075ba9391d934609f1bf368459397e1
2015-03-27 15:58:24 -07:00
Colin Cross
4ae185c7ec Support for suffix property on binaries
The suffix property will modify the name of the resulting binary
by adding its value to the module name.

Change-Id: I188e97d4c88f26c060ba2ffbd37f832d701fe0cb
2015-03-27 15:58:24 -07:00
Colin Cross
f8209413f1 Support target: { android64: {...}} for linker
The linker and a few other executables and libraries need to know
if they are a 32-bit process running on a 64-bit host.  Add
android64 and android32 target types to set custom cflags.

Change-Id: I142378e2d5be17a87ff761257dacc1734b093048
2015-03-27 15:58:24 -07:00
Colin Cross
bfae8859f2 Support prefix_symbols for linker
The linker needs to add __dl_ to the beginning of all of its symbols
to avoid conflicts.  Add support for a prefix_symbols property, and
insert an objcopy --prefix_symbols build step to produce the final
binary.

Change-Id: I70de7c830cd64305e5900c6de53efecea2e17c75
2015-03-27 15:58:24 -07:00
Colin Cross
ed4cf0b655 Refactor ccDynamic for static binaries
ccLibrary uses ccDynamic for linking shared libraries, but bypasses
it by calling directly into ccBase for static libraries.  Instead of
duplicating the same mess for ccBinary, rename ccDynamic to ccLinked
and add the logic for dealing with static or shared linkage.  This
also allows moving the stl logic out of ccBase and into ccLinked.

Change-Id: Idfa6d86de16911c8851f694d6ed92681c8939281
2015-03-27 15:57:49 -07:00
Dan Albert
be96168ee3 Add support for building NDK modules.
Change-Id: I2c5ede530e40a635e26ae45950580ef450e7dcc6
2015-03-26 21:58:12 -07:00