Commit graph

217 commits

Author SHA1 Message Date
Dan Willemsen
f923f2b54c Remove the unused tags property
And fix up androidmk / bpfix to provide warnings about what to do
instead.

Test: m blueprint_tools  (runs the tests, ensures there aren't any tags left)
Change-Id: I1a3ad8600211050420041740207d6957f44463c8
2018-05-15 00:33:11 +00:00
android-build-prod (mdb)
720f04b964 Merge changes I52f88bfd,I4263b7d5
* changes:
  Fix usage of bytes.NewBuffer in bpfix
  Add a dependency fixer for proto deps
2018-05-08 01:05:10 +00:00
Dan Willemsen
4339853a20 Add a dependency fixer for proto deps
protoc dependency files, at least for C++ outputs, uses the form of:

  a/b.c \
  a/b.h: <dep1> <dep2>...

Ninja will fail the command when it parses a dep file and there's more
than one output file (even though it doesn't care what the output file
name is). So this tool will parse the original file, and output a
version with only a single output file.

Bug: 67329638
Test: NINJA_ARGS="-t deps ...pb.c" m
Test: NINJA_ARGS="-t deps ...srcjar" m
Test: NINJA_ARGS="-t deps ...srcszip" m
Test: Run dep_fixer across all of taimen's dep files, no failures.
Test: Run dep_fixer against the processed files, no changes.
Test: Run androidmk across all of our Android.mk files, inspect the diffs
Change-Id: I4263b7d5faea37285afa6b24dedf5964aa7d19dc
2018-05-07 16:21:59 -07:00
Dan Willemsen
75dec2291b Fix androidmk converting cc libraries
The java library rewrites should only happen for java modules, not cc
modules.

Test: Ran androidmk on a number of Android.mk files
Change-Id: Ife2cfb5a69d7db37216671f08317033b99fcd3a1
2018-05-05 13:06:40 -07:00
Colin Cross
fdb084029f Fix androidmk_test.go import ordering
Test: m checkbuild
Change-Id: I9fb94f22a157ffb9369eea071a867289c37cf026
2018-04-16 15:27:19 -07:00
Colin Cross
2dee86d69c Add more androidmk translations for android libraries
Add support for translating LOCAL_MANIFEST_FILE, LOCAL_RESOURCE_DIR
LOCAL_SHARED_ANDROID_LIBRARIES, and LOCAL_STATIC_ANDROID_LIBRARIES.

Use the presence of non-empty LOCAL_RESOURCE_DIR,
LOCAL_SHARED_ANDROID_LIBRARIES or LOCAL_STATIC_ANDROID_LIBRARIES
to convert a java_library_static into an android_library module,
and then squash LOCAL_SHARED_ANDROID_LIBRARIES into
LOCAL_SHARED_LIBRARIES and LOCAL_STATIC_ANDROID_LIBRARIES into
LOCAL_STATIC_LIBRARIES.

Test: androidmk_test.go
Change-Id: I3ad2a3561f69ebd097eca97cb170754d64e06123
2018-04-16 17:32:23 +00:00
Colin Cross
9c55d237f6 Merge matching properties in bpfix
androidmk will start to generate multiple static_libs: properties
in a single module, add a pass in bpfix to fix them up into a
single property.

Test: bpfix_test.go
Change-Id: I30955b6efbb767c02ba77f2f18d44951ef094bad
2018-04-16 17:32:16 +00:00
Colin Cross
adee968a4b Make bpfix not modify the input tree
Make a new object called Fixer to hold the state of the tree, and
make a copy of the input tree so the original doesn't get modified.

Test: bpfix_test.go
Change-Id: I1dc6fd99158c8b0e1db029df99e6cf72699a5e63
2018-04-16 17:32:08 +00:00
Chih-Hung Hsieh
02b4da53a7 Add USE_CLANG_LLD and use_clang_lld.
* USE_CLANG_LLD is unedefined in current builds.
* When USE_CLANG_LLD is defined to 'true' or '1',
  use clang's lld instead of ld or ld.gold.
* When lld is enabled:
  * ld-only flags are not passed to 'lld'.
  * location_packer is disabled.
  * Use new lld's --pack-dyn-relocs=android.
* When lld does not work:
  * In Android.mk files use LOCAL_USE_CLANG_LLD := false.
  * In Android.bp files use use_clang_lld: false.
* Only arm, arm64, x86, and x86_64_devices have LLD flags;
  all other hosts and targets do not call lld yet.

Bug: 73768157
Test: make checkbuild and boot
Change-Id: I06b8a1e868a600997a7e70fe05c299d751d23d5f
2018-04-12 14:37:35 -07:00
Steven Moreland
57a23d2f20 Add vintf_fragments.
Bug: 66917623
Test: fragments are loaded in the right place
Test: boot device which is depending on fragments
Test: androidmk file which uses LOCAL_VINTF_FRAGMENTS properly
    converted
Change-Id: I366b731cf8d5ecf51851866f441ff1c517da75cf
2018-04-05 20:33:01 +00:00
Yifan Hong
946e32e184 Add overrides to cc_binary
Test: use it for healthd, it is not installed.
Bug: 77541952

Change-Id: I170a31d1b4d15f20de6a6b6279a2eeda49ca7447
2018-04-03 16:02:29 -07:00
Colin Cross
f46e37f5f7 Fix format string issues
Fix issues caught by go vet.

Test: m checkbuild
Change-Id: Ib8d740457c15432dabe1575a6707726ddaf93084
2018-03-28 15:54:52 -07:00
Colin Cross
336ad7a667 Fix java_import and android_library_import conversions
java_import and android_library_import modules can't be handled
directly in androidmk because the results may depend on properties
that haven't been parsed yet.  Add a bpfix pass (which is
automatically included at the end of androidmk) to select
android_library_import vs. java_import based on the extension
of the prebuilt file, and convert the srcs property to jars or aars
as appropriate.

