Commit Graph

6123 Commits

Author SHA1 Message Date
Chih-hung Hsieh
7e52be849e Merge "Forbit extra quotes in tidy flag lists" 2021-02-27 08:45:47 +00:00
Justin Yun
163722ae1d Define getSnapshotNameSuffix() am: 07b9f86f0c am: 1ddff5f76f am: 0a6226c014
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1607900

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I607959e437b8e3bb4b082a6cdb42a358d1c7701d
2021-02-26 11:13:51 +00:00
Jingwen Chen
5d8644990b bp2build: add configurable attribute (select) support.
This CL adds a basic framework to support configurable string_list
attributes, selecting on the Arch variant (x86, x86_64, arm, arm64).

It offers fine-grained controls to map individual configurable
properties (arch_variant) to configurable Bazel attributes, starting
with the string_list type for the copts property for cc_object.

This design is primarily motivated to have minimal boilerplate in
bp2build mutators, allowing anyone to opt-in configurable attributes,
and modify intermediate states before passing them on into the
CreateBazelTargetModule instantiator.

Fixes: 178130668

Test: go tests
Test: build/bazel/scripts/milestone-2/demo.sh

Change-Id: Id6f04d7c560312a93e193d7ca4e1b7ceb6062260
2021-02-26 05:17:54 -05:00
Treehugger Robot
4f03289e44 Merge "Remove dependency from vendor_snapshot to each module" am: a777d960ab am: 4f8fa43b99 am: 9fe8c1f482
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1607913

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibd968597d2fee537c97f83d2b5996cf9a597e210
2021-02-26 06:07:34 +00:00
Justin Yun
07b9f86f0c Define getSnapshotNameSuffix()
By sharing a single function for generating snapshot name suffix,
make sure both the DepsMutator and the snapshot modules use the same
names.

Bug: 179666286
Test: m nothing
Change-Id: I9efa94f2981a6bd1b4128bf0e84ca44873ebf3b7
2021-02-26 14:00:03 +09:00
Chih-Hung Hsieh
217e09a784 Forbit extra quotes in tidy flag lists
* Start with clang-tidy flags;
  maybe other flags should be checked too.

Bug: 180862582
Test: make
Change-Id: I82f86a911733693a14fe56a35e28590b065e3ae7
2021-02-25 20:46:15 -08:00
Treehugger Robot
a777d960ab Merge "Remove dependency from vendor_snapshot to each module" 2021-02-26 03:57:42 +00:00
Jingwen Chen
b4adee5361 Merge "bp2build: add support for cc_object's objs and exclude_srcs properties." am: 1251bb5775 am: c1858d0f50 am: eb4d958cf6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1600655

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iba2011c8231a68086ff9faabc76794362300083f
2021-02-25 16:36:12 +00:00
Jingwen Chen
1251bb5775 Merge "bp2build: add support for cc_object's objs and exclude_srcs properties." 2021-02-25 14:09:08 +00:00
Justin Yun
4813867ec3 Remove dependency from vendor_snapshot to each module
The 'vendor_snapshot' module is required to every cc_library to check
if the dependencies need to be rewritten to the snapshot modules or
not. However, as the 'vendor_snapshot' module has dependencies to the
snapshot modules, the dependency to the 'vendor_snapshot' module
creates circular dependencies.
The dependency from the 'vendor_snapshot' to the snapshot modules is
required only to read the module names of the snapshot modules. We
may remove the dependency by setting the name of the snapshot modules
directly.

Bug: 179666286
Test: m nothing
Change-Id: I14abcb06c5c81ef7f8535103578747385c89ae0f
2021-02-25 09:31:12 +00:00
Stephen Hines
6e55d59b00 Merge "reverses common and external Clang flags" am: f3e0d22234 am: 4ad07ba7a3 am: 2a934fba72
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1606997

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifc4e0c7cd537b135bf52af2d86161e65baf8cc32
2021-02-25 08:49:47 +00:00
Christopher Di Bella
c28f5d97a6 reverses common and external Clang flags
Flags for external projects are specialisations of the common flags, and
need to follow the common flags, not precede them.

Bug: 181177782
Test: None

