Commit Graph

3771 Commits

Author SHA1 Message Date
Lukacs T. Berki
5f51839d0d Refactor GetTargetProperties().
This is so that its implementation is more amenable to implementing
`target: { android_arm: { ... } }` and the like.

In addition, add a Boolean return value to getChildPropertyStruct() and
use it at every call site so that we only merge property structs when it
makes sense.

Bug: 187530594
Test: Presubmits.
Change-Id: I1b441c14b3d90a12b84dc89f82dd053978e89c7e
2021-05-17 14:04:04 +02:00
Rupert Shuttleworth
0096079bbc Make bazel build //external/... work by only allowing "approved" existing BUILD files in the Bazel workspace.
Test: bazel build //bionic/... //external/... //frameworks/... //system/...

Test: ./build/bazel/scripts/run_presubmits.sh

Change-Id: I91865ca87c6535053e7a14d2526ff3ce0991bfea
2021-05-17 06:34:53 -04:00
Elliott Hughes
6f95aa43be Merge "cc/linker.go: check min_sdk_version." am: 11bc0eef0c am: 9318bd1437
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1708947

Change-Id: I84b556c9ea49418f383405c544a3cc7a76dda320
2021-05-15 01:01:01 +00:00
Elliott Hughes
11bc0eef0c Merge "cc/linker.go: check min_sdk_version." 2021-05-15 00:35:21 +00:00
Liz Kammer
c2a739c9df Merge "Define a narrower context for getting arch props" am: 374623f91f am: f315fbeaa5 am: da4b4457b9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1708382

Change-Id: Ia67aa4f7cebba16a3159bb317270bd7a200d163f
2021-05-14 22:15:54 +00:00
Liz Kammer
077676144e Merge "Define a narrower context for getting arch props" am: 374623f91f am: f315fbeaa5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1708382

Change-Id: I0e3fe6cf0dcd1f485cb5788e9f9d148f3f9e6a46
2021-05-14 21:58:14 +00:00
Elliott Hughes
852edc147a cc/linker.go: check min_sdk_version.
Checking sdk_version broke mainline code that compiles against a current
API level but needs to be able to run on an older API level.

Bug: http://b/187907243
Test: treehugger
Change-Id: If1192ef2809e39b043f0a384775b6c9e3a8bd619
2021-05-14 14:03:53 -07:00
Liz Kammer
b6dbc87c97 Define a narrower context for getting arch props
go best practices recommend defining an interface where it is used and
limiting the scope

Test: go test soong tests
Change-Id: I96293ba594d37360b1a8910161477133d4aafdd9
2021-05-14 15:14:40 -04:00
Paul Duffin
011d8e670c Merge "Add support for converting OptionalPath to Paths" am: 17ccf26748 am: 1d579e9694 am: 472325bf8d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1706747

Change-Id: I60d5cdc9e77ed68e9c365986057608649eee770b
2021-05-13 20:31:13 +00:00
Paul Duffin
17ccf26748 Merge "Add support for converting OptionalPath to Paths" 2021-05-13 19:33:09 +00:00
Jingwen Chen
8e27e6c226 Merge "bp2build: build //external/scudo/..." am: ccfd7fc939 am: 58344f0391 am: 1c7591cfb9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1704771

Change-Id: I3665975d656141f7919cce5d80eff25ea7edc9d4
2021-05-13 13:23:04 +00:00
Jingwen Chen
ccfd7fc939 Merge "bp2build: build //external/scudo/..." 2021-05-13 12:19:43 +00:00
Paul Duffin
ef08185951 Add support for converting OptionalPath to Paths
Appending a Path or Paths to a slice of Paths is simple but appending
an OptionalPath requires conditional logic which makes OptionalPaths
harder to use. This change makes it easy to append the embedded Path,
if any, to a slice of Paths.

Bug: 179354495
Test: m nothing
Change-Id: Ibf80a23043c846162e17c3a98b2590bca653b170
2021-05-13 12:40:08 +01:00
Jingwen Chen
d17bb43fe1 Merge "bp2build: export some cc toolchain flags into Starlark." am: 1d35a87072 am: 138b60595c am: a7e79646d3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1698426

