Loading android/prebuilt_build_tool.go +5 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package android import "path/filepath" func init() { RegisterModuleType("prebuilt_build_tool", NewPrebuiltBuildTool) RegisterModuleType("prebuilt_build_tool", prebuiltBuildToolFactory) } type prebuiltBuildToolProperties struct { Loading Loading @@ -101,6 +101,10 @@ var _ HostToolProvider = &prebuiltBuildTool{} // prebuilt_build_tool is to declare prebuilts to be used during the build, particularly for use // in genrules with the "tools" property. func prebuiltBuildToolFactory() Module { return NewPrebuiltBuildTool() } func NewPrebuiltBuildTool() Module { module := &prebuiltBuildTool{} module.AddProperties(&module.properties) Loading cc/testing.go +0 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) { multitree.RegisterApiImportsModule(ctx) ctx.RegisterModuleType("prebuilt_build_tool", android.NewPrebuiltBuildTool) ctx.RegisterModuleType("cc_benchmark", BenchmarkFactory) ctx.RegisterModuleType("cc_object", ObjectFactory) ctx.RegisterModuleType("cc_genrule", GenRuleFactory) Loading rust/config/global.go +7 −9 Original line number Diff line number Diff line Loading @@ -81,7 +81,13 @@ var ( func init() { pctx.SourcePathVariable("RustDefaultBase", RustDefaultBase) pctx.VariableConfigMethod("HostPrebuiltTag", HostPrebuiltTag) pctx.VariableConfigMethod("HostPrebuiltTag", func(config android.Config) string { if config.UseHostMusl() { return "linux-musl-x86" } else { return config.PrebuiltOS() } }) pctx.VariableFunc("RustBase", func(ctx android.PackageVarContext) string { if override := ctx.Config().Getenv("RUST_PREBUILTS_BASE"); override != "" { Loading @@ -103,14 +109,6 @@ func init() { exportedVars.ExportStringStaticVariable("RUST_DEFAULT_VERSION", RustDefaultVersion) } func HostPrebuiltTag(config android.Config) string { if config.UseHostMusl() { return "linux-musl-x86" } else { return config.PrebuiltOS() } } func getRustVersionPctx(ctx android.PackageVarContext) string { return GetRustVersion(ctx) } Loading rust/toolchain_library.go +1 −50 Original line number Diff line number Diff line Loading @@ -18,12 +18,9 @@ package rust import ( "path" "path/filepath" "android/soong/android" "android/soong/rust/config" "github.com/google/blueprint/proptools" ) // This module is used to compile the rust toolchain libraries Loading @@ -36,8 +33,6 @@ func init() { rustToolchainLibraryRlibFactory) android.RegisterModuleType("rust_toolchain_library_dylib", rustToolchainLibraryDylibFactory) android.RegisterModuleType("rust_toolchain_rustc_prebuilt", rustToolchainRustcPrebuiltFactory) } type toolchainLibraryProperties struct { Loading Loading @@ -87,7 +82,7 @@ func initToolchainLibrary(module *Module, library *libraryDecorator) android.Mod func rustSetToolchainSource(ctx android.LoadHookContext) { if toolchainLib, ok := ctx.Module().(*Module).compiler.(*toolchainLibraryDecorator); ok { prefix := filepath.Join(config.HostPrebuiltTag(ctx.Config()), GetRustPrebuiltVersion(ctx)) prefix := "linux-x86/" + GetRustPrebuiltVersion(ctx) newSrcs := []string{path.Join(prefix, android.String(toolchainLib.Properties.Toolchain_src))} type props struct { Loading @@ -106,47 +101,3 @@ func rustSetToolchainSource(ctx android.LoadHookContext) { func GetRustPrebuiltVersion(ctx android.LoadHookContext) string { return ctx.AConfig().GetenvWithDefault("RUST_PREBUILTS_VERSION", config.RustDefaultVersion) } type toolchainRustcPrebuiltProperties struct { // path to rustc prebuilt, relative to the top of the toolchain source Toolchain_prebuilt_src *string // path to deps, relative to the top of the toolchain source Toolchain_deps []string // path to deps, relative to module directory Deps []string } func rustToolchainRustcPrebuiltFactory() android.Module { module := android.NewPrebuiltBuildTool() module.AddProperties(&toolchainRustcPrebuiltProperties{}) android.AddLoadHook(module, func(ctx android.LoadHookContext) { var toolchainProps *toolchainRustcPrebuiltProperties for _, p := range ctx.Module().GetProperties() { toolchainProperties, ok := p.(*toolchainRustcPrebuiltProperties) if ok { toolchainProps = toolchainProperties } } if toolchainProps.Toolchain_prebuilt_src == nil { ctx.PropertyErrorf("toolchain_prebuilt_src", "must set path to rustc prebuilt") } prefix := filepath.Join(config.HostPrebuiltTag(ctx.Config()), GetRustPrebuiltVersion(ctx)) deps := make([]string, 0, len(toolchainProps.Toolchain_deps)+len(toolchainProps.Deps)) for _, d := range toolchainProps.Toolchain_deps { deps = append(deps, path.Join(prefix, d)) } deps = append(deps, toolchainProps.Deps...) props := struct { Src *string Deps []string }{ Src: proptools.StringPtr(path.Join(prefix, *toolchainProps.Toolchain_prebuilt_src)), Deps: deps, } ctx.AppendProperties(&props) }) return module } Loading
android/prebuilt_build_tool.go +5 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package android import "path/filepath" func init() { RegisterModuleType("prebuilt_build_tool", NewPrebuiltBuildTool) RegisterModuleType("prebuilt_build_tool", prebuiltBuildToolFactory) } type prebuiltBuildToolProperties struct { Loading Loading @@ -101,6 +101,10 @@ var _ HostToolProvider = &prebuiltBuildTool{} // prebuilt_build_tool is to declare prebuilts to be used during the build, particularly for use // in genrules with the "tools" property. func prebuiltBuildToolFactory() Module { return NewPrebuiltBuildTool() } func NewPrebuiltBuildTool() Module { module := &prebuiltBuildTool{} module.AddProperties(&module.properties) Loading
cc/testing.go +0 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) { multitree.RegisterApiImportsModule(ctx) ctx.RegisterModuleType("prebuilt_build_tool", android.NewPrebuiltBuildTool) ctx.RegisterModuleType("cc_benchmark", BenchmarkFactory) ctx.RegisterModuleType("cc_object", ObjectFactory) ctx.RegisterModuleType("cc_genrule", GenRuleFactory) Loading
rust/config/global.go +7 −9 Original line number Diff line number Diff line Loading @@ -81,7 +81,13 @@ var ( func init() { pctx.SourcePathVariable("RustDefaultBase", RustDefaultBase) pctx.VariableConfigMethod("HostPrebuiltTag", HostPrebuiltTag) pctx.VariableConfigMethod("HostPrebuiltTag", func(config android.Config) string { if config.UseHostMusl() { return "linux-musl-x86" } else { return config.PrebuiltOS() } }) pctx.VariableFunc("RustBase", func(ctx android.PackageVarContext) string { if override := ctx.Config().Getenv("RUST_PREBUILTS_BASE"); override != "" { Loading @@ -103,14 +109,6 @@ func init() { exportedVars.ExportStringStaticVariable("RUST_DEFAULT_VERSION", RustDefaultVersion) } func HostPrebuiltTag(config android.Config) string { if config.UseHostMusl() { return "linux-musl-x86" } else { return config.PrebuiltOS() } } func getRustVersionPctx(ctx android.PackageVarContext) string { return GetRustVersion(ctx) } Loading
rust/toolchain_library.go +1 −50 Original line number Diff line number Diff line Loading @@ -18,12 +18,9 @@ package rust import ( "path" "path/filepath" "android/soong/android" "android/soong/rust/config" "github.com/google/blueprint/proptools" ) // This module is used to compile the rust toolchain libraries Loading @@ -36,8 +33,6 @@ func init() { rustToolchainLibraryRlibFactory) android.RegisterModuleType("rust_toolchain_library_dylib", rustToolchainLibraryDylibFactory) android.RegisterModuleType("rust_toolchain_rustc_prebuilt", rustToolchainRustcPrebuiltFactory) } type toolchainLibraryProperties struct { Loading Loading @@ -87,7 +82,7 @@ func initToolchainLibrary(module *Module, library *libraryDecorator) android.Mod func rustSetToolchainSource(ctx android.LoadHookContext) { if toolchainLib, ok := ctx.Module().(*Module).compiler.(*toolchainLibraryDecorator); ok { prefix := filepath.Join(config.HostPrebuiltTag(ctx.Config()), GetRustPrebuiltVersion(ctx)) prefix := "linux-x86/" + GetRustPrebuiltVersion(ctx) newSrcs := []string{path.Join(prefix, android.String(toolchainLib.Properties.Toolchain_src))} type props struct { Loading @@ -106,47 +101,3 @@ func rustSetToolchainSource(ctx android.LoadHookContext) { func GetRustPrebuiltVersion(ctx android.LoadHookContext) string { return ctx.AConfig().GetenvWithDefault("RUST_PREBUILTS_VERSION", config.RustDefaultVersion) } type toolchainRustcPrebuiltProperties struct { // path to rustc prebuilt, relative to the top of the toolchain source Toolchain_prebuilt_src *string // path to deps, relative to the top of the toolchain source Toolchain_deps []string // path to deps, relative to module directory Deps []string } func rustToolchainRustcPrebuiltFactory() android.Module { module := android.NewPrebuiltBuildTool() module.AddProperties(&toolchainRustcPrebuiltProperties{}) android.AddLoadHook(module, func(ctx android.LoadHookContext) { var toolchainProps *toolchainRustcPrebuiltProperties for _, p := range ctx.Module().GetProperties() { toolchainProperties, ok := p.(*toolchainRustcPrebuiltProperties) if ok { toolchainProps = toolchainProperties } } if toolchainProps.Toolchain_prebuilt_src == nil { ctx.PropertyErrorf("toolchain_prebuilt_src", "must set path to rustc prebuilt") } prefix := filepath.Join(config.HostPrebuiltTag(ctx.Config()), GetRustPrebuiltVersion(ctx)) deps := make([]string, 0, len(toolchainProps.Toolchain_deps)+len(toolchainProps.Deps)) for _, d := range toolchainProps.Toolchain_deps { deps = append(deps, path.Join(prefix, d)) } deps = append(deps, toolchainProps.Deps...) props := struct { Src *string Deps []string }{ Src: proptools.StringPtr(path.Join(prefix, *toolchainProps.Toolchain_prebuilt_src)), Deps: deps, } ctx.AppendProperties(&props) }) return module }