Bug: 73724997
Test: androidmk_test.go
Change-Id: I1024742e9e96d5e1e88c3cc139eeb0d5a2f6849b
2018-02-22 14:54:47 -08:00
Colin Cross
3fad895e75 Don't pretend *parser.List is immutable
The functions in bpfix that take a *parser.List and return a
modified *parser.List are always returning the same pointer
and mutating the target of the pointer.  Remove the extra
unnecessary return value.

Also extract the getLiteralListProperty function.

Test: androidmk_test.go
Change-Id: I08d8aff955c72b7916741cda8083974a49af4d6f
2018-02-22 14:54:47 -08:00
Jaekyun Seok
5cfbfbb67a Use product instead of oem for Product specific module
Bug: 64195575
Test: succeeded building product.img with BOARD_PRODUCTIMAGE_PARTITION_SIZE,
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE and PRODUCT_PRODUCT_VERITY_PARTITION.
Change-Id: Icc4f8c16bc389fe20db680849f311d02df1299c3
2018-01-25 07:50:35 +09:00
Andreas Gampe
f3e5b558e7 Soong: support Errorprone javacflags
Add support for an errorprone block in Java modules that accepts
additional javacflags for the errorprone build.

Sample:

    errorprone: {
        javacflags: ["-Xep:EqualsNaN:WARN"],
    },

Bug: 72004718
Test: m RUN_ERROR_PRONE=true
Test: manual - add block with ERROR to a project
Test: androidmk_test
Change-Id: I502248fe76c26aa19102f413af72a7324c35b7f4
2018-01-23 20:30:01 -08:00
Colin Cross
66dbc0bc32 Add R8 support
Add support for R8 to optimize apps and java libraries.

Test: m checkbuild
Change-Id: I2afd5d7a84912d3ab613c32c599bd1ebe60562e0
2018-01-03 14:15:57 -08:00
Jiyong Park
2db7692a74 Add [soc|device|product]_specific
Added three properties (soc_specific, device_specific, and
product_specific) that shows what a module is specific to.

`soc_specific: true` means that the module is specific to an SoC
(System-On-a-Chip) and thus need to be installed to vendor partition.
This has the same meaning as the old `vendor: true` setting.

`device_specific: true` means that the module is specific to the entire
hardware configuration of a device includeing the SoC and off-chip
peripherals. These modules are installed to odm partition (or /vendor/odm
when odm partition does not exist).

`product_specific: true` means that the module is specific to the
software configuration of a product such as country, network operator,
etc. These modules are installed to oem partition (or /system/oem when
oem partition does not exist). These modules are assumed to be agnostic
to hardware, so this property can't be true when either soc_specific or
device_specific is set to true.

