Commit graph

217 commits

Author SHA1 Message Date
Colin Cross
47e4f9e1e8 Revert "Sandbox soong_build by changing to root directory"
This reverts commit 05c25ccb4a.

Reason for revert: broke absolute OUT_DIR
Bug: 146437378

Change-Id: I523ed79d40e1c1ef040212ba794a7a084abea75d
2020-01-10 18:51:04 +00:00
Colin Cross
05c25ccb4a Sandbox soong_build by changing to root directory
Store the current working directory and then change to the root
directory so that all file accesses must go through helpers in
the android package that properly track dependencies.

Fixes: 146437378
Test: m checkbuild
Change-Id: I12a0f907753fefd1997ab8b4ea2ac331234093cf
2020-01-09 14:19:46 -08:00
Colin Cross
ce23942f3c Move partner androidmk and bpfix files to match their package path
Using a gomod-aware editor with build/soong requires that files
in build/soong can be mapped to the android/soong package path.
Move the partner androidmk and bpfix files such that their path
matches the package path when the android/soong package prefix is
replaced with the build/soong path prefix.

Test: go test ./...
Test: m bpfix androidmk partner_bpfix partner_androidmk
Change-Id: Ic7f7aad9e5eb9178eef0383f0b37e4fb93ce8314
2019-11-11 15:44:09 -08:00
Sasha Smundak
541056c3fa Add dont_merge_manifests attribute to android_test
Bug: 122332514
Test: treehugger, convert cts/tests/tests/content
Change-Id: Ib66fcafd7c31913402cd390dfecce292b1817729
2019-10-28 15:55:58 -07:00
Justin DeMartino
ac38d7e521 Add support to extend commands bpfix and androidmk
Allows our partners to maintain partner-specific fixes in their repos. Converts most of androidmk into a library similar to bpfix. Makes some methods and types public for use by extended versions.

Bug:140727544
Test: Ran unit test cases &&
  ran test conversions with sample
Change-Id: I7e1fbf3a6a7a8bd47334f43fe3eb68cbbd3426c1
2019-10-25 16:18:15 +00:00
changho.shin
b5432b7a3d Add 'Additional_manifest' property to merge other manifests
This is equivalent to 'LOCAL_FULL_LIBS_MANIFEST_FILES' in Make.

Fixes: 123374442
Test: m -j
Change-Id: Ic4b40a08f2454687c74949020598651acea3b2dd
2019-08-13 08:30:00 +00:00
Justin Yun
d5f6c8261a Rename product_services to system_ext
Bug: 134359158
Test: build and check if system_ext.img is created
Change-Id: Ice3229baf97a94c24a6eea22e7d4571941d7f843
2019-07-09 08:57:05 +00:00
Paul Duffin
a3d0986cfc Remove the no_standard_libs property
Corrects an error message that refers to no_standard_libs.

Removes any tests that use no_standard_libs:true where possible as
there are duplicate tests for sdk_version:"none". Otherwise, switches
them over to use sdk_version:"none".

The androidmk mapping from LOCAL_NO_STANDARD_LIBRARIES to
no_standard_libs has also been removed. There was little point in
updating the tool to map it through to sdk_version:"none" as there are
only a couple of places where it is used, in art's test running mk
targets and in some unbundled packages to work around some limitation
in .mk based build.

Bug: 134566750
Test: m droid
Change-Id: I6413c9b1fe3e63b93753a6a017d2981e32b7e013
2019-06-17 11:21:39 +01:00
Treehugger Robot
b6fd6f75f2 Merge "Clean up sortedKeys function" 2019-06-10 19:16:14 +00:00
Inseob Kim
1a365c6a7f Clean up sortedKeys function
This introduces a generic function SortedStringKeys which can be used to
get a slice of sorted string keys for all kinds of maps having string
keys.

Bug: N/A
Test: m
Change-Id: I542194c68984d909b7ad1dbf060d4d3a98f0ef23
2019-06-08 16:10:38 +09:00
Patrice Arruda
1ef3bb5d51 Soong: Add mk2bp conversion for prebuilt_firmare.
There are a couple of makefiles that have etc with $(TARGET_OUT)/etc/firmware,
$(TARGET_OUT_VENDOR)/firmare as the local module path. Added the conversion in
androidmk for target.

