Commit graph

61 commits

Author SHA1 Message Date
Colin Cross
d079e0b270 Reformat build/soong for go 1.19
Test: none
Change-Id: I132368f0fcbdb5ea088b5b84dbe4ccfdd9e94cad
2022-08-17 10:43:13 -07:00
Yuntao Xu
b8e80350d2 rewrite android_app to android_test in mk2bp
1. When a converted android_app module has the `test_suites` property,
rewrite the module type to an android_test one;
2. Refactor the existing codes for rewriting cc_binary to cc_test.

Bug: 217650002
Test: add unit and end-to-end tests
Test: TreeHugger
Change-Id: I90d744a2ae93561f63ed8606f37ea4aa26fa6137
2022-04-05 18:40:19 -07:00
Trevor Radcliffe
82cf9a7d4b Remove res and assets in androidmk if default
Test: new tests in androidmk_test and bpfix_test. Ran against file.
Fixes: 209019903
Change-Id: I5fc9005302c006b3205b4cbd04cef7c2aca40bc8
2022-01-25 23:10:21 +00:00
Liz Kammer
e9ecddc972 Add support for a prebuilt_root_host type.
Test: art-tests
Change-Id: If013e46d2bbd9cc937a11fe7cf3b67eb8b262b55
2022-01-06 12:14:59 -05:00
Treehugger Robot
4fd34e1a6d Merge "Correct typo in prebuilt_etc property name." 2022-01-05 16:59:54 +00:00
Liz Kammer
9f68d21155 Correct typo in prebuilt_etc property name.
Test: run bpfix
Change-Id: I5556eed9ded8e9d6f756a871a5eceb99ed97edee
2022-01-04 12:53:41 -05:00
Liz Kammer
5b8e7bcaf5 Improve error message for missing path + local dir
Test: androidmk in same directory as an Android.mk file being converted.
Change-Id: Id0e95e392884996e3e5a997c09f11501d3e967ed
2021-12-22 15:32:55 -05:00
Yuntao Xu
21be0e26b9 Add tests for converting license in androidmk
1. Added unit tests for license conversions in the androidmk tool, by
using a mocked filesystem;
2. Added integration tests in a shell script with a mocked filesystem.

Bug: 205615944
Test: m androidmk
Test: bash androidmk_test.sh
Test: TreeHugger
Change-Id: Id3d1f914190b52b82aadda7ea019192787b839d6
2021-12-07 11:26:16 -08:00
Yuntao Xu
214cdaf1d4 Handle license conversions in androidmk
1. Support license conversions in the androidmk tool. More details can be
found at go/license-androidmk;
2. As usage examples, locally this functionality has been applied to
aosp/1881088 and aosp/1869664;

Bug: 202964622
Test: m androidmk
Test: manually ran androidmk <typical Android.mk files>
Test: TreeHugger
Change-Id: I7d5013d25ad8961e997109d0378f20f5085e0ecf
2021-11-16 11:41:31 -08:00
Lukacs T. Berki
b838b0a147 Do not modules in files called "Blueprints".
The only case for this was Blueprint itself at build/blueprint, but with
that being a part of Soong, this special case is not necessary anymore.

Test: Presubmits.
Change-Id: Icc51cd80bd43f936a97018061cfbf76fc385e4c3
2021-09-02 11:46:24 +02:00
Yuntao Xu
cc8287c494 convert flag options and values in the same line
1. Added the logic in the `androidmk` tool, to convert the flag options and their
corresponding values in the same line;
2. The flags for cc-type modules include asflags, cflags, clang_asflags, clang_cflags,
conlyflags, cppflags, ldflags, and tidy_flags;
3. The flags for java-type modules include apptflags, dxflags,
javacflags, and kotlincflags;
4. Two unit tests were added.

Bug: 192401704
Test: m androidmk
Test: TreeHugger
Change-Id: I2973ad49812e891079cd488e993f2d12c4da3797
2021-07-12 16:10:44 -07:00
Liz Kammer
fbf51b67c9 Add bpfix to remove sanitize.scudo
scudo is not supported for Android 11+, sanitize.scudo is deprecated,
when running bpfix, remove it.

Test: go test bpfix tests
Change-Id: Ibb58bb302df3bad24cfce3ae98c65015c090853c
2021-07-12 15:28:21 -04:00
Yuntao Xu
8f884a0a69 modify cc_binary type to cc_test for test modules
1. When a cc_binary type module has the non-empty test_suites field,
modify the type to cc_test;
2. Unit tests were also added.

Bug: 193071602
Test: m androidmk
Test: TreeHugger
Change-Id: Icfaa79998616c02bb086f81d194163feafb4c116
2021-07-08 15:13:25 -07:00
Yuntao Xu
f1b75a2377 convert BUILD_CTS_SUPPORT_PACKAGE in mk files
1. Modified the logic of the androidmk tool, to convert the BUILD_CTS_SUPPORT_PACKAGE
field to the android_test_helper_app module type rather than android_test;
2. Updated the unit tests as well.

