Commit Graph

8470 Commits

Author SHA1 Message Date
Treehugger Robot
fae5ec8bbc Merge changes I505a7ad8,I92d88199 into main
* changes:
  Disable source apex variant using apex_available_name
  Skip `contents` validation of source bootclasspath fragments
2024-09-06 06:07:42 +00:00
Spandan Das
003452ff9c Disable source apex variant using apex_available_name
There are two versions of aosp extservices - one for Tplus and one for
Sminus. When prebuilts are active, the `contents` validation of both
variants of extservices bootclasspath fragments should be disabled to
account for BCP jar skew.

This CL adds ApexAvailableName to ApexInfo to achive that. If an
api_domain matching the ApexAvailableName has been selected in
`all_apex_contributions`, the source apex variants will be disabled.

Bug: 361771739

Test: lunch cf_x86_64_phone-next-userdebug
Test: m nothing with ag/28851886
Change-Id: I505a7ad8295c258e2eeef7f183669f7a75a1c88e
2024-09-06 05:10:41 +00:00
Spandan Das
1679192d7d Skip contents validation of source bootclasspath fragments
... if prebuilts are selected.

This is a special case of b/361771739 where a apex starts contributing a
jar to the BCP. `disableSourceApexVariant` uses
`PrebuiltSelectionInfoProvider` and this gets populated via the
following dep chain
```
source --> prebuilt --> all_apex_contributions
```

This runs into issues if a prebuilt bootclasspath_fragment does not
exist.

This CL creates a dependency edge between the source module and
all_apex_contributions singleton module so that
`PrebuiltSelectionInfoProvider` is available for
`disableSourceApexVariant`

Bug: 361771739
Test: lunch cf_x86_64-next-userdebug
Test: m nothing with ag/28851886
Change-Id: I92d88199a27579d3c9879d40fd354653370efcce
2024-09-06 05:10:29 +00:00
Colin Cross
fdaa672ad1 Remove obsolete robolectric test runner integration
The `m Run*RoboTests` test runner is no longer supported, remove the
code to generate the Make rules for it.

Also reduce the number of combining steps by passing the extra jars
that need to be combined into the compile step.

This relands Icf05079bf570bed7a10962cbf03459bd53c51f99 with a fix to
reorder the instrumented app classes after dependency classes.

Test: atest --host SystemUiRoboTests
Flag: EXEMPT refactor
Change-Id: I174ceb95af5557e1859eeb12a2f5fac2332975a8
2024-09-04 15:47:11 -07:00
Yu Liu
c55b25f125 Merge "Move the caching/restoring code from soong to blueprint to fully skip build actions." into main 2024-09-04 22:01:33 +00:00
Treehugger Robot
b94fef7278 Merge "Revert "Remove obsolete robolectric test runner integration"" into main 2024-09-04 21:36:08 +00:00
Priyanka Advani (xWF)
72853677e8 Revert "Remove obsolete robolectric test runner integration"
This reverts commit ef5739ed64.

Reason for revert: Droidmonitor created revert due to b/364665936.

Change-Id: Ia18f642492eafdbe2e78d9f753d87f243d529037
2024-09-04 20:15:58 +00:00
Yu Liu
26a716d5e5 Move the caching/restoring code from soong to blueprint to fully skip build actions.
Bug: 358425833
Test: Manually verified the generated ninja and mk files and CI.
Change-Id: Ieebb822c46f37c0ff55fad08531e9870a76cbd7b
2024-09-04 19:59:55 +00:00
Colin Cross
13d8e82c5e Merge "Rename collectTransitiveHeaderJars and friends to mention R8" into main 2024-09-04 17:34:03 +00:00
Colin Cross
b09e8ec23c Merge "Remove obsolete robolectric test runner integration" into main 2024-09-04 17:21:47 +00:00
Colin Cross
ca3bf2be39 Merge "Move checkbuild targets of Soong modules into Soong" into main 2024-09-04 17:12:03 +00:00
Yihan Dong
a596b12878 Merge "Apply apimapper instrument tool on android tests" into main 2024-09-04 00:52:09 +00:00
Colin Cross
ef5739ed64 Remove obsolete robolectric test runner integration
The `m Run*RoboTests` test runner is no longer supported, remove the
code to generate the Make rules for it.

