Commit graph

9371 commits

Author SHA1 Message Date
Dan Willemsen
2ef08f4458 Add exclude_* and remove arch_subtract / "-file"
To align with the current make build system, add exclude_srcs and
exclude_java_resource_dirs. These replace the functionality of
arch_subtract and glob exclusions that use "-file" to exclude a file.

Change-Id: I91c23d5e3c9409f2d9f7921f950153a03a68ad61
2015-07-01 20:59:39 +00:00
Colin Cross
c41f63071e Use += for both assignments to LOCAL_C_INCLUDES
include_dirs and local_include_dirs properties both translate to
LOCAL_C_INCLUDES.  Use += for both assignments so they don't
clobber eachother.

Change-Id: Ie9e5e28ecd5a7ca76ab2a981e7d50d2c9b93ad92
2015-06-30 17:51:31 -07:00
Colin Cross
b3245e9cf6 androidbp: simplify translation by evaluating all expressions in Blueprint
Translation is getting complicated because the expressions supported
by Blueprint are difficult to support in Make.  Modify androidbp
to use context aware parsing so it can evaluate all expressions at
parse time, so it only needs to deal with constant values.

Change-Id: I57047645fb48475baecd0361f78a93ec0a26011e
2015-06-30 17:51:25 -07:00
Colin Cross
70a5f07663 Ignore some module types during translation
bootstrap_go_binary and bootstrap_go_package modules are part
of Blueprint and don't need to be translated.
toolchain_library modules are used by Soong to wrap gcc-provided
libraries are don't need to be translated.

Change-Id: I1602849060b6c85a43fc1ffb8e98c752d9d1512b
2015-06-30 12:35:47 -07:00
Colin Cross
b1a66c0cf7 Allow manually specifying translations for modules
Parse the comment block above each module or assignment looking
for directives in the form:
Android.mk:<directive>
If a block delimited by start and end directives is found, use it
as the Android.mk translation instead of trying to automatically
translate.  If an ignore directive is found, ignore the module
completely.

Change-Id: I34fe392899ed27ce3f640a2a71fbbaaedea67169
2015-06-30 12:35:44 -07:00
Colin Cross
b093124675 androidbp: make error handling stricter
Instead of putting errors into the translated Android.mk file where
they are unlikely to be seen and may cause strange build behavior,
make all errors fatal.  Also buffer to a byte buffer and then write
to the output file once we are sure there are no errors.

Change-Id: I247f405dd0a7c1d14c2681f86c7ac626e035ac2c
2015-06-30 12:32:03 -07:00
Colin Cross
26478b7fc5 Remove comments from translated Android.mk files
A bad recommendation from me lead to structuring the androidbp code
in a way that can't handle comments interspersed with module
definitions.  Since the translated Android.mk files don't really
need to be human readable, just strip all the comments.

Change-Id: I23e3f1860730bcb43b5e00a305267aa426ed80aa
2015-06-29 16:39:40 -07:00
Dan Willemsen
0a544695e9 Support the 'host' conditional in androidbp
Change-Id: I01eaa1ad2e05aaf8cbf00286d7272d0f45bb18aa
2015-06-29 22:11:40 +00:00
Dan Willemsen
3a4045d3b1 androidbp: Refactor Target/Device duplication to mutation
This is just another mutation in soong, implement it as a mutation in
androidbp as well.

Change-Id: Id72cba58db8603cace9d8ae5d8fbbd08167867cd
2015-06-29 22:06:55 +00:00
Dan Willemsen
49f50454c1 Support 'cc_library' in androidbp
Change-Id: I0a0ee48aac786a422e68e14ba14fc6186296214d
2015-06-29 22:03:26 +00:00
Dan Willemsen
ead184adaf androidbp: Add module tests
Change-Id: I563c901c8c65496f4de13d4dea38d2e7ee629fff
2015-06-29 21:47:59 +00:00
Dan Willemsen
f33877b0e9 androidbp: Test valueToString
Change-Id: I358cf4bb020fc4db14792e2cdffc18bc2f89f4d4
2015-06-29 21:46:22 +00:00
Colin Cross
00a36d3f21 Remove unnecessary glob depFile phony rule
The glob depFile is not a listed output file of a rule, so it will
never be deleted by the cleanup phase.  Remove the unnecessary phony
rule to avoid a warning when running soong -d explain:
ninja explain: output .intermediates/androidmk/glob/build/soong/Androidmk.d of phony edge with no inputs doesn't exist

Change-Id: I40ed5a28fb29b8455981f6debf1de2ea21c911ea
2015-06-29 13:09:30 -07:00
Colin Cross
7d5136f033 Improve property comments for docs
Improve the comments associated with properties to work better with
Blueprint's auto-documenting feature.

Make all properties structs into named types so that thet types can be
found using reflection and cross-referenced to the source code to
auto-extract docs.

Remove the leading <property>: text from properties, the documentation
will include the lowercased name of the property.

Add filter tags to the nested arch properties.

