Commit graph

4805 commits

Author SHA1 Message Date
Paul Duffin
de13a3a232 Add CommonOs to Config.Targets
Previously, CommonOs was not added to Config.Targets for the test which
caused AndroidMk to crash when trying to determine if a target needed
the 2ND_ prefix added to some make variables.

Bug: 245956352
Test: m nothing
Change-Id: Ia815537ee5ce8e83df9a01c57250aa888453d138
2022-10-06 10:24:47 +01:00
Colin Cross
a497606f1d Merge changes I154a6f3a,I79f0c20a,I605ae9af,I647c7305,I95e96e3e, ...
* changes:
  Move fuzzer's CollectAllSharedDependencies into GenerateAndroidBuildActions
  Support AllowMissingDependencies in prebuilt_apex modules
  Support AllowMissingDependencies for apex dependencies
  Add AllowMissingDependencies support for prebuilt_etc module with no src property
  Make OutputFileForModule work for AllowMissingDependencies
  Fix panics when target arch is riscv64
2022-10-05 21:25:17 +00:00
Spandan Das
e191ae76b6 Merge "Move API providing modules from bp2build to api_bp2build workspace" 2022-10-05 19:40:01 +00:00
Jihoon Kang
0b5f7f153f Merge "Specify jnilib partition in Android-<target>.mk" 2022-10-05 16:19:51 +00:00
Spandan Das
ee08eb3c81 Merge "Create a new mode in soong_ui to generate API only BUILD files" 2022-10-05 01:37:28 +00:00
Colin Cross
14ec66c2fb Make OutputFileForModule work for AllowMissingDependencies
Report missing output files as missing dependencies when
AllowMissingDependencies is enabled.  This will fix
AllowMissingDependencies builds where a dependency module is
present but missing support for a specific architecture.

Bug: 250918230
Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing
Test: TestOutputFileForModule
Change-Id: I95e96e3e7cb3df7bf678ed628b45baf659addbad
2022-10-04 16:38:14 -07:00
Spandan Das
8b4a5f352e Move API providing modules from bp2build to api_bp2build workspace
The module types in scope are
1. ndk_library
2. ndk_headers, versioned_ndk_headers
3. api_domain

These modules will no longer generate Bazel targets in bp2build
workspace. A new soong mode `api_bp2build` will be used to generate API
specific targets in a separate Bazel workspace at out/soong/api_bp2build

Test: go test ./bp2build

Change-Id: I01d06b6d8b8364c0d56d6d3f07f8f8bf21db31d7
2022-10-04 17:33:32 +00:00
Spandan Das
5af0bd3e48 Create a new mode in soong_ui to generate API only BUILD files
The generated Bazel workspace will only contain api specific targets.
This is feasible since these targets do not have any cross dependencies
with the targets in the bp2build workspace

The advantages of a new mode are
1. Does not pollute bp2build workspace with api targets
2. Does not block api targets with the current allowlist conversion
   mechansims in bp2build
(In the future we might want to combine these two workspaces)

A Soong module type will generate a Bazel target if it implements
ApiProvider interface

Test: m apigen
Test: m nothing

Change-Id: I69c57ca6539f932e0ad554ce84a87fb7936fdba0
2022-10-04 17:32:56 +00:00
Vinh Tran
220fb8b627 Allowlist frameworks/native/libs/gui and frameworks/native/libs/vr
Test: CI
Change-Id: Ibe82874b5d2aefe4d8322e19080496c4223aaeed
2022-10-04 12:05:04 -04:00
Jihoon Kang
f78a890183 Specify jnilib partition in Android-<target>.mk
Context
- Android-<target>.mk currently does not contain information about partition for its dependent unembedded jni libraries, but only lists the name of the unembedded jni libraries.
- If an android_app module depends on an unembedded jni library that is located in a different partition, make cannot find the library.

Implementation
- Create a string field partition in jniLib struct.
- Add variable "LOCAL_SOONG_JNI_LIBS_PARTITION_<target>", an array of mappings of the name of the jni library to its partition.

Bug: 154162945
Test: m
Change-Id: I6b8e1272ff59dc70e3dd6ce8c6c8e4686dad76df
2022-10-04 03:26:05 +00:00
Jason Wu
d201524549 Merge ""verbose log" mixed build bazel cquery commands" 2022-10-03 21:59:38 +00:00
Colin Cross
9531e42407 Merge changes from topic "soong-riscv64"
* changes:
  Add riscv64-linux-android support
  Removed unused GCC references
2022-10-03 19:41:45 +00:00
Jason Wu
52cd19401d "verbose log" mixed build bazel cquery commands
Test: Using m-nothing to verify the Cquery.output

Bug: 244573247

Change-Id: I48bbcf0bf3000b214fba8d63af96b675d17e2428
2022-10-03 19:29:17 +00:00
Colin Cross
f05b0d35d2 Add riscv64-linux-android support
Add barebones riscv64-linux-android support.  This should be enough
to add riscv64-specific entries to Android.bp files, but can't
actually compile anything until there are riscv64 toolchains.

Test: arch_test.go
Change-Id: I0dcc7e797d9352dd38243be908a7f19004ff3db1
2022-10-03 08:43:13 -07:00
Vinh Tran
1b6a461877 Allowlist frameworks/av/media/codec2/components/aom and external/libaom
Test: CI
Change-Id: Id28ebe7fee7a4b6639efff512c32f48dd584e474
2022-10-03 10:41:15 -04:00
Usta (Tsering) Shrestha
d0c8d54f29 Merge "typo in comment" 2022-09-30 19:59:42 +00:00
Vinh Tran
8c7e3d871a Merge "Allowlist com.android.media.swcodec" 2022-09-30 15:56:32 +00:00
Christopher Parsons
6378c05029 Merge "Support main repository prefixing in cquery" 2022-09-29 15:21:22 +00:00
Vinh Tran
2dbc7451bf Allowlist com.android.media.swcodec
Bug: 2238278
Test: CI
Change-Id: I802542429615217fd8405d47839d262579d9db01
2022-09-29 11:08:12 -04:00
Paul Duffin
a3be747e5d Merge "java_sdk_library_import: Copy all prebuilt properties to child modules" 2022-09-29 10:28:41 +00:00
Treehugger Robot
fba6f7797c Merge "Add bp2build converter for bpf" 2022-09-29 03:04:46 +00:00
Zi Wang
b3cb38c3c8 Add bp2build converter for bpf
Bug: 240163393
Test: m bp2build
Test: bp2build/bpf_conversion_test.go
Change-Id: Ie3bbc64511146b099a766d7e8b56e93cef58ef68
2022-09-28 14:18:45 -07:00
Chris Parsons
86dc2c268a Support main repository prefixing in cquery
This makes mixed builds resilient to a recent backward-incompatbile
Bazel feature which explicitly adds the main repository (`@`) prefix to
all labels which are stringified by `str(target.label)` in Starlark.

This implementation is compatible with both current Bazel and
Bazel@HEAD.

After a new Bazel release to AOSP, we can clean up this code a little to
only support Bazel with this feature active (and that we need not hedge
on either Bazel behavior).

Bug: 248106697
Test: `m --bazel-mode nothing` with both current Bazel and a new Bazel
Change-Id: Id53c8505bb9080d5073c844de7f1ee57ceceae46
2022-09-28 19:02:51 +00:00
Treehugger Robot
d15df3269c Merge "Allowlist more deps of minadbd." 2022-09-28 18:20:03 +00:00
Yu Liu
cb7516349c Merge "Enable mediaswcodec." 2022-09-28 15:42:46 +00:00
Paul Duffin
bf4de041de java_sdk_library_import: Copy all prebuilt properties to child modules
Previously, only the prefer property was copied from the
java_sdk_library_import module to its child modules which meant that if
the use_source_config_var property was used to control the prefer
property that the child modules would never be used. That can cause
build breakages when building against prebuilts as some parts of the
build will use prebuilt files from java_sdk_library_import and some
will use source files from the corresponding java_sdk_library.

This change copies the use_source_config_var property too.

It also adds tests to verify that dependencies on child modules of a
java_sdk_library use the prebuilt child modules of the corresponding
java_sdk_library_import. That revealed a bug with the handling of stub
sources where the prefer property was set after creating the module
which has also been fixed.

Bug: 249192297
Test: m nothing
      # Cherry pick into branch broken by previous behavior and make
      # sure that it fixes it.
Change-Id: I5719c257f8457bcb2238bc7965215512a20f1095
2022-09-28 13:58:52 +01:00
Jingwen Chen
a051942118 Allowlist more deps of minadbd.
..except minadbd itself, which depends on 'adbd_system_api_recovery', a
phony module type that doesn't have a bp2build converter.

