Merge "Implement sysprop type checker"

This commit is contained in:
Treehugger Robot 2020-03-26 21:22:26 +00:00 committed by Gerrit Code Review
commit ac66c74a58
1 changed files with 24 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import (
"fmt"
"io"
"path"
"sync"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@ -154,8 +155,21 @@ type syspropLibraryProperties struct {
var (
pctx = android.NewPackageContext("android/soong/sysprop")
syspropCcTag = dependencyTag{name: "syspropCc"}
syspropLibrariesKey = android.NewOnceKey("syspropLibraries")
syspropLibrariesLock sync.Mutex
)
func syspropLibraries(config android.Config) *[]string {
return config.Once(syspropLibrariesKey, func() interface{} {
return &[]string{}
}).(*[]string)
}
func SyspropLibraries(config android.Config) []string {
return append([]string{}, *syspropLibraries(config)...)
}
func init() {
android.RegisterModuleType("sysprop_library", syspropLibraryFactory)
}
@ -195,6 +209,10 @@ func (m *syspropLibrary) HasPublicStub() bool {
return proptools.Bool(m.properties.Public_stub)
}
func (m *syspropLibrary) CurrentSyspropApiFile() android.Path {
return m.currentApiFile
}
func (m *syspropLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
baseModuleName := m.BaseModuleName()
@ -463,6 +481,12 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
Stem: proptools.StringPtr(m.BaseModuleName()),
})
}
syspropLibrariesLock.Lock()
defer syspropLibrariesLock.Unlock()
libraries := syspropLibraries(ctx.Config())
*libraries = append(*libraries, ctx.ModuleName())
}
func syspropDepsMutator(ctx android.BottomUpMutatorContext) {