Bug: 191907322
Test: m androidmk
Test: TreeHugger
Change-Id: Iabff299f6d043521481ef1af457c708353559823
2021-06-24 16:02:31 -07:00
Jaewoong Jung
3ef77e89f0 Make runtime_resource_overlay product specific.
When mk2bp'ing a runtime_resource_overlay module, make it product
specific by default so that it reflects how the current make
configuration works.

Bug: 155783598
Test: bpfix_test.go
Change-Id: Icafa8228fe65ecc5b33ad80ad721e7997fbff383
2021-02-25 18:58:16 -08:00
Bob Badour
02040de891 Add LOCAL_LICENSE_KINDS to build/soong
Added SPDX-license-identifier-Apache-2.0 to:
  Android.bp
  android/Android.bp
  android/soongconfig/Android.bp
  androidmk/Android.bp
  apex/Android.bp
  bazel/Android.bp
  bp2build/Android.bp
  bpf/Android.bp
  bpfix/Android.bp
  cc/Android.bp
  cc/config/Android.bp
  cc/libbuildversion/Android.bp
  cc/libbuildversion/tests/Android.bp
  cc/ndk_api_coverage_parser/Android.bp
  cc/ndkstubgen/Android.bp
  cc/symbolfile/Android.bp
  cmd/dep_fixer/Android.bp
  cmd/diff_target_files/Android.bp
  cmd/extract_apks/Android.bp
  cmd/extract_jar_packages/Android.bp
  cmd/extract_linker/Android.bp
  cmd/fileslist/Android.bp
  cmd/host_bionic_inject/Android.bp
  cmd/javac_wrapper/Android.bp
  cmd/merge_zips/Android.bp
  cmd/multiproduct_kati/Android.bp
  cmd/path_interposer/Android.bp
  cmd/pom2bp/Android.bp
  cmd/pom2mk/Android.bp
  cmd/sbox/Android.bp
  cmd/soong_build/Android.bp
  cmd/soong_env/Android.bp
  cmd/soong_ui/Android.bp
  cmd/zip2zip/Android.bp
  cmd/zipsync/Android.bp
  cuj/Android.bp
  dexpreopt/Android.bp
  dexpreopt/dexpreopt_gen/Android.bp
  env/Android.bp
  etc/Android.bp
  filesystem/Android.bp
  finder/Android.bp
  finder/cmd/Android.bp
  genrule/Android.bp
  jar/Android.bp
  java/Android.bp
  java/config/Android.bp
  kernel/Android.bp
  linkerconfig/Android.bp
  linkerconfig/proto/Android.bp
  makedeps/Android.bp
  partner/Android.bp
  phony/Android.bp
  python/Android.bp
  python/tests/Android.bp
  remoteexec/Android.bp
  rust/Android.bp
  rust/config/Android.bp
  scripts/Android.bp
  sdk/Android.bp
  sh/Android.bp
  shared/Android.bp
  symbol_inject/Android.bp
  symbol_inject/cmd/Android.bp
  sysprop/Android.bp
  tradefed/Android.bp
  ui/build/Android.bp
  ui/logger/Android.bp
  ui/metrics/Android.bp
  ui/metrics/proc/Android.bp
  ui/status/Android.bp
  ui/terminal/Android.bp
  ui/tracer/Android.bp
  xml/Android.bp
  zip/Android.bp
  zip/cmd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  finder/fs/Android.bp
  third_party/zip/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work

Change-Id: Ia47ca14f16b8c9f84f9d533a07e5b00e2c04e8d4
2021-02-06 04:23:21 +00:00
Jaewoong Jung
18aefc1977 Remove unnecessary snake case variables.
Test: m nothing + TreeHugger
Change-Id: I99f7162944daa6c57c6ae4763261e108bb5cb6b1
2020-12-22 12:38:35 -08:00
Colin Cross
405af07859 Revert "Make lots of tests run in parallel"
This reverts commit 323dc60712.

Reason for revert: Possible cause of test instability
Bug: 170513220
Test: soong tests

Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-09 18:34:24 -07:00
Colin Cross
323dc60712 Make lots of tests run in parallel
Putting t.Parallel() in each test makes them run in parallel.
Additional t.Parallel() could be added to each subtest, although
that requires making a local copy of the loop variable for
table driven tests.

Test: m checkbuild
Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2020-10-06 15:12:22 -07:00
Dan Willemsen
9f43597ff7 Remove obsolete PDK build functionality
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.

Adds a bpfix rule so that we can eventually remove the
product_variables.pdk definition, which is now always a no-op.

Test: treehugger
Change-Id: I830b54d419b59f6db1d4617b45e61a78234f57a7
Merged-In: I830b54d419b59f6db1d4617b45e61a78234f57a7
2020-08-11 01:11:44 +00:00
Liz Kammer
0449a6337e Add relative_install_path property to prebuilt_etc
This supports a more consistent property across modules for specifying a
subdirectory to install a file into for prebuilt_etc modules.

Updates bpfix to rewrite `sub_dir` to `relative_install_path`.

