Commit graph

49 commits

Author SHA1 Message Date
Cole Faust
2b4402d43f Merge "Revert^2 "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"" am: 100c7ad7f2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2143082

Change-Id: I393938d1bf83b8dc734761679fbd5df10caf1c93
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-01 23:06:03 +00:00
Cole Faust
100c7ad7f2 Merge "Revert^2 "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"" 2022-07-01 22:48:49 +00:00
Cole Faust
e5bf3fb4c2 Revert^2 "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"
This reverts commit 5d80d895b6.

Reason for revert: The issue that broke the build the first time this was submitted has been fixed in ag/19125702. Also the errorprone build was added to presubmit for changes to these files so we should hopefully catch any other issues at presubmit now: cl/458501206

Change-Id: I80ca08df49c58a1ad70de917822301368d49fc67
2022-07-01 19:39:14 +00:00
Xin Li
313fdb5812 Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014
Merged-In: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
Change-Id: If059be00e6bdaaa94171b456afae1d585540639c
2022-06-28 21:23:06 +00:00
Vinh Tran
f192474a60 Replace API level codename with number
This CL fixes a bug when Soong pass `-target` with a non-digit suffix in Clang. As mentioned in b/236753843, Clang's version parsing expects to see an integer in the target string so it ignores the
S suffix.

Test: m gwp_asan_crash_handler && make sure -target is aarch64-linux-androidS instead of aarch64-linux-android31
Test: go test -run ^TestNonDigitMinSdkVersionInClangTriple$ android/soong/cc
Bug: 236753843
Change-Id: I258ecc52083dbf3471d23cf310e0ad54440f1908
2022-06-28 01:33:18 +00:00
Victor Chang
197ec71ec9 Merge "Revert "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"" am: 99666e2720 am: 611f75ea9a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2081278

Change-Id: Ib989959b0b864c46f519d57295c5647321db009c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-29 18:16:50 +00:00
Nataniel Borges
5d80d895b6 Revert "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"
This reverts commit 8b7f627f30.

Reason for revert: b/230821289

Change-Id: I3032103b174c78586b38b64d2748ec5a42fa9522
2022-04-29 09:49:16 +00:00
Treehugger Robot
35e5179349 Merge "Fix erroneous "Field requires API level 33 (current min is 32)" warnings" am: fcf0b686aa am: 587f8c3425
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2072628

Change-Id: I7cc60174e9e525181cbf51dfd20e2e3e89f5c241
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 23:30:58 +00:00
Cole Faust
8b7f627f30 Fix erroneous "Field requires API level 33 (current min is 32)" warnings
Bug: 215567981
Bug: 204776549
Test: m out/soong/.intermediates/frameworks/base/framework-minus-apex/android_common/lint/lint-report.xml, then check that that file doesn't have any of these warnings
Change-Id: I39aa2228474630c93250bf5833ac6bd9bbadcc7f
2022-04-27 12:20:08 -07:00
Yurii Zubrytskyi
6114bd54eb platform/build/soong - Tiramisu is now 33
Bug: 225745567
Test: Build
Change-Id: I647b3e979ea9df622d86784f84f1155759e9ac0e
2022-04-12 08:23:14 -07:00
Sam Delmerico
7f88956c16 refactor Bazel variable export
Most of the variable export code for cc modules can be re-used for
exporting variables for java modules. Refactor this code into a more
composable structure for reuse.

Test: build/bazel/bp2build.sh
Test: manual comparison of
  out/soong/soong_injection/cc_toolchain/constants.bzl
  with previous output
Change-Id: Ie5a6fee08cc888b7dc69c3e324e5c3f8aa269a8f
2022-04-06 14:48:32 +00:00
Yu Liu
fc603167f4 Support tailoring clang --target flag based on min sdk version.
Bug: 215748260
Test: Tested using aquery to verify the --target flag; add added unit

Change-Id: Ifb13509db7d1e110316aa44d55ec9cccaa4b83d1
2022-03-18 01:16:52 +00:00
Xin Li
daf686db06 Merge sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I4fecfba711c0d3d7a22f4fdf7684924a9457b464
Change-Id: I0587f395e4eef309d76e70764e6b5eaafec0e401
2022-02-11 06:56:21 +00:00
Jingwen Chen
0ee88a6b65 Implement stubs.symbol_file and stubs.versions for cc_library_shared bp2build.
This CL turns the stubs.symbol_file and stubs.versions properties into
stubs_symbol_file and stubs_version attributes on the cc_shared_library
target. See associated build/bazel change on how these attributes are
used to generate stub libraries.

Bug: 207812332

Test: New tests
Test: CI
Change-Id: Ie23eafb9903a131d92ff4e251215e998cea0a763
2022-01-17 13:03:12 +00:00
Artur Satayev
659c3144b5 Merge "Test SdkSpecForm." am: a71eabb705 am: 1fc2cf0ef6 am: 48fe6ad1cd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1907852

Change-Id: I90ebac8f747498b0e174adfe7f01316295d3c808
2021-12-02 15:56:22 +00:00
satayev
0ee2f913ef Test SdkSpecForm.
Bug: 190818041
Test: presubmit
Change-Id: Ib8cd891f03537712d709ed063dd76dee55221118
2021-12-01 17:43:00 +00:00
Michael Wright
44af49bf3a S V2 is now 32 am: 08dd45a3b5
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/16140643

Change-Id: I1f3e05582a9adc0d5b37b6c7fbf73b10a65f40d0
2021-11-06 16:06:51 +00:00
Michael Wright
08dd45a3b5 S V2 is now 32
Bug: 204295952
Test: N/A
Change-Id: Ib13f30c27cf79c2903e05d3c2cd27d79c4a28668
Merged-In: Ib13f30c27cf79c2903e05d3c2cd27d79c4a28668
2021-11-05 19:39:17 +00:00
Paul Duffin
004547facd Use module-lib system modules when building from prebuilts
When building from source the build uses the java system modules for
the public or module APIs as needed. However, previously when building
from prebuilts it would always use the public API. That difference lead
to build failures when building from prebuilts.

This change makes the selection of java system modules when building
from prebuilts consistent with the selection when building from
sources.

As API levels 30 and 31 (which are the only previous releases to
provide system modules) did not provide separate java system modules
for the module-lib API those levels always use the public APIs.

Bug: 204189791
Test: - before applying these change
      m TARGET_BUILD_APPS=framework-connectivity
      - build fails with compilation error due to missing module APIs
      m sdk dist
      cp out/dist/system-modules/module-lib/core-for-system-modules.jar prebuilts/sdk/current/module-lib/core-for-system-modules.jar
      - apply these changes
      m TARGET_BUILD_APPS=framework-connectivity
      - build passes as expected
Change-Id: Id113ff014e7892b1009fbcaad89b1ae23a7c3b79
2021-11-01 16:40:28 +00:00
Jeff Sharkey
7412091dcc platform/build/soong - S is now 31
Bug: 171506470
Test: Build
Change-Id: I7b02ab24d12ea07463efd319a7ff059751416990
2021-06-01 06:49:05 -06:00
Elliott Hughes
0e9cdb04df 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-17 17:52:26 +00:00
Jiyong Park
f1691d2a2c Move java.sdkSpec to the android package
... in preparation for making the handling of sdk versions consistent
across java and cc modules.

Bug: 175678607
Test: m
Change-Id: I598f0454bce9b7320621022115412fbe97403945
2021-04-03 08:25:12 +09:00
Jooyung Han
11b0fbdbf6 cc: fix version macro for stubs
When a cc module is built against a stub, compiler passes version macro
of the stub lib. Version macro should be numeric, so codenames or
"current" should be mapped to numbers just like how ndkstubgen maps to.

* "current" -> future (10000)
* codenames -> look up api_level.json
* otherwise -> cast to int

