Commit graph

5163 commits

Author SHA1 Message Date
Paul Duffin
0b57ca11ac Merge "Allow hiddenapi list to ignore missing classes/members" am: 9e4a27840b am: cac5c585dc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1747553

Change-Id: I828d35e39750bb5f57ceb6af6a11ba92ba6fd868
2021-06-28 11:27:28 +00:00
Paul Duffin
9e4a27840b Merge "Allow hiddenapi list to ignore missing classes/members" 2021-06-28 10:58:46 +00:00
Anton Hansson
7c05246ab2 Merge "Use trimmed lint database for mainline modules" am: 8aa7beb58d am: 2e764b82b8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731410

Change-Id: I45582af575f269524359d1a2b666f9aa3056479d
2021-06-28 10:06:56 +00:00
Anton Hansson
8aa7beb58d Merge "Use trimmed lint database for mainline modules" 2021-06-28 09:36:46 +00:00
Paul Duffin
a9c7f46118 Merge "Add sdk_library_test.go to Android.bp file" am: aed46487b0 am: e49ae4af3f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748465

Change-Id: If48277205b9d227fead01970eb8f2cb9727907cc
2021-06-28 07:51:58 +00:00
Paul Duffin
156b5d3b61 Allow hiddenapi list to ignore missing classes/members
When generating the stub-flags.csv for a bootclasspath_fragment the
hiddenapi list tool is not given a complete set of all classes and
members. This change causes it to ignore them by passing the new
--fragment option to it.

This does not risk changing the flags as the stub-flags.csv files
created with the --fragment option are compared with the monolithic
out/soong/hiddenapi/hiddenapi-stub-flags.txt file which is not run
with this option to ensure that they match.

Bug: 179354495
Test: m out/soong/hiddenapi-stub-flags.csv
      - make sure that this does not change the file.
Change-Id: I890c7374c445759cade4d685f51e81261b7ccea2
2021-06-27 22:46:14 +01:00
Paul Duffin
9fc208ee54 Add sdk_library_test.go to Android.bp file
When this file was initially created by extracting the test from the
java_test.go file it was not added to Android.bp file so was not being
built and tested as it should. That lead to a recent change that left
it unable to compile. This change corrects both those issues.

Bug: 186723288
Bug: 179354495
Test: m nothing
Change-Id: I06f32bb572f57b6df3c772f1d9d21fe323fbf353
2021-06-27 20:42:48 +01:00
Paul Duffin
12ef8d8bac Merge "Support hidden API processing for modules that use platform APIs" am: 99926a2a77 am: 9d67121fff
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744417

Change-Id: I0929917000886efd04d021dd4370c66f09cca00c
2021-06-25 18:56:19 +00:00
Paul Duffin
75ca10d437 Merge "Verify the modular stub flags are subsets of the monolithic stub flags" am: 921d33d447 am: 6b923bc2c0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1745334

Change-Id: I0d420d934d63008a4de087c35a5c07caff2adf5f
2021-06-25 18:55:41 +00:00
Paul Duffin
f48c06ec21 Merge "Make ruleToGenerateHiddenAPIStubFlagsFile build rule" am: 49c91f32b2 am: 3a5056f429
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1745333

Change-Id: I3bb3957639442ee0e30e15d7abe230feea23547e
2021-06-25 18:54:28 +00:00
Paul Duffin
99926a2a77 Merge "Support hidden API processing for modules that use platform APIs" 2021-06-25 18:25:39 +00:00
Paul Duffin
5cca7c44e5 Support hidden API processing for modules that use platform APIs
Previously, hidden API processing could only be done by those
bootclasspath_fragment modules that either did not depend on any other
fragments (e.g. art-bootclasspath-fragment) or only depended on APIs
provided by other fragments (e.g. i18n-bootclasspath-fragment). That
meant that modules like com.android.os.statsd-bootclasspath-fragment
that depended on APIs provided by parts of the platform which are not
yet part of another bootclasspath_fragment could not perform hidden
API processing.

This change adds support for a bootclasspath_fragment to specify the
additional stubs needed to perform hidden API processing. It adds a new
additional_stubs property that can be used to specify the additional
stub libraries.