Test: gotest prebuilt_etc_test
Test: gotest bpfix_test
Bug: 156568187
Change-Id: Idd05cd2178c46e290764a3b708faa8275818ca1e
2020-06-29 10:54:03 -07:00
Thiébaud Weksteen
5e291c238f Fix bpfmt issues and add bpfmt to preupload checks
Test: m nothing
Change-Id: I10526a33685335bdd26cc7692815133379d4e0f6
2020-06-29 09:14:08 +02:00
Liz Kammer
6e85e4c2bc Support preprocessed prebuilt tests in androidmk
Adds support to translate app prebuilt tests to android_test_import and
LOCAL_REPLACE_PREBUILT_APK_INSTALLED to preprocessed property.

Test: androidmk_test.go, bpfix_test.go
Bug: 155412211
Change-Id: I77c07c684125adf228ba91911998823a68b3a65d
2020-05-26 09:12:42 -07:00
Dan Willemsen
2b8b89cfa2 soong_config: bool_variables shortcut
Using a lot of boolean variables can become very verbose without adding
really any new information:

      variables: ["a", "b", "c"],
  }

  soong_config_bool_variable {
      name: "a",
  }

  soong_config_bool_variable {
      name: "b",
  }

  soong_config_bool_variable {
      name: "c",
  }

Now turns into:

      bool_variables: ["a", "b", "c"],
  }

Test: built-in tests
Change-Id: If5455a38433431c7ecbce1e5b32cfbb47f42602a
2020-03-23 22:42:32 -07:00
Steven Moreland
3cc2dfaf90 bpfix: remove hidl_interface types
These were needed to create/track dependencies, but since we use src
jars now, they are no longer needed.

Test: bpfix_test
Change-Id: Ife7942f937cf94c66547af92821a4c11bd747e3f
2020-01-21 18:51:04 -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
Steven Moreland
c0647eb9ee bpfix: remove empty HIDL libs
libhidltransport/libhwbinder are empty and disallowed in Android.bp
(motivation is ~4kb per empty library per process overhead).

Bug: 135686713
Test: bpfix
Change-Id: I964215ad35068465217af74c5ef1322b43476428
2019-11-06 11:35:55 -08: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
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
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
Jaewoong Jung
a725681ed8 Merge "androidmk conversion logic for android_app_import" 2019-05-23 20:55:57 +00: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
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
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
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
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
Jaewoong Jung
2a9ed7c429 Add java_import_host handling logic.
Now java_import with a host flag set to true is converted to
java_import_host.

Bug: 122372359
Test: bpfix_test.go + manual test with real examples.
Change-Id: Ie38fa51a44c83c434927db4b742d6839c64b3d63
2019-01-07 14:13:51 -08:00
Dan Willemsen
59339a29e1 Fix go vet issues
Test: go vet ./...
Change-Id: Ifb936ccc5e2b5a2c3fcbbbcb54f680e2973ea1b3
2018-07-22 21:18:45 -07: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
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
e467f44f9b Reduce boilerplate around bpfix passes
Make it easier to add bpfix passes by putting them in a single
list.

Test: bpfix_test.go
Change-Id: I194aeeb88457800545d58aceb5d1616c6752274a
2018-05-24 14:53:58 -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
Dan Willemsen
2b21a77ad9 bpfix: Convert local_include_dirs removal to PatchList
This way we can remove the line the property was on, not just the
property itself.

Test: `m blueprint_tools` to run the unit tests
Test: diff bpfix results on all of AOSP before/after this change
Change-Id: I61fdd945e6ee711c620b79683dfee7b7c751b3c4
2018-05-14 15:32:21 -07:00
Dan Willemsen
36c69ee42b bpfix: Add reorderCommonProperties
This will move the common properties:

  name
  defaults
  device_supported
  host_supported

To be listed first (and in that order) for every module. Other
properties are untouched.

This also adds a helper to test individual passes in an end-to-end
manner, and a helper to run passes that use PatchLists.

Test: `m blueprint_tools` to add the new tests
Test: Diff bpfix results over all of aosp before/after this change
Change-Id: I746a00a3731cb7597d2613ef2dc45a99654cd122
2018-05-14 15:32:21 -07: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
d6989f2e52 Fix usage of bytes.NewBuffer in bpfix
According to the documentation: "NewBuffer creates and initializes a new
Buffer using buf as its initial contents. The new Buffer takes ownership
of buf, and the caller should not use buf after this call."

Test: Run bpfix twice, only wrote the first time.
Change-Id: I52f88bfd9247240436b46f396c9196157774615b
2018-05-07 16:22:22 -07:00
Dan Willemsen
dde8cb9615 bpfix: Remove local_include_dirs if we remove the last entry
This still leaves a blank line in it's place, but that's a more general
problem.

Test: m blueprint_tools
Test: Run bpfix over AOSP, diff.
Change-Id: I55c1d1c183cfa49beeca07abd539348bc2524c5a
2018-05-07 13:32:09 -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