Commit graph

35 commits

Author SHA1 Message Date
Spandan Das
159b264873 Export JavaBootLibsSdkMemberType and JavaSystemserverLibsSdkMemberType
build/soong/sdk will use these tags to differentiate the sdk and non-sdk
contents of bootclasspath and systemserverclasspath fragments.

Test: go build ./java
Bug: 326246905

Change-Id: Ia8352c09fcbbca06988eb57153e5986801eb45a5
2024-03-20 21:41:49 +00:00
Spandan Das
2ea84dd0dc Propagate profile_guided requirement of imports to top-level apex
For prebuilts, the dexpreopt rules of system server jars are now
generated from the context of the top-level prebuilt apex and not in the
context of the shim java_import modules. Since
`dex_preopt.profile_guided` property is defined in java_import, this
needs to be bubbled up to the top-level apex. This will be done using
deapxerInfo. If profile_guided of a transitive java_import is true, the deapexed .prof file will be
set as dexreopter.inputProfilePathOnHost before invoking
dexpreopter.dexpreopt. This ensures that only that java_import undergoes
profile guided dexpreopt, and not every other transitive java_import

Test: go test ./apex -run TestPrebuiltStandaloneSystemserverclasspathFragmentContents
Test: lunch cf_x86_64_only_phone-next-userdebug && m
$ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex
Test: du -sh
$ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex
24K

Bug: 308790457
Change-Id: Ibf46ecb400b3f126b243fc8d27b08d9a1aa4cc97
2024-01-30 18:04:52 +00:00
Colin Cross
a644c263dd Stop collecting path entry for module_bp_java_deps.json from each module type
The jdepsGeneratorSingleton can get the module path directly, it doesn't
need to be collected by each module type that implements IDEInfo.  Fixes
module types (like android_library) that didn't reach the code that
collected the path.

Bug: 309835196
Test: out/soong/module_bp_java_deps.json contains path for ExtServices.core
Change-Id: If8cb81b4f708e0367f156ade164bee253bf53492
2023-11-15 11:40:48 -08:00
Paul Duffin
d796f6f6dc Stop module types being SdkAware
Removes all usages of SdkBase and InitSdkAwareModule.

Bug: 260237150
Test: m nothing
Change-Id: I07db8afc805eadbeb5b23f2e1d2f51567eecfab0
2022-12-12 17:33:06 +00:00
Paul Duffin
458a15bd8a Remove IsModuleInVersionedSdk
Previously, as all versioned sdk snapshots have been removed from
Android.bp files this method would always return false. This change
effectively replaces all calls to it with false, and then optimizes
away any unused code.

Bug: 260237150
Test: m nothing
Change-Id: I1b717ee8345e807bd888451f6e7e3c3a0d391ee2
2022-12-12 17:33:05 +00:00
Paul Duffin
4e7d1c43e2 Add apexes property to sdk
Specifying an apex in the apexes propety will cause all the
*classpath_fragments that are contents of the APEX to be automatically
added as members of the sdk and appear in the snapshot.

The purpose of this change is to dedup the APEX and sdk definitions and
try and avoid some of the issues that we have been finding while
attempting to build against the prebuilts.

Two tests, one each for bootclasspath_fragment and
systemserverclasspath_fragment, have been refactored to compare the
output when adding the *fragment to the sdk directly of via the APEX.
That ensures switching to use the APEX will not change the sdk snapshot
unless it was previously missing a *fragment.

There was also a slight difference in where the hidden API flags were
copied from. That should have no impact on the output as the flags are
identical.

The sdk snapshot generation needed some tweaks to avoid generating a
prebuilt for the APEX.

Bug: 232401814
Test: m nothing
Change-Id: I7aaf16a3a0ab4bebf97765d1484215cc008dc4b8
2022-07-06 15:58:43 +00:00
Paul Duffin
f861df7907 Stop exporting systemserverclasspath_fragment when targeting S
Previously, when targeting the S release the generated sdk snapshot
would contain prebuilt_systemserverclasspath_fragment modules even
though they were only added in T.

This allows SdkMemberTypes to specify the set of target build releases
they support and ignores them when targeting an unsupported target
build release.

Test: m nothing
      packages/modules/common/build/mainline_modules_sdks.sh
      # Check that the for-S-build snapshots do not include SSCPFs.
Bug: 237718221
Change-Id: I2df08c2fcebf9b866695d691572a9d3783758b17
2022-07-05 15:13:09 +00:00
Jiakai Zhang
389a647320 Dexpreopt standalone system server jars.
Standalone system server jars are dynamically loaded by system server
using a `PathClassLoader` whose parent is `SYSTEMSERVERCLASSPATH`. They
are listed in `PRODUCT_STANDALONE_SYSTEM_SERVER_JARS` and
`PRODUCT_APEX_STANDALONE_SYSTEM_SERVER_JARS` in Makefile. We need to
dexpreopt them to achieve better performance.

