Make the srcjar for bcp available in OutputFiles

This makes it possible for Android.bp files to depends on the srcjar.

Bug: 151360309
Test: m platform-bootclasspath.srcjar
Change-Id: Id42cc3cff89c084b55c7fb0726ad84ecd4f50f58
This commit is contained in:
Anton Hansson
2023-09-21 16:23:20 +00:00
parent 57162c515e
commit b3738ed1f4

View File

@@ -57,6 +57,9 @@ type platformBootclasspathModule struct {
// Path to the monolithic hiddenapi-unsupported.csv file. // Path to the monolithic hiddenapi-unsupported.csv file.
hiddenAPIMetadataCSV android.OutputPath hiddenAPIMetadataCSV android.OutputPath
// Path to a srcjar containing all the transitive sources of the bootclasspath.
srcjar android.OutputPath
} }
type platformBootclasspathProperties struct { type platformBootclasspathProperties struct {
@@ -95,6 +98,8 @@ func (b *platformBootclasspathModule) OutputFiles(tag string) (android.Paths, er
return android.Paths{b.hiddenAPIIndexCSV}, nil return android.Paths{b.hiddenAPIIndexCSV}, nil
case "hiddenapi-metadata.csv": case "hiddenapi-metadata.csv":
return android.Paths{b.hiddenAPIMetadataCSV}, nil return android.Paths{b.hiddenAPIMetadataCSV}, nil
case ".srcjar":
return android.Paths{b.srcjar}, nil
} }
return nil, fmt.Errorf("unknown tag %s", tag) return nil, fmt.Errorf("unknown tag %s", tag)
@@ -182,8 +187,8 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
} }
jarArgs := resourcePathsToJarArgs(transitiveSrcFiles) jarArgs := resourcePathsToJarArgs(transitiveSrcFiles)
jarArgs = append(jarArgs, "-srcjar") // Move srcfiles to the right package jarArgs = append(jarArgs, "-srcjar") // Move srcfiles to the right package
transitiveSrcJar := android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar") b.srcjar = android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar").OutputPath
TransformResourcesToJar(ctx, transitiveSrcJar, jarArgs, transitiveSrcFiles) TransformResourcesToJar(ctx, b.srcjar, jarArgs, transitiveSrcFiles)
// Gather all the fragments dependencies. // Gather all the fragments dependencies.
b.fragments = gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag) b.fragments = gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag)