Commit Graph

34084 Commits

Author SHA1 Message Date
Treehugger Robot 9a4279309f Merge "Update soong copy of java binaries when Make copy is installed" 2021-02-23 21:35:20 +00:00
Treehugger Robot 7eacdbf8a6 Merge "Add non-fatal mode for verify_uses_libraries check." 2021-02-23 20:45:42 +00:00
Treehugger Robot 30899caf1f Merge "Refactor BazelTargetModule" 2021-02-23 20:40:23 +00:00
Colin Cross 44b85d01c9 Update soong copy of java binaries when Make copy is installed
m <modulename> is handled by Make and installs the Make copy of a host
java binary in out/host/linux-x86/bin, and doesn't depend on the Soong
copy in out/soong/host/linux-x86/bin.  That can leave a stale binary
in the Soong directory, and since the Soong directory is first in the
path set up by envsetup.sh, can result in confusing behavior to end
users.

cc_binary already has the Make binary depend on the Soong binary
so that they are both updated.  Do the same for java_binary.

Fixes: 180405155
Test: m metalava
Change-Id: Ic84a131a2851cc4a18ce3725da3c4067137d6120
2021-02-23 11:19:57 -08:00
Jiyong Park 66dd5c09e2 android:path attribute is respected for fields in a slice of struct
This change fixes a bug that android:path attribute is ignored when
annotated field is in a slice of struct.

blueprint now traverses fields whose type is slice of struct and
provides the index list in the case. Soong is modified so that it checks
whether the field being referenced is a slice of struct or not. If that
is the case, it gathers field values from each of the elements. If not,
it follows the original path.

Bug: 181018147
Test: m nothing
Change-Id: I220efb6feaa525a00939654459b2998e98e7ad56
2021-02-24 01:22:57 +09: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 d98f5b27e1 Merge "Differentiate usages of word "include" in cc_sdk_test.go" 2021-02-23 15:29:47 +00:00
Paul Duffin 8e46253840 Merge "Add sdk test for incorrect handling of generated headers" 2021-02-23 15:29:39 +00:00
Paul Duffin d884c993dd Merge "Separate versioned/unversioned testing in sdk/cc_sdk_test.go" 2021-02-23 15:29:29 +00:00
Paul Duffin 036e84a767 Merge "Support testing versioned/unversioned sdk Android.bp files separately" 2021-02-23 15:29:20 +00:00
Paul Duffin 1dd5764a4e Merge "Only export sysprop headers in exported sysprop include directory" 2021-02-23 15:28:26 +00:00
Jeffrey Vander Stoep 0d2bc64075 Merge "Setup ANDROID_RUST_VERSION env variable" am: 22af74eafd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1597935

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7993b91eed86d0811f10c20dde09741e4394e22c
2021-02-23 15:17:50 +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 ece454400d Merge changes from topic "hiddenapi_additional_annotations"
* changes:
  Sort hiddenapi monolithic files by signature
  Remove duplicates in monolithic hidden API files
  Remove implicit dependency from <x> -> <x>-hiddenapi
2021-02-23 12:48:24 +00:00
Jeffrey Vander Stoep 22af74eafd Merge "Setup ANDROID_RUST_VERSION env variable" 2021-02-23 10:10:06 +00:00
TreeHugger Robot 4191ec7529 Merge "Merge ab/7061308 into stage." into stage-aosp-master 2021-02-23 08:43:12 +00:00
Treehugger Robot 2cf358677b Merge "Fix infinite recursion when printing unrecognized linktype" am: f0f152484b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1600834

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6bf67cf22a8547fe9cabf7f4f2f54a7045cbf980
2021-02-23 08:09:24 +00:00
Jingwen Chen 8bc5edc91d Merge "bp2build: Unexport GenerateBazelTargetsForDir." am: 0d2497088c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1598094

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib8991cb26dc54ad1e279baa420edb8d08b016ac9
2021-02-23 04:34:13 +00:00
Treehugger Robot f0f152484b Merge "Fix infinite recursion when printing unrecognized linktype" 2021-02-23 04:24:14 +00:00
Jiyong Park d4cbf34032 Fix infinite recursion when printing unrecognized linktype
Bug: N/A
Test: remove some cases from String() so that some linktypes go to the
default path. Then run m nothing. No infinite recursion. Error is
correctly shown.
PANIC=String method: unrecognized linktype: 5
Change-Id: I424755bc89871fc2144ff22d6391f57157cd434d