Also reduce the number of combining steps by passing the extra jars
that need to be combined into the compile step.

Test: atest --host SystemUiRoboTests
Flag: EXEMPT refactor
Change-Id: Icf05079bf570bed7a10962cbf03459bd53c51f99
2024-09-03 14:52:26 -07:00
Colin Cross
9ffaf28f5f Rename collectTransitiveHeaderJars and friends to mention R8
collectTransitiveHeaderJarsForR8 visits direct dependencies and collects
all transitive libs and static_libs header jars.  The semantics of the
collected jars are odd (it collects combined jars that contain the static
libs, but also the static libs, and it collects transitive libs dependencies
of static_libs), so these are only used to expand the --library arguments
to R8.  Rename the method and all the fields it uses with a "ForR8"
suffix to avoid confusion when more transitive header jar collection is
added to support transitive classpaths.

Bug: 308016794
Test: all soong tests pass
Change-Id: I291a86fbbc2e2f088598fb309d1b992080d60941
2024-09-03 14:52:26 -07:00
Colin Cross
a6182ab2fa Move checkbuild targets of Soong modules into Soong
Pass the name of Soong's checkbuild target for each module to
Make so that it can depend on it from the main checkbuild rule.
This will give better control over which files get built, allowing
checkbuild to skip the jar combining step when transitive classpath
jars are enabled.  The per-module checkbuild targets are passed to
make instead of added directly as a dependency of checkbuild in order
to maintain the existing behavior of only building modules exposed
to make in checkbuild.

Also tweak the existing calls to CheckbuildFile and add
InstallFileWithoutCheckbuild to match the files that are
in the Make-based checkbuild.

Bug: 308016794
Test: m checkbuild
Change-Id: Ic5140819381d58f4d00f23a7a12447950c4cf268
2024-09-03 14:52:19 -07:00
Yihan Dong
8be09c2075 Apply apimapper instrument tool on android tests
Apimapper is a tool to instrument android tests to log potentail API calls at the run time.

The real tool is developed internally. We use a placeholder binary in
AOSP before the real tool is ready.

The tool will only take affect when the enviroment var EMMA_API_MAPPER
is set to true.

Test: m cts
Bug: 328699028

Change-Id: Iece53b8afdb9803334b7393527f4fa24e22f71a8
2024-09-02 09:02:08 +08:00
Jihoon Kang
7344482ff3 Merge "Revert^4 "Implement detecting container violations."" into main 2024-08-30 20:18:53 +00:00
Paul Duffin
c540beef74 Retry: Allow modules to override --error-when-new UnflaggedApi
Some `java_sdk_library` and `droidstubs` modules already specify
`--error UnflaggedApi` but they are currently ignored because they are
added before the `--error-when-new UnflaggedApi` automatically added by
Soong and Metalava uses the last setting. That means adding
`--error-when-new UnflaggedApi` in change https://r.android.com/3248013
actually reduced the severity of the issue for those modules making it
more likely that they would be missed.

This change only adds the `--error-when-new UnflaggedApi` if it does
not already appear in the metalava command.

Bug: 361582214
Test: m checkapi
Change-Id: I7228bf9794b1c7e27d7acf7a461956b30f3335f5
2024-08-30 15:27:07 +01:00
Priyanka Advani (xWF)
2075155076 Merge "Revert "Allow modules to override --error-when-new UnflaggedApi"" into main 2024-08-29 18:56:17 +00:00
Priyanka Advani (xWF)
b09c0d25c9 Revert "Allow modules to override --error-when-new UnflaggedApi"
This reverts commit 3001ce3bf5.

Reason for revert: Droidmonitor created revert due to b/363016109

Change-Id: Iaf3ca41520b4328fc727af8837e5dff6def41f2b
2024-08-29 18:48:14 +00:00
Treehugger Robot
f016b08ece Merge "Allow modules to override --error-when-new UnflaggedApi" into main 2024-08-29 17:58:56 +00:00
Jihoon Kang
85bc193805 Revert^4 "Implement detecting container violations."
This change introduces a method to detect violating inter-container
dependencies between modules. The method is run in
`ModuleBase.GenerateBuildActions`, after the container info provider is
set. Given that the provider of the direct dependencies would have been
set at this time, the method utilizes this information to determine
the violations, which are introduced in https://r.android.com/3141104.

