summaryrefslogtreecommitdiff
path: root/java/platform_bootclasspath.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2024-05-20 18:37:17 +0000
committer Spandan Das <spandandas@google.com> 2024-05-20 18:56:28 +0000
commita90db96bb90f6ab8531910a693177595b862c9f8 (patch)
treed8a0442f54a6874130038a9da5ff3e0f46e52fc0 /java/platform_bootclasspath.go
parent9b9d29b8458a63a54f9e79f888a5e6060e284f3f (diff)
Create empty monolithic hiddenapi flags files for non java devices.
This is a followup https://r.android.com/3089366 that disabled the creation of out/soong/hiddenapi/hiddenapi* files for non java device builds. This works fine for `m`, but `m dist` runs issues since `f/b/boot/Android.bp` dists these files. For non java devices, the previous implementation would report missing files during ninja excecution (https://b.corp.google.com/issues/338363444#comment5) This CL creates empty files for these so that the dist tags can always be resolved. Bug: 338363444 Test: lunch aosp_cf_x86_64_minidroid-trunk_staging-userdebug && m dist Change-Id: Ice2d970a164246753da89a6a06dfd28a627a272d
Diffstat (limited to 'java/platform_bootclasspath.go')
-rw-r--r--java/platform_bootclasspath.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 0f87b2745..8d4cf6823 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -294,6 +294,15 @@ func (b *platformBootclasspathModule) checkApexModules(ctx android.ModuleContext
// generateHiddenAPIBuildActions generates all the hidden API related build rules.
func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android.ModuleContext, modules []android.Module, fragments []android.Module) bootDexJarByModule {
+ createEmptyHiddenApiFiles := func() {
+ paths := android.OutputPaths{b.hiddenAPIFlagsCSV, b.hiddenAPIIndexCSV, b.hiddenAPIMetadataCSV}
+ for _, path := range paths {
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Touch,
+ Output: path,
+ })
+ }
+ }
// Save the paths to the monolithic files for retrieval via OutputFiles().
b.hiddenAPIFlagsCSV = hiddenAPISingletonPaths(ctx).flags
@@ -306,13 +315,7 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android.
// optimization that can be used to reduce the incremental build time but as its name suggests it
// can be unsafe to use, e.g. when the changes affect anything that goes on the bootclasspath.
if ctx.Config().DisableHiddenApiChecks() {
- paths := android.OutputPaths{b.hiddenAPIFlagsCSV, b.hiddenAPIIndexCSV, b.hiddenAPIMetadataCSV}
- for _, path := range paths {
- ctx.Build(pctx, android.BuildParams{
- Rule: android.Touch,
- Output: path,
- })
- }
+ createEmptyHiddenApiFiles()
return bootDexJarByModule
}
@@ -327,6 +330,8 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android.
if len(classesJars) == 0 {
// This product does not include any monolithic jars. Monolithic hiddenapi flag generation is not required.
+ // However, generate an empty file so that the dist tags in f/b/boot/Android.bp can be resolved, and `m dist` works.
+ createEmptyHiddenApiFiles()
return bootDexJarByModule
}