Change-Id: I19c8c2a3539573e9b2f2d9e3e1c898fa09570663
2021-02-25 01:34:08 +00:00
Paul Duffin
5951b78bbc Merge "Generated headers may not be arch specific" am: b2773e116f am: 94dad2bdb4 am: 8da901ceae
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1599159

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1a5b6b034b8e5920e51f4eb5c4971c4db01ecf31
2021-02-24 12:02:57 +00:00
Paul Duffin
baf573a087 Merge "Fix the snapshot handling of generated headers" am: efa0f00706 am: 7c7d2fc156 am: 3b2020b8a3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1599158

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icdd6da97232c36e26f0a1baefd0831cdb2aaae6e
2021-02-24 12:02:47 +00:00
Paul Duffin
b2773e116f Merge "Generated headers may not be arch specific" 2021-02-24 10:10:23 +00:00
Paul Duffin
efa0f00706 Merge "Fix the snapshot handling of generated headers" 2021-02-24 10:08:34 +00:00
Treehugger Robot
17d3ac9aa1 Merge "Move bazel.Properties to a BazelModuleBase" am: bbfd5ab606 am: 035b6e6882 am: 75f8de41e9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1591532

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I137929cc5eb3e20f563f7b184bf088bca913e410
2021-02-24 07:38:44 +00:00
Jingwen Chen
db12024524 bp2build: add support for cc_object's objs and exclude_srcs properties.
objs contains module references to other cc_objects that will be used
for linking later. This maps to cc_library deps.

Also support exclude_srcs, and added tests.

Test: bp2build generate, sync, bazel build //bionic/...

Change-Id: I21200ff73f24bcf5357d9df8dcb5519cde532a77
2021-02-24 01:08:57 -05:00
Treehugger Robot
bbfd5ab606 Merge "Move bazel.Properties to a BazelModuleBase" 2021-02-24 05:53:25 +00:00
Treehugger Robot
3b148cbc0e Merge "Refactor BazelTargetModule" am: 30899caf1f am: be2383b27d am: 501085ce55
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1596752

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0fdb016f6fa9ef9c54496feaebe0934f885c405d
2021-02-24 02:20:17 +00:00
Paul Duffin
73a7d9be76 Merge "Only export sysprop headers in exported sysprop include directory" am: 1dd5764a4e am: e2db082638 am: 28a690d283
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1596831

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I06da8ac9ac32f5a16eedc0245ec94bb45dad5d96
2021-02-24 02:17:19 +00:00
Treehugger Robot
c0c4c82580 Merge "Export aidl, proto and sysprop generated headers separately" am: 2b22365c8c am: d9a7dc9b57 am: bda7188220
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1595276

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2bcc6f82743fdcdba78835c3d893dadc01ec3db7
2021-02-24 02:16:42 +00:00
Treehugger Robot
30899caf1f Merge "Refactor BazelTargetModule" 2021-02-23 20:40:23 +00:00
Liz Kammer
ea6666fba9 Move bazel.Properties to a BazelModuleBase
This allows more direct access to the bazel label and whether the module
is bp2build available.

Test: go test *
Change-Id: I23375835d20fa53d7d94127b2dc2d5bb20487bfb
2021-02-23 10:58:57 -05:00
Paul Duffin
1dd5764a4e Merge "Only export sysprop headers in exported sysprop include directory" 2021-02-23 15:28:26 +00:00
Treehugger Robot
2b22365c8c Merge "Export aidl, proto and sysprop generated headers separately" 2021-02-23 14:11:24 +00:00
Liz Kammer
fc46bc1ee4 Refactor BazelTargetModule
This eliminates the need to remove quotes, delete attributes, and
re-checking that name has correct prefix. Additionally, this allows
assignment directly to the BazelTargetModuleProperties struct, which
allows defaulting unused fields and clarity of which field is being set.

Test: go test soong tests
Test: ran ./build/bazel/scripts/milestone-2/demo.sh
Change-Id: Ia9bfcce76234c793a4ddd5f29a661150f83341c9
2021-02-23 08:29:40 -05:00
Paul Duffin
c9ed7c652a Merge "Add tests for exported generated headers" am: bc179bc44f am: d24432aaf0 am: 16a1b25774
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1595275

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I13b1df790dde3540473b339110e448b69507b8e6
2021-02-23 01:09:27 +00:00
Treehugger Robot
277303f042 Merge "Add ctx to AndroidMkExtraEntriesFunc" 2021-02-22 22:40:31 +00:00
Paul Duffin
7a7d067c74 Generated headers may not be arch specific
Previously, it was assumed that generated headers must be arch specific
and so prevented the fields referencing the paths to those headers from
being automatically optimized by the sdk generation code. That is not
always the case, e.g. with headers generated from protos so this change
allows those fields to be optimized.