Most bootclasspath_fragments that need to use the property will need
access to the APIs provided by the android-non-updatable.* libraries.
Rather than have each fragment explicitly specify the correct module
for each scope it treats "android-non-updatable" as if it was a
java_sdk_library that can provide different jars for each scope.
Soong will handle mapping that to the correct android-non-updatable.*
module.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv \
        out/soong/hiddenapi/hiddenapi-index.csv \
        out/soong/hiddenapi/hiddenapi-stub-flags.txt \
        out/soong/hiddenapi/hiddenapi-unsupported.csv
      - make sure that this change does not change the contents.
      m TARGET_BUILD_APPS=Calendar nothing
Change-Id: Ia8b79830ed0e6d42100de03d76b0c51b7f6c8ade
2021-06-25 16:20:19 +01:00
Paul Duffin
2e88097152 Verify the modular stub flags are subsets of the monolithic stub flags
Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-stub-flags.txt
      - check that an error is reported if a modular stub-flags.csv file,
        i.e. one created by a fragment is not a subset of the monolithic
        file, e.g. because a signature in the modular file has different
        flags than it does in the monolithic or is not present there.
Change-Id: I46ebb495cb093a5e3abe7571c49933c845318549
2021-06-25 14:49:10 +01:00
Paul Duffin
4539a37a61 Make ruleToGenerateHiddenAPIStubFlagsFile build rule
Previously, the func created a rule and returned it for the caller to
create with the appropriate name and description. This change passes
the name and description into the func and causes it to create the rule
itself. The func is also renamed to make it more consistent with the
other similar rules.

Bug: 179354495
Test: m nothing
Change-Id: I2a4455daa8a6090ed5568994b255848d063e1ab2
2021-06-25 14:49:07 +01:00
Paul Duffin
ca9dcd2d38 Merge "Add ModuleLibHiddenAPIScope for hidden API processing" am: 136fd5554d am: 9579e5e4ac
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744416

Change-Id: Ifa3bb7fdf5abdf084de1efcd321767d1cf6ab87f
2021-06-25 11:26:55 +00:00
Paul Duffin
ac35c397bc Merge "Add HiddenAPIScope to replace use of SdkKind" am: e09a6692de am: 7f5954a225
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744414

Change-Id: I85bc152e161fafad8d086e58f5e296e2a10f5160
2021-06-25 11:26:43 +00:00
Paul Duffin
136fd5554d Merge "Add ModuleLibHiddenAPIScope for hidden API processing" 2021-06-25 11:08:31 +00:00
Paul Duffin
e09a6692de Merge "Add HiddenAPIScope to replace use of SdkKind" 2021-06-25 11:08:15 +00:00
Pedro Loureiro
18233a2b47 Use trimmed lint database for mainline modules
Lint's NewApi checks currently produce a lot of false positive findings.
The filtered lint database removes information of classes defined by
mainline modules which are the cases that might become a false positive.

This commit updates soong to use this database instead of the normal one
when linting mainline modules.

Test: m lint-check
Fixes: 186478867
Change-Id: Ica646081b9189303c393b36b2f02914d69eee291
2021-06-25 10:44:59 +00:00
Orion Hodson
ce3f20e5c2 Merge "Update dex_preopt related OWNERS" am: 4eb3d6599f am: f6ef94cc37
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1739057

Change-Id: Ib2e961cc7cabd2c0bd90d2faa3384bb961a52e61
2021-06-25 09:30:44 +00:00
Orion Hodson
4eb3d6599f Merge "Update dex_preopt related OWNERS" 2021-06-25 08:52:09 +00:00
Paul Duffin
b51db2ed8e Add ModuleLibHiddenAPIScope for hidden API processing
Although the hidden API runtime does not support a module-lib API flag
the hidden API processing does need to used them as they are needed by
the "hiddenapi list" tool for any bootclasspath_fragment module whose
contents builds against an sdk_version of "module_current". Without it
the "hiddenapi list" tool could fail to resolve references to classes
provided by other modules which would break the build.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that this change has no effect on the generated flags.
Change-Id: I3ecb80fdaeba0e66d1ee25cb57152ab546d9bfe0
2021-06-24 22:04:09 +01:00
Paul Duffin
31fad800a7 Add HiddenAPIScope to replace use of SdkKind
Previously, the hidden API processing used SdkKind to identify the API
scopes, e.g. public, system, etc. that are of interest for hidden API
processing. Unfortunately, there is a mismatch between the SdkKind and
what hidden API processing needs. e.g. SdkKind includes values that are
not used by hidden API processing and hidden API processing needs
additional API scope specific information not provided by SdkKind. The
apiScope struct used in sdk_library.go is also not a suitable
representation for similar reasons.