Test: bp2build.sh
Bug: 243025934
Change-Id: I48db09f8028a04089ed6fa6afac00007c3de4b31
2022-09-28 08:28:48 +00:00
Yu Liu
8c98153fc3 Enable mediaswcodec.
Bug: 233947030
Test: Manual
Change-Id: I4588167fadc609b0cf28a2918e0a24771a295b3b
2022-09-27 12:47:26 -07:00
Usta Shrestha
56b84e7786 typo in comment
Bug: N/A
Test: N/A
Change-Id: Ibfcaf4deba2181d48a6428d05f715fac447d74c6
2022-09-27 14:59:10 -04:00
Sasha Smundak
05b0ba6d1c Convert Soong licenses attribute to Bazel's applicable_licenses attribute
Add it to the `CommonAttributes` struct and handle it in fillCommonBp2BuildModuleAttrs

Bug: 190817312
Test: treehugger
Change-Id: I7b21056e680384d4046372ee844512029721026e
2022-09-27 11:38:11 -07:00
Treehugger Robot
8c45f98c3e Merge "File paths to allow "./" prefix" 2022-09-26 21:02:34 +00:00
Usta Shrestha
d558031e0c File paths to allow "./" prefix
bazel_path conversion would treat "./" as a package boundary
  which would be incorrect

Bug: b/243072036
Test: unit test build_conversion_test.go and `m libc`
Change-Id: I0fc44d2fd7a4270442c8755219a11fd585244c5c
2022-09-26 14:44:15 -04:00
Paul Duffin
bfdca96828 Add sdk:"keep" tag support
Fields tagged with `sdk:"keep"` will keep the value even if it would
normally be cleared because it was common across a number of structs.
This will allow a module type to specify the same value across all
structs populated directly from variants and have it be copied into all
common property structs without clearing it from the variant specific
structs.

Bug: 248258460
Test: m nothing
Change-Id: I147d946b11fd8766a7d875d9206e8f5034f585d6
2022-09-26 18:28:56 +01:00
Paul Duffin
02e25c85eb Rename sdk field tag "keep" to "ignore"
"ignore" is a better description of the effect that this tag has on the
optimization that is done as part of the sdk snapshot generation.
"keep" implies that something special is done with the field during the
optimization process but actually the optimization process completely
ignores the property, just as it does with unexported fields.

Bug: 248258460
Test: m nothing
Change-Id: Idfdfd87f927d641d4d301cbbde72b463c89155bf
2022-09-26 18:23:25 +01:00
Alix Espino
394a12b315 Merge "Implement bp2build for prebuilt_etc_xml" 2022-09-26 17:18:56 +00:00
Vinh Tran
32a98a5d55 Convert genDir to RULEDIR in gensrcs's cmd
Test: CI
Change-Id: I5ecc19dc73559bb518871080737b28a649edc162
2022-09-23 14:18:20 -04:00
Yu Liu
7574afb67f Merge "Allowlist libcode2_hidl@1.0/1.1/1.2" 2022-09-23 16:05:44 +00:00
Jingwen Chen
a5ecb37d64 Remove apexer.required workaround for aapt2.
Add a filter for cyclic references in required module names in bp2build.

Test: CI
Bug: 247985196
Bug: 225291837
Fixes: 234748998
Change-Id: Id1cfd0b2e5f217cdb01218ec3bbe11d5070cc9df
2022-09-23 06:41:35 +00:00
Jingwen Chen
f50817d511 Add zip2zip alias and allowlist unblocked rdeps.
Test: presubmit
Change-Id: Ia4eb3e6af5cf43dc5c1d924cbf7dcf812f4b8703
2022-09-23 02:29:02 +00:00
Jingwen Chen
4a7bf608b2 Add a soong_zip alias to prebuilts and allowlist all blocked rdeps.
This is an improvement over directly referencing the prebuilt because
bp2build can now emit BUILD files that contain a dep to
//build/soong/zip/cmd:soong_zip even though we're not converting the
soong_zip module.

It helps to make progress despite not having go rules support to
convert/build soong_zip. This unblocks many modules, like genrules and
gensrcs that use soong_zip in tools. soong_zip doesn't change often, so
it's not risky to depend on the prebuilt instead of source version.

Bug: 194644518
Bug: 248222296

Test: bp2build CI
Change-Id: Idef0c27ec0fb43a9097d750ec72fba00644c9f2a
2022-09-23 02:28:36 +00:00
Treehugger Robot
eaf5eda15b Merge "Fix package boundary in glob expansion with checked in BUILD files." 2022-09-23 01:25:36 +00:00
Jingwen Chen
0eeaeb8ef7 Fix package boundary in glob expansion with checked in BUILD files.
For directories without an Android.bp file, if they contain a merged
checked in BUILD file, it becomes a package boundary in the symlink
forest. However, the current glob expansion is only aware of Android.bp
files, but not merged BUILD files, so it generates glob expansions
incorrectly for files that cross the package boundary.

