Commit Graph

5623 Commits

Author SHA1 Message Date
Paul Duffin
a2f33cc96e Merge "Support UNSAFE_DISABLE_HIDDENAPI_FLAGS in platform_bootclasspath" am: 6050c3c31e am: 58a26e96b7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674036

Change-Id: Iffa71d25dea6845866854cbb2e72036a64c330e0
2021-04-13 18:25:38 +00:00
Paul Duffin
97838afd6f Merge "Remove noop code from generateHiddenAPIBuildActions" am: 149e19ef70 am: ee207a67e8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674035

Change-Id: I27758217e5dfd1660729e39125d4a5d9224bd25b
2021-04-13 18:25:04 +00:00
Paul Duffin
8f146b99e6 prebuilt_apex created ApexInfo must not include prebuilt_ prefix
As part of the work to modularize the hiddenAPI processing the
generation of the monolithic hidden API index file needs to be moved
to the platform_bootclasspath module type. Doing that broke the
TestBootDexJarsFromSourcesAndPrebuilts tests which checks the inputs to
the rule that creates that file. Fixing that required added a
platform_bootclasspath module to the test fixture for those tests which
highlighted an issue with the prebuilt_apex module.

Previously, when the prebuilt_apex created apex variants it would use
its own name as the apex variant name, even when that name included the
prebuilt_ prefix. That broke the platform_bootclasspath logic as it was
looking for apex variants for "myapex" but the only ones available were
"prebuilt_myapex".

This change ensures that it always uses the unprefixed name and fixes
the TestNoUpdatableJarsInBootImage to match. This also adds some
improved error reporting in platform_bootclasspath which helped debug
this problem.

Bug: 177892522
Test: m nothing
Change-Id: I3e88b5cec767f77dcc0e94b3ae38b499d07eadf0
2021-04-13 19:15:27 +01:00
Anton Hansson
fa5e6b50aa Remove special case code for obsolete files
incompatibilities.txt doesn't exist anymore, only
"<module>-incompatibilities.txt". Clean up the associated logic that
mapped incompatibilities.txt to android-incompatibilities.txt.

Bug: 178171189
Test: m
Change-Id: I61eeb5dcc82770fa2af356bad11b7205551d6d83
2021-04-13 19:09:48 +01:00
Pedro Loureiro
f4a88b1633 Introduce NewApi lint checks
We are enabling NewApi lint check where the min sdk != compile sdk.
At the same time, we are introducing baseline files for existing
projects that fail this check in order to keep the build running.

At the very least we stop introducing new problems and teams might
realise of risks in their projects they were not aware of.

Bug: 150847901

Test: m lint-check
Change-Id: Icfa5eb98cc6b6708149f0c52fac8fc1440d9c3b0
Merged-In: Icfa5eb98cc6b6708149f0c52fac8fc1440d9c3b0
2021-04-13 15:19:02 +00:00
Pedro Loureiro
d1618e3ff4 Merge "Introduce NewApi lint checks" into sc-dev 2021-04-13 14:12:41 +00:00
Paul Duffin
60264a0b99 Improve realism of boot jar tests
Boot jars, updatable boot jars and art apex jars are part of two
separate but related configuration objects, the main Config struct
(actually the nested productVariables struct) and the dexpreopt
specific GlobalConfig. The fields in both are initialized from the same
data in the make config files but handled separately.

Previously each test that used one of the configuration objects would
generally just initialize the one it used. That would make the test
sensitive to the specific configuration object that was used. A
refactoring that change the code from using one configuration object to
the other would cause the test to fail.

Also, some tests would inadvertently create invalid configurations by
setting ArtApexJars without also setting BootJars. While the ability to
create invalid configurations is useful (and there are some tests that
exist to verify the behavior in that case) most tests should not be
using them.

This change simplifies the configuration of the tests and improves
their realism by:
1. Providing a new FixtureConfigureBootJars method that takes a set of
   boot jars and sets ArtApexJars, and BootJars in the
   dexpreopt.GlobalConfig and BootJars in the product variables too.