Note that this enforcement does not turn all inter-container
dependencies as errors. Instead, it will only turn dependencies that
matches the pre-defined violations into errors. Even if the dependency
matches the violation, an error will not be thrown if the dependency
satisfies any of the exception functions (e.g. the dependent module is
stubs, or the two modules belong to the same apexes).

Test: m nothing --no-skip-soong-tests
Bug: 338660802
Change-Id: Ib9ddc0761fa46f1309b1a1a4f759d9a4e04fd70e
2024-08-29 17:55:00 +00:00
Paul Duffin
3001ce3bf5 Allow modules to override --error-when-new UnflaggedApi
Some `java_sdk_library` and `droidstubs` modules already specify
`--error UnflaggedApi` but they are currently ignored because they are
added before the `--error-when-new UnflaggedApi` automatically added by
Soong and Metalava uses the last setting. That means adding
`--error-when-new UnflaggedApi` in change https://r.android.com/3248013
actually reduced the severity of the issue for those modules making it
more likely that they would be missed.

This change only adds the `--error-when-new UnflaggedApi` if it does
not already appear in the metalava command.

Bug: 361582214
Test: m checkapi
Change-Id: I499183276c7520605cca7acc6e6e9ab535feaa86
2024-08-29 15:35:58 +01:00
Priyanka Advani (xWF)
88a8daf8ca Merge "Revert^3 "Implement detecting container violations."" into main 2024-08-28 23:20:03 +00:00
Priyanka Advani (xWF)
33b3a638a5 Revert^3 "Implement detecting container violations."
2a88491afc

Change-Id: Iba4527f391a093703978fe01177b56fec4604b28
2024-08-28 23:10:29 +00:00
Jihoon Kang
c14be38f1a Merge changes Ia693c4a5,I8e5620d2 into main
* changes:
  Revert^2 "Implement detecting container violations."
  Define additional container violations
2024-08-28 21:35:16 +00:00
Treehugger Robot
5fa409b88e Merge "Report UnflaggedApi issues as warnings but treat as errors when new" into main 2024-08-28 19:13:24 +00:00
Jihoon Kang
2a88491afc Revert^2 "Implement detecting container violations."
This change introduces a method to detect violating inter-container
dependencies between modules. The method is run in
`ModuleBase.GenerateBuildActions`, after the container info provider is
set. Given that the provider of the direct dependencies would have been
set at this time, the method utilizes this information to determine
the violations, which are introduced in https://r.android.com/3141104.

Note that this enforcement does not turn all inter-container
dependencies as errors. Instead, it will only turn dependencies that
matches the pre-defined violations into errors. Even if the dependency
matches the violation, an error will not be thrown if the dependency
satisfies any of the exception functions (e.g. the dependent module is
stubs, or the two modules belong to the same apexes).

Test: m nothing --no-skip-soong-tests
Bug: 338660802
Change-Id: Ia693c4a53369c757a3e96656a769405c759b111c
2024-08-28 18:01:25 +00:00
Paul Duffin
88d3b39846 Report UnflaggedApi issues as warnings but treat as errors when new
The `UnflaggedApi` issue is only reported when doing API linting and
defaults to `Severity.HIDDEN` because AndroidX (among other users) do
not support using `@FlaggedApi` annotations. This change switches it to
be warning by default in the  Android build as there are some existing
instances of it, but will be treated as an error by the "Build Warnings
Aye Aye Analyzer" in a Gerrit change if it occurs on lines that are
modified/added by that change.

Bug: 361582214
Test: m checkapi
Change-Id: Ie5ed23d00dd49454aeb5b43ccd8ad027d9d34fd2
2024-08-28 18:24:02 +01:00
Satish Yalla
f2d6e5004f Merge "Revert "Implement detecting container violations."" into main 2024-08-28 05:48:21 +00:00
Satish Yalla
b2b1ef63e2 Revert "Implement detecting container violations."
This reverts commit bb678f82d6.

Reason for revert: Droidmonitor created revert due to b/362639013. Will be verifying through ABTD before submission.