Change-Id: Ice791025dc50f44ffabd1050bafc5ea35023d32c
2021-02-23 04:02:23 +00:00
Jingwen Chen 0d2497088c Merge "bp2build: Unexport GenerateBazelTargetsForDir." 2021-02-23 03:07:00 +00:00
Treehugger Robot 79b58b3d11 Merge "bootimg supports building (non-vendor) boot.img" am: 05785f0023
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1594411

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic162526591b47f7a7df48d929724af0a1d790a2b
2021-02-23 00:46:06 +00:00
Treehugger Robot 5b72de988f Merge "Add ctx to AndroidMkExtraEntriesFunc" am: 277303f042
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1360943

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5bd4388e45b8e09998819fc5417900d2b9fba58f
2021-02-23 00:45:42 +00:00
Treehugger Robot 3e97f39674 Merge "Limit the number of the Java source files in a single compilation unit" am: a61a042fa6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1590694

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib2fc03fc0e30e99b530bb130c16a358511b027ce
2021-02-23 00:45:18 +00:00
Treehugger Robot 7daedc9c56 Merge "Add modules-utils-build_system to allowed deps" am: 4c666e81d0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1596933

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic87c8e30200b566ef8209154f84d27d64b31b0f0
2021-02-23 00:44:44 +00:00
Treehugger Robot 05785f0023 Merge "bootimg supports building (non-vendor) boot.img" 2021-02-22 23:53:15 +00:00
Paul Duffin d24432aaf0 Merge "Add tests for exported generated headers" am: bc179bc44f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1595275

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iaf8fbc43d59ad31c722ab04f925bbdf6e0f2c387
2021-02-22 23:27:46 +00:00
Treehugger Robot 277303f042 Merge "Add ctx to AndroidMkExtraEntriesFunc" 2021-02-22 22:40:31 +00:00
Treehugger Robot a61a042fa6 Merge "Limit the number of the Java source files in a single compilation unit" 2021-02-22 19:54:00 +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 86b02a7962 Differentiate usages of word "include" in cc_sdk_test.go
A number of tests in cc_sdk_test.go use "include" for the input include
directory which results in the output containing "include/include"
(because the snapshot code uses "include" as the directory into which
native headers will be output). This change switches the inputs from
"include.." to "myinclude.." to differentiate between the two sources.

Bug: 180427921
Test: m nothing

Change-Id: Iba1e6d94647c74b31307b18254c03580e64c91cf
2021-02-22 18:23:22 +00:00
Paul Duffin a43f927cd6 Add sdk test for incorrect handling of generated headers
Bug: 180427921
Test: m nothing
Change-Id: I3d7ff2625eb5c6f5ed5e094da2a5ce6acc0c987c
2021-02-22 18:23:22 +00:00
Paul Duffin 75b902a964 Separate versioned/unversioned testing in sdk/cc_sdk_test.go
Uses new capability added in previous change to separate the testing of
the versioned and unversioned snapshots in sdk/cc_sdk_test.go. Any test
that generated an _snapshot module that simply listed the modules and
did not check a new type only tests the unversioned output to reduce
the duplication and cost of changing the tests.

Bug: 180479010
Test: m nothing
Change-Id: If11f82b3dd8ec79110b3a2f5adf193b6464000ab
2021-02-22 18:23:22 +00:00
Paul Duffin d075907d29 Support testing versioned/unversioned sdk Android.bp files separately
Previously, the only way to test the Android.bp file generated by the
sdk module was to test both the unversioned and versioned parts
together. This change allows them to be tested separately.

