From d9781fd67ed16bd4723dd7898340f0c096d03070 Mon Sep 17 00:00:00 2001 From: Chris Wailes Date: Fri, 3 Dec 2021 17:17:28 -0800 Subject: Allow users to enable local incremental Rust builds This CL allows users to set the SOONG_RUSTC_INCREMENTAL environment variable to enable incremental Rust builds. The out/soong/rustc directory is used for intermediate artifacts. Test: m rust Change-Id: Ica2587c30596325b7d3e82d8e3c1d610b92718b8 --- rust/builder.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'rust/builder.go') diff --git a/rust/builder.go b/rust/builder.go index 60b5926e8..a7efc282a 100644 --- a/rust/builder.go +++ b/rust/builder.go @@ -216,6 +216,13 @@ 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) + } + // Collect linker flags linkFlags = append(linkFlags, flags.GlobalLinkFlags...) linkFlags = append(linkFlags, flags.LinkFlags...) -- cgit v1.2.3-59-g8ed1b