Merge "Collect aconfig_declarations of the dependent java_aconfig_library modules" into main am: 033ffb9533
am: 1628b82c6f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3001319 Change-Id: I81e9d102c17bb5a1caf4400fc9d9513eb2be5c02 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
17
java/base.go
17
java/base.go
@@ -197,6 +197,9 @@ type CommonProperties struct {
|
||||
// Additional srcJars tacked in by GeneratedJavaLibraryModule
|
||||
Generated_srcjars []android.Path `android:"mutated"`
|
||||
|
||||
// intermediate aconfig cache file tacked in by GeneratedJavaLibraryModule
|
||||
Aconfig_Cache_files []android.Path `android:"mutated"`
|
||||
|
||||
// If true, then only the headers are built and not the implementation jar.
|
||||
Headers_only *bool
|
||||
|
||||
@@ -541,6 +544,11 @@ type Module struct {
|
||||
jarjarRenameRules map[string]string
|
||||
|
||||
stubsLinkType StubsLinkType
|
||||
|
||||
// Paths to the aconfig intermediate cache files that are provided by the
|
||||
// java_aconfig_library or java_library modules that are statically linked
|
||||
// to this module. Does not contain cache files from all transitive dependencies.
|
||||
aconfigCacheFiles android.Paths
|
||||
}
|
||||
|
||||
func (j *Module) CheckStableSdkVersion(ctx android.BaseModuleContext) error {
|
||||
@@ -1197,6 +1205,8 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
||||
// final R classes from the app.
|
||||
flags.classpath = append(android.CopyOf(extraClasspathJars), flags.classpath...)
|
||||
|
||||
j.aconfigCacheFiles = append(deps.aconfigProtoFiles, j.properties.Aconfig_Cache_files...)
|
||||
|
||||
// If compiling headers then compile them and skip the rest
|
||||
if proptools.Bool(j.properties.Headers_only) {
|
||||
if srcFiles.HasExt(".kt") {
|
||||
@@ -1736,7 +1746,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
||||
ExportedPluginDisableTurbine: j.exportedDisableTurbine,
|
||||
JacocoReportClassesFile: j.jacocoReportClassesFile,
|
||||
StubsLinkType: j.stubsLinkType,
|
||||
AconfigIntermediateCacheOutputPaths: deps.aconfigProtoFiles,
|
||||
AconfigIntermediateCacheOutputPaths: j.aconfigCacheFiles,
|
||||
})
|
||||
|
||||
// Save the output file with no relative path so that it doesn't end up in a subdirectory when used as a resource
|
||||
@@ -2350,7 +2360,10 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
||||
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...)
|
||||
switch tag {
|
||||
case staticLibTag:
|
||||
deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.IntermediateCacheOutputPaths...)
|
||||
}
|
||||
} else {
|
||||
switch tag {
|
||||
case bootClasspathTag:
|
||||
|
@@ -391,12 +391,14 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
||||
} else if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||
deps.classpath = append(deps.classpath, dep.HeaderJars...)
|
||||
deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs...)
|
||||
deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.AconfigIntermediateCacheOutputPaths...)
|
||||
} else if dep, ok := module.(android.SourceFileProducer); ok {
|
||||
checkProducesJars(ctx, dep)
|
||||
deps.classpath = append(deps.classpath, dep.Srcs()...)
|
||||
} else {
|
||||
ctx.ModuleErrorf("depends on non-java module %q", otherName)
|
||||
}
|
||||
|
||||
case java9LibTag:
|
||||
if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||
deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars...)
|
||||
@@ -429,6 +431,19 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
||||
srcFiles := android.PathsForModuleSrcExcludes(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
|
||||
j.implicits = append(j.implicits, srcFiles...)
|
||||
|
||||
// Module can depend on a java_aconfig_library module using the ":module_name{.tag}" syntax.
|
||||
// Find the corresponding aconfig_declarations module name for such case.
|
||||
for _, src := range j.properties.Srcs {
|
||||
if moduleName, tag := android.SrcIsModuleWithTag(src); moduleName != "" {
|
||||
otherModule := android.GetModuleFromPathDep(ctx, moduleName, tag)
|
||||
if otherModule != nil {
|
||||
if dep, ok := android.OtherModuleProvider(ctx, otherModule, android.CodegenInfoProvider); ok {
|
||||
deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.IntermediateCacheOutputPaths...)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filterByPackage := func(srcs []android.Path, filterPackages []string) []android.Path {
|
||||
if filterPackages == nil {
|
||||
return srcs
|
||||
|
@@ -34,7 +34,7 @@ type GeneratedJavaLibraryCallbacks interface {
|
||||
|
||||
// Called from inside GenerateAndroidBuildActions. Add the build rules to
|
||||
// make the srcjar, and return the path to it.
|
||||
GenerateSourceJarBuildActions(module *GeneratedJavaLibraryModule, ctx android.ModuleContext) android.Path
|
||||
GenerateSourceJarBuildActions(module *GeneratedJavaLibraryModule, ctx android.ModuleContext) (android.Path, android.Path)
|
||||
}
|
||||
|
||||
// GeneratedJavaLibraryModuleFactory provides a utility for modules that are generated
|
||||
@@ -103,8 +103,10 @@ func (module *GeneratedJavaLibraryModule) GenerateAndroidBuildActions(ctx androi
|
||||
checkPropertyEmpty(ctx, module, "plugins", module.Library.properties.Plugins)
|
||||
checkPropertyEmpty(ctx, module, "exported_plugins", module.Library.properties.Exported_plugins)
|
||||
|
||||
srcJarPath := module.callbacks.GenerateSourceJarBuildActions(module, ctx)
|
||||
srcJarPath, cacheOutputPath := module.callbacks.GenerateSourceJarBuildActions(module, ctx)
|
||||
|
||||
module.Library.properties.Generated_srcjars = append(module.Library.properties.Generated_srcjars, srcJarPath)
|
||||
module.Library.properties.Aconfig_Cache_files = append(module.Library.properties.Aconfig_Cache_files, cacheOutputPath)
|
||||
module.Library.GenerateAndroidBuildActions(ctx)
|
||||
}
|
||||
|
||||
|
@@ -36,8 +36,8 @@ type JavaGenLibTestCallbacks struct {
|
||||
func (callbacks *JavaGenLibTestCallbacks) DepsMutator(module *GeneratedJavaLibraryModule, ctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
|
||||
func (callbacks *JavaGenLibTestCallbacks) GenerateSourceJarBuildActions(module *GeneratedJavaLibraryModule, ctx android.ModuleContext) android.Path {
|
||||
return android.PathForOutput(ctx, "blah.srcjar")
|
||||
func (callbacks *JavaGenLibTestCallbacks) GenerateSourceJarBuildActions(module *GeneratedJavaLibraryModule, ctx android.ModuleContext) (android.Path, android.Path) {
|
||||
return android.PathForOutput(ctx, "blah.srcjar"), android.PathForOutput(ctx, "blah.pb")
|
||||
}
|
||||
|
||||
func testGenLib(t *testing.T, errorHandler android.FixtureErrorHandler, bp string) *android.TestResult {
|
||||
|
Reference in New Issue
Block a user