Change-Id: I1dcb71672eeb44a17cf176d3731bcaf9aaf81edf
2024-08-28 05:10:31 +00:00
Treehugger Robot
26f071db92 Merge "Implement detecting container violations." into main 2024-08-28 04:39:12 +00:00
Treehugger Robot
529da9b897 Merge "dexpreopt rules for google mainline prebuilts with missing source" into main 2024-08-28 01:25:52 +00:00
Treehugger Robot
9cbbafe300 Merge changes from topic "ctx_in_ideinfo" into main
* changes:
  Add ctx argument to IDEInfo()
  Add configurable property support to neverallow
2024-08-28 00:49:13 +00:00
Treehugger Robot
78a3761bde Merge "Make IdeInfo into a provider" into main 2024-08-27 23:49:10 +00:00
Cole Faust
b36d31d870 Add ctx argument to IDEInfo()
The IDEInfo() methods read properties. To make those properties
configurable, we need a context to evaluate them with.

Bug: 362579941
Test: m nothing --no-skip-soong-tests
Change-Id: I26d4b7084439b3006e50b02277298f74a929e1aa
2024-08-27 16:04:28 -07:00
Cole Faust
08c7f86575 Make IdeInfo into a provider
In order to keep the changes minimal, call the old IdeInfo method right
after GenerateAndroidBuildActions and then set the result of that
into a provider.

Test: Diff'd ninja files and saw no difference.
Change-Id: Ic706e7dbcb7c6e3d2a381ddae383eb87e105f385
2024-08-27 15:50:35 -07:00
Spandan Das
8a2c56c516 dexpreopt rules for google mainline prebuilts with missing source
AddFarVariationDependencies runs into issues in partner workspaces which
do not contain the sources of google mainline prebuilts, since the
prebuilt would be renamed in a prior prebuilt_rename mutator. To account
for this rename, add `prebuilt_` prefix in
`addDependenciesOntoSelectedBootImageApexes` to ensure that the prebuilt
apex does not get elided

Test: m nothing --no-skip-soong-tests
Test: in v-aml-prebuilt dev,
aninja -t query out/soong/dexpreopt_arm64/dex_bootjars_input/okhttp.jar | head -n3
out/soong/dexpreopt_arm64/dex_bootjars_input/okhttp.jar:
  input: g.android.Cp
    out/soong/.intermediates/vendor/partner_modules/ArtPrebuilt/prebuilt_com.google.android.art_compressed.deapexer/android_common/deapexer/javalib/okhttp.jar
(uses the prebuilt deapexed boot jar, and no the source apex boot jar)

Bug: 362163831
Change-Id: Ie94a36911ab40ac09a470efe505fd00ef3a5bf9c
2024-08-27 22:01:11 +00:00
Spandan Das
ed7a030c6c Contents validation of override_apex's bootclasspath fragments
https://r.android.com/3083813 added support for overriding
min_sdk_version, and creating separate variants of transitive
dependencies of override apexes. This causes issues when there is a skew
between apex boot jars of source and prebuilt mainline modules. For
mediaprovider google apex, we now have _two_ source variants of
mediaprovider bcp fragment module.

This CL uses ApexInfo.BaseApexName to skip the check on both variants of
bootclasspath/systemserverclasspath fragments.

This CL also removes the prefix based check to determine if prebuilts
are active. If RELEASE_APEX_CONTRIBUTIONS for a specific mainline module
is set, it will be assumed that prebuilts for that mainline module are
active.

Test: go test ./apex ./java
Bug: 361771739

Change-Id: I01f7ef437df8f10b74ffa397ba461ff4f1f9bed6
2024-08-27 18:48:46 +00:00
Jihoon Kang
bb678f82d6 Implement detecting container violations.
This change introduces a method to detect violating inter-container
dependencies between modules. The method is run in
`ModuleBase.GenerateBuildActions`, after the container info provider is
set. Given that the provider of the direct dependencies would have been
set at this time, the method utilizes this information to determine
the violations, which are introduced in https://r.android.com/3141104.

Note that this enforcement does not turn all inter-container
dependencies as errors. Instead, it will only turn dependencies that
matches the pre-defined violations into errors. Even if the dependency
matches the violation, an error will not be thrown if the dependency
satisfies any of the exception functions (e.g. the dependent module is
stubs, or the two modules belong to the same apexes).