Change-Id: I4ef5db86358886fe61456c24eb2dbe6f7b876115
2015-06-29 10:36:02 -07:00
Colin Cross
0bc42685ee Update build.ninja.in for blueprint doc changes
Change-Id: I6244bc5d4f30643faabd151ef34af01e30295701
2015-06-26 19:43:42 -07:00
Dan Willemsen
e5e2033146 Build and run tests during bootstrap
Change-Id: If40489d74136af4d15d4ff26210a50975a462497
2015-06-26 11:51:03 -07:00
Dan Willemsen
88b4c29fb3 Fix androidmk make_strings_test to use new API
Change-Id: I23eb2df0603dbf76ff829c696cd09fe723efa9d9
2015-06-24 10:54:39 -07:00
Colin Cross
eb05083e27 Fix more androidbp bugs
Don't insert a space when concatentating strings.  Lists will already have
a separator, and strings may need to be a single word.
Use valueToString to print individual elements in a list to pick up the
same expression fix from a previous patch.
"static_executable" converts to LOCAL_FORCE_STATIC_EXECUTABLE, not "static".
Add "no_default_compiler_flags" to LOCAL_NO_DEFAULT_COMPILER_FLAGS.

Change-Id: I45c7eb8355ee1b40d7949e1560cc11cc959764b3
2015-06-22 17:26:12 -07:00
Dan Willemsen
499c094c09 androidbp: Fix conditional spacing
In make, conditionals are required to have a space in between the text
and the opening parenthesis.

Change-Id: I7e60e36982ec1d99acc66d0ffb4cff507e6a040d
2015-06-22 16:26:36 -07:00
Dan Willemsen
d7b11dd232 androidbp: Compile fix
Change-Id: I6db343c4d6426ffa6d76db7c6d94a54a5e94f712
2015-06-22 16:25:39 -07:00
Dan Willemsen
1d9f279a80 androidbp: Add static_executable, fix suffix
Add a conversion for static_executable -> LOCAL_FORCE_STATIC_EXECUTABLE

In androidmk, LOCAL_MODULE_STEM values are converted to 'suffix' values
if it is in the form $(LOCAL_MODULE)<suffix>. Do the opposite in
androidbp.

Change-Id: Ia645cf21c0def3d055188ab5b021344bb50aa58e
2015-06-22 16:00:08 -07:00
Colin Cross
ff3b795eff Fix Android.bp to Android.mk conversion bugs
Support + operators in Android.bp files
Remove trailing \n from list values in case they are part of an
expression
Replace manual $(LOCAL_PATH) prefixing in prependLocalPath with
a call to $(addprefix $(LOCAL_PATH),...) so it works on expressions.

Change-Id: I68a62b64381b7616fb7dc27fb064b1ffd3b4542a
2015-06-22 15:41:15 -07:00
Dan Willemsen
c2666e664f androidbp: Add LOCAL_MODULE_MAKEFILE
We're hardcoding LOCAL_PATH instead of using the my-dir macro.
LOCAL_MODULE_MAKEFILE is the other variable set up by this macro, used
to ensure that changes to the makefile rebuilds the objects defined in
the makefile.

Change-Id: I994b72ab9053d5a057eb3e35a8710038800432eb
2015-06-19 21:30:44 +00:00
Dan Willemsen
cdd1a99096 Add dependency to existing Android.mk files
So that we generate the Android.mk file if it is removed. Adding
Android.mk files is already handled by the implicit dependencies in
common.Glob

Change-Id: I568e24b7bc44ecadbbe01c1f7c6a97afd819c7db
2015-06-19 21:25:19 +00:00
Dan Willemsen
68fdfccd2f androidbp: Improve target conditionals when host_supported
Properties need to be parsed twice to support different conditionals for
target and host modules. Then add 'android' target support that will
just be selected for target modules.

Change-Id: I8970d5a0d132324ac7e2a7fffc2b07e7c0da33c0
2015-06-19 13:16:38 -07:00
Dan Willemsen
57ad08c15d androidbp: Handle local_include_dirs and fix export_include_dirs
The androidmk->androidbp translation strips $(LOCAL_PATH), add it back
in the reverse path.

Change-Id: I64ff213511c7dd6da0259746ea97677140ee5bf5
2015-06-19 12:51:09 -07:00
Dan Willemsen
2c342afa88 Merge "androidbp: Defer local path printing" into master-soong 2015-06-19 19:34:59 +00:00
Dan Willemsen
fd69421a70 Merge "Create 'androidmk' rule to automatically run androidbp" into master-soong 2015-06-19 01:11:59 +00:00
Dan Willemsen
e1acfc85ce Merge "Fix bootstrap.bash -r with Android.bp" into master-soong 2015-06-19 00:52:01 +00:00
Dan Willemsen
bf9207aceb Create 'androidmk' rule to automatically run androidbp
This finds any Android.bp files with Android modules defined, and if
there isn't an Android.mk file in the same directory, it will run
androidbp to generate one in $OUT

Change-Id: Ie8aef492e8cd28f6c314ce1254730975a1b8991f
2015-06-18 12:56:43 -07:00
Colin Cross
8f101b45fc Allow common.Glob to be called by singletons
Make common.Glob take an interface that is the intersection of
blueprint.ModuleContext and blueprint.SingletonContext used by
Glob and GlobRule, allowing it to be called on either.  Also
move ExpandSources and Glob into AndroidModuleContext.