Bug: 179329813
Test: m / soong test / manually check the output build.ninja
Change-Id: Ic0e1dd904984e161694a0b77fad5559c06a4462f
2021-02-05 11:27:57 +09:00
Jooyung Han
ed124c308f apex: checks min_sdk_version for preview/current
If we don't check "current", it won't be checked even in the finalized
branch.

If we don't check "preview", it should be done during the SDK
finalization. It'd be better done before the SDK finalization regarding
that setting min_sdk_version is to get approval from deps library owners.

Bug: 177833148
Test: m (soong tests)
Change-Id: I712b61cfe5a134fbb69c73956d26fb3a1e5c011e
2021-01-26 12:09:07 +09:00
Colin Cross
cf371cc1f7 Replace android.WriteFile rule with android.WriteFileRule
The android.WriteFile rule takes careful escaping to produce the
right contents.  Wrap it in an android.WriteFileRule that handles
the escaping.

Test: compare all android.WriteFile outputs
Change-Id: If71a5843af47a37ca61714e1a1ebb32d08536c31
2020-11-14 16:26:00 -08:00
Colin Cross
9f720ce52a Fix apex_test.go and add it to Android.bp
apex_test.go wasn't listed in the Android.bp file, which allowed
it to bitrot.  Make the API level methods take a PathContext
so that they can be called from a test using configErrorWrapper.
Also fix an int that was converted to a string.

Test: apex_test.go
Change-Id: I1ff87134c837bd5d344d22550baabde10d1b0b2e
2020-10-02 13:00:14 -07:00
Dan Albert
4f378d75aa Convert more versions in config to ApiLevel.
The test case I removed is invalid. The codename has had its int
assigned, but the config claims it is not final.

If this ever does need to be supported it's just a matter of making
sure the Q -> 29 mapping (or whatever) in the finalized codenames map
in android/api_levels.go.

Test: treehugger
Bug: http://b/154667674
Change-Id: I4f42ec2fd4a37750519ee3937938a1c65b6bb1e8
2020-09-22 16:01:56 -07:00
Dan Albert
0b176c8038 Replace FutureApiLevel with an ApiLevel.
Keeping the int constant around for now as FutureApiLevelInt because
it's still useful in places that haven't adopted ApiLevel yet for
testing if their non-ApiLevel API level is current or not.

Test: treehugger
Bug: http://b/154667674
Change-Id: I47a7012703f41fdeb56f91edf9c83afa93042deb
2020-09-22 15:04:48 -07:00
Dan Albert
c8060536e8 Replace ApiStrToNum uses with ApiLevel.
Test: treehugger
Bug: http://b/154667674
Change-Id: I2954bb21c1cfdeb305f25cfb6c8711c930f6ed50
2020-09-22 15:04:48 -07:00
Dan Albert
dbc008f663 Update finalized codenames map.
Test: None
Bug: None
Change-Id: I9846776ff93fa2ead0affeff729a3c7bb934fbf8
2020-09-18 12:41:31 -07:00
Dan Albert
1a2462717e Replace stringly-typed API levels.
Handling of API levels within Soong is currently fairly difficult
since it isn't always clear based on context what kind of API level a
given string represents, how much canonicalizing and error checking
the code receiving the string are expected to do, or how those errors
should be treated.

The API level struct does not export its raw data, so as to keep its
"constructor" private to the android package, and to prevent misuse of
the `number` field, which is only an implementation detail for preview
API levels. API levels can be parsed with either
`android.ApiLevelFromUser`, which returns any errors to the caller, or
`android.ApiLevelOrPanic`, which is used in the case where the input
is trusted and any errors in parsing should panic. Even within the
`android` package, these APIs should be preferred over direct
construction.

For cases where there are context specific parsing requirements, such
as handling the "minimum" alias in the cc module,
`nativeApiLevelFromUser` and `nativeApiLevelOrPanic` should be used
instead.

Test: treehugger
Bug: http://b/154667674
Change-Id: Id52921fda32cb437fb1775ac2183299dedc0cf20
2020-09-18 12:41:28 -07:00
Svet Ganov
3b0b84b8a7 Updating platform SDK version for R
* Update SDK versions

Test: build + boot

 bug:150281259

Exempt-From-Owner-Approval: merge conflict resolution

Change-Id: I30d7cda3c95327c4080e279e876129eb9e6a8091
Merged-In: I30d7cda3c95327c4080e279e876129eb9e6a8091
2020-05-02 14:39:14 -07:00
Jooyung Han
424175d72a Remove PLATFORM_VERSION_FUTURE_CODENAMES
It has been wrong to split ALL_VERSIONS into exclusive two sets of
before/after TARGET_PLATFORM_VERSION.

And PLATFORM_VERSION_ALL_CODENAMES supports all *active* list of
non-finalized codenames.

Bug: 152960049
Test: m
Change-Id: I78ca88758998e440bea72ba2d56d90eea3ec99ae
2020-04-08 09:25:20 +09:00
Jooyung Han
29e91d2121 Apex: support codenames for min_sdk_version
Apex can use codenames like "Q", "R" for its min_sdk_version property.
Also, cc_library can use codenames for its stubs.versions.

Bug: 152655956
Test: vendor/google/build/build_mainline_modules.sh
Change-Id: I077ad7b2ac5d90b4c8708921e43846206f05ba70
2020-04-02 23:26:41 +09:00
Colin Cross
9d5d72f7a6 Merge changes I9f8df94f,I2d7f5c56,I0ebb7381,Ieefcfc1a am: a6bf56d4be
am: 236ac108f5

Change-Id: Ia0777130add15aceb17739f5dcb613ca4e1bf172
2019-06-10 10:00:33 -07:00
Colin Cross
0ea8ba82fc Consolidate baseContext, BaseContext, and BaseModuleContext
blueprint.BaseModuleContext is the set of methods available to all
module-specific calls (GenerateBuildActions or mutators).  The
android package split the same functionality across baseContext (nee
androidBaseContext), BaseModuleContext, and BaseContext.
Consolidate all of them into android.BaseModuleContext.

Test: m checkbuild
Change-Id: I2d7f5c56fd4424032cb93edff6dc730ff33e4f1e
2019-06-06 20:01:31 -07:00
Ian Pedowitz
851de71044 Revert "Revert "Android Q is API 29""
This reverts commit 9e2bf9ec51.

Reason for revert: Rolling forward for Q-Finalization

Bug: 129975435
Bug: 129943426
Change-Id: Ic8a09aca67c189edfda4b10e5deb13716eb66adc
Test: Build
2019-05-11 17:02:50 +00:00
Ian Pedowitz
9e2bf9ec51 Revert "RESTRICT AUTOMERGE Android Q is API 29"
This reverts commit ca6e927678.

Reason for revert: QT SDK Finalization. Will be merged again on/after May 13th

Bug: 129975435
Change-Id: Ice988aea0cab8ba462166c27b0d7f95fc7d46466
2019-05-02 00:55:30 +00:00
Suprabh Shukla
ca6e927678 RESTRICT AUTOMERGE Android Q is API 29
Test: Only updated a constant. Builds as expected.

Bug: 129975435
Change-Id: I10bb72d59d7ffdb942b11701d3cebc383afa6a77
2019-04-30 00:17:09 +00:00
Colin Cross
571cccfcbc Prepare for a type-safe OnceKey
Add an opaque OnceKey type and use it for all calls to Once in
build/soong.  A future patch will convert the arguments to
Once* to OnceKey once users outside build/soong have been updated.