Bug: 180479010
Test: m nothing
Change-Id: I3d695bcfbff030a6da393283ab30ec0979fb2826
2021-02-22 18:23:22 +00:00
Treehugger Robot 4c666e81d0 Merge "Add modules-utils-build_system to allowed deps" 2021-02-22 18:22:46 +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
Treehugger Robot bcf3d3411c Merge "update apex/allowed_deps.txt" am: d4b9d04557
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1597975

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iafdcea7b0191e1beffc22e5ace5e4ed5eb716496
2021-02-22 17:19:32 +00:00
Ulya Trafimovich 8c35fcf4d5 Add non-fatal mode for verify_uses_libraries check.
The new mode is enabled with environment variable
RELAX_USES_LIBRARY_CHECK. If the variable is set to true, then a
verify_uses_libraries check failure does not fail the build, instead it
sets a special compiler filter "extract" for dexpreopt, which means that
the DEX file will be extracted, but it won't be compiled to native code.
Class loader context will be set to empty in this case (not &, as it is
going to be deprecated soon).

If the variable RELAX_USES_LIBRARY_CHECK is unset or set to something
other than "true", then the old behaviour of the verify_uses_libraries
check is preserved.

The intended use case for this flag is to have a smoother migration path
for the Java modules that need to add <uses-library> information in
the build files. The flag allows to quickly silence build errors. This
flag should be used with caution and only as a temporary measure, as it
masks real errors and affects performance.

verify_uses_libraries check is reworked so that it writes the error
message to a status file (which is used instead of the former timestamp
file). Currently the stored error message is not used, but it may be
used later to produce a warning. Dexpreopt command checks if the status
file exists and is nonempty; if that is the case, then compiler filter
is set to "extract".
Bug: 132357300

Test: Manually add some mismatch between the libraries in the Android.bp
      and Android.mk files for dexpreopted apps, build with
      RELAX_USES_LIBRARY_CHECK=true and obsserve that the build doesn't
      fail and they are compiled with compiler-filter "extract".
      Unset RELAX_USES_LIBRARY_CHECK and observe that the build fails.

Change-Id: Ibb5d993a25b1df1d2e70b7d5aafc6997f9d64e67
2021-02-22 15:41:03 +00:00
Treehugger Robot d4b9d04557 Merge "update apex/allowed_deps.txt" 2021-02-22 15:38:08 +00:00
Jingwen Chen ba369adff1 bp2build: Unexport GenerateBazelTargetsForDir.
Resolving a comment from aosp/1595678

Test: build/bazel/scripts/milestone-2/demo.sh
Change-Id: Ia7aba2b149fc09615fbafee67838632c71320f1b
2021-02-22 10:22:58 -05:00
Anton Hansson 17a2d5439d Merge "Remove sdkext apex_available allowlist" am: f19be717c6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1597936

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I00f4c829c6954ee446bd7221ed035e7774fe1326
2021-02-22 13:24:42 +00:00
Anton Hansson f19be717c6 Merge "Remove sdkext apex_available allowlist" 2021-02-22 12:20:00 +00:00
Christoffer Quist Adamsen e850737ee4 Allow missing classes in R8 builds
Bug: 180878971
Bug: 72683872
Test: TARGET_PRODUCT=aosp_arm64 m -j core-oj
Change-Id: I663220567eb8f034d3efccc60228aef91c716e8e
2021-02-22 12:09:01 +00:00
Treehugger Robot 1326be14e1 Merge "Add phony target for depsinfo." am: 4b5c5f9283
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1594091

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I58eed9ca879b5ebeac93f3db517b9f96f44cbc39
2021-02-22 11:47:23 +00:00
Lorenzo Colitti 97ca28e990 Add the new NetworkStack shim libraries to APEX allowed deps.
These are not currently tracked before because the shims are just
filegroups. aosp/1598155 is turning them into libraries so each
shim can build with the appropriate SDK version.

Test: m
Change-Id: I9df3dd98d46f49943211cb0893493d628ddd157c
Merged-In: I9df3dd98d46f49943211cb0893493d628ddd157c
2021-02-22 20:32:34 +09:00
Anton Hansson 6536ad7d0f Remove sdkext apex_available allowlist
Not needed anymore.

Bug: 180886919
Test: m
Change-Id: I1f716076eeb44c979e92b767ea67692649e1bfb4
2021-02-22 10:08:40 +00:00