Bug: 68187740
Test: Build. path_tests amended.
Change-Id: I44ff055d87d53b0d2676758c506060de54cbffa0
2017-12-21 12:16:29 +09:00
Colin Cross
3ce001aa40 Support more all-*-files-under functions in androidmk
Add support for all-aidl-files-under, all-Iaidl-files-under,
and all-logtags-files-under to android.mk

Test: manual
Change-Id: I5e187e0c5f9d1c63c8632f84ab47665ba85a5678
2017-12-14 12:28:41 -08:00
Colin Cross
16056060d5 Add privileged app support in Soong
Allow apps to specify that they should be installed in priv-app,
and export the value to Make which normally handles installation.

Test: m checkbuild
Change-Id: I79a05e7bb6ec0df5c31429e2f4592c6fd57dab70
2017-12-14 11:25:45 -08:00
Colin Cross
5beccee92c Split logtags implementations for cc and java
Logtags files in cc and java are treated fundamentally differently.
In cc, they are not used for compiling at all, but need to be passed
to Make to be combined into the global logtags list, and logtag files
are listed in a logtags property.  In java they are listed in srcs
and produce generated code that is compiled in, and so shouldn't
also need to be listed in a logtags property.

Move the logtags property to cc and export it to Make from there,
and have java extract logtags files from srcs to be exported to
Make.

Test: m checkbuild
Change-Id: I31d49289efe72db60d2f33566df771b4a3ebc8a0
2017-12-07 15:32:30 -08:00
Colin Cross
1bd8780881 Add more dex_preopt properties
Move dex_preopt to dex_preopt.enabled, and add dex_preopt.app_image,
dex_preopt.profile_guided, and dex_preopt.profile.  These values will
be passed back to Make if provided to control dex preopting.

Test: m checkbuild
Change-Id: I54a4b1de697a08be20ab65d2a5dc43ce0046692d
2017-12-06 13:27:56 -08:00
Colin Cross
5ab4e6d817 Allow building framework.jar and framework-res.apk
Update app support enough to build framework-res.apk, link
framework.jar against its generated files, and export it to
make.

Bug: 69917341
Test: m checkbuild tests docs
Change-Id: I7db29cd1f5fabb22e844483ecc7c38abfedbbe0a
2017-11-29 20:47:42 -08:00
Jeff Gaston
0d83b8c9fe Have androidmk ignore all-makefiles-under
That's automatically implemented now by the finder

Bug: b/37748825
Test: m -j nothing # which runs unit tests
Change-Id: Ie17907733a744dc97cd24c90bed73b4731e878ad
2017-11-28 14:24:24 -08:00
Colin Cross
d00350c61b Add license headers to all go and shell files
Test: none
Change-Id: I75c443e05f2b1e17fcb6823182717d2e6f5df7c4
2017-11-17 23:05:26 +00:00
Colin Cross
38cd9a4ec7 Merge "Add property to prevent dex preopting" 2017-10-19 23:01:02 +00:00
Colin Cross
a22116e2d9 Add property to prevent dex preopting
Add dex_preopt property and pass it through to make as
LOCAL_DEX_PREOPT.

Test: m checkbuild
Change-Id: I6f19d097d1769068b7e4093f011574c540c137f3
2017-10-19 14:26:32 -07:00
Jeff Gaston
af7d3ef81d Prevent androidmk crash on art/tools/ahat/Android.mk
Because a directive can exist within a rule's recipe,
there may not exist an ordering of nodes such that
nodes[i].End() <= nodes[i+1].Start()

This disables that assertion.

Test: androidmk art/tools/ahat/Android.mk
Bug: 67906386

Change-Id: I84ea6ebdbc01c1600b1fa188463aae56270f0135
2017-10-19 13:22:56 -07:00
Jeff Gaston
4b9ef72fe2 Add usage message to androidmk
Test: androidmk 2>&1 | grep usage && androidmk --help 2>&1 | grep usage && echo ok
Bug: 67426255
Change-Id: I1e5033321c62c6744672f2ea435a422a4b9bd3da
2017-10-06 11:48:44 -07:00
Dan Willemsen
dece58146f Change androidmk to use linux_glibc instead of linux
Test: m blueprint_tools
Test: androidmk system/core/fastboot/Android.mk
Change-Id: I7003b86f16a522f01c826092b8e45603270aa391
2017-10-02 10:55:22 -07:00
Colin Cross
86a63ff366 Rename resource_dirs to java_resource_dirs
For consistency with make, rename java resources to
java_resource_dirs and android resources to resource_dirs.