2. Providing a new FixtureConfigureUpdatableBootJars method that takes
   a set of boot jars and sets UpdatableBootJars in both the
   dexpreopt.GlobalConfig and productVariables.
3. Migrating existing tests to use these new methods.

Some tests still use the dexpreopt.FixtureSet...Jars() methods directly,
generally to create invalid configurations.

Bug: 177892522
Test: m nothing
Change-Id: I4d8f0b9762cfcc7ae6383bef08563d7c3fa13955
2021-04-13 14:48:34 +01:00
Paul Duffin
0b659866e8 Support UNSAFE_DISABLE_HIDDENAPI_FLAGS in platform_bootclasspath
Previously attempting to use m UNSAFE_DISABLE_HIDDENAPI_FLAGS would
cause a build failure.

It is necessary when UNSAFE_DISABLE_HIDDENAPI_FLAGS=true to create
empty files for the monolithic files so that those usages which are not
protected by the build flag, e.g. in dists or CTS tests like
CtsHiddenApiBlocklistTestApiTestCases do not cause ninja failures due
to reliance on a file that does not exist and has no rule to create it.

Bug: 177892522
Test: m nothing
      m UNSAFE_DISABLE_HIDDENAPI_FLAGS=true CtsHiddenApiBlocklistTestApiTestCases
Change-Id: I05d0b3680dbc0b5b7c7c0d792550faf848829647
2021-04-13 14:19:51 +01:00
Paul Duffin
90b8ad38e0 Remove noop code from generateHiddenAPIBuildActions
Change https://r.android.com/1673266 introduced some code that does
nothing. This change removes that.

Bug: 177892522
Test: m nothing
Change-Id: I349b17c7fe7e2f68a807dab43a4300da7fe0ad4d
2021-04-13 14:18:34 +01:00
Paul Duffin
3e56a08adb Merge "Remove unused hiddenapi_flags module type" am: 99e4fc13bf am: 93391542f9 am: 51ae64962d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674027

Change-Id: I936eba4dbc4f19a3542511a9845d1263db05ce99
2021-04-13 13:09:20 +00:00
Paul Duffin
3d37a3b111 Merge "Export monolithic hidden API files from platform_bootclasspath" am: db173510d3 am: 64e6f0ff5d am: 703509119f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1673266

Change-Id: Ia7d8fa1dd41a2ce4da9630d65ec867e24eb586df
2021-04-13 13:08:09 +00:00
satayev
84ea699fcc Merge "Introduce classpath_fragment.go." am: 86628403e9 am: 94a783223d am: f92ad57372
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670069

Change-Id: I101ad1b1446fde0583833c8a36a07a962b7e0aa1
2021-04-13 13:07:53 +00:00
Paul Duffin
51ae64962d Merge "Remove unused hiddenapi_flags module type" am: 99e4fc13bf am: 93391542f9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674027

Change-Id: I5c46593a38ede8963eeb6287f4ff1588ef3bccb9
2021-04-13 12:15:29 +00:00
Paul Duffin
703509119f Merge "Export monolithic hidden API files from platform_bootclasspath" am: db173510d3 am: 64e6f0ff5d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1673266

Change-Id: I35021b0746a5aa9ac071ca488ae530f950634159
2021-04-13 12:15:17 +00:00
satayev
f92ad57372 Merge "Introduce classpath_fragment.go." am: 86628403e9 am: 94a783223d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670069

Change-Id: Id9da955035530a1b64b987f83cebf8c729df65df
2021-04-13 12:15:02 +00:00
Jiyong Park
3db6f99780 Merge "SdkSpec is fully using ApiLevel" into sc-dev 2021-04-13 11:02:38 +00:00
Paul Duffin
99e4fc13bf Merge "Remove unused hiddenapi_flags module type" 2021-04-13 09:57:31 +00:00
Paul Duffin
db173510d3 Merge "Export monolithic hidden API files from platform_bootclasspath" 2021-04-13 09:57:12 +00:00
Artur Satayev
eabf2c175f Introduce classpath_fragment.go.
A skeleton of a classpath fragment's interface and base to be used by
any modules that provide entries for *CLASSPATH variables at runtime.