This change adds the HiddenAPIScope (following a similar approach as
apiScope) that rectifies that and uses it as a replacement for SdkKind
in most parts of the hidden API processing. The SdkKind is still used
for retrieving information from java_sdk_library[_import] modules.

Follow up changes will extend the HiddenAPIScope with more information.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that this change has no effect on the generated flags.
Change-Id: I97968f58535121652852b8d25217aa288afd2bfd
2021-06-24 21:56:27 +01:00
Paul Duffin
2d44b91e47 Merge "Ensure consistent APEX variation for java_sdk_library and java_sdk_library_import" am: 770193da6c am: 6376a132a7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1746296

Change-Id: Ifa5c52220eb38b3f8be980c2ff866e5862340a93
2021-06-24 15:17:46 +00:00
Paul Duffin
ea8f808580 Ensure consistent APEX variation for java_sdk_library and java_sdk_library_import
Previously, a java_sdk_library with shared_library = true would create
a variation per APEX because it depends on an sdkLibraryXml module
which generates a file containing the APEX name. However, a shared
java_sdk_library_import would create a merged APEX variation. The
inconsistent variations caused failures in sdkDepsReplaceMutator.

This change ensures that both java_sdk_library and
java_sdk_library_import create an APEX specific variation when their
shared_library property is true.

Bug: 190499958
Test: m nothing
      - ran the above command after modifying the test to reproduce the
        problem and then after fixing to verify that it fixed the problem.
Change-Id: Iee81776a8569db3e871c40cbde14d248dfeb56e4
2021-06-24 13:33:01 +01:00
Jeongik Cha
2c9391aace Merge "Expose imageLocationsOnDevice as well as imageLocationsOnHost" am: c1218f395c am: e40749a1b6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744553

Change-Id: I532648d21cd60b95fa7e6d868ecc2244e04299f4
2021-06-24 00:29:20 +00:00
Treehugger Robot
a8de9fb2ae Merge "Remove duplicate component from sdk snapshot" 2021-06-24 00:04:42 +00:00
Jeongik Cha
c1218f395c Merge "Expose imageLocationsOnDevice as well as imageLocationsOnHost" 2021-06-23 23:59:07 +00:00
Paul Duffin
b97b1579d3 Remove duplicate component from sdk snapshot
Previously, an sdk snapshot could contain the following:
* A java_sdk_library_import module, e.g. "foo" which creates component
  modules "foo.stubs", etc.
* A corresponding versioned module, e.g. "sdk_foo@current" which
  created component modules "sdk_foo@current.stubs", etc.
* An internal (to the sdk snapshot) java_import for one of "foo"'s
  components, e.g. "sdk_foo.stubs"
* A corresponding versioned module, e.g. "sdk_foo.stubs@current".

That causes a few problems:
1. The "foo.stubs" is duplicated.
2. The names of the components created by the versioned
   java_sdk_library_import are invalid, as they append the component's
   suffix to the version and not the name before the version.

The latter causes problems when building against prebuilts and fixing
that causes the generated snapshot to be invalid because it contains
duplicate definitions of the "sdk_foo.stubs@current" module. One
explicitly in the Android.bp file and one created by the
"sdk_foo@current" module.

Removing the duplicates from the snapshot causes errors as the name
generated by the snapshot for the component module, i.e.
"sdk_foo.stubs@current" does not match the name generated by the
"sdk_foo@current", i.e. "sdk_foo@current.stubs".

This change fixes them together.

Bug: 179354495
Test: m nothing
Merged-In: I515f235fe21755b5275af12366e96c24c94c0273
Change-Id: I515f235fe21755b5275af12366e96c24c94c0273
(cherry picked from commit a1aa7387f7)
2021-06-23 21:38:14 +01:00
Paul Duffin
25f05b1996 Remove duplicate component from sdk snapshot am: a1aa7387f7
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15080378