Test: onceper_test.go
Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
2019-02-06 01:52:41 +00:00
Dan Albert
6bc5b8320f Stop versioning NDK stubs pre-M.
Test: make ndk # readelf various stubs to check version info
Bug: https://github.com/android-ndk/ndk/issues/622
Change-Id: Ic2930cfe5ee8377bb89bfb1bc051b6975f6e57d3
Merged-In: Ic2930cfe5ee8377bb89bfb1bc051b6975f6e57d3
(cherry picked from commit c229f38e93)
2018-07-24 22:52:57 +00:00
Wale Ogunwale
0148f91348 Finalizing P SDK
Bug: 77588754
Test: builds
Change-Id: I07930ba9ca1f8b60a45109c4cc08ed2f17ea19fa
2018-04-12 06:43:59 -07:00
Colin Cross
aabf67968c Make *Context.Config return a Config instead of a interface{}
In Soong, a Config() method will always return a Config.  Make
ModuleContext, SingletonContext, TopDownMutatorContext and
BottomUpMutatorContext's Config() methods explictly return
a Config to avoid having to type-assert everywhere.  Overriding
the Config method requires duplicating the list of methods in
blueprint.BaseModuleContext and blueprint.BottomUpMutatorContext,
following the same pattern used by the other *Contexts.

Config() obsoletes the AConfig() method used in some places, which
will be cleaned up in the next patch.

Test: m checkbuild
Change-Id: Ibe21efde933959811d52443496967ab8ce71215e
2017-11-30 00:44:11 +00:00
Colin Cross
0875c52de7 Wrap PackageContext and SingletonContext
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}.  The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.

SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does.  This requires
updating every Singleton to use the android-specific methods.

Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
2017-11-29 05:04:30 +00:00
Dan Albert
e3e4fc8693 Add a name to API level map for O.
O is released, so we don't get this knowledge from the development
codenames list any more.

Test: make ndk # with an API using introduced=O
Bug: None
Change-Id: I21104c5d97c89f2f85157ac7d73de8cd5a478571
2017-08-29 11:50:34 -07:00
Dan Albert
31384debd7 Adapt to PLATFORM_VERSION_FUTURE_CODENAMES.
Don't preserve the confusing names from make. Rename AllCodenames to
ActiveCodenames, add FutureCodenames, and add CombinedCodenames to
fetch the *real* AllCodenames.

To allow `introduced=P` in NDK library definitions, we need to know
that P exists. Use the combined list of current and future API
codenames generating stubs.

Test: make ndk
Test: check out/soong/api_levels.json
Bug: None
Change-Id: I435f9ce7446236edc268a84e33474044a55a6302
2017-08-02 17:14:10 -07:00
Dan Albert
151027107d Add NDK API codenames for old releases.
Without these, we'd need to go rewrite all the stub templates to stop
using the codename and use the number instead whenever an API is
released.

Test: changed something in libc to use introduced=L, make ndk
Bug: None
Change-Id: I1b8703655664c567f8a5c36219e73f11ba27d99a
2017-07-28 12:31:28 -07:00
Colin Cross
67a5c132c5 Prettify soong ninja build descriptions
Descriptions currently look like:
[  0% 4/29328] cc out-soong/.intermediates/external/clang/lib/Sema/libclangSema/android_arm_armv7-a-neon_denver_static_core/obj/external/clang/lib/Sema/SemaCodeComplete.o

This is not very helpful - most of the characters are used to show the
output path, which contains useful information like target architecture,
but also contains most of the path to the source files twice, and less
useful information like the exact variant name used by soong.
Make the descriptions look like:
[  0% 3/29329] //external/clang/lib/Sema:libclangSema clang++ SemaTemplateInstantiate.cpp

This is //path/to/module:modulename tool relative/path/to/source/file

Test: builds, looks pretty
Change-Id: I3087aa7d4eb1860ef6239d77407b8b35445616d7
2017-05-10 11:04:16 -07:00
Dan Albert
30c9d6e771 Generate file to map codenames to API levels.
The NDK stub library generator needs to know what unreleased API
levels exist and what the ordering is between them. This singleton
will later be expanded to generate api-level.h to cut down on
duplication.

Test: make out/soong/api_levels.json && cat out/soong/api_levels.json
Bug: None
Change-Id: I53126dd2cacb67c331c44f7d7c77c98b176b93cd
2017-03-31 12:27:42 -07:00