diff options
author | 2023-09-08 16:10:47 +0000 | |
---|---|---|
committer | 2023-09-08 16:10:47 +0000 | |
commit | 400749d1f02c1751dbcaee540a17da945a513f62 (patch) | |
tree | 3a9b41328ac2c91100475bd71542f12bb176e64c | |
parent | 5162ff14fc91db500e008a18840c3dfd4edc695a (diff) |
Revert "add rust_toolchain_rustc_prebuilt module type"
Revert submission 2605644-rulebuilder-ninja-vars
Reason for revert: b/299568218
Reverted changes: /q/submissionid:2605644-rulebuilder-ninja-vars
Change-Id: Ic3d1ba7e8a61427b52f31cc3f187c9d5a7d9a7bb
-rw-r--r-- | android/prebuilt_build_tool.go | 6 | ||||
-rw-r--r-- | cc/testing.go | 1 | ||||
-rw-r--r-- | rust/toolchain_library.go | 48 |
3 files changed, 5 insertions, 50 deletions
diff --git a/android/prebuilt_build_tool.go b/android/prebuilt_build_tool.go index 17b323067..aeae20f48 100644 --- a/android/prebuilt_build_tool.go +++ b/android/prebuilt_build_tool.go @@ -17,7 +17,7 @@ package android import "path/filepath" func init() { - RegisterModuleType("prebuilt_build_tool", NewPrebuiltBuildTool) + RegisterModuleType("prebuilt_build_tool", prebuiltBuildToolFactory) } type prebuiltBuildToolProperties struct { @@ -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) diff --git a/cc/testing.go b/cc/testing.go index dbdee9edf..d1632aaa6 100644 --- a/cc/testing.go +++ b/cc/testing.go @@ -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) diff --git a/rust/toolchain_library.go b/rust/toolchain_library.go index 801c0c271..326d52924 100644 --- a/rust/toolchain_library.go +++ b/rust/toolchain_library.go @@ -21,8 +21,6 @@ import ( "android/soong/android" "android/soong/rust/config" - - "github.com/google/blueprint/proptools" ) // This module is used to compile the rust toolchain libraries @@ -35,8 +33,6 @@ func init() { rustToolchainLibraryRlibFactory) android.RegisterModuleType("rust_toolchain_library_dylib", rustToolchainLibraryDylibFactory) - android.RegisterModuleType("rust_toolchain_rustc_prebuilt", - rustToolchainRustcPrebuiltFactory) } type toolchainLibraryProperties struct { @@ -105,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 := "linux-x86/" + 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 -} |