Test: m -j checkbuild
Change-Id: Ie9aac50fef40f6a9093b4b98759e79cd086bb797
2017-09-27 23:21:36 -07:00
Jeff Gaston
97001aaffd androidmk suport for aidl includes using LOCAL_PATH
Bug: 62882283
Test: m -j blueprint_tools # which runs unit tests
Change-Id: I6708aa21eada660a1f01759f090084692baa8937
2017-09-12 18:30:27 -07:00
Colin Cross
38f794ee49 Refactor proto in preparation for java proto support
Test: m -j checkbuild
Change-Id: Idf00ea0bacb2777458f9af2c7eb47e1e1854eeba
2017-09-11 12:41:58 -07:00
Colin Cross
32f676a7b4 Add support for java annotation processors
Add annotation_processor and annotation_processor_classes properties.

Test: m -j checkbuild
Change-Id: I41a6cd42f0c048070a99cb18af150030170498f7
2017-09-06 13:44:03 -07:00
Colin Cross
6c51d80adb Update java androidmk conversions
Java prebuilts are now java_import, and add support for java_version
properties.

Test: m -j checkbuild
Change-Id: Ieae59efb3370f1370f82fc3672facbbb98205c68
2017-09-06 13:44:03 -07:00
Colin Cross
2c429dc7d4 Support non-installable java libraries
Some java libraries will never be installed, support an
installable: false property and export it back to make as
LOCAL_UNINSTALLABLE_MODULE := true.

Test: m -j checkbuild, manually inspect out/soong/Android*.mk
Change-Id: I825ec897648c82fb7323da7df3539c9aaa6bcfce
2017-09-05 13:48:23 -07:00
Colin Cross
5aac362949 Add notice property to all modules
Add a notice property to all modules which, if set, propagates to
LOCAL_NOTICE_FILE in make.

Test: m -j checkbuild, examine out/soong/Android*.mk
Change-Id: I565a5624dfd7b376b976b1a43dac5cea96869026
2017-09-01 13:21:53 -07:00
Colin Cross
76b5f0ca31 Rename no_standard_libraries to no_standard_libs
For consistency with libs and static_libs.  And make it a *bool
so that it can be overriden when used in java_defaults modules.

Test: java_test.go
Change-Id: If0eaf5d5571dc6e565056d273b0addd960d6b33f
2017-08-31 13:48:52 -07:00
Jeff Gaston
f3ccfa9b99 Fix crash when running androidmk against frameworks/base/Android.mk
The was a variable on the right-hand side of the assignment to
LOCAL_MODULE_CLASS , which wants a non-nil scope

Bug: 64266643
Test: androidmk frameworks/base/Android.mk
Test: androidmk prebuilts/misc/common/ddmlib/Android.mk

Change-Id: I52d33f5e5cb1179f84d4df149ef804268d67f7fb
2017-08-24 22:59:50 +00:00
Jeff Gaston
21c21b7a75 Consolidate localIncludeDirs and exportIncludeDirs
in preparation to have LOCAL_AIDL_INCLUDES work similarly

Bug: 62882283
Test: m -j
Change-Id: I5df3d5ac2eac43d839440c291d4cdc0e26172dfa
2017-08-24 13:38:50 -07:00
Jeff Gaston
15e8e75a05 Fix androidmk crash if no CLEAR_VARS is detected
Bug: 38459493
Test: make blueprint_tools
Change-Id: I968a2e46160c6c04091412e6d5450f9917ec8b67
2017-08-17 15:08:06 -07:00
Jeff Gaston
fd4ce1bb68 androidmk no longer escaping escaped quotes in CFLAGS
Bug: 37547491
Test: m -j

Change-Id: I2f406be477f3990bf109778eb9adc9c33db2f2ad
2017-08-15 22:05:39 +00:00
Colin Cross
e8dc34a372 Rename java module and property names for consistency
prebuilt_java_library -> java_prebuilt_library
prebuilt_sdk -> android_prebuilt_sdk
java_resource_dirs -> resource_dirs
exclude_java_resource_dirs -> exclude_resource_dirs
java_libs -> libs
java_static_libs -> static_libs