This CL fixes that by making the package boundary function aware of the
keepExistingBuildFile allowlist. See the new test cases for example.

Also stop using the same global bp2buildConfig for every test case to
allow each test to define their own bp2build allowlists.

Bug: 185358476
Test: new unit tests

Change-Id: Ifcd1283480a09a642ef4343e5bbc599583524577
2022-09-22 23:22:49 +00:00
Spandan Das
b79d1aee38 Merge changes from topic "api_export"
* changes:
  Allowlist conversion of api providing module types
  Multi-tree API bp2build converter for ndk_library
2022-09-22 20:49:16 +00:00
Alix
5918d649a4 Implement bp2build for prebuilt_etc_xml
Bug: 237039154
Test: xml_conversion_test.go & bp2build
Change-Id: I1f2c57b9532138f73041d8fc08feea3f66b2ebbc
2022-09-22 20:17:19 +00:00
Yu Liu
bf7c03ef66 Allowlist libcode2_hidl@1.0/1.1/1.2
Bug: 232544295
Test: Manual
Change-Id: Iaeae1d348a0756e63e0c16ebd0759528543c057f
2022-09-22 12:12:26 -07:00
Vinh Tran
fd446d6dba Allowlist com.android.neuralnetworks
Bug: 246958825
Bug: 232486397
Test: b build //packages/modules/NeuralNetworks/apex:com.android.neuralnetworks
Change-Id: I0f818911cc99505e95239e0aa782e3ed3b5b1da7
2022-09-22 14:45:42 +00:00
Vinh Tran
f19b658803 bp2build to convert $(genDir) to $(RULEDIR) in genrule's cmd
`statslog.cpp` with cmd `"$(location stats-log-api-gen) --cpp $(genDir)/statslog.cpp"` produces `out/.intermediates/frameworks/proto_logging/stats/stats_log_api_gen/statslog.cpp/gen/statslog.cpp`. Hence, $(genDir) is equivalent to `<package-dir>/<module-name>/gen`.

Currently, bp2buld converts `$(genDir)` to `$(GENDIR)`. In Bazel, `$(GENDIR)` is only the base of the generated code (e.g. `bazel-bin`).

```
genrule(
    name = "statslog.cpp",
    cmd = "$(location :stats-log-api-gen) --cpp $(GENDIR)/statslog.cpp",
    outs = ["statslog.cpp"],
    tools = [":stats-log-api-gen"],
)
```
produces `bazel-bin/statslog.cpp` but expects to have `bazel-bin/frameworks/proto_logging/stats/stats_log_api_gen/statslog.cpp`.

By converting to `$(RULEDIR)` which is `bazel-bin/frameworks/proto_logging/stats/stats_log_api_gen`.

There had not been any genrule module allowlisted with genDir
yet. So this should not cause any issue with modules converted before
this CL.

Bug: 247536535
Test: go tests
Test: presubmit builds and tests
Change-Id: I65c6aafadab6b180b7ef700427e041547ae7e98a
2022-09-22 08:57:14 -04:00
Spandan Das
d58630f5fc Allowlist conversion of api providing module types
The allowlisted modules will be used to gather the contributions to the
publicapi surfce

Test: TH
Change-Id: I49df3a734c7ab21f21020a8cf8ddfaf7b6fa9717
2022-09-21 19:58:18 +00:00
Spandan Das
81593891ee Create api_domain module type and its bp2build converter
This module does not have any build actions in Soong yet. It will be
converted to a Bazel target using bp2build, and API export will be run
on the generated Bazel target

Test: go test ./bp2build
Test: TH
Change-Id: I76df32bd9f23b60e746b2700af07668a2ed74844
2022-09-21 19:49:46 +00:00
Spandan Das
1278c2cb24 Multi-tree API bp2build converter for ndk_library
This is a partial bp2build conversion that only emits the
cc_api_contribution target of ndk_library. We also need to convert this
to cc_stub_suite eventually to enable building vendor/product API
domains with Bazel

Also create an enum for the three known Multi-tree API surfaces (will
likely be expanded in the future)

Test: go test ./bp2build
Test: b cquery //bionic/libc:libc.ndk.contribution --output=starlark
--starlark:expr="providers(target)"

Change-Id: Idb24871ba20aae132b61eb31ef35c917cacae9e1
2022-09-21 19:49:46 +00:00