In follow up changes, this would be extended to generate
packages/modules/SdkExtensions/proto/classpaths.proto configs for such
modules to be bundled into system and individual apex binaries.

Bug: 180105615
Test: m
Change-Id: I2df550862e97222c5650c4d0480c90231fd78ef0
2021-04-13 08:58:18 +01:00
Paul Duffin
082afbb656 Remove unused hiddenapi_flags module type
Bug: 177892522
Test: m nothing
Change-Id: I604a86a25bbc722ec718b0b0272d0481218d3cd9
2021-04-13 00:23:55 +01:00
Paul Duffin
6a766453fd Export monolithic hidden API files from platform_bootclasspath
Makes the monolithic hidden API files accessible from the
platform_bootclasspath so they can be output to the dist build target
and used by other modules, e.g. by doing something like this:
  java_resources: [
    ":platform-bootclasspath{hiddenapi-flags.csv}",
  ],

It makes the paths relative to the out/soong/hiddenapi directory rather
than the out/soong directory to make them easier to use in the
java_resources property without changing the structure of the APK.
Without that attempting to use them in a java_resources property will
result in them being copied to a hiddenapi/ within the APK instead of
being used at the top level as existing APKs like
CtsHiddenApiBlocklistTestApiTestCases expect.

Bug: 177892522
Test: m nothing
Change-Id: I829412fc7d25411e0c2e0713d0d219a18f4af2ee
2021-04-13 00:23:55 +01:00
Paul Duffin
687953c126 Merge "Move generation of global hidden API flags to platform_bootclasspath" am: 26bd783d0b am: 3f13b50d6f am: a4daf9ee74
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670072

Change-Id: Id03314ff46c39781018b6dc6161cb54bacf61fc7
2021-04-12 20:59:22 +00:00
Paul Duffin
73e07f6a77 Merge "Extract ruleToGenerateHiddenApiFlags" am: 690d5f2c7d am: 215b99f3d2 am: e6b5c9ef56
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670071

Change-Id: I4be712b2085fa6123fad4005c5f7b8617cb2e9e0
2021-04-12 20:59:09 +00:00
Paul Duffin
a4daf9ee74 Merge "Move generation of global hidden API flags to platform_bootclasspath" am: 26bd783d0b am: 3f13b50d6f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670072

Change-Id: Ic46e24de3f500d81f63bd9da67b9541741f1a192
2021-04-12 20:08:58 +00:00
Paul Duffin
e6b5c9ef56 Merge "Extract ruleToGenerateHiddenApiFlags" am: 690d5f2c7d am: 215b99f3d2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670071

Change-Id: I40995e074ad7a06642d84dcb87e1f0d1a5e59b4c
2021-04-12 20:08:31 +00:00
Paul Duffin
702210b804 Move generation of global hidden API flags to platform_bootclasspath
This change moves the generation of the global hidden API flags from
the singleton to the platform_bootclasspath module. It involves:
1. Moving the ruleToGenerateHiddenApiFlags to hiddenapi_modular.go.
2. Adding HiddenAPIAugmentationProperties to be used by the
   platform_bootclasspath type.
3. Moving the file paths into the platform-bootclasspath module
   definition in frameworks/base/boot/Android.bp.

The flagsRule is kept as a placeholder for now. The emptyFlagsRule is
also kept so that builds continue to work even when the frameworks/base
repository is not present.

Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: Idf4dd414a016831bfe04a01f93234c1c33819881
2021-04-12 11:04:24 +01:00
Paul Duffin
c6bb7cf8d7 Extract ruleToGenerateHiddenApiFlags
Extracts the code for creating the rule that creates the monolithic
hidden API flags file which is encoded into dex implementation jars.
This refactoring is in preparation for moving the functionality from
the hiddenapi_singleton into the platform_bootclasspath.

