Add support for new 'symlink_outputs' reserved variable to AOSP Ninja statements.
This variable contains a space-separated list of paths representing
declared symlink outputs that an edge creates.
If `-o usessymlinkoutputs=yes`, Ninja will check that symlink outputs
are in this list, and file outputs are not in this list. Otherwise, it
prints a warning. Defaults to `usesymlinkoutputs=no`, which does not
affect existing Ninja files (unless symlink_outputs is already being
used, which isn't the case in AOSP).
`-w undeclaredsymlinkoutputs=err` turns that warning into error.
This is not necessary today because AOSP Ninja (not upstream Ninja)runs
`lstat` on all outputs, which would return the correct metadata
regardless if the output is a symlink or a file. However, tooling
integration with Ninja files require symlink outputs to be marked as
such, and aggregating them in the symlink_outputs variable is probably
the least invasive approach.
Test: (in build-tools) OUT_DIR=out build/soong/soong_ui.bash --make-mode --skip-make ninja ninja_test && out/soong/host/linux-x86/nativetest64/ninja_test/ninja_test
Test: (in AOSP) m NINJA_ARGS="-o usessymlinkoutputs=yes"
Test: (in AOSP) m NINJA_ARGS="-o usessymlinkoutputs=yes -w undeclaredsymlinkoutputs=err"
13 files changed