Change-Id: I8d1a3160c5dd201033afdb37210e82d8065b137d
2015-06-17 15:36:48 -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
6a745c6ad0 Fix gofmt
Change-Id: I031ecd7f28a0fb29d8c5d322e4910cc4947b2fb8
2015-06-16 16:44:05 -07:00
Dan Willemsen
360a39c0f1 androidbp: Defer local path printing
This will defer printing the local path until the first module or
definition. Usually, there's a copyright comment at the top of the file
that will be now be printed first, then the LOCAL_PATH.

Change-Id: I349f7e30eaa99dcfdc73e96248774927a13be8cb
2015-06-11 18:26:25 -07:00
Dan Willemsen
98c93e9fbf Fix bootstrap.bash -r with Android.bp
Change-Id: I8182e57105b1c17254e082f6b72d2504befb7870
2015-06-10 18:07:39 -07:00
Ying Wang
3828490eef Allow to specify the output Android.mk file path.
- Allow to specify the output Android.mk file path.
  We need this to generate Android.mk into the out diretory.
- Makefile strings don't need quotes.
- Return non-zero exit code if it fails.
- Other trivial format changes.

Change-Id: I460083f6e0a2707cd4a6fe0bef3f8ae7562e9edb
2015-06-03 11:14:13 -07:00
Andres Morales
199ee3943e Merge "[androidbp] address comments aosp/149217" into master-soong 2015-05-27 01:44:24 +00:00
Colin Cross
e5ee41274a Rename Blueprints to Android.bp
Rename module definition files to Android.bp to avoid conflicts
with another project called Blueprint.

Change-Id: I105a07555eb7890f56120deab9036cf9ae5d8525
2015-05-20 13:10:32 -07:00
Colin Cross
3ab7d8835f Use proptools.CloneEmptyProperties
CloneEmptyProperties is much faster than CloneProperties followed
by ZeroProperties.  Cuts >100ms off soong_build runtime, which will
become more important when we start calling soong_build a second
time to automatically generate documentation.

Change-Id: I45d948b36d9937a21b13dab068c3ce9a60b5a59b
2015-05-19 13:03:01 -07:00
Colin Cross
d81496084b Fix repeated ccCmd dependencies on object files
ccCmd was being added as a dependency each time through the object
file loop, tripling the size of the build.ninja file.  Create a
new slice for dependencies on each object file.

Change-Id: Id768d8ea6e5300c15f0f1a5fac5fcbdfdf5e6b0a
2015-05-13 00:50:25 +00:00
Colin Cross
7d42bdad16 Merge "androidmk: make class+suffix into generic prefix" into master-soong 2015-05-13 00:50:10 +00:00
Colin Cross
f9964d5a8d Use far dependency for genrule tool
A far dependency will not inherit any of the variations from the current
module, allowing a device genrule to depend on a host tool to generate
the sources.

Change-Id: I7f622ddd31a81d605f55d5946a109ea53e864084
2015-05-12 20:46:49 +00:00
Colin Cross
3d289a4037 androidmk: make class+suffix into generic prefix
Allow variables to have a prefix, for example "target.arm.cflags".
Each prefixed name separated by a "." will become a nested map
property.

Change-Id: Ib982b8dcaf2f1dc919acb2767e769950916c50f7
2015-05-12 13:36:11 -07:00
Colin Cross
eae04e04ac androidmk: convert stems prefixed with LOCAL_MODULE to suffix
Convert stem: LOCAL_MODULE + "32" to suffix: "32"

Change-Id: I7126e814bd35f502196abc087b5d0afb825d3665
2015-05-12 11:38:37 -07:00
Colin Cross
a93000350a androidmk: strip LOCAL_PATH from export_include_dirs and local_include_dirs
Sort LOCAL_INCLUDE_DIRS values into local_include_dir include_dirs based
on whether they are prefixed with $(LOCAL_PATH)/, and strip $(LOCAL_PATH)/
from export_include_dirs.

Change-Id: I20f9f0f8385088660855c7ccf85b7933ff2dcd44
2015-05-12 11:38:37 -07:00
Colin Cross
f22982707d Check that local, top level, and exported include paths exist
Require directories listed in the include_dirs, local_include_dirs, and
exported_include_dirs properties to exist.

Change-Id: I5b079bd2c607839bb28dae43801cd7345bde2299
2015-05-12 11:36:53 -07:00
Colin Cross
4e13f6d573 androidmk: clean up nested comparisons for local variable names
Change-Id: If84dbce05f1a28a562c8dba3eceedfe92b8d5ba5
2015-05-12 18:18:05 +00:00
Colin Cross
f5f5dec662 androidmk: use a single map for property list
Change-Id: I08019443f5fcb012190486e9144a1bfec26761b4
2015-05-12 18:17:40 +00:00
Andres Morales
8ae47de451 [androidbp] address comments aosp/149217
Change-Id: I8b4bbbeef6c2c11080a4bc30820b2200ba78b7e9
2015-05-11 17:54:50 -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