Commit graph

72049 commits

Author SHA1 Message Date
Colin Cross
2732e9a43f cc: improve combined static/shared libraries
Allow combined static/shared libraries to specify separate dependencies,
and recompile objects if static or shared cflags are set.

Change-Id: I9fd71d8debd5ade5637389ee38e793082d6d18bb
2015-04-28 15:34:01 -07:00
Colin Cross
18b6dc5d25 cc: fix host gcc libraries
Host gcc libraries should only apply to static binaries, not all
static libraries.  Add c.staticBinary(), and rework everything
else to use c.static(), removing c.shared().

Change-Id: I8addae9b6848010cef94d873f48e7e358e4f5059
2015-04-28 14:12:00 -07:00
Colin Cross
c1e814dbf1 cc: remove --fix-cortex-a8 from non-Cortex A8 devcies
Pass --fix-cortex-a8 only on Cortex A8 and generic ARM builds, and
pass --no-fix-cortex-a8 on everything else.

Change-Id: I4b12afee4de443b5d55df66be3c6a05251715e31
2015-04-28 14:11:56 -07:00
Colin Cross
e11befc4e4 cc: finish unexporting DepNames and Flags
gorename missed DepNames and Flags on CCBase and CCLinked

Change-Id: I926227eef51fdbe10f22b743bf3e2265cdc6a9ad
2015-04-28 14:11:53 -07:00
Colin Cross
11f5654ba6 Extract jar files to different directory than compiling
Now that we use extractPrebuilts to extract compiled classes from
jars after jarjar, it needs to extract to a different directory
than used when compiling.  Extract them to extracted/classes.  Also
move the classes.list and resources.list file out of the classes
directory so they don't find themselves and end up in downstream
jars.

Change-Id: I070323466858edc7e33e14207c98f77d540882f3
2015-04-27 14:32:36 -07:00
Colin Cross
957cc4e20d soong_jar: ignore directories passed to jar unless -d is set
Java resource lists created by globs like "**/*" may include
directories.  Ignore them when creating the zip file unless
-d was passed on the command line.  Fixes read: is a directory
errors.

Change-Id: Ifa6fd4fbd8262f700bed1f4a7268f11618dc305c
2015-04-27 14:32:36 -07:00
Colin Cross
e19c79310d soong_jar: combine zipWriter and zipInfo into a class
Combine the zipWriter and info arguments that are passed into every
function into a single writer class, and make all the functions
methods on the new class.

Change-Id: I29d0164578894974ceaed9482349604633de6533
2015-04-27 14:32:30 -07:00
Colin Cross
712fc026df Fix gcc libraries for host targets with platform libc++
Targeting the platform-provided libc++ on the host requires passing
-nodefautlibs to gcc, and then re-adding all the default libs except
libc++.

Change-Id: I5a42375bcc819b07f6ee02e9d76e7f5088fa00e0
2015-04-27 11:18:21 -07:00
Colin Cross
9ffb4f5295 cc: export CCTest
export CCTest so it can be overriden by artCCTest

Change-Id: I027c7fb392ff7fa55e5ecb635fbf31a7662d8e22
2015-04-27 11:18:21 -07:00
Colin Cross
0676e2d1d6 cc: unexport Flags and DepNames
Flags and DepNames are no longer needed outside of cc, they are
replaced by ModifyProperties.

Change-Id: I84ff0dc180cb3459d6181a83fc67c6158987c1ae
2015-04-27 11:18:21 -07:00
Colin Cross
fa1387916f cc: export structs and add ModifyProperties
Instead of the complicated Flags and DepNames system used now
for overriding CC modules, export all the main structs and the
properties structs so that module types that override them can
modify properties before build rule generation starts.

Change-Id: I6d71550def1ef07798b27d5fec40739ef3ac8165
2015-04-27 11:18:21 -07:00
Colin Cross
28344528cf Simplify flags in c compiling, fix NDK build warnings
Reduce the number of flags variables when compiling C by getting
rid of the separately-tracked IncludeDirs variables, and putting
them directly in GlobalFlags.  Also changes exportedIncludeDirs
to exportedFlags, which will allow exporting flags besides -I.

Also fixes a bug when building a module with the NDK and -Werror
by passing NDK exported include directories with -isystem instead
of -I, which will ignore warnings from those includes.

Also fixes a bug where the default includes were being inserted
into all cflags by the arm and arm64 toolchain modules.

Change-Id: Ice97f84e637b21d20c38c85b881afa315f9f92ae
2015-04-22 14:08:45 -07:00
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