Bug: 203198541
Test: m nothing
Test: -
  1. Add a standalone system server jar (e.g., by patching
     aosp/1906158)
  2. Build a system image.
  3. See the odex and vdex files generated in
     $ANDROID_PRODUCT_OUT/system/framework/oat/
  4. Flash the image to a device.
  5. Run `atest art_standalone_dexpreopt_tests`.
Change-Id: I358a62d34989c5c8eba12e18fe6167e0b72ff69d
2021-12-20 15:07:26 +00:00
Jiakai Zhang
cee9e19a51 Add entries for STANDALONE_SYSTEMSERVER_JARS to systemserverclasspath.pb
This CL updates platform_systemserverclasspath,
systemserverclasspath_fragment, and
prebuilt_systemserverclasspath_fragment to write entries for
STANDALONE_SYSTEMSERVER_JARS to systemserverclasspath.pb. A new property
`standalone_contents` is aded to `systemserverclasspath_fragment` and
`prebuilt_systemserverclasspath_fragment` to list the standalone system
server jars in the APEX, and entries will be written to
systemserverclasspath.pb accordingly at build time.

To add more context, these entries will be consumed by derive_classpath
in order to generate an environment variable
PRODUCT_STANDALONE_SYSTEM_SERVER_JARS. The environment variable will
then be comsumed by odrefresh to determine what jars to preopt on early
boot.

Note that the variable should not end with "CLASSPATH" because the list
is not used by runtime as a classpath. It is just a colon-separated list
of jars. System server loads the jars separately with paths hardcoded in
the code.

Bug: 203198541
Test: manual -
  1. Add some jars to PRODUCT_STANDALONE_SYSTEM_SERVER_JARS
  2. Add some other jars to PRODUCT_APEX_STANDALONE_SYSTEM_SERVER_JARS
     and standalone_contents.
  3. Build an image.
  4. Flash the image to a device.
  5. adb shell echo \$STANDALONE_SYSTEMSERVER_JARS
  6. See the correct list of jars.
Change-Id: I09a6fd1d3db85c194330da9b751702a9bf069e26
2021-11-30 10:51:10 +00:00
Alan Stokes
bcd567ea12 Make CompOS library optional in PRODUCT_APEX_SYSTEM_SERVER_JARS
CompOS is an optional module so it may legitimately be omitted from
some products.

Bug: 199147668
Test: Builds if PRODUCT_ISOLATED_COMPILATION_ENABLED not set
Change-Id: I4e031ca6184d920b64f9c370d35b5525ecbe8a1f
2021-11-17 15:37:14 +00:00
Samiul Islam
7b385c5677 Add exemption for test_framework-apexd and test_service-apexd jars
For testing purpose, we need to add java libraries to bootclasspath and
systemserverclasspath that are not present in PRODUCT_APEX_BOOT_JARS and
PRODUCT_APEX_SYSTEM_SERVER_JARS.

Currently, we can't unconditionally add all the contents to the config
for test APEXs. Until a formal way is introduced, hardcoding the
artifact in the build system like how it's done for
test_framework-sdkextensions.

Bug: 187444679
Test: atest ApexTestCases
Test: atest StagedInstallInternalTest
Change-Id: I1f7b01a57bc9c46163e025de2ab00e671a42b202
2021-10-28 06:12:48 +01:00
Keun young Park
d64ab233e4 Make car apex's library optional in PRODUCT_APEX_SYSTEM_SERVER_JARS
- car-frameworks-service-module is added from com.android.car.framework
  apex which only exisits in car products.

Bug: 203233647
Bug: 203201931
Test: build, bootup
Change-Id: I5f13b0505c1ac4fd2fd7b6559e080c8a6fb526e0
Merged-In: I5f13b0505c1ac4fd2fd7b6559e080c8a6fb526e0
(cherry picked from commit 6e3ba9ac3b)
2021-10-28 06:12:26 +01:00
Ulya Trafimovich
e5b2b49a73 Update variable name in error messages.
Variable PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS was renamed to
PRODUCT_APEX_SYSTEM_SERVER_JARS in https://r.android.com/1779472.

Bug: 191127295
Test: m nothing
Change-Id: I0c8ae839cab443c824760b40d30b4374982010f9
2021-10-04 15:43:39 +01:00
Jiakai Zhang
a8d8660ab1 Generate prebuilt_systemserverclasspath_fragment.
Bug: 194150908
Test: m nothing
Test: manual - 1. Patch aosp/1835087.
  2. m out/soong/.intermediates/art/build/sdk/art-module-sdk/common_os/snapshot/Android.bp
  3. See prebuilt_systemserverclasspath_fragment modules and
     systemserverclasspath_fragments in an sdk_snapshot module.