Bug: 180427921
Test: m nothing
Change-Id: Id2af419d58ae3c30ea6d9e87f71e33a9ff6ba13b
2021-02-22 18:23:22 +00:00
Paul Duffin
42dd4e6cd6 Fix the snapshot handling of generated headers
Previously, the snapshot handling code did not preserve the directory
structure of generated include directories and instead just copied the
headers into the same module specific directory and added that single
directory to the export_include_dirs (or similar) property.

That had a couple of issues:
* The include directory was repeated in the ..._include_dirs property.
* It did not work when the include directories overlapped.

In the latter case it had a couple of issues:
* Code which compiled fine against the source would not compile against
  the prebuilt.
* Header files were duplicated in the output.

e.g. assume the following generated header file structure:
  foo/
      foo.h
  bar/
      bar.h
      baz/
          baz.h

When the sdk snapshot was passed include directories of "foo", "bar" and
headers of "foo/foo.h", "bar/bar.h", "bar/baz/baz.h" it would generate a
snapshot with the structure:
  include_gen/
      foo.h
      bar.h
      baz/
         baz.h

And:
  export_include_dirs: ["include_gen", "include_gen"]

However, when the include directories overlapped and include directories
of "foo", "bar" and "bar/baz" were passed in the directory structure
would be the same and the export_include_dirs would contain 3 usages of
"include_gen".

That meant that source code which used the following would build
against the source (because it would find "baz.h" in the "bar/baz"
include directory) but would fail when built against the prebuilts
because the "include_gen" directory did not contain "baz.h":
    #include "baz.h"

This change preserves the input directory structure for generated files
in a similar way to how it does it for source files. So, the snapshot
structure looks something like this:

  include_gen/
      foo/
          foo.h
      bar/
          bar.h
          baz/
              baz.h

And:
  export_include_dirs: [
    "include_gen/foo",
    "include_gen/bar",
    "include_gen/bar/baz",
  ],

Bug: 180427921
Test: m nothing
Change-Id: Id69eef8cf5eecd033841d3b7cd0c044a697ce404
2021-02-22 18:23:22 +00:00
Paul Duffin
37e0de5004 Only export sysprop headers in exported sysprop include directory
Bug: 180712399
Test: m nothing
Change-Id: Ia93d20fe0fecf977773257fa43fe40e7fe9f024f
2021-02-22 18:05:18 +00:00
Paul Duffin
33056e8a9a Export aidl, proto and sysprop generated headers separately
Previously, a cc library that included .aidl, .proto and/or .sysprop
files and exported headers generated from at least one of those types
would actually export generated headers from all of them.

While headers generated from .sysprop files are always exported those
generated from .aidl or .proto should only be exported when explicitly
requested.

This change treats them separately as expected. It has the potential
to break the build as it could reduce the set of headers exported and
so a dependent module that needed those would break. The fix in that
case is to simply add one (or both) of the following to the module
that previously exported those headers:

  aidl: {
    export_aidl_headers: true,
  }

  proto: {
    export_proto_headers: true,
  }

Bug: 180712399
Test: m droid
Change-Id: I488182e27dd423d261443612f98d5c112dd3ef8f
2021-02-22 18:05:10 +00:00
Paul Duffin
bc179bc44f Merge "Add tests for exported generated headers" 2021-02-22 18:03:00 +00:00
Justin Yun
5d090eb063 Merge "Update test_min_api_level for cc_test" am: b4697b8125 am: efb6015365 am: 0fabbdb611
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1581288

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9915d2882a1ea03a17796f74413972455c04e566
2021-02-21 07:26:45 +00:00
Justin Yun
107a4cb56c Update test_min_api_level for cc_test
By replacing MinApiLevelModuleController with
ShippingApiLevelModuleController, we don't need to define
api-level-prop option. The property name must not be a parameter but
be defined in the module controller.

