Revert^3 "add rust_toolchain_rustc_prebuilt module type"
9333ac12499f1c56cb74618699c5bce3799c1f19
Change-Id: Ic7f064806553a0cfbc286136a764b5ea3898d06c
diff --git a/rust/toolchain_library.go b/rust/toolchain_library.go
index 2b2f885..326d529 100644
--- a/rust/toolchain_library.go
+++ b/rust/toolchain_library.go
@@ -18,12 +18,9 @@
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
@@ -36,8 +33,6 @@
rustToolchainLibraryRlibFactory)
android.RegisterModuleType("rust_toolchain_library_dylib",
rustToolchainLibraryDylibFactory)
- android.RegisterModuleType("rust_toolchain_rustc_prebuilt",
- rustToolchainRustcPrebuiltFactory)
}
type toolchainLibraryProperties struct {
@@ -87,7 +82,7 @@
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 {
@@ -106,47 +101,3 @@
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
-}