Commit graph

211 commits

Author SHA1 Message Date
Andres Morales
da8706fed8 Initial androidbp translator.
Translates Android.bp files back to Android.mk

Change-Id: Ib4bd1e0abc58ab514a7dd4a01008af645d6a3d13
2015-04-30 18:51:10 -07:00
Colin Cross
b05bff2f26 Add per target archtecture properties
At least libcutils and boringssl need to set source files that
apply to x86 or x86_64, but only on the host or on the device.
Add new properties that can contain arch variant properties:
target.android_arm
target.android_arm64
target.android_mips
target.android_mips64
target.android_x86
target.android_x86_64
target.linux_x86
target.linux_x86_64
target.darwin_x86
target.darwin_x86_64

Change-Id: I5a7076653a7367a63daa7f7e34a6a28f5cbdfbe7
2015-04-30 16:35:06 -07:00
Colin Cross
6bedfaaeea cc: remove incorrect arch cflags
arm and host builds both got some extra global cflags from arm64,
remove them.

Change-Id: Ie4dcbb114714f4ae8b45304755978d66e13e889c
2015-04-30 16:35:03 -07:00
Colin Cross
3d7678f9d6 Fix java resource globbing
Handle java resource globbing in two passes, the first on the
list of resource dirs to produce a list of directories, and the
second to glob for files inside those directories using **/*.
Fixes incorrect jarSpec dir errors when the resource directories
list contains globs.

Change-Id: Icea5d8178336eb7de4ad91a9acba4822423d9f60
2015-04-29 14:59:23 -07:00
Colin Cross
6a114caa17 Fix globbing bugs
Fix two bugs in globbing: check for excludes before globs so that
excludes that contain globs are not treated as includes, and
remove the Generator attribute from globRule so that the rule
reruns if the command line changes, for example if the glob or
excludes list changes.

Change-Id: I216c0c925eeb00a3814300548c005bcdf64a1f30
2015-04-29 14:59:23 -07:00
Colin Cross
6f23ef6bf3 Move globbing on top of pathtools.GlobWithExcludes
pathtools.GlobWithExcludes contains all the features of
glob.GlobWithDepFile now, make GlobWithDepFile a wrapper
around GlobWithExcludes that writes the results to a file.

Change-Id: Ie75d9042845505f499aac7fa00d3c90f8ecab4f7
2015-04-29 14:59:23 -07:00
Colin Cross
d8e780df69 cc: make static or shared cflags apply to all source files
Make static or shared cflags properties apply to all source files,
not just the source files defined in the static or shared block.
Needed for libunwind, which passes -DUNW_ADDITIONAL_PREFIX to source
files for the static library, but not for the shared library.

Change-Id: I3cd88cc1099e505eeee077c697db00de22a8b03a
2015-04-29 14:59:23 -07:00
Colin Cross
0607cf7daa java: add genrule support to java builds
Add support for source files generated by genrule or gensrcs to
java builds.

Change-Id: I39762b2ab65fa4cf92724300edc4ba995845ce92
2015-04-29 14:59:07 -07:00
Colin Cross
d350ecd102 Add support for genrule
Add genrule, which uses a host executable (possibly built by the
build system) to generate a single source file.  This differs slightly
from gensrcs, which takes a list of sources and translates them through
a host executable to individual source files.

Change-Id: I94bda62c4c53fb3f3817def190e6a7561508d297
2015-04-29 14:58:16 -07:00
Dan Albert
c3144b1553 ndk: Use prebuilt NDK CRT objects.
Change-Id: Ie8d58fa7c4ef2a62338c20c3078603ac98be0f9c
2015-04-29 10:27:00 -07:00
Colin Cross
eb1e6cc62c java: add missing tool dependencies
Add missing dependencies on the jar, aapt, signapk, and zipalign
tools.

Change-Id: Ib70fdd41daf84c474f72e1219bf3d02931fcefd7
2015-04-28 15:34:45 -07:00
Colin Cross
5adac8a045 java: delete package-export.apk before rebuilding
Delete package-export.apk before rebuilding to avoid aapt warnings
about using -f on existing packages.

Change-Id: I189486c4b3bd5fa46eff2e3b6a244d28329e7f02
2015-04-28 15:34:44 -07:00
Colin Cross
a8a93d3769 cc: fix native tests
Add libgtest to native test dependencies before adding stl
dependencies to resolve link errors between libgtest and
libc++_static.

Install device native tests to /dava/nativetest32 and
/data/nativetest64.

Change-Id: I6d9ddba8d5cdbacaa86cae0833fd7e656657e4d9
2015-04-28 15:34:08 -07:00
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