Test: java_test.go
Change-Id: Icb0eefa6663844e20ad0a8729fb2c90ec916c3eb
2017-07-19 23:19:58 +00:00
Jeff Gaston
c381fd0282 Revert "Revert "Run bpfix at the end of androidmk""
Bug: 38351765
Test: androidmk Android.mk > Android.bp

This reverts commit eb3186abbe.

Change-Id: I0b67e89f5096aae60c97eb6af4fd205509aac5c9
2017-06-19 15:52:25 -07:00
Jeff Gaston
eb3186abbe Revert "Run bpfix at the end of androidmk"
This reverts commit 7fd905ae26.

Reason for revert: postsubmit build broken

Change-Id: Iddff17616c7307918380e15c1ed69ee5625a6c8e
2017-05-26 00:30:01 +00:00
Jeff Gaston
7fd905ae26 Run bpfix at the end of androidmk
Bug: 38351765
Test: androidmk Android.mk > Android.bp
Change-Id: Iefcae1b01f4e915ec20782b302ba4350a20d0f1a
2017-05-24 13:06:35 -07:00
Jeff Gaston
fa833bb6d5 Support for LOCAL_AIDL_INCLUDES in androidmk
Now it converts to:
aidl: {
  include_dirs: [
    "...",
  ]
}

Bug: 37747936
Test: run androidmk against an Android.mk file having LOCAL_AIDLE_INCLUDES
Change-Id: If9f4c3ee9969610f1e0e0f147ee6a70102b63edc
2017-05-15 11:46:04 -07:00
Colin Cross
254514eb73 androidmk: support cfi, diag, and misc_undefined properties
Support more sanitize related properties.  Also remove integer,
since it isn't a supported property, and rewrite it to be
deterministic by not going through splitBpList.

This reapplies Ie8fba06c36fc121912c65a77ee495ceef4962df0.

Bug: 37547301
Test: androidmk_test.go
Change-Id: Id637ffdb7d36bed8a2c2fe76bd6f54662709e3b3
2017-05-08 16:03:17 -07:00
Colin Cross
0fdee74f5b Revert "androidmk: support cfi, diag, and misc_undefined properties"
This reverts commit a8688c4652.

Change-Id: Ida4050f3ddc8303d614f2bd2a01470ed5459fe2c
2017-05-08 22:10:25 +00:00
Colin Cross
a8688c4652 androidmk: support cfi, diag, and misc_undefined properties
Support more sanitize related properties.

Bug: 37547301
Test: androidmk_test.go
Change-Id: Ie8fba06c36fc121912c65a77ee495ceef4962df0
2017-05-08 19:36:57 +00:00
Colin Cross
b2123aa1df Add a variable to disable modules in the PDK
Not plumbed through yet, but will at least prevent us from losing
track of which modules will not build in the PDK.

Test: builds
Change-Id: I4c1a0e39104b104dc1ff23c4391d5e83b3002d3a
2017-05-05 18:22:30 -07:00
Colin Cross
2a252bef50 Support .rs and .fs files in cc_* module srcs lists
Translate .rs and .fs files to .cpp files using llvm-rs-cc.

Test: builds
Change-Id: I242cea0d09c9985730a512cec7705c3f1479f4ed
2017-05-05 18:22:30 -07:00
Dan Willemsen
aa118f95a6 Implement vendor as a synonym of proprietary
The vendor image will have more than just proprietary modules in it
under Treble, so let's stop marking open source code as proprietary just
to move it to vendor.

Bug: 36452052
Bug: 37134596
Test: compare build.ninja before/after, no changes.
Test: Set vendor: true, ensure it works.
Change-Id: I44b0ec7007d0e311bdcbd44b238b1ef2d05cc6ff
2017-04-07 14:59:18 -07:00
Po Hu
a2226b960a Support prebuilt module types
Now BUILD_PREBUILT should be converted into corresponding types
like cc_prebuilt_library_shared/cc_prebuilt_library_static ...
So change to check LOCAL_MODULE_CLASS in Android.mk to determine
module types, and eliminate class property from Android.bp which
will cause a build break.

Change-Id: If865cc865f360eac7cc77f060df5a310bada6900
Test: out/soong/host/linux-x86/bin/androidmk prebuilts/misc/common/ddmlib/Android.mk
2017-03-31 01:27:14 +00:00
Dan Willemsen
11b261472a Rework vndk detection
Instead of having a module define `use_vndk: true`, assume that we're
building with the VNDK if we're installed on the vendor partition, and
BOARD_VNDK_VERSION==current. This now matches our behavior in Make.

