Move registration into android package
Mutator registration is tightly coupled with the android package, move all registration from the soong package to the android package. Test: build.ninja identical Change-Id: Ie183d0b52cc7431c9e05b231934d189208ef1efe
This commit is contained in:
parent
3f9bde87fb
commit
798bfce9d0
|
@ -45,7 +45,6 @@ bootstrap_go_package {
|
|||
],
|
||||
srcs: [
|
||||
"doc.go",
|
||||
"register.go",
|
||||
],
|
||||
}
|
||||
|
||||
|
@ -73,6 +72,7 @@ bootstrap_go_package {
|
|||
"android/onceper.go",
|
||||
"android/package_ctx.go",
|
||||
"android/paths.go",
|
||||
"android/register.go",
|
||||
"android/util.go",
|
||||
"android/variable.go",
|
||||
|
||||
|
|
|
@ -24,14 +24,12 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
"android/soong"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
func init() {
|
||||
soong.RegisterSingletonType("androidmk", AndroidMkSingleton)
|
||||
RegisterSingletonType("androidmk", AndroidMkSingleton)
|
||||
}
|
||||
|
||||
type AndroidMkDataProvider interface {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
package android
|
||||
|
||||
import (
|
||||
"android/soong"
|
||||
"android/soong/env"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
|
@ -29,7 +28,7 @@ import (
|
|||
// a manifest regeneration.
|
||||
|
||||
func init() {
|
||||
soong.RegisterSingletonType("env", EnvSingleton)
|
||||
RegisterSingletonType("env", EnvSingleton)
|
||||
}
|
||||
|
||||
func EnvSingleton() blueprint.Singleton {
|
||||
|
|
|
@ -20,8 +20,6 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"android/soong"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
@ -66,7 +64,7 @@ func RegisterMakeVarsProvider(pctx blueprint.PackageContext, provider MakeVarsPr
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
func init() {
|
||||
soong.RegisterSingletonType("makevars", makeVarsSingletonFunc)
|
||||
RegisterSingletonType("makevars", makeVarsSingletonFunc)
|
||||
}
|
||||
|
||||
func makeVarsSingletonFunc() blueprint.Singleton {
|
||||
|
|
|
@ -19,7 +19,6 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/glob"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
|
@ -710,7 +709,7 @@ func (ctx *androidModuleContext) Glob(outDir, globPattern string, excludes []str
|
|||
}
|
||||
|
||||
func init() {
|
||||
soong.RegisterSingletonType("buildtarget", BuildTargetSingleton)
|
||||
RegisterSingletonType("buildtarget", BuildTargetSingleton)
|
||||
}
|
||||
|
||||
func BuildTargetSingleton() blueprint.Singleton {
|
||||
|
|
|
@ -14,11 +14,7 @@
|
|||
|
||||
package android
|
||||
|
||||
import (
|
||||
"android/soong"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
)
|
||||
import "github.com/google/blueprint"
|
||||
|
||||
type AndroidTopDownMutator func(TopDownMutatorContext)
|
||||
|
||||
|
@ -44,26 +40,41 @@ type androidBottomUpMutatorContext struct {
|
|||
androidBaseContextImpl
|
||||
}
|
||||
|
||||
func RegisterBottomUpMutator(name string, mutator AndroidBottomUpMutator) soong.MutatorHandle {
|
||||
return soong.RegisterBottomUpMutator(name, func(ctx blueprint.BottomUpMutatorContext) {
|
||||
func RegisterBottomUpMutator(name string, m AndroidBottomUpMutator) MutatorHandle {
|
||||
f := func(ctx blueprint.BottomUpMutatorContext) {
|
||||
if a, ok := ctx.Module().(Module); ok {
|
||||
actx := &androidBottomUpMutatorContext{
|
||||
BottomUpMutatorContext: ctx,
|
||||
androidBaseContextImpl: a.base().androidBaseContextFactory(ctx),
|
||||
}
|
||||
mutator(actx)
|
||||
m(actx)
|
||||
}
|
||||
})
|
||||
}
|
||||
mutator := &mutator{name: name, bottomUpMutator: f}
|
||||
mutators = append(mutators, mutator)
|
||||
return mutator
|
||||
}
|
||||
|
||||
func RegisterTopDownMutator(name string, mutator AndroidTopDownMutator) soong.MutatorHandle {
|
||||
return soong.RegisterTopDownMutator(name, func(ctx blueprint.TopDownMutatorContext) {
|
||||
func RegisterTopDownMutator(name string, m AndroidTopDownMutator) MutatorHandle {
|
||||
f := func(ctx blueprint.TopDownMutatorContext) {
|
||||
if a, ok := ctx.Module().(Module); ok {
|
||||
actx := &androidTopDownMutatorContext{
|
||||
TopDownMutatorContext: ctx,
|
||||
androidBaseContextImpl: a.base().androidBaseContextFactory(ctx),
|
||||
}
|
||||
mutator(actx)
|
||||
m(actx)
|
||||
}
|
||||
})
|
||||
}
|
||||
mutator := &mutator{name: name, topDownMutator: f}
|
||||
mutators = append(mutators, mutator)
|
||||
return mutator
|
||||
}
|
||||
|
||||
type MutatorHandle interface {
|
||||
Parallel() MutatorHandle
|
||||
}
|
||||
|
||||
func (mutator *mutator) Parallel() MutatorHandle {
|
||||
mutator.parallel = true
|
||||
return mutator
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package soong
|
||||
package android
|
||||
|
||||
import "github.com/google/blueprint"
|
||||
|
||||
|
@ -47,27 +47,6 @@ func RegisterSingletonType(name string, factory blueprint.SingletonFactory) {
|
|||
singletons = append(singletons, singleton{name, factory})
|
||||
}
|
||||
|
||||
func RegisterBottomUpMutator(name string, m blueprint.BottomUpMutator) MutatorHandle {
|
||||
mutator := &mutator{name: name, bottomUpMutator: m}
|
||||
mutators = append(mutators, mutator)
|
||||
return mutator
|
||||
}
|
||||
|
||||
func RegisterTopDownMutator(name string, m blueprint.TopDownMutator) MutatorHandle {
|
||||
mutator := &mutator{name: name, topDownMutator: m}
|
||||
mutators = append(mutators, mutator)
|
||||
return mutator
|
||||
}
|
||||
|
||||
type MutatorHandle interface {
|
||||
Parallel() MutatorHandle
|
||||
}
|
||||
|
||||
func (mutator *mutator) Parallel() MutatorHandle {
|
||||
mutator.parallel = true
|
||||
return mutator
|
||||
}
|
||||
|
||||
func NewContext() *blueprint.Context {
|
||||
ctx := blueprint.NewContext()
|
||||
|
|
@ -18,7 +18,6 @@ import (
|
|||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
|
@ -42,8 +41,8 @@ type BinaryLinkerProperties struct {
|
|||
}
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("cc_binary", binaryFactory)
|
||||
soong.RegisterModuleType("cc_binary_host", binaryHostFactory)
|
||||
android.RegisterModuleType("cc_binary", binaryFactory)
|
||||
android.RegisterModuleType("cc_binary_host", binaryHostFactory)
|
||||
}
|
||||
|
||||
// Module factory for binaries
|
||||
|
|
3
cc/cc.go
3
cc/cc.go
|
@ -26,14 +26,13 @@ import (
|
|||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
"android/soong/cc/config"
|
||||
"android/soong/genrule"
|
||||
)
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("cc_defaults", defaultsFactory)
|
||||
android.RegisterModuleType("cc_defaults", defaultsFactory)
|
||||
|
||||
// LinkageMutator must be registered after common.ArchMutator, but that is guaranteed by
|
||||
// the Go initialization order because this package depends on common, so common's init
|
||||
|
|
|
@ -20,7 +20,6 @@ import (
|
|||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/pathtools"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
|
@ -77,11 +76,11 @@ type FlagExporterProperties struct {
|
|||
}
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("cc_library_static", libraryStaticFactory)
|
||||
soong.RegisterModuleType("cc_library_shared", librarySharedFactory)
|
||||
soong.RegisterModuleType("cc_library", libraryFactory)
|
||||
soong.RegisterModuleType("cc_library_host_static", libraryHostStaticFactory)
|
||||
soong.RegisterModuleType("cc_library_host_shared", libraryHostSharedFactory)
|
||||
android.RegisterModuleType("cc_library_static", libraryStaticFactory)
|
||||
android.RegisterModuleType("cc_library_shared", librarySharedFactory)
|
||||
android.RegisterModuleType("cc_library", libraryFactory)
|
||||
android.RegisterModuleType("cc_library_host_static", libraryHostStaticFactory)
|
||||
android.RegisterModuleType("cc_library_host_shared", libraryHostSharedFactory)
|
||||
}
|
||||
|
||||
// Module factory for combined static + shared libraries, device by default but with possible host
|
||||
|
|
|
@ -20,16 +20,15 @@ import (
|
|||
|
||||
"github.com/google/blueprint"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
"android/soong/cc/config"
|
||||
)
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("ndk_prebuilt_library", ndkPrebuiltLibraryFactory)
|
||||
soong.RegisterModuleType("ndk_prebuilt_object", ndkPrebuiltObjectFactory)
|
||||
soong.RegisterModuleType("ndk_prebuilt_static_stl", ndkPrebuiltStaticStlFactory)
|
||||
soong.RegisterModuleType("ndk_prebuilt_shared_stl", ndkPrebuiltSharedStlFactory)
|
||||
android.RegisterModuleType("ndk_prebuilt_library", ndkPrebuiltLibraryFactory)
|
||||
android.RegisterModuleType("ndk_prebuilt_object", ndkPrebuiltObjectFactory)
|
||||
android.RegisterModuleType("ndk_prebuilt_static_stl", ndkPrebuiltStaticStlFactory)
|
||||
android.RegisterModuleType("ndk_prebuilt_shared_stl", ndkPrebuiltSharedStlFactory)
|
||||
}
|
||||
|
||||
// NDK prebuilt libraries.
|
||||
|
|
|
@ -55,14 +55,13 @@ package cc
|
|||
import (
|
||||
"github.com/google/blueprint"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("ndk_headers", ndkHeadersFactory)
|
||||
soong.RegisterModuleType("ndk_library", ndkLibraryFactory)
|
||||
soong.RegisterSingletonType("ndk", NdkSingleton)
|
||||
android.RegisterModuleType("ndk_headers", ndkHeadersFactory)
|
||||
android.RegisterModuleType("ndk_library", ndkLibraryFactory)
|
||||
android.RegisterSingletonType("ndk", NdkSingleton)
|
||||
|
||||
pctx.Import("android/soong/common")
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import (
|
|||
|
||||
"github.com/google/blueprint"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
|
@ -28,7 +27,7 @@ import (
|
|||
//
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("cc_object", objectFactory)
|
||||
android.RegisterModuleType("cc_object", objectFactory)
|
||||
}
|
||||
|
||||
type objectLinker struct {
|
||||
|
|
11
cc/test.go
11
cc/test.go
|
@ -21,7 +21,6 @@ import (
|
|||
|
||||
"github.com/google/blueprint"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
|
@ -37,11 +36,11 @@ type TestBinaryProperties struct {
|
|||
}
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("cc_test", testFactory)
|
||||
soong.RegisterModuleType("cc_test_library", testLibraryFactory)
|
||||
soong.RegisterModuleType("cc_benchmark", benchmarkFactory)
|
||||
soong.RegisterModuleType("cc_test_host", testHostFactory)
|
||||
soong.RegisterModuleType("cc_benchmark_host", benchmarkHostFactory)
|
||||
android.RegisterModuleType("cc_test", testFactory)
|
||||
android.RegisterModuleType("cc_test_library", testLibraryFactory)
|
||||
android.RegisterModuleType("cc_benchmark", benchmarkFactory)
|
||||
android.RegisterModuleType("cc_test_host", testHostFactory)
|
||||
android.RegisterModuleType("cc_benchmark_host", benchmarkHostFactory)
|
||||
}
|
||||
|
||||
// Module factory for tests
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
|
@ -27,7 +26,7 @@ import (
|
|||
//
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("toolchain_library", toolchainLibraryFactory)
|
||||
android.RegisterModuleType("toolchain_library", toolchainLibraryFactory)
|
||||
}
|
||||
|
||||
type toolchainLibraryDecorator struct {
|
||||
|
|
|
@ -22,8 +22,6 @@ import (
|
|||
|
||||
"github.com/google/blueprint/bootstrap"
|
||||
|
||||
"android/soong"
|
||||
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
|
@ -33,7 +31,7 @@ func main() {
|
|||
// The top-level Blueprints file is passed as the first argument.
|
||||
srcDir := filepath.Dir(flag.Arg(0))
|
||||
|
||||
ctx := soong.NewContext()
|
||||
ctx := android.NewContext()
|
||||
|
||||
configuration, err := android.NewConfig(srcDir, bootstrap.BuildDir)
|
||||
if err != nil {
|
||||
|
|
|
@ -19,13 +19,12 @@ import (
|
|||
|
||||
"github.com/google/blueprint"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("gensrcs", GenSrcsFactory)
|
||||
soong.RegisterModuleType("genrule", GenRuleFactory)
|
||||
android.RegisterModuleType("gensrcs", GenSrcsFactory)
|
||||
android.RegisterModuleType("genrule", GenRuleFactory)
|
||||
|
||||
android.RegisterBottomUpMutator("genrule_deps", genruleDepsMutator).Parallel()
|
||||
}
|
||||
|
|
19
java/java.go
19
java/java.go
|
@ -24,22 +24,21 @@ import (
|
|||
|
||||
"github.com/google/blueprint"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/android"
|
||||
"android/soong/genrule"
|
||||
)
|
||||
|
||||
func init() {
|
||||
soong.RegisterModuleType("java_library", JavaLibraryFactory)
|
||||
soong.RegisterModuleType("java_library_static", JavaLibraryFactory)
|
||||
soong.RegisterModuleType("java_library_host", JavaLibraryHostFactory)
|
||||
soong.RegisterModuleType("java_binary", JavaBinaryFactory)
|
||||
soong.RegisterModuleType("java_binary_host", JavaBinaryHostFactory)
|
||||
soong.RegisterModuleType("prebuilt_java_library", JavaPrebuiltFactory)
|
||||
soong.RegisterModuleType("prebuilt_sdk", SdkPrebuiltFactory)
|
||||
soong.RegisterModuleType("android_app", AndroidAppFactory)
|
||||
android.RegisterModuleType("java_library", JavaLibraryFactory)
|
||||
android.RegisterModuleType("java_library_static", JavaLibraryFactory)
|
||||
android.RegisterModuleType("java_library_host", JavaLibraryHostFactory)
|
||||
android.RegisterModuleType("java_binary", JavaBinaryFactory)
|
||||
android.RegisterModuleType("java_binary_host", JavaBinaryHostFactory)
|
||||
android.RegisterModuleType("prebuilt_java_library", JavaPrebuiltFactory)
|
||||
android.RegisterModuleType("prebuilt_sdk", SdkPrebuiltFactory)
|
||||
android.RegisterModuleType("android_app", AndroidAppFactory)
|
||||
|
||||
soong.RegisterSingletonType("logtags", LogtagsSingleton)
|
||||
android.RegisterSingletonType("logtags", LogtagsSingleton)
|
||||
}
|
||||
|
||||
// TODO:
|
||||
|
|
Loading…
Reference in New Issue