diff options
author | 2023-09-11 17:18:08 +0000 | |
---|---|---|
committer | 2023-09-15 22:41:51 +0000 | |
commit | 60375c4adf0753d0e2519ebf1b908d424dd2d466 (patch) | |
tree | 19248d68042f49ec31d93a5460a634594fe8f258 /rust/toolchain_library.go | |
parent | 9333ac12499f1c56cb74618699c5bce3799c1f19 (diff) |
Revert^2 "add crate_root property to rust modules"
5162ff14fc91db500e008a18840c3dfd4edc695a
Change-Id: I9a76df938639676ee4aa7bdd2b2902e0e6df08d5
Diffstat (limited to 'rust/toolchain_library.go')
-rw-r--r-- | rust/toolchain_library.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/rust/toolchain_library.go b/rust/toolchain_library.go index 2b2f88520..cb345a4b6 100644 --- a/rust/toolchain_library.go +++ b/rust/toolchain_library.go @@ -41,8 +41,10 @@ func init() { } type toolchainLibraryProperties struct { - // path to the toolchain source, relative to the top of the toolchain source - Toolchain_src *string `android:"arch_variant"` + // path to the toolchain crate root, relative to the top of the toolchain source + Toolchain_crate_root *string `android:"arch_variant"` + // path to the rest of the toolchain srcs, relative to the top of the toolchain source + Toolchain_srcs []string `android:"arch_variant"` } type toolchainLibraryDecorator struct { @@ -88,15 +90,20 @@ 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)) - newSrcs := []string{path.Join(prefix, android.String(toolchainLib.Properties.Toolchain_src))} + versionedCrateRoot := path.Join(prefix, android.String(toolchainLib.Properties.Toolchain_crate_root)) + versionedSrcs := make([]string, len(toolchainLib.Properties.Toolchain_srcs)) + for i, src := range toolchainLib.Properties.Toolchain_srcs { + versionedSrcs[i] = path.Join(prefix, src) + } type props struct { - Srcs []string + Crate_root *string + Srcs []string } p := &props{} - p.Srcs = newSrcs + p.Crate_root = &versionedCrateRoot + p.Srcs = versionedSrcs ctx.AppendProperties(p) - } else { ctx.ModuleErrorf("Called rustSetToolchainSource on a non-Rust Module.") } |