Once BOARD_VNDK_VERSION!=current, we'll need to disable modules that
need to otherwise compile against the VNDK, since we can only compile
against the current VNDK.

Test: build.ninja for aosp_arm is the same before/after
Test: Ensure there are no boards that set BOARD_VNDK_VERSION
Change-Id: If937fa7bdb119648137af52daebadf486163484b
2017-03-29 04:33:25 +00:00
Colin Cross
a929db05b3 Add support for test_suites property on cc_test modules
Add a test_suites property that is passed through to make as
LOCAL_COMPATIBILITY_SUITES.

Test: m -j checkbuild, examine out/soong/Android-${TARGET_PRODUCT}.mk
Bug: 35394669
Change-Id: If05b0f5f7d6dd85228546123bebe32859bcc8186
2017-03-27 16:27:50 -07:00
Colin Cross
55708f3fb3 Support owner property
Support owner properties in Android.bp files and propagate the value
to make using LOCAL_MODULE_OWNER.

Bug: 36413696
Test: builds
Change-Id: Iac1cf7f2a14c9e3e6d85d6e09d5adb08a7078d00
2017-03-20 13:33:45 -07:00
Jeff Gaston
4f2feeee50 Have AndroidMk skip emitting LOCAL_MODULE_TAGS="optional"
Also somewhat consolidate the way in which properties are converted

Bug: 34671474
Test: make blueprint_tools

Change-Id: Idf0d6d63b8539ab6e514a6043d1f88836899864b
2017-03-08 16:00:14 -08:00
Dan Willemsen
d5781347e0 Export cc_library_headers as BUILD_HEADER_LIBRARY
And support the reverse translation in androidmk.

Test: Use a cc_library_headers using LOCAL_HEADER_LIBRARIES in make
Test: androidmk with LOCAL_HEADER_LIBRARIES
Test: androidmk with soong's Android-*.mk file for BUILD_HEADER_LIBRARIES
Change-Id: I17adedb62151f62e67e2168b09ad87f1d5648df6
2017-02-16 10:58:26 -08:00
Nan Zhang
62ea583316 Fixed androidmk crash when parsing external/aac/Android.mk
Catched the error when bpparser encountered the non-standard make variables.

Bug: b/34454142
Test: Manual + (m -j blueprint_tools) command
Change-Id: I0766082baa2c2c4020317f975012a476133f4f77
2017-01-27 14:07:38 -08:00
Dan Willemsen
7ed1ae3fa4 Import/Export LOCAL_PROPRIETARY_MODULE
Test: androidmk hardware/broadcom/libbt/Android.mk
Test: m -j vulkan.default, inspect out/soong/Android-aosp_flounder.mk
Change-Id: I8a9553f772a1d434eb0069c1575e1b0d6db36bc9
2016-12-05 17:20:57 -08:00
Dan Willemsen
d2ede879b5 Add basic VNDK support in Soong
Export a list of libraries in the VNDK, which is currently empty.

Take in Make's global BOARD_VNDK_VERSION, and use that as the SDK
version for modules that specify use_vndk: true.

Modules that use the vndk have some configuration as if they were
building against the NDK (the absence of globally defined headers), but
in other cases look like platform modules (using the platform libc++,
for now).

This change does not attempt to enforce any linking constraints, that
will come in a later patch.

Test: out/soong/build.ninja doesn't change
Change-Id: I3be206b67015ac5177b7eef4a451c579e3dc903f
2016-11-28 13:45:24 -08:00
Dan Willemsen
a03cf6d322 Add clang-tidy support
For every file which we can run clang-tidy (C/C++ clang-built), we add a
new build node that depends on the object file (since clang-tidy does
not export a depfile), and is depended on by the link step. This is
better than how we're doing it in make, since calling tidy can be turned
on or off without needing to rebuild the object files.

This does not attempt to port WITH_TIDY_ONLY from Make, since the way
that it works is broken (due to the lack of a depfile).