Change-Id: I74fac58b575541c685179414b6d14aca66549b05
2021-06-23 20:32:26 +00:00
Paul Duffin
1491087dbb Merge "Output bootclasspath_fragment's fragments property to sdk snapshot" am: 94b51488d9 am: c7a0512670
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1742967

Change-Id: I81ab059b6cf18ea19933fd7acf50187d91f32494
2021-06-23 18:35:28 +00:00
Paul Duffin
94b51488d9 Merge "Output bootclasspath_fragment's fragments property to sdk snapshot" 2021-06-23 17:47:49 +00:00
Jooyung Han
73a471ea9b Merge "fix: comparison between min_sdk_version" am: 91913e3e07 am: bdafb79af7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1743953

Change-Id: Id481769c8852103cb3690911e44d103b0f9cbe6a
2021-06-23 17:34:59 +00:00
Jooyung Han
91913e3e07 Merge "fix: comparison between min_sdk_version" 2021-06-23 17:02:02 +00:00
Paul Duffin
a1aa7387f7 Remove duplicate component from sdk snapshot
Previously, an sdk snapshot could contain the following:
* A java_sdk_library_import module, e.g. "foo" which creates component
  modules "foo.stubs", etc.
* A corresponding versioned module, e.g. "sdk_foo@current" which
  created component modules "sdk_foo@current.stubs", etc.
* An internal (to the sdk snapshot) java_import for one of "foo"'s
  components, e.g. "sdk_foo.stubs"
* A corresponding versioned module, e.g. "sdk_foo.stubs@current".

That causes a few problems:
1. The "foo.stubs" is duplicated.
2. The names of the components created by the versioned
   java_sdk_library_import are invalid, as they append the component's
   suffix to the version and not the name before the version.

The latter causes problems when building against prebuilts and fixing
that causes the generated snapshot to be invalid because it contains
duplicate definitions of the "sdk_foo.stubs@current" module. One
explicitly in the Android.bp file and one created by the
"sdk_foo@current" module.

Removing the duplicates from the snapshot causes errors as the name
generated by the snapshot for the component module, i.e.
"sdk_foo.stubs@current" does not match the name generated by the
"sdk_foo@current", i.e. "sdk_foo@current.stubs".

This change fixes them together.

Bug: 179354495
Test: m nothing
Change-Id: I515f235fe21755b5275af12366e96c24c94c0273
2021-06-23 17:46:50 +01:00
Paul Duffin
3accbb5446 Add commonSdkLibraryAndImportModule interface
The commonSdkLibraryAndImportModule defines the methods that a module
which embeds the commonToSdkLibraryAndImport struct need to provide.

Bug: 179354495
Test: m nothing
Merged-In: I7a469ae03ea5c19922200284da08a9ae38a46751
Change-Id: I7a469ae03ea5c19922200284da08a9ae38a46751
(cherry picked from commit 71b33cca9d)
2021-06-23 17:46:50 +01:00
Paul Duffin
51227d875b Output bootclasspath_fragment's fragments property to sdk snapshot
Adds support for printing a PropertySet that has a property whose value
is an array of structs.

Bug: 179354495
Test: m nothing
      m conscrypt-module-sdk
      - check generated Android.bp file
Change-Id: I71be04188465610bcbea4d3c9a5e8204171a1eeb
2021-06-23 17:12:31 +01:00
Paul Duffin
b7a9ecd996 Merge "Add commonSdkLibraryAndImportModule interface" am: 2afa8915bb am: c461d90f18
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744313

Change-Id: Ieb4124174daeb033d9faa388fe193d19c2d0fd85
2021-06-23 16:08:29 +00:00
Paul Duffin
2afa8915bb Merge "Add commonSdkLibraryAndImportModule interface" 2021-06-23 15:36:36 +00:00
Jeongik Cha
e3165c8de3 Expose imageLocationsOnDevice as well as imageLocationsOnHost
Bug: 158843648
Test: check if dexpreopt.config for the module defined in mk file has
DexPreoptImageLocationsOnDevice field

