Merge "rust: set ANDROID_RUST_VERSION based on prebuilts"
This commit is contained in:
@@ -274,7 +274,7 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
|
|||||||
implicits = append(implicits, outputs.Paths()...)
|
implicits = append(implicits, outputs.Paths()...)
|
||||||
}
|
}
|
||||||
|
|
||||||
envVars = append(envVars, "ANDROID_RUST_VERSION="+config.RustDefaultVersion)
|
envVars = append(envVars, "ANDROID_RUST_VERSION="+config.GetRustVersion(ctx))
|
||||||
|
|
||||||
if ctx.RustModule().compiler.CargoEnvCompat() {
|
if ctx.RustModule().compiler.CargoEnvCompat() {
|
||||||
if _, ok := ctx.RustModule().compiler.(*binaryDecorator); ok {
|
if _, ok := ctx.RustModule().compiler.(*binaryDecorator); ok {
|
||||||
|
@@ -86,12 +86,7 @@ func init() {
|
|||||||
return "${RustDefaultBase}"
|
return "${RustDefaultBase}"
|
||||||
})
|
})
|
||||||
|
|
||||||
pctx.VariableFunc("RustVersion", func(ctx android.PackageVarContext) string {
|
pctx.VariableFunc("RustVersion", getRustVersionPctx)
|
||||||
if override := ctx.Config().Getenv("RUST_PREBUILTS_VERSION"); override != "" {
|
|
||||||
return override
|
|
||||||
}
|
|
||||||
return RustDefaultVersion
|
|
||||||
})
|
|
||||||
|
|
||||||
pctx.StaticVariable("RustPath", "${RustBase}/${HostPrebuiltTag}/${RustVersion}")
|
pctx.StaticVariable("RustPath", "${RustBase}/${HostPrebuiltTag}/${RustVersion}")
|
||||||
pctx.StaticVariable("RustBin", "${RustPath}/bin")
|
pctx.StaticVariable("RustBin", "${RustPath}/bin")
|
||||||
@@ -103,3 +98,14 @@ func init() {
|
|||||||
pctx.StaticVariable("DeviceGlobalLinkFlags", strings.Join(deviceGlobalLinkFlags, " "))
|
pctx.StaticVariable("DeviceGlobalLinkFlags", strings.Join(deviceGlobalLinkFlags, " "))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getRustVersionPctx(ctx android.PackageVarContext) string {
|
||||||
|
return GetRustVersion(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetRustVersion(ctx android.PathContext) string {
|
||||||
|
if override := ctx.Config().Getenv("RUST_PREBUILTS_VERSION"); override != "" {
|
||||||
|
return override
|
||||||
|
}
|
||||||
|
return RustDefaultVersion
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user