Ninja: Consider only custom commands deps as side-effects (#14972)

Since commit v2.8.12~248^2 (Ninja: Custom Command file depends don't
need to exist before building, 2013-06-07) all explicit dependencies
inside build folder were considered as possible build command
side-effects and phony rules were produced for them in case they don't
exist when starting to build. This is unnecessary since regular compile
inputs need to exist or cmake will fail.  Moreover the exception for
sources having GENERATED property that can be missing is already handled
by WriteAssumedSourceDependencies.

This fixes unwanted phony rules for all regular source files when doing
in-source build, causing Ninja not complain when such files gets missing,
i.e. during development. Also this reduces number of rules in ninja.build.

Now only custom command dependencies are considered as possible side-effects.
Ninja: Don't limit custom cmd side-effects to build folder (#14972)

Actually custom command can write wherever it wants to, such as temporary
folder or source folder, possibly violating rules that only build folder should
be affected. Therefore we should consider custom command dependency at any path
as possible side effect adding phony rule.

We avoid adding phony rules for regular source files (since the paraent
commit) so we no longer need the in-build-tree test to avoid them.
Ninja: Skip generating empty phony rules

Ninja generator ensures that all custom commands being target
dependencies are run before other source compilations. However in case
there are no such dependencies it currently generates empty phony rules
which clutter the build graph.

Teach the Ninja generator to produce such rules only when necessary.
Merge topic 'ninja-no-phony-sources' into next

93371ed5 Ninja: Skip generating empty phony rules
7243c951 Ninja: Don't limit custom cmd side-effects to build folder (#14972)
a33cf6d0 Ninja: Consider only custom commands deps as side-effects (#14972)