Revert "remove rust deps on clang prebuilts" am: 05cbcb3539
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2760227 Change-Id: I942dfaa79421482d14b48cb464e437dc826bc505 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
|||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
cc_config "android/soong/cc/config"
|
|
||||||
"android/soong/rust/config"
|
"android/soong/rust/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -205,9 +204,7 @@ func rustEnvVars(ctx ModuleContext, deps PathDeps, cmd *android.RuleBuilderComma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
envVars = append(envVars, "AR="+cmd.PathForInput(
|
envVars = append(envVars, "AR="+cmd.PathForTool(deps.Llvm_ar))
|
||||||
cc_config.ClangPath(ctx, "bin/llvm-ar")),
|
|
||||||
)
|
|
||||||
|
|
||||||
if ctx.Darwin() {
|
if ctx.Darwin() {
|
||||||
envVars = append(envVars, "ANDROID_RUST_DARWIN=true")
|
envVars = append(envVars, "ANDROID_RUST_DARWIN=true")
|
||||||
@@ -295,6 +292,11 @@ func transformSrctoCrate(ctx ModuleContext, comp compiler, main android.Path, de
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flags.Clippy {
|
if flags.Clippy {
|
||||||
|
// TODO(b/298461712) remove this hack to let slim manifest branches build
|
||||||
|
if deps.Clippy_driver == nil {
|
||||||
|
deps.Clippy_driver = config.RustPath(ctx, "bin/clippy-driver")
|
||||||
|
}
|
||||||
|
|
||||||
clippyRule := getRuleBuilder(ctx, pctx, false, "clippy")
|
clippyRule := getRuleBuilder(ctx, pctx, false, "clippy")
|
||||||
clippyCmd := clippyRule.Command()
|
clippyCmd := clippyRule.Command()
|
||||||
clippyFile := android.PathForModuleOut(ctx, outputFile.Base()+".clippy")
|
clippyFile := android.PathForModuleOut(ctx, outputFile.Base()+".clippy")
|
||||||
@@ -303,7 +305,7 @@ func transformSrctoCrate(ctx ModuleContext, comp compiler, main android.Path, de
|
|||||||
|
|
||||||
clippyCmd.
|
clippyCmd.
|
||||||
Flags(rustEnvVars(ctx, deps, clippyCmd)).
|
Flags(rustEnvVars(ctx, deps, clippyCmd)).
|
||||||
Tool(config.RustPath(ctx, "bin/clippy-driver")).
|
Tool(deps.Clippy_driver).
|
||||||
Flag("--emit metadata").
|
Flag("--emit metadata").
|
||||||
FlagWithOutput("-o ", clippyFile).
|
FlagWithOutput("-o ", clippyFile).
|
||||||
FlagWithOutput("--emit dep-info=", clippyDepInfoFile).
|
FlagWithOutput("--emit dep-info=", clippyDepInfoFile).
|
||||||
@@ -363,18 +365,14 @@ func transformSrctoCrate(ctx ModuleContext, comp compiler, main android.Path, de
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clangTools := android.Paths{
|
// TODO(b/298461712) remove this hack to let slim manifest branches build
|
||||||
cc_config.ClangPath(ctx, "bin/llvm-ar"),
|
if deps.Rustc == nil {
|
||||||
}
|
deps.Rustc = config.RustPath(ctx, "bin/rustc")
|
||||||
if ctx.Config().BuildOS != android.Darwin {
|
|
||||||
clangTools = append(clangTools,
|
|
||||||
cc_config.ClangPath(ctx, "lib/libc++.so"),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustcCmd.
|
rustcCmd.
|
||||||
Flags(rustEnvVars(ctx, deps, rustcCmd)).
|
Flags(rustEnvVars(ctx, deps, rustcCmd)).
|
||||||
Tool(config.RustPath(ctx, "bin/rustc")).
|
Tool(deps.Rustc).
|
||||||
FlagWithInput("-C linker=", android.PathForSource(ctx, "build", "soong", "scripts", "mkcratersp.py")).
|
FlagWithInput("-C linker=", android.PathForSource(ctx, "build", "soong", "scripts", "mkcratersp.py")).
|
||||||
Flag("--emit link").
|
Flag("--emit link").
|
||||||
Flag("-o").
|
Flag("-o").
|
||||||
@@ -382,7 +380,6 @@ func transformSrctoCrate(ctx ModuleContext, comp compiler, main android.Path, de
|
|||||||
FlagWithOutput("--emit dep-info=", depInfoFile).
|
FlagWithOutput("--emit dep-info=", depInfoFile).
|
||||||
Inputs(inputs).
|
Inputs(inputs).
|
||||||
Flags(libFlags).
|
Flags(libFlags).
|
||||||
Implicits(clangTools).
|
|
||||||
ImplicitTools(toolImplicits).
|
ImplicitTools(toolImplicits).
|
||||||
Implicits(implicits).
|
Implicits(implicits).
|
||||||
Flags(rustcFlags).
|
Flags(rustcFlags).
|
||||||
@@ -409,20 +406,9 @@ func transformSrctoCrate(ctx ModuleContext, comp compiler, main android.Path, de
|
|||||||
// those need to be renamed/symlinked to something in the rustLink sandbox
|
// those need to be renamed/symlinked to something in the rustLink sandbox
|
||||||
// if we want to separate the rules
|
// if we want to separate the rules
|
||||||
linkerSboxOutputFile := android.PathForModuleOut(ctx, sboxDirectory, outputFile.Base())
|
linkerSboxOutputFile := android.PathForModuleOut(ctx, sboxDirectory, outputFile.Base())
|
||||||
clangTools := android.Paths{
|
|
||||||
cc_config.ClangPath(ctx, "bin/clang++"),
|
|
||||||
cc_config.ClangPath(ctx, "bin/lld"),
|
|
||||||
cc_config.ClangPath(ctx, "bin/ld.lld"),
|
|
||||||
}
|
|
||||||
if ctx.Config().BuildOS != android.Darwin {
|
|
||||||
clangTools = append(clangTools,
|
|
||||||
cc_config.ClangPath(ctx, "bin/clang++.real"),
|
|
||||||
cc_config.ClangPath(ctx, "lib/libc++.so"),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
rustLinkCmd := rustcRule.Command()
|
rustLinkCmd := rustcRule.Command()
|
||||||
rustLinkCmd.
|
rustLinkCmd.
|
||||||
Tool(cc_config.ClangPath(ctx, "bin/clang++")).
|
Tool(deps.Clang).
|
||||||
Flag("-o").
|
Flag("-o").
|
||||||
Output(linkerSboxOutputFile).
|
Output(linkerSboxOutputFile).
|
||||||
Inputs(deps.CrtBegin).
|
Inputs(deps.CrtBegin).
|
||||||
@@ -430,7 +416,6 @@ func transformSrctoCrate(ctx ModuleContext, comp compiler, main android.Path, de
|
|||||||
FlagWithInput("@", rustSboxOutputFile).
|
FlagWithInput("@", rustSboxOutputFile).
|
||||||
Flags(linkFlags).
|
Flags(linkFlags).
|
||||||
Inputs(deps.CrtEnd).
|
Inputs(deps.CrtEnd).
|
||||||
ImplicitTools(clangTools).
|
|
||||||
ImplicitTools(toolImplicits).
|
ImplicitTools(toolImplicits).
|
||||||
Implicits(rustcImplicitOutputs.Paths()).
|
Implicits(rustcImplicitOutputs.Paths()).
|
||||||
Implicits(implicits).
|
Implicits(implicits).
|
||||||
@@ -456,7 +441,7 @@ func transformSrctoCrate(ctx ModuleContext, comp compiler, main android.Path, de
|
|||||||
Flag("KYTHE_CANONICALIZE_VNAME_PATHS=prefer-relative").
|
Flag("KYTHE_CANONICALIZE_VNAME_PATHS=prefer-relative").
|
||||||
Tool(ctx.Config().PrebuiltBuildTool(ctx, "rust_extractor")).
|
Tool(ctx.Config().PrebuiltBuildTool(ctx, "rust_extractor")).
|
||||||
Flags(rustEnvVars(ctx, deps, kytheCmd)).
|
Flags(rustEnvVars(ctx, deps, kytheCmd)).
|
||||||
Tool(config.RustPath(ctx, "bin/rustc")).
|
Tool(deps.Rustc).
|
||||||
Flag("-C linker=true").
|
Flag("-C linker=true").
|
||||||
Inputs(inputs).
|
Inputs(inputs).
|
||||||
Flags(makeLibFlags(deps, kytheCmd)).
|
Flags(makeLibFlags(deps, kytheCmd)).
|
||||||
@@ -470,6 +455,11 @@ func transformSrctoCrate(ctx ModuleContext, comp compiler, main android.Path, de
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Rustdoc(ctx ModuleContext, main android.Path, deps PathDeps, flags Flags) android.ModuleOutPath {
|
func Rustdoc(ctx ModuleContext, main android.Path, deps PathDeps, flags Flags) android.ModuleOutPath {
|
||||||
|
// TODO(b/298461712) remove this hack to let slim manifest branches build
|
||||||
|
if deps.Rustdoc == nil {
|
||||||
|
deps.Rustdoc = config.RustPath(ctx, "bin/rustdoc")
|
||||||
|
}
|
||||||
|
|
||||||
rustdocRule := getRuleBuilder(ctx, pctx, false, "rustdoc")
|
rustdocRule := getRuleBuilder(ctx, pctx, false, "rustdoc")
|
||||||
rustdocCmd := rustdocRule.Command()
|
rustdocCmd := rustdocRule.Command()
|
||||||
|
|
||||||
@@ -508,7 +498,7 @@ func Rustdoc(ctx ModuleContext, main android.Path, deps PathDeps, flags Flags) a
|
|||||||
|
|
||||||
rustdocCmd.
|
rustdocCmd.
|
||||||
Flags(rustEnvVars(ctx, deps, rustdocCmd)).
|
Flags(rustEnvVars(ctx, deps, rustdocCmd)).
|
||||||
Tool(config.RustPath(ctx, "bin/rustdoc")).
|
Tool(deps.Rustdoc).
|
||||||
Flags(rustdocFlags).
|
Flags(rustdocFlags).
|
||||||
Input(main).
|
Input(main).
|
||||||
Flag("-o "+docDir.String()).
|
Flag("-o "+docDir.String()).
|
||||||
|
@@ -147,6 +147,6 @@ func rustPath(ctx android.PathContext) android.SourcePath {
|
|||||||
if override := ctx.Config().Getenv("RUST_DEFAULT_VERSION"); override != "" {
|
if override := ctx.Config().Getenv("RUST_DEFAULT_VERSION"); override != "" {
|
||||||
rustVersion = override
|
rustVersion = override
|
||||||
}
|
}
|
||||||
return android.PathForSource(ctx, rustBase, HostPrebuiltTag(ctx.Config()), rustVersion)
|
return android.PathForSource(ctx, rustBase, ctx.Config().PrebuiltOS(), rustVersion)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
23
rust/rust.go
23
rust/rust.go
@@ -472,6 +472,13 @@ type PathDeps struct {
|
|||||||
// Paths to generated source files
|
// Paths to generated source files
|
||||||
SrcDeps android.Paths
|
SrcDeps android.Paths
|
||||||
srcProviderFiles android.Paths
|
srcProviderFiles android.Paths
|
||||||
|
|
||||||
|
// Paths to specific build tools
|
||||||
|
Rustc android.Path
|
||||||
|
Clang android.Path
|
||||||
|
Llvm_ar android.Path
|
||||||
|
Clippy_driver android.Path
|
||||||
|
Rustdoc android.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
type RustLibraries []RustLibrary
|
type RustLibraries []RustLibrary
|
||||||
@@ -1473,9 +1480,18 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
depPaths.BuildToolDeps = append(depPaths.BuildToolDeps, buildTool.Deps...)
|
depPaths.BuildToolDeps = append(depPaths.BuildToolDeps, buildTool.Deps...)
|
||||||
switch android.RemoveOptionalPrebuiltPrefix(dep.Name()) {
|
switch android.RemoveOptionalPrebuiltPrefix(dep.Name()) {
|
||||||
case "rustc":
|
case "rustc":
|
||||||
|
depPaths.Rustc = buildTool.Src
|
||||||
// rustc expects the standard cc toolchain libraries (libdl, libm, libc, etc.)
|
// rustc expects the standard cc toolchain libraries (libdl, libm, libc, etc.)
|
||||||
// not to be under the __SBOX_SANDBOX_DIR__/ directory
|
// not to be under the __SBOX_SANDBOX_DIR__/ directory
|
||||||
depPaths.BuildToolSrcDeps = append(depPaths.BuildToolSrcDeps, buildTool.Deps...)
|
depPaths.BuildToolSrcDeps = append(depPaths.BuildToolSrcDeps, buildTool.Deps...)
|
||||||
|
case "clang++":
|
||||||
|
depPaths.Clang = buildTool.Src
|
||||||
|
case "llvm-ar":
|
||||||
|
depPaths.Llvm_ar = buildTool.Src
|
||||||
|
case "clippy-driver":
|
||||||
|
depPaths.Clippy_driver = buildTool.Src
|
||||||
|
case "rustdoc":
|
||||||
|
depPaths.Rustdoc = buildTool.Src
|
||||||
}
|
}
|
||||||
case depTag == cc.CrtBeginDepTag:
|
case depTag == cc.CrtBeginDepTag:
|
||||||
depPaths.CrtBegin = append(depPaths.CrtBegin, android.OutputFileForModule(ctx, dep, ""))
|
depPaths.CrtBegin = append(depPaths.CrtBegin, android.OutputFileForModule(ctx, dep, ""))
|
||||||
@@ -1596,6 +1612,13 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.AddFarVariationDependencies([]blueprint.Variation{}, buildToolDepTag, "rustc")
|
ctx.AddFarVariationDependencies([]blueprint.Variation{}, buildToolDepTag, "rustc")
|
||||||
|
ctx.AddFarVariationDependencies([]blueprint.Variation{}, buildToolDepTag, "clippy-driver")
|
||||||
|
ctx.AddFarVariationDependencies([]blueprint.Variation{}, buildToolDepTag, "rustdoc")
|
||||||
|
ctx.AddFarVariationDependencies([]blueprint.Variation{}, buildToolDepTag, "clang++")
|
||||||
|
ctx.AddFarVariationDependencies([]blueprint.Variation{}, buildToolDepTag, "clang++.real")
|
||||||
|
ctx.AddFarVariationDependencies([]blueprint.Variation{}, buildToolDepTag, "lld")
|
||||||
|
ctx.AddFarVariationDependencies([]blueprint.Variation{}, buildToolDepTag, "ld.lld")
|
||||||
|
ctx.AddFarVariationDependencies([]blueprint.Variation{}, buildToolDepTag, "llvm-ar")
|
||||||
|
|
||||||
// rlibs
|
// rlibs
|
||||||
rlibDepVariations = append(rlibDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: rlibVariation})
|
rlibDepVariations = append(rlibDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: rlibVariation})
|
||||||
|
Reference in New Issue
Block a user