Bug: 32244182
Test: WITH_TIDY=true mmma -j bionic/libc
Test: ./soong (Setting ClangTidy: true)
Change-Id: I40bbb5bb00d292d72bf1c293b93080b5f9f6d8ea
2016-10-31 16:21:01 -07:00
Colin Cross
0c461f1f6e Add support for .proto files
.proto files are translated to .pb.cc and .pb.h files, which are then
compiled normally.

Bug: 32286026
Test: mmma -j system/extras/perfprofd
Change-Id: I538071424d667aacf35b4b8bfebe217f5f092726
2016-10-27 15:28:09 -07:00
Dan Willemsen
394e9dc876 Add Relocation Packer support
This only applies to shared libraries on the device, and like stripping,
we'll let make do the actual packing if we're embedded in Make.

Change-Id: I1585d74ecfc41e18dcbb5ffb70005adf007cc941
2016-09-15 03:39:05 +00:00
Dan Willemsen
377737a01c Move Android.bp definitions into subdirs
Test: m blueprint_tools still produces the same tools
Change-Id: Ia1e2e43c62cb6035616bef9fbef56417b46cf3a4
2016-08-25 15:50:21 -07:00
Dan Willemsen
2277bcbc2a Add init_rc property, equivalent to LOCAL_INIT_RC
Change-Id: I914bfff8cbdf71b6cfb2271199a964b2cdcb72d0
2016-07-29 15:24:08 -07:00
Colin Cross
7b6ba5c7fa Add CommentGroups
Follows blueprint change 1e73794d42

Change-Id: If3539e2d9370a0224a2364608c496a1e4385dbbf
2016-06-14 19:04:53 -07:00
Colin Cross
e538e410cb Rename Pos members
Follows blueprint change b3d0b8dab4

Change-Id: I10f53498557325d26c6b690583596ac4f9206c79
2016-06-14 19:04:28 -07:00
Colin Cross
2867296203 Remove blueprint/parser.Ident
Follows blueprint change c32c47938f

Change-Id: I8f479704504f7bbefed3ed63bd0d040f65a2fdd5
2016-06-14 19:03:10 -07:00
Colin Cross
d20b36be5d Update androidmk to match blueprint changes
blueprint/parser.Value is now an Expression interface, update androidmk
to match.

Change-Id: I01e0b2a83cf430c1981b450d35c8ab0aab6975f1
2016-06-08 14:50:11 -07:00
Colin Cross
a43f9b3cbf Rename androidmk/test.go so go test can find it
Change-Id: If18c749fe9bc883552952284a469ea8e8f3e8f6d
2016-06-08 14:49:55 -07:00
Dan Willemsen
c79e0e7dd3 androidmk: Fix LOCAL_FORCE_STATIC_EXECUTABLE
Change-Id: Ia7e7fb61ffff212a5b6170743c429417a528cef3
2016-06-06 22:34:37 -07:00
Dan Willemsen
490a8dc2d5 Implement re-exporting of library headers
This matches LOCAL_EXPORT_(SHARED|STATIC)_LIBRARY_HEADERS in Make.

Change-Id: Iede67e2c24a24cf51e68a50123299effbe4e4196
2016-06-06 18:35:57 -07:00
Dan Willemsen
22abd40ed0 androidmk: TOP is always "."
But if it comes out to ./, remove both characters.

Change-Id: Ia86c1a60522736773b2e8ee0cf54a4348d302573
2016-06-05 22:47:40 -07:00
Dan Willemsen
58f9bb1160 androidmk: Support version_script
This only translates the common case using $(LOCAL_PATH). If it doesn't
match here, Soong will throw an error with a suggested fix.

Change-Id: If64c8fca008a1a414fc12389e6b1bb40af0df899
2016-06-03 13:56:55 -07:00
Dan Willemsen
0c236aba6e androidmk: Update LOCAL_SANITIZE* support
Change-Id: Ib3d5473869f69e9e3a74ebb403653e5918ad240a
2016-06-03 12:57:05 -07:00
Dan Willemsen
31a6a69f9f Add _<OS> suffix support, remove USE_MINGW
USE_MINGW is no longer supported by Make

Change-Id: I399190ac9e92a2e633bf5438d8deb653beae1bb1
2016-06-03 12:57:05 -07:00
Dan Willemsen
42e20e6063 Add logtags support to androidmk
Generalize the list splitting function used by include_dirs and
export_include_dirs to also support splitting sources.

