Commit graph

16 commits

Author SHA1 Message Date
Paul Duffin
74431d57c6 Move monolithic stub flags generation to platform_bootclasspath
As part of that this change:
* Moves code that will be common to platform_bootclasspath and
  bootclasspath_fragment from hiddenapi_singleton.go into
  hiddenapi_modular.go.
* Fixes the tests in hiddenapi_singleton_test.go but intentionally
  does not rename them or move them into a more appropriate place so
  as to make it easier to see the differences. A TODO has been added
  and these will be cleaned up in a follow up change.

Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: I680e4dab2e6bdf4a655fa9f255c195175904667e
2021-04-22 14:23:28 +01:00
Paul Duffin
9b381ef2b8 platform_bootclasspath: aggregate hidden API flag files from fragments
Aggregates hidden API flag files from the bootclasspath_fragments which
will allow the hidden API flag files in frameworks/base/boot/hiddenapi
to be modularized and moved to the appropriate repo.

Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
      also verified that changes to the fragment provided files do
      affect the monolithic files.
Change-Id: Ifce14c9ef24c58c7ab1085475d85b61cfbfefecd
2021-04-16 00:29:53 +01:00
satayev
76f88384c4 Merge "Generate classpaths.proto config for *CLASSPATH variables." 2021-04-15 16:07:13 +00:00
Paul Duffin
4616977948 Rename hidden API types ..Augmentation.. to ..FlagFile..
Augmentation was too abstract this makes it clearer.

Bug: 177892522
Test: m nothinge
Change-Id: I60ad005e68d9e15b01bcb46bc6a9b7f84d8bfd43
2021-04-15 10:45:39 +01:00
Paul Duffin
85dee5d8fb Move hidden API metadata file rule to platform_bootclasspath
This change moves the monolithic hidden API index file creation rule
from the hiddenAPISingleton into the platform_bootclasspath.

Bug: 179354495
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: Ib25be3618e30a83dc2929a18062eb58eefdabefb
2021-04-14 18:54:55 +01:00
Paul Duffin
00b2bfdea5 Move hidden API index file rule to platform_bootclasspath
This change moves the monolithic hidden API index file creation rule
from the hiddenAPIIndexSingleton into the platform_bootclasspath. It
also moves the corresponding test from java/hiddenapi_singleton_test.go
to java/platform_bootclasspath_test.go.

Bug: 179354495
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: Ia295d0f7ae9b51ea816f16921aa42339ed91704e
2021-04-14 18:54:29 +01:00
Artur Satayev
97259dc625 Generate classpaths.proto config for *CLASSPATH variables.
Instead of embedding "raw" values from PRODUCT_*_CLASSPATH variables
into /etc/classpath, encode them into classpaths.proto binary format.

Existing platform_bootclasspath{} module is used to generate the whole
monolithic config to begin with. Later, the config will be split
among individual bootclasspath_fragment and
systemserverclasspath_fragment modules.

Bug: 180105615
Test: m && launch_cvd
Change-Id: Ia66f521f8976ff78a62ecf91131d26db21064de7
2021-04-14 15:03:23 +01:00
Paul Duffin
1ba246732d Ensure boot jar modules have been initialized properly for hidden API
Checks to make sure that every module that is part of the platform
bootclasspath has been initialized property for hidden API processing.

Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: Ic4368963f2011784b537b8aebf5ef97ea22b2db5
2021-04-14 09:08:02 +01: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
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
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
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
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
Paul Duffin
bb7f1ac794 Add a new platform_bootclasspath module type
Initially, this is just a placeholder but functionality will be added
in follow up changes.

Bug: 177892522
Test: m nothing
Change-Id: I890b0d5a117c51a19c9ac5df98c766761d3aa16c
2021-03-31 22:44:34 +01:00