Test: m nothing --no-skip-soong-tests
Bug: 338660802
Change-Id: I36e9cd956c5a076a53635be0c6ff27f77725516e
2024-08-27 17:30:42 +00:00
Spandan Das
18c2607bde Merge "Move installation rules of dexpreopt'd apex systemserver jars to soong" into main 2024-08-26 22:27:57 +00:00
Treehugger Robot
7389ad5c18 Merge "Guarantee frameworks.aidl stability." into main 2024-08-26 21:21:19 +00:00
Spandan Das
746161db0c Move installation rules of dexpreopt'd apex systemserver jars to soong
This will eventually allow us to build devices by skipping `katiBuild`
and moving straight to `katiPackaging`.

Implementation details
- Replace ctx.PackageFile with ctx.InstallFile. These makes these rules
  available to both make and soong packaging systems. This will be done
inside d.dexpreopt function
- Add InstallDepNeeded on the dependency tags in this chain
(apex --> sscp_fragment --> (java_library|java_sdk_library)). This is
necessary for the soong packaging system.
- Remove `LOCAL_SOONG_INSTALLED_MODULE=""`. A non-empty string ensures
  that kati honors the installation rules generated by soong.

Bug: 355509400
Test: lunch aosp_cf_x86_64_phone-trunk_staging-userdebug (mainline source)
Test: lunch cf_x86_64_only_phone-ap3a-userdebug (mainline prebuilts)
(no diff in system_intermediates/file_list.txt in both cases)

Change-Id: I190a919e9480e7d9981a6b9b96a50d9c33ceea02
2024-08-26 20:58:10 +00:00
Treehugger Robot
65c530c17e Merge "Remove suffix based stub matching logic" into main 2024-08-23 03:42:12 +00:00
Treehugger Robot
fe5f57b27f Merge "Make java_sdk_library phony target depend on its stub jar" into main 2024-08-23 03:14:53 +00:00
Jihoon Kang
4b9220af10 Make java_sdk_library phony target depend on its stub jar
Currently, the (from-text) stub jar depends on the check api timestamp
of the same api scope droidstubs. However, building the top level
sdk_library phony target does not trigger check api, as the top level
java_sdk_library "depends" on the stub submodules but the top level
phony target does not build the stubs generated by its submodule, nor
the top level java_sdk_library generate any output files.

In order to support the user's workflow of observing checkapi failure
after modifying the api by running `m <java_sdk_library name>`, this
change adds the paths to the stub jars as dependencies as the top level
java_sdk_library phony target.

Bug: 234113632
Test: modify source file api, run m <java_sdk_library name> and observe checkapi failure
Change-Id: Iccd42c8ef7d5de20f71c347455c1a90d83a6c70c
2024-08-22 22:11:04 +00:00
Jihoon Kang
fa3f0782f7 Remove suffix based stub matching logic
This change prevents non-stub modules with stub suffix from being
determined as the stub module, and instead makes the check more robust
by determining the condition based on the user-hidden
`Stub_contributing_api` property, which is only set for the stub
submodules generated by `java_sdk_library`.

Test: m nothing --no-skip-soong-tests
Bug: 361179822
Change-Id: I28a599c5b4fe1e8460e60580c0535aaf19e39ba3
2024-08-22 22:05:03 +00:00
Steven Moreland
465baeed14 Guarantee frameworks.aidl stability.
Apps share these classes from the BCP, so even if
they are changed, they stay in sync.

Bug: 258850063
Test: build
Change-Id: I50b6a928c29f5d9eca9496b91363a8fc5d397b00
2024-08-21 16:47:49 +00:00
Yu Liu
51c2231eab Access output files thru providers in Soong tests.
The outputFiles field on ModuleBase will be removed next.

Bug: 358425833
Test: CI
Change-Id: I6d665ac13134d9278e5908f64c454366bc6bca5e
2024-08-21 00:03:50 +00:00
Treehugger Robot
0fd3de6151 Merge "Restrict R8 -libraryjars refs for stable targets" into main 2024-08-20 22:31:28 +00:00