Only enable rust_toolchain_filegroup targets on Linux hosts
The Rust toolchain prebuilts only include stdlib sources on Linux hosts.
Test: m nothing
Bug: 384401387
Change-Id: I81cd2dfe6dcd0420572fbb6c520a4ffc199b2965
diff --git a/soong/toolchain_filegroup.go b/soong/toolchain_filegroup.go
index ef4630f..bcfcc1d 100644
--- a/soong/toolchain_filegroup.go
+++ b/soong/toolchain_filegroup.go
@@ -18,10 +18,13 @@
import (
"path"
+ "runtime"
"android/soong/android"
"android/soong/rust"
"android/soong/rust/config"
+
+ "github.com/google/blueprint/proptools"
)
// This module contains logic for defining file groups inside of a Rust
@@ -51,10 +54,17 @@
func rustSetToolchainFileGroupSource(ctx android.LoadHookContext, inProps *toolchainFilegroupProps) {
type props struct {
- Srcs []string
+ Srcs []string
+ Enabled *bool
}
p := &props{}
+ if runtime.GOOS == "linux" {
+ p.Enabled = proptools.BoolPtr(true)
+ } else {
+ p.Enabled = proptools.BoolPtr(false)
+ }
+
prebuiltsDir := path.Join(config.HostPrebuiltTag(ctx.Config()), rust.GetRustPrebuiltVersion(ctx))
for _, src := range inProps.Toolchain_srcs {
p.Srcs = append(p.Srcs, path.Join(prebuiltsDir, src))