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

Commit 6e739b9b authored by Jihoon Kang's avatar Jihoon Kang Committed by Gerrit Code Review
Browse files

Merge "Propagate intermediateCacheFiles in java modules and filegroup" into main

parents a8ad9bbd 705e63e3
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
package android

import (
	"maps"
	"strings"

	"github.com/google/blueprint"
@@ -97,6 +98,25 @@ func (fg *fileGroup) GenerateAndroidBuildActions(ctx ModuleContext) {
	}
	SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: fg.srcs.Strings()})
	CollectDependencyAconfigFiles(ctx, &fg.mergedAconfigFiles)

	var aconfigDeclarations []string
	var intermediateCacheOutputPaths Paths
	var srcjars Paths
	modeInfos := make(map[string]ModeInfo)
	ctx.VisitDirectDeps(func(module Module) {
		if dep, ok := OtherModuleProvider(ctx, module, CodegenInfoProvider); ok {
			aconfigDeclarations = append(aconfigDeclarations, dep.AconfigDeclarations...)
			intermediateCacheOutputPaths = append(intermediateCacheOutputPaths, dep.IntermediateCacheOutputPaths...)
			srcjars = append(srcjars, dep.Srcjars...)
			maps.Copy(modeInfos, dep.ModeInfos)
		}
	})
	SetProvider(ctx, CodegenInfoProvider, CodegenInfo{
		AconfigDeclarations:          aconfigDeclarations,
		IntermediateCacheOutputPaths: intermediateCacheOutputPaths,
		Srcjars:                      srcjars,
		ModeInfos:                    modeInfos,
	})
}

func (fg *fileGroup) Srcs() Paths {
+29 −24
Original line number Diff line number Diff line
@@ -1227,6 +1227,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
			ExportedPluginClasses:               j.exportedPluginClasses,
			ExportedPluginDisableTurbine:        j.exportedDisableTurbine,
			StubsLinkType:                       j.stubsLinkType,
			AconfigIntermediateCacheOutputPaths: deps.aconfigProtoFiles,
		})

		j.outputFile = j.headerJarFile
@@ -1745,6 +1746,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
		ExportedPluginDisableTurbine:        j.exportedDisableTurbine,
		JacocoReportClassesFile:             j.jacocoReportClassesFile,
		StubsLinkType:                       j.stubsLinkType,
		AconfigIntermediateCacheOutputPaths: deps.aconfigProtoFiles,
	})

	// Save the output file with no relative path so that it doesn't end up in a subdirectory when used as a resource
@@ -2295,6 +2297,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
				// annotation processor that generates API is incompatible with the turbine
				// optimization.
				deps.disableTurbine = deps.disableTurbine || dep.ExportedPluginDisableTurbine
				deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.AconfigIntermediateCacheOutputPaths...)
			case pluginTag:
				if plugin, ok := module.(*Plugin); ok {
					if plugin.pluginProperties.Processor_class != nil {
@@ -2353,6 +2356,8 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
				deps.staticJars = append(deps.staticJars, dep.Srcs()...)
				deps.staticHeaderJars = append(deps.staticHeaderJars, dep.Srcs()...)
			}
		} else if dep, ok := android.OtherModuleProvider(ctx, module, android.CodegenInfoProvider); ok {
			deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.IntermediateCacheOutputPaths...)
		} else {
			switch tag {
			case bootClasspathTag:
+4 −0
Original line number Diff line number Diff line
@@ -309,6 +309,10 @@ type JavaInfo struct {
	// implementation jars. If the provider is set by java_sdk_library, the link type is "unknown"
	// and selection between the stub jar vs implementation jar is deferred to SdkLibrary.sdkJars(...)
	StubsLinkType StubsLinkType

	// AconfigIntermediateCacheOutputPaths is a path to the cache files collected from the
	// java_aconfig_library modules that are statically linked to this module.
	AconfigIntermediateCacheOutputPaths android.Paths
}

var JavaInfoProvider = blueprint.NewProvider[JavaInfo]()