diff options
author | 2021-12-03 17:17:28 -0800 | |
---|---|---|
committer | 2021-12-06 15:02:20 -0800 | |
commit | d9781fd67ed16bd4723dd7898340f0c096d03070 (patch) | |
tree | 6c806628da8dcb12ea4d2013a75ad39d8a60b3cf /rust/builder.go | |
parent | 23d5d986fefe0142963009cbed3284f941a8c923 (diff) |
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
Diffstat (limited to 'rust/builder.go')
-rw-r--r-- | rust/builder.go | 7 |
1 files changed, 7 insertions, 0 deletions
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...) |