Change-Id: Iac3a24bb6a528b1281465ed4a354c95ea01e4a59
2021-05-13 11:29:09 +00:00
Jingwen Chen
1d35a87072 Merge "bp2build: export some cc toolchain flags into Starlark." 2021-05-13 10:31:54 +00:00
Paul Duffin
b964b24a51 Merge "Allow module types to force creation of a default APEX variant" am: 9896b3424b am: 05ca6f6919 am: 5c45498964
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1705263

Change-Id: I4365d9d1dfbfcd8bf9aa3f6381ec9470b7ff9921
2021-05-13 09:06:26 +00:00
Paul Duffin
9896b3424b Merge "Allow module types to force creation of a default APEX variant" 2021-05-13 08:07:19 +00:00
Jingwen Chen
75be1cae8f bp2build: build //external/scudo/...
Test: TH
Fixes: 187158841
Change-Id: I73c1d8fe075d2534c2389973b9381405d9389044
2021-05-13 06:25:49 +00:00
Jingwen Chen
bf61afb7f7 bp2build: export some cc toolchain flags into Starlark.
This CL exports common/global/device/host clang/ld/ldd flags
from their Ninja variable initialization locations in
cc/config/global.go and cc/config/clang.go to make Bazel's cc_toolchain
and Soong's cc actions more consistent with each other.

This does not handle env-dependent or arch-specific toolchain flags
yet (logic in compiler.go and linker.go).

Test: TH
Bug: 187086342
Bug: 187084737
Bug: 186628704
Bug: 187857770
Change-Id: Ie403d7cd23f35160897b9dd902c799cbf1bd7f0c
2021-05-13 06:25:47 +00:00
Treehugger Robot
56c46fc32d Merge changes I2729001d,Ife5d2193 am: 015a0afe07 am: 3c11654140 am: 3a13833166
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1702492

Change-Id: I25c4bc3fd4733bd1c4bd36e5f1262a57c60c4b84
2021-05-12 23:10:26 +00:00
Treehugger Robot
015a0afe07 Merge changes I2729001d,Ife5d2193
* changes:
  packaging: install/package deps if not marked IsHideFromMake
  Generate linker config with packaged items.
2021-05-12 22:08:54 +00:00
Paul Duffin
94c97c1fe3 Merge "Add license modules to the sdk" am: 62fb7438b1 am: f5dae016bb am: 7079601939
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1699191

Change-Id: I1807f6d0a0118eb0b96d494c2b52c2e2b4a3c7a1
2021-05-12 15:27:20 +00:00
Paul Duffin
3c8f7522bd Merge "Switch Effective_license_text from []string to Paths" am: fffd98fd16 am: 814d3fffaa am: 18f6703cd7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1702369

Change-Id: Ifab3e0717b65fa16e87a6e2197bbe756db64529f
2021-05-12 15:27:15 +00:00
Paul Duffin
1e4f9077a2 Merge "Move license module processing to GenerateAndroidBuildActions" am: 12f5d04859 am: d2dea2f249 am: a25390436b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1699190

Change-Id: Id01bb9e37bf6375f80cff1967fec49c43829d53c
2021-05-12 15:27:00 +00:00
Paul Duffin
f46c6f158a Merge "Add baseline test for license with sdk" am: 0d62615468 am: 9fbe8bb506 am: 88a0a1da57
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1699189

Change-Id: I6c034823489c9f7f97a019c0f3696e5854d53299
2021-05-12 15:26:41 +00:00
Paul Duffin
b5769c15a3 Allow module types to force creation of a default APEX variant
Bug: 187910671
Test: m droid
Change-Id: I797d4ab60d15b526744fe6e4df1b55c8b75b0310
2021-05-12 16:16:51 +01:00
Paul Duffin
62fb7438b1 Merge "Add license modules to the sdk" 2021-05-12 13:28:45 +00:00
Paul Duffin
fffd98fd16 Merge "Switch Effective_license_text from []string to Paths" 2021-05-12 13:28:05 +00:00
Paul Duffin
12f5d04859 Merge "Move license module processing to GenerateAndroidBuildActions" 2021-05-12 13:27:15 +00:00
Paul Duffin
0d62615468 Merge "Add baseline test for license with sdk" 2021-05-12 13:27:08 +00:00
Jingwen Chen
0bf1dcc16a bp2build: remove libc_tzcode from denylist. am: 3950cd6ed4 am: 2700ace254 am: 19c563ed78
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1704770