A follow up change will move the method into the new
hiddenapi_modular.go alongside the hiddenAPIAugmentationInfo as they
will both be used to perform hidden API processing for a
bootclasspath_fragment.

Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: I2729afa80cdfd2d1d4717365001648453d65632f
2021-04-12 11:04:09 +01:00
Jiyong Park
dbd710c426 SdkSpec is fully using ApiLevel
Previously, SdkSpec was constructed only from the user string. It didn't
make use of the Config struct where information about the latest stable
SDK version, etc. is recorded. As a result, the build system couldn't
check if the sdk version "current" is referring to the in-development
(i.e.  not-yet-frozen) SDK version or the latest stable version.
"current" was always assumed to be in-development (IsPreview() returns
true) even when Platform_sdk_final == true.

As the first step for fixing that, this change requires
android.EarlyModuleContext to be passed when constructing SdkSpec from
the user string.

In the following changes, "current" will be mapped to either
FutureApiLevel (10000) or one of the FinalApiLevels() depending on
whether the platform SDK was finalized or not.

Bug: 175678607
Test: m
Change-Id: Ifea12ebf147ecccf12e7266dd382819806571543
2021-04-12 13:46:21 +09:00
Paul Duffin
2fe363ff6a Merge "Allow platform_bootclasspath to specify contributing fragments" am: 49ab1d38de am: 75e90d6974 am: 4a385f9987
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670067

Change-Id: Ie7e07eb17dd14aaec57b9c9de02483c8869ef309
2021-04-08 21:55:58 +00:00
Paul Duffin
ea1ef0beaf Merge "Add dependencies from platform_bootclasspath to contents" am: d32118c5c4 am: 6caf7f9662 am: 42418e09a2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670066

Change-Id: I564c75f572a5ad78f66695829b50ec999423addc
2021-04-08 21:55:51 +00:00
Paul Duffin
4a385f9987 Merge "Allow platform_bootclasspath to specify contributing fragments" am: 49ab1d38de am: 75e90d6974
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670067

Change-Id: Ib3304ee0007baf2518219472703407186e0bb95a
2021-04-08 21:07:08 +00:00
Paul Duffin
42418e09a2 Merge "Add dependencies from platform_bootclasspath to contents" am: d32118c5c4 am: 6caf7f9662
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670066

Change-Id: I34fc991b5efafc5df447dc4fd783d1734d0737be
2021-04-08 21:07:02 +00:00
Paul Duffin
62d8c3b110 Allow platform_bootclasspath to specify contributing fragments
Adds the fragments property to the platform_bootclasspath to allow the
fragments that contribute to it to be specified.

Bug: 177892522
Test: m nothing
Change-Id: I14f83d9336f6984442c7315cc86dfdd0a0fd2d20
2021-04-08 18:53:04 +01:00
Paul Duffin
b432df9cda Add dependencies from platform_bootclasspath to contents
Adds a FinalDeps mutator to add dependencies from the
platform_bootclasspath to the configured boot jars which can be from
either the platform or any apex. It adds dependencies for every
configured boot jar, whether in ArtApexJars, BootJars or
UpdatableBootJars.

At the moment the dependencies are only used for testing purposes
but following changes will make more use of them.

Bug: 177892522
Test: m nothing
Change-Id: I981305bf45bc20539a3d36987252f490e2b885cc
2021-04-08 18:53:04 +01:00
Pedro Loureiro
8c7a11a8df Introduce NewApi lint checks
We are enabling NewApi lint check where the min sdk != compile sdk.
At the same time, we are introducing baseline files for existing
projects that fail this check in order to keep the build running.

At the very least we stop introducing new problems and teams might
realise of risks in their projects they were not aware of.

Bug: 150847901

Test: m lint-check
Change-Id: Icfa5eb98cc6b6708149f0c52fac8fc1440d9c3b0
2021-04-08 12:10:42 +00:00
Anton Hansson
57e91234db Merge "Fix bug in sdk_library string matching" am: f247ff73ae am: abde6d24d4 am: aa963fda38
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665886

Change-Id: I4603a16491e348520fa13cf5b086314ef26e12cf
2021-04-08 11:22:16 +00:00
Anton Hansson
aa963fda38 Merge "Fix bug in sdk_library string matching" am: f247ff73ae am: abde6d24d4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665886

Change-Id: I5eb9be1a5cbc964f5bfe89077b381625d52f4de5
2021-04-08 10:36:03 +00:00
Anton Hansson
f247ff73ae Merge "Fix bug in sdk_library string matching" 2021-04-08 09:28:41 +00:00
Jiyong Park
9231537fe2 SdkSpec is fully using ApiLevel
Previously, SdkSpec was constructed only from the user string. It didn't
make use of the Config struct where information about the latest stable
SDK version, etc. is recorded. As a result, the build system couldn't
check if the sdk version "current" is referring to the in-development
(i.e.  not-yet-frozen) SDK version or the latest stable version.
"current" was always assumed to be in-development (IsPreview() returns
true) even when Platform_sdk_final == true.

As the first step for fixing that, this change requires
android.EarlyModuleContext to be passed when constructing SdkSpec from
the user string.

In the following changes, "current" will be mapped to either
FutureApiLevel (10000) or one of the FinalApiLevels() depending on
whether the platform SDK was finalized or not.

Bug: 175678607
Test: m
Change-Id: Ifea12ebf147ecccf12e7266dd382819806571543
2021-04-08 11:27:24 +09:00
Paul Duffin
c9ad0982b6 resolve merge conflicts of 2f71f4eee9 to sc-dev
Bug: 179354495
Test: m nothing
Change-Id: Iff987f29e2c333fa7515c31acc0ab2d25bd0b791
2021-04-07 20:16:18 +01:00
Paul Duffin
2f71f4eee9 Merge "Update build to new location of hiddenapi config files" am: 5bdc83c20a am: 327f943a36
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1664025

Change-Id: I2549952a328411d0a1c70c80a5e3d3419d3ff2b5
2021-04-07 16:37:31 +00:00
Paul Duffin
5bdc83c20a Merge "Update build to new location of hiddenapi config files" 2021-04-07 15:52:06 +00:00
Anton Hansson
08f476bf83 Fix bug in sdk_library string matching
- The public stubs were being matched against the string ".stubs.public"
  which was never the suffix that these stubs used
- Remove obsolete naming pattern matching

Test: m
Change-Id: I1f7bd54e4629f42e34fb3c09828d8853813ba2a7
2021-04-07 15:39:58 +01:00
Paul Duffin
c81171aeda Merge "Remove hidden API special handling of android.test.base" am: 4896da1444 am: bd8ceee02b am: d9749fc553
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665745

Change-Id: Ie56660598421ddee8cdf93742b52b7b861a7029a
2021-04-07 14:13:48 +00:00
Paul Duffin
d9749fc553 Merge "Remove hidden API special handling of android.test.base" am: 4896da1444 am: bd8ceee02b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665745

Change-Id: Ica9417c42d2c597872e133410de007f7f1f33478
2021-04-07 13:25:48 +00:00
Paul Duffin
4896da1444 Merge "Remove hidden API special handling of android.test.base" 2021-04-07 12:27:16 +00:00
Pedro Loureiro
d5178c7604 Merge "Update soong for new lint version" am: 9537d594ce am: 50023a5a40 am: 522dab8b8f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1664033

Change-Id: I6eb7937e02dc33d774d426e4ff8f0ee809dd9d08
2021-04-07 11:04:59 +00:00
Paul Duffin
79a8744fd1 Merge changes I45274836,I47268b81 am: de21202bd2 am: 6c9d9bd3b1 am: 73057c5172
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665746

Change-Id: Ia624d9bc94179df6c7c9d27901901d7764d9f7c5
2021-04-07 11:04:50 +00:00
Pedro Loureiro
522dab8b8f Merge "Update soong for new lint version" am: 9537d594ce am: 50023a5a40
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1664033

Change-Id: I6136fe27fb141dc2816809c43a6b122c49f024ba
2021-04-07 10:18:30 +00:00
Paul Duffin
73057c5172 Merge changes I45274836,I47268b81 am: de21202bd2 am: 6c9d9bd3b1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665746

Change-Id: I54195a9d8abc4fc7b835ea89f20e7e9e643ddb2c
2021-04-07 10:18:19 +00:00