test_min_sdk_version is removed as it is not used.

Bug: 178990561
Test: atest vts_core_liblp_test
Change-Id: Ib4660b91c7adb2ec8b970197dc6f65b8e6952a66
2021-02-20 00:46:21 +00:00
Elliott Hughes
ca8a75e102 Merge "__ANDROID_UNGUARDED_AVAILABILITY__ is gone now." am: 272649ceb5 am: 8198c438ca am: eac2d22f6b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1596932

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I13975b59c2c7e5c4c13c1795458932e99efc2d34
2021-02-20 00:32:30 +00:00
Colin Cross
aa2555387d Add ctx to AndroidMkExtraEntriesFunc
Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to
access providers.

Test: m checkbuild
Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
Merged-In: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
2021-02-19 23:05:40 +00:00
Elliott Hughes
272649ceb5 Merge "__ANDROID_UNGUARDED_AVAILABILITY__ is gone now." 2021-02-19 22:27:11 +00:00
Julien Desprez
2e6a5548ce Merge "Switch cc_test host_supported: true to unit tests" am: 251261d01b am: fb7470923a am: c2457399a7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1576042

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Idcee697e2fe9b23e86ca171f4fbabe4d066d84ee
2021-02-19 19:01:05 +00:00
Elliott Hughes
5a8c9531e4 __ANDROID_UNGUARDED_AVAILABILITY__ is gone now.
So no need to keep `-D`ing it.

Bug: http://b/179067538
Test: treehugger
Change-Id: If5bcead40d3bb355c241e363a8f1a956cb144438
2021-02-19 10:43:19 -08:00
Paul Duffin
3cb603eb51 Add tests for exported generated headers
Improves the test coverage for exporting of generated headers. These
tests highlight the bug described in b/180712399.

Follow up changes will refactor and fix bugs in this code. Adding the
tests separately help ensure that those changes do not inadvertantly
change the behavior.

Test: m nothing
Bug: 180712399
Change-Id: I0225b0cf53259071edb99a94be5014ed0e019bde
2021-02-19 17:12:01 +00:00
Julien Desprez
251261d01b Merge "Switch cc_test host_supported: true to unit tests" 2021-02-19 16:55:04 +00:00
Jingwen Chen
d82b711739 Merge "bp2build: cc_object converter." am: 4e86b6ae43 am: d178288566 am: 80939fbbe1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1580344

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib51378b26b297469e17d5495ca15b54cd021098d
2021-02-19 05:54:04 +00:00
Jingwen Chen
4e86b6ae43 Merge "bp2build: cc_object converter." 2021-02-19 03:54:43 +00:00
TreeHugger Robot
bd72625520 Merge "Add ctx to AndroidMkExtraEntriesFunc" into sc-dev 2021-02-19 01:03:10 +00:00
vichang
d4ce81e6eb Merge "Non-installable module should not be installed into a fuzzer .zip package" am: cd821d8283 am: 8c488d9075 am: c96569722b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1579438

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1398cb096137fa516b64b906211fddfeeb1447cc
2021-02-18 10:48:56 +00:00
vichang
cd821d8283 Merge "Non-installable module should not be installed into a fuzzer .zip package" 2021-02-18 09:59:06 +00:00
Jingwen Chen
8c1b97e01b bp2build: cc_object converter.
This CL introduces a basic bp2build converter for cc_object modules.
cc_objects maps cleanly to cc_library targets, but with -fnoaddrsig.

This CL also demonstrates generating include deps within a macro to
allow the cc_object compilation to depend on a relative-include header
within an include dir.

e.g. if "foo.cc" includes "android/log.h" and the latter is located at
"include/android/log.h", the autogenerated header deps would export
"android/log.h" correctly to the foo.cc upstream target.

Test: GENERATE_BAZEL_FILES=true m nothing && bp2build-sync write && bazel build //bionic/libc:crtbegin_so1

Change-Id: Ifd9e097051ec184ab0a1929d07918f0ff4f24d98
2021-02-18 03:27:28 -05:00
Colin Cross
f79fee864c Add ctx to AndroidMkExtraEntriesFunc
Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to
access providers.

Bug: 180540739
Test: m checkbuild
Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
2021-02-17 15:24:43 -08:00