Change-Id: I2c0f87fb73c124d54db0e4a36c9c8e7b8841ee88
2021-05-12 13:18:56 +00:00
Jingwen Chen
3950cd6ed4 bp2build: remove libc_tzcode from denylist.
This now works with --features no_copts_tokenization. With tokenization,
the escaped empty string '\"\"' became an actual empty string '' on the
command line, setting -DWILDABBR to the wrong value.

However, no_copts_tokenization unveiled other problems with Android.bp
flags, such as spaces in existing cflags like
https://cs.android.com/android/platform/superproject/+/master:bionic/libc/Android.bp;l=288;drc=a0a4a6c2967b5b3c02c951ea1145f32ed5564ab9
- this trips up Bazel's copts when generated literally, so the
fix (other than splitting on space and making Soong accept strings that
don't start with dashes as cflags) is to make bp2build split cflags on
spaces before generating them as copts.

Test: bp2build, build bionic/...
Fixes: 186822591
Change-Id: Icf10bd20f6fb81db0b719ca0555fc70c75b91a79
2021-05-12 10:46:15 +00:00
Lukács T. Berki
8da487f9e1 Merge "Make @soong_injection usable in standalone builds." am: b9ebb7dfd8 am: 8178b454a3 am: 3114ff6f5a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1703387

Change-Id: Ia5a5510274a97d7528eb7ada81a4ae56a06f25f5
2021-05-12 07:34:54 +00:00
Lukács T. Berki
b9ebb7dfd8 Merge "Make @soong_injection usable in standalone builds." 2021-05-12 06:26:31 +00:00
Jooyung Han
77f7c44246 packaging: install/package deps if not marked IsHideFromMake
TransitivePackagingSpecs() gathers transitive "install/package"
dependencies.

Previously, IsInstallDepNeeded(depTag) was checked. But, in this way,
some stub libraries which are marked as "HideFromMake()" to avoid
install/package can be gathered.

For example, libdexfile is not installed even if it is one of
libdexfile_support's runtime_libs because it is a stub library and the
impl is provided by "art" apex.

So when gathering transitive deps "IsHideFromMake()" is checked and if
the dep is hidden (so, not supposed to be installed) then the dep
(and its deps) is ignored.

Bug: 187686926
Test: m nothing
Test: m microdroid (libdexfile shouldn't be included in system/lib)
Test: m hosttar (no changes)
Change-Id: I2729001d4c64985cf0f2b37440c2082fe912e6c5
2021-05-11 19:03:25 +00:00
Lukacs T. Berki
3069dd9d71 Make @soong_injection usable in standalone builds.
Test: Presubmits.
Change-Id: I942e627f9f7b7428834258ef3ccefb7f1f5c7606
2021-05-11 16:54:29 +02:00
Treehugger Robot
ddcf758f8c Merge "Generate empty classpaths.proto for bootclasspath_fragment.go." am: a556647c50 am: 3e51be492f am: 613e4c502a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1699193

Change-Id: Ia92df6204946e3e28341cd27a75d108b657754cc
2021-05-11 13:44:08 +00:00
Treehugger Robot
a556647c50 Merge "Generate empty classpaths.proto for bootclasspath_fragment.go." 2021-05-11 12:53:23 +00:00
Paul Duffin
b0f46ea0b5 Merge "Add support for name-less modules and property comments" am: 05f86890ee am: b999da770a am: ad98b0248b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1702368

Change-Id: Ic27fc064cf63077f4b572c1327e4fa1f8c5189c9
2021-05-11 10:47:28 +00:00
Paul Duffin
0b6c806c19 Merge "Allow an sdk member type not to provide a bp property" am: bea70fb54e am: a5b2055183 am: 2565f3253b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1702367

Change-Id: Ibf136b5989921a1975fff44359e561145ab3cf2c
2021-05-11 10:47:24 +00:00
Paul Duffin
a6b712cae4 Merge "Allow sdk snapshot to contain source module type" am: f08e7c444c am: 5a0a87eb16 am: b212748ee6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1702366

Change-Id: I05f85743062ac39549d9a730b93f30da0f467f34
2021-05-11 10:47:20 +00:00
satayev
3db3547d1f Generate empty classpaths.proto for bootclasspath_fragment.go.
- Adds all required details for bootclasspath_fragment to implement
  classpath_fragment.
- Keeps the actual boot jars in platform-bootclasspath to begin with.
- Makes sure to put the file in apex/etc/classpath on device. Note that
  for platform versions of classpath fragment AndroidMkEntries perform
  the installation, while for APEXes it must be plumbed via apex.go.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I6101ebdf5b8bcbe95c0b7ce21f3f67a2685aef50
2021-05-11 10:34:47 +01:00
Paul Duffin
b0bb376efa Add license modules to the sdk
Adds initial support for adding license modules to the sdk, along with
any referenced license text files. There is a number of minor
improvements to be made but the core of the support is there and it
works for ART sdks.

Basically, this change will automatically add license modules
referenced from any sdk member module as an internal sdk member. An
internal module has an sdk snapshot specific name that will not
conflict with the source module and which cannot be referenced from
outside the sdk snapshot.

Bug: 181569894
Test: m art-module-sdk art-module-host-exports art-module-test-exports
      - diff output before and after this change
        made sure that every prebuilt had a licenses field
        and that the license modules were added
Change-Id: I0c5ccabf58f4ef487e42ef8e61a5b2a74c0e81af
2021-05-11 08:28:49 +01:00
Paul Duffin
ec0836af3a Switch Effective_license_text from []string to Paths
Effective_license_text contains paths to files that are copied from
one module to another and so need to be converted to Paths within the
context of the owning module as the paths are relative to the owning
module's directory.

The previous code did convert the license_text property to paths but
converted it back to strings again which was confusing and does not
follow the normal pattern.

Bug: 181569894
Test: m nothing
Change-Id: Iea09ee7f3de1187a2c3e41455ca83b0233d904b2
2021-05-11 08:24:59 +01:00
Paul Duffin
df5a90502d Move license module processing to GenerateAndroidBuildActions
Previously, the processing of the license module was done in the
licensesPropertyFlattener method which is called for all modules before
their GenerateAndroidBuildActions method is called. This change moves
the processing into the license module's GenerateAndroidBuildActions
method which was previously empty to match the normal practice.

Bug: 181569894
Test: m nothing
Change-Id: I3736879bfa4b4d1f4e2b35770852a02d09b3db83
2021-05-11 08:24:59 +01:00
Paul Duffin
e96108d797 Add baseline test for license with sdk
This change adds a test that includes license modules that are used by
modules which are part of an sdk but which does not yet copy the
license module into the snapshot. It includes the refactoring changes
needed to allow license modules to be used in an sdk test and provides
a baseline against which future changes can be compared.

Bug: 181569894
Test: m nothing
Change-Id: I60722f43cc9cc8375d97f46eb4c281e6c38987cd
2021-05-11 08:24:59 +01:00
Jooyung Han
df09d173ca Generate linker config with packaged items.
Previously, we gather all deps without checking if a dep is actually one
of packaged items (CopyDepsToZip contents)

For example, following items shouldn't be listed.

provideLibs: "platform-mainline-sdk_libartpalette-system@current.so"
provideLibs: "platform-mainline-sdk_liblog@current.so"
provideLibs: "runtime-module-sdk_libc@current.so"
provideLibs: "runtime-module-sdk_libdl@current.so"
provideLibs: "runtime-module-sdk_libdl_android@current.so"
provideLibs: "runtime-module-sdk_libm@current.so"

Now, we gather only those modules contributing CopyDepsToZip to generate
linker config for android_system_image.

Test: m nothing
Test: m microdroid
Test: conv_linker_config print -s
    .../microdroid/android_common/root/system/etc/linker.config.pb
    shouldn't list sdk members.
Change-Id: Ife5d2193ab59970367d10e196aaaa922c6582862
2021-05-11 11:56:54 +09:00
Paul Duffin
0df49686b3 Add support for name-less modules and property comments
Bug: 181569894
Test: m nothing
Change-Id: Ia4da1d2a55a924db82ae999da455adedbaca47c0
2021-05-11 01:00:12 +01:00
Paul Duffin
1308205638 Allow an sdk member type not to provide a bp property
Bug: 181569894
Test: m nothing
Change-Id: I7e98f14cb377683457fba32fd05d6c614f78ffeb
2021-05-11 01:00:06 +01:00
Paul Duffin
0d4ed0ac56 Allow sdk snapshot to contain source module type
Bug: 181569894
Test: m nothing
Change-Id: I30513dd22e2719099a1a1ef63cacc98336d02e9f
2021-05-11 00:59:56 +01:00