Change-Id: I11b8f817fb32309511522074fe6b26052ae3d65f
2016-06-03 12:57:05 -07:00
Dan Willemsen
6c2ac0673d Add tests for androidmk
Change-Id: Ic31bf68f75c8dd4d7737d9ea01f2d93637cdaca2
2016-06-03 00:00:50 -07:00
Colin Cross
5126504fae Add spaces around := when dumping assignments
Add spaces around := when dumping assignments that failed translation.

Change-Id: I92cea0616a9dacd74a63b48f4626340b22542fbf
2016-05-30 13:42:19 -07:00
Colin Cross
08693d2bf2 Improve makefile parser
Improve the androidmk makefile parser based on ideas from go/ast and
friends:
   - Use type switching instead of the As* mess
   - Don't store endPos for every node, compute it based on the last
     known position in the node plus the length of the last token
   - Store positions as only the offset into the file, and then unpack
     them into Line/Column scanner.Position objects later

Change-Id: I87eb6661859951e6c2ea5a85db6229fa5561d615
2016-05-26 03:34:30 +00:00
Colin Cross
7fd911f713 Fix blank line translation once and for all
Track the position in the input makefile and output blueprint file
separately.  When parsing a new makefile line, increment the line in the
output position by the number of lines between the end of the last
makefile line and the beginning of this line.  Any extra blank lines
will be discarded by the blueprint printer.

Change-Id: I85c6e006667b5733b15e03b56b91caf29fbc0ea0
2016-05-26 03:34:17 +00:00
Colin Cross
ab6e6e0135 Fix non-deterministic errors with LOCAL_*_x86_64
LOCAL_*_x86_64 was sometimes recognized as a _64 suffix and other times
as the correct _x86_64 suffix, based on the random order of the
propertyPrefixes map.  Replace the map with a slice so that the ordering
is consistent, and ensure 64 as after x86_64.

Change-Id: I1a4b4959f8ef4273ad4a1cdd0672ad557bf1891e
2016-05-25 17:17:40 -07:00
Colin Cross
1f7c527ee9 Update androidmk translator
support LOCAL_SRC_FILES_EXCLUDE, and fix a typo arm->arch.

Change-Id: I9f789e943d9aca4c5aff2b6b56b1e4a0626ecd86
2016-05-03 18:06:43 -07:00
Colin Cross
d9344d20ff androidmk: Add support for LOCAL_MODULE_HOST_OS
Change-Id: Ic1aba6cdcd394fbe2b1819b80fb997f00d9711dc
2015-12-02 11:26:17 -08:00
Colin Cross
4bd49c2ce1 androidmk: Add support for TARGET_BUILD_APPS
Change-Id: Iade2dd9fd5b8873d723d5f6f235775f447fb1d98
2015-12-01 18:06:33 -08:00
Colin Cross
b43a159c13 Replace asan with sanitize
LOCAL_ADDRESS_SANITIZER has been replaced with LOCAL_SANITIZE.

Change-Id: I81fe7e0c9135cfd4a222fae4012ab5082cc58f29
2015-09-16 14:19:55 -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
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
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
Colin Cross
2ba19d90c3 Add cc_benchmark module type
Change-Id: I83bed375fa77518baaab4260e714a9368761f0bc
2015-05-07 16:09:34 -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
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
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
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
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
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
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
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
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
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
7601ef600a androidmk fixes for blueprint update
Blueprint's internal Comment type changed, update androidmk to
match.

Change-Id: I7ce308cd5879734c1c76e19deef5b08aee377404
2015-03-20 17:54:09 -07:00
Tim Kilbourn
3f0c9ede6d Add support for LOCAL_ARM_MODE in androidmk
Uses a hack to nest it inside of an arch-arm block.

Change-Id: Id36c7398e4a91fc8dd69fa7d1f78c9d30258281a
2015-03-19 17:26:22 -07:00
Colin Cross
70a255f3c9 Remove LOCAL_CPP_EXTENSION during Android.mk translation
LOCAL_CPP_EXTENSION is unnecesary in soong, it can accept files
with .cc or .cpp extension.

Change-Id: I64cb37f199e25f1fed7e53144f85e52ba616529a
2015-03-19 10:51:40 -07:00
Dan Albert
483665904f Fix LOCAL_CXX_STL translation (now maps to stl).
Change-Id: Ib365255bfa1cdd80ac87b8ed452e70410ea0eb3c
2015-03-18 15:35: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