Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6650b159 authored by Zi Wang's avatar Zi Wang Committed by Gerrit Code Review
Browse files

Merge "Use OutputFilesProvider on platformBootclasspathModule" into main

parents 09a1f585 444762b4
Loading
Loading
Loading
Loading
+7 −25
Original line number Original line Diff line number Diff line
@@ -15,8 +15,6 @@
package java
package java


import (
import (
	"fmt"

	"android/soong/android"
	"android/soong/android"
	"android/soong/dexpreopt"
	"android/soong/dexpreopt"
)
)
@@ -57,9 +55,6 @@ 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 {
@@ -76,8 +71,6 @@ func platformBootclasspathFactory() android.SingletonModule {
	return m
	return m
}
}


var _ android.OutputFileProducer = (*platformBootclasspathModule)(nil)

func (b *platformBootclasspathModule) AndroidMkEntries() (entries []android.AndroidMkEntries) {
func (b *platformBootclasspathModule) AndroidMkEntries() (entries []android.AndroidMkEntries) {
	entries = append(entries, android.AndroidMkEntries{
	entries = append(entries, android.AndroidMkEntries{
		Class: "FAKE",
		Class: "FAKE",
@@ -89,22 +82,6 @@ func (b *platformBootclasspathModule) AndroidMkEntries() (entries []android.Andr
	return
	return
}
}


// Make the hidden API files available from the platform-bootclasspath module.
func (b *platformBootclasspathModule) OutputFiles(tag string) (android.Paths, error) {
	switch tag {
	case "hiddenapi-flags.csv":
		return android.Paths{b.hiddenAPIFlagsCSV}, nil
	case "hiddenapi-index.csv":
		return android.Paths{b.hiddenAPIIndexCSV}, nil
	case "hiddenapi-metadata.csv":
		return android.Paths{b.hiddenAPIMetadataCSV}, nil
	case ".srcjar":
		return android.Paths{b.srcjar}, nil
	}

	return nil, fmt.Errorf("unknown tag %s", tag)
}

func (b *platformBootclasspathModule) DepsMutator(ctx android.BottomUpMutatorContext) {
func (b *platformBootclasspathModule) DepsMutator(ctx android.BottomUpMutatorContext) {
	// Create a dependency on all_apex_contributions to determine the selected mainline module
	// Create a dependency on all_apex_contributions to determine the selected mainline module
	ctx.AddDependency(ctx.Module(), apexContributionsMetadataDepTag, "all_apex_contributions")
	ctx.AddDependency(ctx.Module(), apexContributionsMetadataDepTag, "all_apex_contributions")
@@ -198,8 +175,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
	b.srcjar = android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar").OutputPath
	srcjar := android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar").OutputPath
	TransformResourcesToJar(ctx, b.srcjar, jarArgs, transitiveSrcFiles)
	TransformResourcesToJar(ctx, srcjar, jarArgs, transitiveSrcFiles)


	// Gather all the fragments dependencies.
	// Gather all the fragments dependencies.
	b.fragments = gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag)
	b.fragments = gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag)
@@ -213,6 +190,11 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo


	bootDexJarByModule := b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments)
	bootDexJarByModule := b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments)
	buildRuleForBootJarsPackageCheck(ctx, bootDexJarByModule)
	buildRuleForBootJarsPackageCheck(ctx, bootDexJarByModule)

	ctx.SetOutputFiles(android.Paths{b.hiddenAPIFlagsCSV}, "hiddenapi-flags.csv")
	ctx.SetOutputFiles(android.Paths{b.hiddenAPIIndexCSV}, "hiddenapi-index.csv")
	ctx.SetOutputFiles(android.Paths{b.hiddenAPIMetadataCSV}, "hiddenapi-metadata.csv")
	ctx.SetOutputFiles(android.Paths{srcjar}, ".srcjar")
}
}


// Generate classpaths.proto config
// Generate classpaths.proto config