Change-Id: I7876b077b0b4ed190f01dbfa9533de04ea32d524
2021-09-30 10:06:24 +00:00
Jiakai Zhang
774dd305f4 Add exported_systemserverclasspath_fragments to prebuilt_apex rule.
This is for exporting the contents of systemserverclasspath_fragment for
dexpreopting.

Bug: 194150908
Test: manual - 1. Patch aosp/1818020 and aosp/1834534
  2. m SOONG_CONFIG_art_module_source_build=false com.android.art
Change-Id: I7d2d2e02869d8a523f7c0efbbff81706672a95c5
2021-09-30 10:06:21 +00:00
Jiakai Zhang
c9864278da Add prebuilt_systemserverclasspath_fragment rule.
This is the prebuilt side of systemserverclasspath_fragment, currently
for used for dexpreopting.

The change to automactially generate
prebuilt_systemserverclasspath_fragment rules will be in a separate CL.

Bug: 194150908
Test: m nothing
Change-Id: Ibf5322f80f78ac3ca037489f4a279456fe38a23f
2021-09-30 10:05:58 +00:00
Paul Duffin
25322e4d98 Prevent systemserverclasspath_fragment from depending on prebuilts
When TARGET_BUILD_APPS is set then TARGET_BUILD_USE_PREBUILT_SDKS=true
which causes all java_sdk_library_import modules to be treated as
prefer:true.

That breaks the build when the systemserverclasspath_fragment's content
property references a source java_sdk_library module that has a
corresponding java_sdk_library_import prebuilt module.

This fixes the issue by marking the dependency from the
systemserverclasspath_fragment to the source module as one that must
not be replaced with a reference to the prebuilt module.

Test: - update art prebuilts to include service-art
      m TARGET_BUILD_APPS=Calendar apps_only
      - fails before, works afterwards
Bug: 199116972
Change-Id: Ia2d8ce7bb7e644336a42c901f7fb8ea50fd67909
2021-09-16 11:12:51 +01:00
satayev
d34eb0c4a6 Make sure that classpath fragment contents appear in make vars.
The source of truth for what jars are in BOOTCLASSPATH and
SYSTEMSERVERCLASSPATH is make; adding a classpath fragment in soong
with a new jar in the contents without having it declared in make
is wrong (excluding test apexes).

Bug: 191369843
Test: m nothing
Change-Id: Ifd313776ee7ad206031244534ed3870126e4f835
2021-08-16 12:00:25 +01:00
satayev
492b17d533 Rename UpdatableSystemServerJars to ApexSystemServerJars.
This is consistent with naming for boot jars, e.g. ApexBootJars.

Bug: 191127295
Test: presubmit
Change-Id: I6e8828d55ac86b7f5260ed7f8d4eca1c0b3dced8
2021-07-28 14:04:49 +01:00
satayev
d604b210c4 Rename UpdatableBootJars to ApexBootJars.
Note that ART apex boot jars and core-icu4j are exceptions here as they
are not part of ApexBootJars. ART apex boot jars are defined in their
own variable, while core-icu4j is treated as a regular non-updatable
boot jar.

Bug: 191127295
Test: atest CtsClasspathsTestCases
Change-Id: I3cea3d82ef521655a1a5ffa8cae2258ab9d08bfc
2021-07-22 17:35:42 +01:00
Paul Duffin
56c93e899a Use both module name and stem name to filter updatable boot jars
Sometimes the stem property is set to change both the installed file
name and the name use to filter the configured module list, e.g. when
adding a test library to replace the standard library, e.g. test_foo
instead of foo.

Sometimes it is used just to change the installed file name.

This change uses both to filter the updatable boot jars and not just
the stem.

Bug: 180105615
Test: m nothing
Change-Id: I6c459fc3597b1e4f062bc9a4e52843305b538c5f
2021-06-29 23:35:25 +01: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
Treehugger Robot
348f20be0e Merge "AIDEGen: Collect dependencies info from APEX module." 2021-06-21 07:17:28 +00:00
satayev
142ed27e32 Rename ClasspathFragmentToConfiguredJarList methods to configuredJars.
They are internal implementation details of individual fragments.

Bug: 191127295
Test: m
Change-Id: Ib350135f5f6720741492f362f7b3203e5107772e
2021-06-16 10:13:55 +01:00
bralee
b0c1f0c45a AIDEGen: Collect dependencies info from APEX module.
Add apex dependencies.

Bug: 188004865
Test: 1. aidegen frameworks/base/apex/appsearch frameworks/base/apex/appsearch/testing   frameworks/base/services/tests/servicestests   frameworks/base/core/tests/coretests   cts/tests/appsearch   external/icing   vendor/google_testing/integration/tests/scenarios
      2. The dependency graph shows it is workable to provide the result to let IDE's [Project structure] to include the service-appsearch as source directory.
Change-Id: Ifd1548f0a86c1c73f8279e8ecea67756aeb1281e
2021-06-15 08:35:13 +08:00
Colin Cross
4ab2dd1afe Merge changes I0116f5f4,I950c9b54,I967f5c42
* changes:
  Treat java libraries in classpath fragments as directly in apex
  Make CopyDirectlyInAnyApex match the documentation
  Remove unused cc.copyDirectlyInAnyApexDependencyTag
2021-05-27 00:56:52 +00:00
Colin Cross
c33e5216f1 Treat java libraries in classpath fragments as directly in apex
Coverage is applied to java libraries that are directly in an apex.
Mark java libraries that are in an apex through a bootclasspath_fragment
or a systemserverclasspath_fragment as directly in the apex by
implementing CopyDirectlyInAnyApexTag on the dependency tags used for
their contents.

Bug: 183759446
Test: TestApexJavaCoverage
Change-Id: I0116f5f415083b5194000988cb257454ef115200
2021-05-26 10:07:44 -07:00
satayev
1c564cc9c9 Use stem when filtering boot jars.
For testing purposes, a boot jar may be provided by a test java_library
that has a different content name, but sets "stem" property to match
the original java_library.

Given that Stem() returns either the property value or module name,
it is safe to replace all content names by their stems.

Bug: 180105615
Test: atest CtsClasspathsTestCases sdkextensions_e2e_tests
Merged-In: Ic519ffa0c5b616abddf15b41c934421dfac2e78a
Change-Id: Ic519ffa0c5b616abddf15b41c934421dfac2e78a
2021-05-26 17:13:43 +01:00
satayev
703c67a0a9 Populate individual systemserverclasspath_fragments' proto configs.
Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: Ic0ae897e9baca75dcc022d84656496563645e74e
2021-05-24 13:41:20 +01:00
satayev
8fab6f86af Populate individual classpath_fragments' classpaths.proto configs.
To avoid duplicates on *CLASSPATH environ variables at runtime, remove
split entries from platform-*classpath, i.e. all updatable jars that
have their own classpath fragments should not appear in the
platform-*classpath's classpaths.proto config.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: Id2759ab8e106cc183e695bf3509a6ab60ab0ef2a
Merged-In: Id2759ab8e106cc183e695bf3509a6ab60ab0ef2a
2021-05-20 20:06:03 +01:00
satayev
333a1732b1 Add systemserverclasspath_fragments property to apex.
- All contents of the fragment are added as java_lib dependencies.
- Generated classpaths.proto is added into etc as required.

Bug: 180105615
Test: m nothing
Change-Id: I8e8e8b019c4ca2909182f205a47deffa946de6da
2021-05-17 21:46:08 +01:00
satayev
9366a053da Add "contents" property to systemserverclasspath_fragment.
Similar to bcp_fragment's contents, this property lists all java library
contributions made by this fragment.

Bug: 180105615
Test: m nothing
Change-Id: Ifb1f54d5db290fffaa31933d15207014bb72d2fb
2021-05-17 21:46:08 +01:00
satayev
aa86bac2b0 Add no-op systemserverclasspath_fragment module.
This would allow to start introducing these modules for apexes that
contribute to SYSTEMSERVERCLASSPATH.

In follow up, it will be evolved:
- platform_systemserverclasspath would have "fragments" property to
  list all individual systemserverclasspath_fragments;
- systemserverclasspath_fragment would have "contents" property to list
  contibuting java libs;
- systemserverclasspath_fragment would generate non-empty
  classpaths.proto config within individual apexes.

Bug: 180105615
Test: m nothing
Change-Id: Ibaaa3fae5f1eab9a41ceecc1214a53be6bbc8ba6
2021-05-17 20:53:59 +01:00
satayev
013485bd83 Declare ConfiguredJarList in specific fragment implementations.
Each specific classpath_fragment module knows what jars must be part
of the corresponding classpaths.proto config.

Note that bootclasspath_fragment does not implement classpath_fragment
yet, thus all boot jars and all system server jars go into corresponding
platform classpaths.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I6a8c7b0a5d17d62e790a441b8e2c5c1a816e7f30
2021-05-07 16:31:07 +01:00
satayev
95e9c5bbfa Split SYSTEMSERVERCLASSPATH entries from platform_bootclasspath.
Boot jars are different to system server jars at build level, due to
added complexity of dexpreopt. As a logical separation add a new
classpath fragment type and split existing classpaths.proto generation
into relevant pieces.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I88bec09fc920166ffd0092faef980754ddeb6593
2021-05-07 13:24:16 +01:00