Revert "Make building Rust targets faster in eng builds"
This reverts commit 6146cf4b98
.
Reason for revert: <b/325547632>
Change-Id: Ifd3619c5db5b989edb4aa2c37f85e5cd88d0c633
This commit is contained in:
committed by
Gerrit Code Review
parent
6146cf4b98
commit
fad3e69d7f
@@ -122,6 +122,8 @@ func init() {
|
||||
|
||||
func TransformSrcToBinary(ctx ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags,
|
||||
outputFile android.WritablePath) buildOutput {
|
||||
flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin")
|
||||
|
||||
return transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "bin")
|
||||
}
|
||||
|
||||
@@ -132,16 +134,20 @@ func TransformSrctoRlib(ctx ModuleContext, mainSrc android.Path, deps PathDeps,
|
||||
|
||||
func TransformSrctoDylib(ctx ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags,
|
||||
outputFile android.WritablePath) buildOutput {
|
||||
flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin")
|
||||
|
||||
return transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "dylib")
|
||||
}
|
||||
|
||||
func TransformSrctoStatic(ctx ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags,
|
||||
outputFile android.WritablePath) buildOutput {
|
||||
flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin")
|
||||
return transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "staticlib")
|
||||
}
|
||||
|
||||
func TransformSrctoShared(ctx ModuleContext, mainSrc android.Path, deps PathDeps, flags Flags,
|
||||
outputFile android.WritablePath) buildOutput {
|
||||
flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin")
|
||||
return transformSrctoCrate(ctx, mainSrc, deps, flags, outputFile, "cdylib")
|
||||
}
|
||||
|
||||
@@ -257,21 +263,6 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
|
||||
|
||||
inputs = append(inputs, main)
|
||||
|
||||
if ctx.Config().Eng() {
|
||||
// Per https://doc.rust-lang.org/rustc/codegen-options/index.html#codegen-units
|
||||
// incremental building implies codegen-units=256
|
||||
incrementalPath := android.PathForModuleOut(ctx, "rustc-incremental").String()
|
||||
flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C incremental="+incrementalPath)
|
||||
|
||||
} else {
|
||||
flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C codegen-units=1")
|
||||
|
||||
if !(ctx.RustModule().Rlib() || ctx.RustModule().ProcMacro()) {
|
||||
flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-Z dylib-lto")
|
||||
flags.GlobalRustFlags = append(flags.GlobalRustFlags, "-C lto=thin")
|
||||
}
|
||||
}
|
||||
|
||||
// Collect rustc flags
|
||||
rustcFlags = append(rustcFlags, flags.GlobalRustFlags...)
|
||||
rustcFlags = append(rustcFlags, flags.RustFlags...)
|
||||
@@ -287,6 +278,15 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
|
||||
// Suppress an implicit sysroot
|
||||
rustcFlags = append(rustcFlags, "--sysroot=/dev/null")
|
||||
|
||||
// Enable incremental compilation if requested by user
|
||||
if ctx.Config().IsEnvTrue("SOONG_RUSTC_INCREMENTAL") {
|
||||
incrementalPath := android.PathForOutput(ctx, "rustc").String()
|
||||
|
||||
rustcFlags = append(rustcFlags, "-C incremental="+incrementalPath)
|
||||
} else {
|
||||
rustcFlags = append(rustcFlags, "-C codegen-units=1")
|
||||
}
|
||||
|
||||
// Disallow experimental features
|
||||
modulePath := ctx.ModuleDir()
|
||||
if !(android.IsThirdPartyPath(modulePath) || strings.HasPrefix(modulePath, "prebuilts")) {
|
||||
|
Reference in New Issue
Block a user