Merge "Add aconfig annotations for java_aconfig_library" into main
This commit is contained in:
commit
01f70e8d0e
3 changed files with 26 additions and 0 deletions
|
@ -52,6 +52,9 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) DepsMutator(module *ja
|
||||||
} else {
|
} else {
|
||||||
ctx.AddDependency(ctx.Module(), declarationsTag, declarations)
|
ctx.AddDependency(ctx.Module(), declarationsTag, declarations)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add aconfig-annotations-lib as a dependency for the optimization / code stripping annotations
|
||||||
|
module.AddSharedLibrary("aconfig-annotations-lib")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuildActions(module *java.GeneratedJavaLibraryModule, ctx android.ModuleContext) android.Path {
|
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuildActions(module *java.GeneratedJavaLibraryModule, ctx android.ModuleContext) android.Path {
|
||||||
|
|
|
@ -22,6 +22,10 @@ type GeneratedJavaLibraryModule struct {
|
||||||
Library
|
Library
|
||||||
callbacks GeneratedJavaLibraryCallbacks
|
callbacks GeneratedJavaLibraryCallbacks
|
||||||
moduleName string
|
moduleName string
|
||||||
|
|
||||||
|
// true if we've already called DepsMutator. Can't call AddLibrary or AddSharedLibrary
|
||||||
|
// after DepsMutator.
|
||||||
|
depsMutatorDone bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type GeneratedJavaLibraryCallbacks interface {
|
type GeneratedJavaLibraryCallbacks interface {
|
||||||
|
@ -59,8 +63,25 @@ func GeneratedJavaLibraryModuleFactory(moduleName string, callbacks GeneratedJav
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add a java shared library as a dependency, as if they had said `libs: [ "name" ]`
|
||||||
|
func (module *GeneratedJavaLibraryModule) AddSharedLibrary(name string) {
|
||||||
|
if module.depsMutatorDone {
|
||||||
|
panic("GeneratedJavaLibraryModule.AddLibrary called after DepsMutator")
|
||||||
|
}
|
||||||
|
module.Library.properties.Libs = append(module.Library.properties.Libs, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a java shared library as a dependency, as if they had said `libs: [ "name" ]`
|
||||||
|
func (module *GeneratedJavaLibraryModule) AddStaticLibrary(name string) {
|
||||||
|
if module.depsMutatorDone {
|
||||||
|
panic("GeneratedJavaLibraryModule.AddStaticLibrary called after DepsMutator")
|
||||||
|
}
|
||||||
|
module.Library.properties.Static_libs = append(module.Library.properties.Static_libs, name)
|
||||||
|
}
|
||||||
|
|
||||||
func (module *GeneratedJavaLibraryModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (module *GeneratedJavaLibraryModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
module.callbacks.DepsMutator(module, ctx)
|
module.callbacks.DepsMutator(module, ctx)
|
||||||
|
module.depsMutatorDone = true
|
||||||
module.Library.DepsMutator(ctx)
|
module.Library.DepsMutator(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -385,6 +385,8 @@ func gatherRequiredDepsForTest() string {
|
||||||
"kotlin-stdlib-jdk8",
|
"kotlin-stdlib-jdk8",
|
||||||
"kotlin-annotations",
|
"kotlin-annotations",
|
||||||
"stub-annotations",
|
"stub-annotations",
|
||||||
|
|
||||||
|
"aconfig-annotations-lib",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, extra := range extraModules {
|
for _, extra := range extraModules {
|
||||||
|
|
Loading…
Reference in a new issue