Change-Id: Idb2de398871ff114245393a9dd92b5a1b5c942e7
2021-06-23 23:18:50 +09:00
Paul Duffin
71b33cca9d Add commonSdkLibraryAndImportModule interface
The commonSdkLibraryAndImportModule defines the methods that a module
which embeds the commonToSdkLibraryAndImport struct need to provide.

Bug: 179354495
Test: m nothing
Change-Id: I7a469ae03ea5c19922200284da08a9ae38a46751
2021-06-23 11:50:08 +01:00
satayev
c92cff4f0d Merge "Append platform classpath proto configs with missing apex jars." am: a580b5ef0f am: f8f2d7b4e8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1739054

Change-Id: I825921148500db99b1f8a0fb3f6acadba2d023ac
2021-06-23 10:27:01 +00:00
satayev
a580b5ef0f Merge "Append platform classpath proto configs with missing apex jars." 2021-06-23 09:51:39 +00:00
Jooyung Han
4c4da0688c fix: comparison between min_sdk_version
Added test demonstrates the error case. The bug was that java modules'
ShouldSupportSdkVersion() converts min_sdk_version into effective
version before comparison, which discards "preview" version into
"future" version. That caused a weird case like rejecting with error
"should support "S"" even when it is set to "S".

Bug: n/a
Test: m nothing
Change-Id: Ieb53f0097b2969a8535778b1286dbfa0d4895ad4
2021-06-23 10:45:28 +09:00
Paul Duffin
bbb8c289b8 Merge "Disable boot jars package check if no boot jars have been configured" am: 99fc06f8ed am: 5a5f422c23
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1742164

Change-Id: I807bfedb98b3bf728bc68389b1aaf544b3fe69f4
2021-06-22 19:09:44 +00:00
satayev
b30905019f Append platform classpath proto configs with missing apex jars.
Any apex classpath fragment that doesn't generate its own classpaths
proto, must still propagate it's boot jars for the platform classpath
fragment to include for complete CLASSPATH variables on device.

Bug: 191127295
Test: atest CtsClasspathsTestCases derive_classpath_test
Change-Id: I93687f69006741fcd66eb6e04891a4b4bbcc3b47
2021-06-22 20:03:54 +01:00
Paul Duffin
99fc06f8ed Merge "Disable boot jars package check if no boot jars have been configured" 2021-06-22 18:28:16 +00:00
Paul Duffin
0b5a143c32 Remove unused apiModuleName
Bug: 179354495
Test: m nothing
Merged-In: Id1dd09a11c63981b32af524cffcdbd177c8f0232
Change-Id: Id1dd09a11c63981b32af524cffcdbd177c8f0232
(cherry picked from commit 86fe8f8514)
2021-06-22 19:16:28 +01:00
Paul Duffin
2a999332ef Fix monolithic hidden API processing with prebuilts
Prebuilt modules do not provide classesJars containing annotations.
Previously, the monolithic hidden API processing just used classesJars
from all the modules that provided them so when building against
prebuilts would have fewer classesJars than when building against
sources and so would produce different hidden API flags.

This change will generate the monolithic files from both classesJars
and files previously generated from hidden API processing. A fragment
that has performed hidden API processing will contribute its generated
files whereas standalone libraries and fragments which have not
performed hidden API processing will contribute classesJars.

Bug: 177892522
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      m SOONG_CONFIG_art_module_source_build=false out/soong/hiddenapi/hiddenapi-flags.csv
      - verify that the files are identical whether built from
        source or prebuilts.
Merged-In: I06f3c7df49626bec21a452bc9abf1bb9e7545e5c
Change-Id: I06f3c7df49626bec21a452bc9abf1bb9e7545e5c
(cherry picked from commit d061d40eb6)
2021-06-22 19:16:27 +01:00
Paul Duffin
4c2f78bff4 Make CheckHiddenAPIRuleInputs more reusable
Adds a message parameter and allows leading spaces in the expected file
string to allow them to be nicely indented.

Bug: 177892522
Test: m nothing
Merged-In: I33df26610738c48879fa0b8250dc377dd04bb07d
Change-Id: I33df26610738c48879fa0b8250dc377dd04bb07d
(cherry picked from commit 51d7da2c4e)
2021-06-22 19:16:27 +01:00