Commit graph

28 commits

Author SHA1 Message Date
Dan Willemsen
87b17d1ff4 Use SRCDIR as a working directory
The existing behavior of using the build directory as the working
directory is useful if you want to move/copy the output directory around
and SRCDIR still refers the the source. But, it's more useful to have
the source directory be the working directory. Tools like cpp(__FILE__)
and other debug prints embed relative paths from the working directory.
We also have tools that expect the working directory to be $TOP.

Change-Id: Ia0f1d3c6b7df72d61cf5628efa2baa98bd19775b
2015-09-17 23:42:25 -07:00
Dan Willemsen
98b26c576a Use the blueprint plugin infrastructure
Instead of using this hardcoded list, use the blueprint plugin
infrastructure to find them at build time and load them.

Bug: 23567252
Change-Id: Iae87e8c9bf020f4beb42c418b9a6bf8b0fe8b601
2015-09-15 00:31:30 +00:00
Colin Cross
485e572aeb Read product variables from soong.variables
Refactor the soong.config loading code to support reading in
product variables from soong.variables.

Change-Id: I389e6bb5c501b53167267d5f5d0d25557811cf72
2015-09-14 16:09:36 -07:00
Colin Cross
463a90e587 use init functions to register module types, etc.
Instead of putting all the blueprint registrations in soong_build,
put them all in init() functions.  This puts the registration next
to the implementation.

Change-Id: Ide1a749518f5e9d1367a18ab3bb1d91da3310c76
2015-07-09 17:57:18 -07:00
Colin Cross
1f8c52be73 Add per-directory build targets
Build a map of blueprint directory to modules built from that
directory, and then add phony rules to build.ninja that emulate
the behavior of mma in the current build system.

Also fixes checkbuild to depend on checkbuild files and installable
files, but not installed files.

Change-Id: I8bad6e93387940df7439dbd4554f6d79f924c65f
2015-06-17 10:18:35 -07:00
Colin Cross
d3ba039f74 Separate HostOrDevice out of Arch
Take HostOrDevice out of Arch, and put it into AndroidModuleBase
instead.  Also separate out the host vs. device mutator from
ArchMutator.  This will make it possible for genrules to depend
on a host tool, regardless of which host arches it is compiled
for.

Change-Id: I22bbfd28b65c3eebdfa101a712f90dd615148dc8
2015-05-09 00:10:19 +00:00
Colin Cross
2ba19d90c3 Add cc_benchmark module type
Change-Id: I83bed375fa77518baaab4260e714a9368761f0bc
2015-05-07 16:09:34 -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
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
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
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
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
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
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
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
Dan Albert
be96168ee3 Add support for building NDK modules.
Change-Id: I2c5ede530e40a635e26ae45950580ef450e7dcc6
2015-03-26 21:58:12 -07:00
Colin Cross
68f55102da Support dependencies on environment variables
Ninja can't depend on environment variables, so modifying build
behavior based on environment variables requires coordinating
between the soong script that invokes ninja and the soong_build
manifest generator.

Allow any module to call Config.Getenv to get the contents of an
environment variable while registering a dependency on it.
After all modules have been processed write out the state of
all used environment variables to a JSON file called
.soong.environment.  During the next build the soong script
will use the soong_env tool to compare the contents of
.soong.environment to the current environment, and force a
build manifest regeneration by deleting the .soong.environment
file if any variables have changed.

Change-Id: Id0d81933a857bc2fc1cd7a393a3c6cec73dc4824
2015-03-26 14:13:49 -07:00
Colin Cross
82df943c5a Add art_cc_library module type
Change-Id: I7aba376b755f3ce431f7b2f555a85a0ef5323453
2015-03-25 13:49:24 -07:00
Colin Cross
97ba073833 Export cc types for art to inherit from
Art needs a custom module type in order to perform complicated
build logic like depending on environment variables and varying
cflags based on cpu variant.  Export enough of the types and
functions from cc for art_cc_library to inherit from cc_library.

While I'm touching every line, also rename the New* methods
to *Factory.

Change-Id: I7123aa47019c4ced7a1ab57c394225bc7844b5ea
2015-03-25 11:33:06 -07:00
Colin Cross
70b4059e3f Update import paths for changes to blueprint
Blueprint has been modified to include a canonical import path,
update soong to match.

Change-Id: If29d31afbf3bf2e6364961a66456fa5f8f738455
2015-03-23 12:57:34 -07:00
Colin Cross
6b29069d42 Allow cc_test to build a test per source file
Some cc_test modules want a test per source file, for example when
there is global state that needs to be reset between each test
suite, but no way to reset it.  Allow them to specify test_per_src: true,
which will cause a separate test to be built for each source file.

Change-Id: I3dbf1202fb070437cb0109f195dc11a6440061ee
2015-03-19 14:05:33 -07:00
Colin Cross
5049f02e60 Add gensrcs module type
gensrcs allows sources to be generated by a specified command.

Change-Id: I725086fcdcd72bfe6c07fb8903e7b520678a247f
2015-03-19 10:51:41 -07:00
Dan Albert
c403f7ce6d Add support for cc_test.
This behaves slightly differently than it does in the make based build.

1. The make based build manually passes -DGTEST_OS_ANDROID (or
   whatever). gtest-port.h already has logic that does this, so it's a
   no-op.
2. Host libraries are named identically, rather than libgtest_host.

Change-Id: Ic40a1025c698611d202cb7c8ec45abd8fe130065
2015-03-18 23:39:02 -07:00
Colin Cross
9454bfafcb Add support for checkbuild target
Modules can choose to add "installed files", which are files that
a product can depend on to cause the module to build, and "checkbuild
files", which will only be built if another module that needs to build
depends on them.  For every target, add a module-install and a
module-checkbuild target that create dependencies on those files,
and then add a global checkbuild target that depends on all the
module-checkbuild targets.  Also add a module target for each module
that depends on module-install and module-checkbuild.

Change-Id: I801389ad6ab9806b71d92cd327a0f9cb7582e0df
2015-03-17 13:24:18 -07:00
Colin Cross
3f40fa460d Add soong_build primary builder
Initial build logic for building android with soong.  It can build
a variety of C and C++ files for arm/arm64 and host.

Change-Id: I10eb37c2c2a50be6af1bb5fd568c0962b9476bf0
2015-03-13 20:28:16 -07:00