Create static archives in temporary file

Creating static archives is often a multi-command process due to
adding whole static libraires or hitting command line length limits.
If one of the intermediate commands fails, the output file may
already exist.  Unlike make, ninja has no option to delete output
files on failed builds, instead assuming all build commands will
produce their output file atomically
(https://github.com/ninja-build/ninja/issues/1135).

Change the static library rules to generate to a temporary file
that is then atomically moved into place as the output file.

Test: m -j checkbuild tests cts
Change-Id: I4faf269f0c8e313c738154870a5aa0b4774a72bc
1 file changed