Bug: b/133711895
Test: Unit test cases.
Change-Id: I74aca18a7eb8aa4dd692cde680fa4e112edcf6d1
2019-06-04 17:10:48 -07:00
Mitch Phillips
bfeade6424 Fix fuzzer builds [#2].
- Updates the fuzzer builds to use SANITIZE_TARGET='fuzzer' instead of
'coverage'.
- Removed an old dependency that made fuzzer builds without ASan
an error.
- Fixed up the build flags to allow fuzzers to be built. Previously, the
coverage flags were manually provided. As the toolchain has moved on,
these flags are no longer compatible with libFuzzer, and so I've updated
them to use the correct, compatible flags.
- Added a dependency mutator for fuzzer coverage.

Bug: 121042685
Test: With all patches in the bug merged, build a fuzzer using
'SANITIZE_TARGET=fuzzer mmma <your_fuzzer>'.

Change-Id: Ib6246980f77bc4babe587b1e88038aa12228fa83
Merged-In: Ib6246980f77bc4babe587b1e88038aa12228fa83
2019-05-30 16:49:42 +00:00
Treehugger Robot
13feeb7b62 Merge "Convert LOCAL_COMPATIBILITY_SUPPORT_FILES to data: attribute in androidmk" 2019-05-24 16:25:48 +00:00
Jaewoong Jung
a725681ed8 Merge "androidmk conversion logic for android_app_import" 2019-05-23 20:55:57 +00:00
Sasha Smundak
0d11feb42f Convert LOCAL_COMPATIBILITY_SUPPORT_FILES to data: attribute in androidmk
Fixes: 133434805
Test: build executes internal tests
Change-Id: I688672cec640f0113dc06a19a87c097cda60d180
2019-05-23 13:02:06 -07:00
Patrice Arruda
d1f45c8967 Soong: Add mk2bp conversion for prebuilt_font.
There are a couple of makefiles that have etc with $(TARGET_OUT)/fonts
and $(TARGET_OUT_PRODUCT)/fonts  as the local module path. Added the
conversion in androidmk for target.

bug: b/123403785
Test: Wrote and ran unit test cases, did a test conversion on
        * platform/external/google-fonts/dancing-script/Android.mk
        * internal/external/google-fonts/arbutus-fonts/Android.mk
Change-Id: Id67e10f80b32b27c5027cd274a7944801dad0880
2019-05-16 10:48:32 -07:00
Jaewoong Jung
e07b0b60e5 androidmk conversion logic for android_app_import
Test: androidmk_test.go, bpfix_test.go
Bug: 128610294
Change-Id: Ide183ba1e696fa0ffb4245e3288ffc47535b39af
2019-05-15 12:33:11 -07:00
Patrice Arruda
77311df787 Soong: Add mk2bp conversion for prebuilt_usr_share.
There are a couple of makefiles that have etc with $(TARGET_OUT)/usr/share
as the local module path. Added the conversion in androidmk for target
and host.

Bug: b/132123818
Test: Wrote and ran unit test cases, did a test conversion on
      external/neven/Android.mk makefile.

Change-Id: Iafed89f4cee499f561a1235f8870b1f1329e99bc
2019-05-10 12:59:37 -07:00
Dan Willemsen
4e0aa23dd3 Convert yacc to a single RuleBuilder rule
So that <module>/gen/yacc/... is (re)created by a single rule, previous
files are removed, and location.hh is in the build graph when it is
produced.

Test: treehugger
Change-Id: I2f6e47ea07f315e10ae1cb8ad50697e7123d0285
2019-04-15 14:52:05 -07:00
Sasha Smundak
9223a6262a Handle LOCAL_JAVA_RESOURCE_FILES variable
Fixes: 130040716
Test: treehugger, internal unit test
Change-Id: I3fcc5e041d6e4eaa5d2d4ab75f9a645e724fab1b
2019-04-05 13:53:39 -07:00
Sasha Smundak
b6d230515e Implement host_required and target_required properties.
They are counterparts of LOCAL_HOST_REQUIRED_MODULES and
LOCAL_TARGET_REQUIRED_MODULES respectively.

Fixes: 128693436
Test: treehugger, convert cts/hostsidetests/devicepolicy/Android.bp
Change-Id: Id66ffca6edffe18993ac51e8930f1d0e78178249
2019-04-04 11:24:01 -07:00
Colin Cross
1001a7971a Rename jetifier property and add it to androidmk
Rename jetifier_enabled to jetifier since there are no users
yet and it is more consistent with the rest of the Soong
properties.  Also add it to androidmk translation.

Fixes: 123524520
Test: androidmk_test.go
Change-Id: Ib4c688cf3cb171a822ddf7dd49467522c4c1276c
2019-03-22 15:25:30 +00:00
Ng Zhi An
2935b409fc Rename test description
Bug: 127712304
Test: m androidmk
Change-Id: I1ffb07c2bce0c3890d8e8d8a5661ba351bcadd68
2019-03-19 12:50:13 -07:00
Ng Zhi An
e02e41a9ea Skip obsolete JACK flags
Fixes: 127712304
Test: m androidmk
Change-Id: Ia2f0ccd184151c691563779d1828c111800ed382
2019-03-15 15:03:49 -07:00
Sasha Smundak
177a1a589d Fix crash in mergeListProperties
The value of a property to be merged may be a reference to a variable.
When we first create an attribute for a makefile variable (e.g. we
create 'android_static_libs' from LOCAL_STATIC_ANDROID_LIBRARIES), we
set its type correctly. However, reparse in bpfix erases this
information, so by the time 'android_static_libs' attribute is to be
merged with 'static_libs', it has no type and merge occurs. It isn't
easy to fix properly, so just don't merge in such case, Soong will
complain and it will be fixed manually.

Fixes: 125519127
Test: unit tests in androidmk_test.go
Change-Id: Ic66d7ab686a2fdde987f32e2b204c72d9bf0d026
2019-03-11 10:11:17 -07:00
Sasha Smundak
e10952b442 Do not "escape" newline if comment ends with ESC character.
Fixes: 127521510
Test: manual
Change-Id: I88a8eb2ca94b8aa06e2682d2c14f9e74f5ada286
2019-03-06 16:46:23 -08:00
Jaewoong Jung
b8ba8a5ee8 Fixe typos in androidmk.
Replace contitional with conditional.

Test: androidmk_test.go
Change-Id: Ic261701f4588b9b8b6d3560598831368c3422508
2019-03-05 22:29:58 +00:00
Sasha Smundak
aa7fdad7f3 Revert $(LOCAL_PATH) handling for certificate and
`additional_certificates` properties.

Bug: 122728056
Test: builtin tests
Change-Id: I96f84bf7396447b0207438a4073c864f2d9b1ab7
2019-03-01 11:11:10 -08:00
Sasha Smundak
1d318cbaa9 Handle $(LOCAL_PATH) in androidmk
The variables LOCAL_ADDITIONAL_CERTIFICATES. LOCAL_ASSET_DIR,
LOCAL_CERTIFICATE, LOCAL_JARJAR_RULES, LOCAL_PROGUARD_FLAG_FILES,
LOCAL_RESOURCE_DIR specify the paths relative to the top of the
source tree using $(LOCAL_PATH)/. Remove it when converting to
blueprint files and diagnose the cases when these paths do not start
with $(LOCAL_PATH).

Fixes: 122728056
Test: Internal tests
Change-Id: Id3fcacdd5445a97365c03e00656291bfe829c035
2019-02-25 15:19:06 -08:00
Sasha Smundak
f7ed0513e9 Handle LOCAL_MODULE_PATH assignment for android_test modules
Many Android.mk files for the CTS tests have
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
statement. This can be dropped during the conversion to blueprint
files.
Also, ignore the assignments to obsolete LOCAL_CTS_TEST_PACKAGE
variable.

Fixes: 125405331
Test: Internal tests, selectively run androidmk on Android.mk's in cts/
directory

Change-Id: I2ed88acd3c8837f96b84be6eb7c7b9b0b5405f57
2019-02-22 15:10:08 -08:00
Sasha Smundak
ff36da04e8 Implement vts_config module
Test: internal (see android/vts_config_test.go) + run 'm vts' and check
that host/linux-x86/vts/android-vts.zip remians the same
Change-Id: I0249a974a240e7669c3b9378c17739df8e120873
Fixes: 122617100
2019-02-19 16:58:43 -08:00
Colin Cross
46abdad46a Add support for use_embedded_dex in Soong
When use_embedded_dex is set, store the dex uncompressed in the
APK and set the android:useEmbeddedDex="true" attribute in the
manifest.

Test: m checkbuild
Change-Id: Iea6e7ed19599830ac72392ef93f9c98957df1cce
2019-02-08 15:25:17 +00:00
Colin Cross
e4246abd7f Make manifest and APK agree on uncompressed native libs
Only put uncompressed native libs in an APK if the min_sdk_version
supports it (>= 23, Marshmallow), and set
android:extractNativeLibs="false" in the AndroidManifest.xml so
that the platform won't extract them anyways.

Bug: 117618214
Test: m checkbuild
Change-Id: I760017e48bf3c6b618aabde0982df45995765d48
2019-02-08 15:24:47 +00:00
Sasha Smundak
7054764304 Convert BUILD_PREBUILT with LOCAL_MODULE_CLASS=ETC to prebuilt_etc
The conversion is a two-step process: first, when processing
BUILT_PREBUILT, convert LOCAL_SOURCE_PATH to a variable reference+fixed
subpath path in the blueprint AST. Then, set various boolean flags
depending on variable being referenced. androidmk_test.go has a test for
each handled case.

Change-Id: Iabd18d5f8645ca7077536863cd6640df5b24d24a
Fixes: 122906526
Test: treehugger
2019-01-24 18:46:31 -08:00
Colin Cross
11ecdd6979 Translate LOCAL_ANNOTATION_PROCESSORS to java_plugin
The annotation_processors property is deprected, translate
LOCAL_ANNOTATION_PROCESSORS to plugins instead.  Also remove
LOCAL_ANNOTATION_PROCESSOR_CLASSES properties, they are
retrieved from java_plugin dependencies instead.

Bug: 77284273
Test: androidmk_test.go
Change-Id: If6f6177262d5579e03bae58d9eb54a599e3da786
2019-01-24 23:47:56 +00:00
Dan Willemsen
e9622a33c3 Add BUILD_CTS_* to androidmk
Bug: 122617736
Test: new unit tests
Change-Id: Ibce6b4bbe49015a1ca6cf88cd43badc6b5cc078e
2019-01-15 16:39:02 -08:00
Sasha Smundak
e5c5317f44 Handle Jacoco filters
Test: treehugger
Change-Id: I8bf242cdb4709d086ff0806c143ff03ad2e5cd30
2019-01-09 19:30:38 +00:00
Anton Hansson
1976a25692 Make androidmk translate LOCAL_32_BIT_ONLY
Translate LOCAL_32_BIT_ONLY := true to compile_multilib: "32".

Test: androidmk frameworks/av/services/mediadrm/Android.mk
Change-Id: I9f73f5fdfc67738286844ff42b39ee54403fe649
2019-01-09 10:50:57 +00:00
Jaewoong Jung
acb529b038 Handle multi dir all-*-files-under function calls.
This change fixes a bug where androidmk assumes all-*-files-under
function only takes one directory parameter.

Test: androidmk_text.go, manual execution
Change-Id: Ib1614a2ddde7ea1120c1c37126231988f4862165
2019-01-09 00:07:01 +00:00
Jaewoong Jung
18ef4a2881 Add LOCAL_OVERRIDES_PACKAGES support to androidmk.
It is supposed to be translated to overrides.

Test: Manual test
Change-Id: Ice2e7c5f7669ad1e4c3e82000c8dd52d20a49a7a
2019-01-07 14:30:43 -08:00
Dan Willemsen
72be5901eb Add aapt_include_all_resources
The equivalent of Make's LOCAL_AAPT_INCLUDE_ALL_RESOURCES.

Test: build LatinIME with Soong
Change-Id: Ib76bea5f28e365b59fa9477b9bceabb84012ff8e
2018-10-29 23:49:46 +00:00
Jaewoong Jung
59171a4401 Fix how soong converts LOCAL_STRIP_MODULE.
It should be translated to a poperty map with one entry, not a string
value.

Bug: 74083867
Change-Id: Ida659749a63e67eb55184e7c79959f57b8549dad
Test: androidmk_test.go
2018-10-15 19:38:19 +00:00
Colin Cross
bd01e2abee Add support for android_app_certificate modules
Some android_app modules need certificates located outside their
directory.  Instead of requiring paths from the root of the tree,
add an android_app_certificate module that exports the certificate
files.

Test: m checkbuild
Change-Id: Icbf3898894f3eb857e2d907e3e58dd072c6fabe9
2018-10-08 15:25:54 -07:00
Colin Cross
a4f08813a3 Add support for JNI libraries to android_app modules
Make android_app modules a MultiTargets module, which means the
common variant will have a list of Targets that it needs to handle.
Collect JNI libraries for each Target, and package them into or
alongside the APK.

Bug: 80095087
Test: app_test.go
Change-Id: Iabd3921e1d4c4b4cfcc7e131a0b0d9ab83b0ebbb
2018-10-08 15:20:56 -07:00
Dario Freni
fd05a74e06 Add support for /product-services partition
This is an adaptation of Icc4f8c16bc389fe20db680849f311d02df1299c3, to
support modules that are installed on the /product-services partition.

Bug: 80741439
Test: m -j both with and without enabling the new partition
Change-Id: I72b335ad38baff5848cd3da7489343f8cf98ff16
2018-07-19 14:04:30 +01:00
Colin Cross
0fa89a3ff9 Translate java libraries to java_library
In androidmk, translate BUILD_JAVA_LIBRARY to java_library plus
installable: true, and BUILD_STATIC_JAVA_LIBRARY to java_library.
In bpfix, rewrite java_library_static to java_library.

Bug: 110885583
Test: androidmk_test.go, bpfix_test.go
Change-Id: I63c2f759ae9c62a43f3439526552d2cd8e8cedc3
2018-07-11 05:50:32 +00:00
Colin Cross
83bb3167f6 Add support for min_sdk_version
Add min_sdk_version properties and use it for aapt2
--min-sdk-version and --target-sdk-version flags.  Add an sdkContext
interface that any function that needs an sdk version can take in
order to get the values for the current module.

Bug: 110848854
Test: m checkbuild
Change-Id: Ic69f1f935d8b865ec77689350407df08bfac5925
2018-07-09 12:42:01 -07:00
Colin Cross
ae5caf554c Add support for android_test modules
android_test module are APKs that can be run as tests, either
as standalone unit tests or as instrumentation tests for another
APK.

Test: m checkbuild
Change-Id: I16661701637e4048fd99442029c3e195ebf373a4
2018-05-24 14:53:58 -07:00
Colin Cross
6af2e4980f Support platform_apis property
Add a platform_apis property.  The logic to verify it isn't
hooked up yet, but this will allow translating modules to
Soong without losing the annotation.

Test: m checkbuild
Change-Id: I75ff2d7b94247873f5bb1547a9b347a8e73c3191
2018-05-22 14:14:27 -07:00
Colin Cross
96e7f85b51 Fix optimize.proguard_flags_files typo
LOCAL_PROGUARD_FLAG_FILES should convert to
optimize.proguard_flags_files, not optimize.proguard_flag_files.

Test: m checkbuild
Change-Id: I1471afc006a2a3892af37d2cb73c51636f05d7f7
2018-05-22 12:51:27 -07:00
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