ninja-build / ninja

a small build system with a focus on speed
https://ninja-build.org/
Apache License 2.0
11.17k stars 1.59k forks source link

Full vs. relative paths and ninja #2283

Open alecazam opened 1 year ago

alecazam commented 1 year ago

Seems like there should be someway to correlate cononcial relative paths for readability with full paths for the actual build. Xcode for example, doesn't support clickthrough to issues unless a full path is written out for errors/warnings.

Could it be possible to tie modstamp comparisons and progress logs to the shorter path, but request the full path with something like the following? If the calling script has already done a pushd to the directory, then the shorter paths are much simpler to read, but I need the full path for output of warnings/errors.

Here's what I have now which is pretty ugly syntax

rule genMSL
    command = $hlslparser $flagsParser -i $in -o $out

build ${dstDir}Skinning.metal: genMSL ${srcDir}Skinning.hlsl | ${dependsMSL}

vs. what I want

rule genMSL
    command = $hlslparser $flagsParser -i fullpath($in) -o fullpath($out)

build Skinning.metal : genMSL ../src/Skinning.hlsl |  ${dependsMSL}
jhasse commented 1 year ago

Xcode for example, doesn't support clickthrough to issues unless a full path is written out for errors/warnings.

That's a bug then. And NOTOURBUG ;)

[...] but I need the full path for output of warnings/errors.

What's stopping your tool from outputting full paths? Ninja doesn't parse the output so it won't care.

alecazam commented 1 year ago

There's no build tool. I just write the ninja files like a makefile. Seems like Ninja has to track a canonical file internally, but if that is not an absolute path, then maybe ninja cannot provide it. Just seems like the ultra-minimal functionality, just forces use of gn or cmake instead of actually making ninja a writeable build system. It also hurts output readability if those systems have to pass an absolute path to ninja for build ops.

jhasse commented 1 year ago

With "build tool" I meant the $hlslparser. Why do you need to pass $in and $out as absolute paths?

alecazam commented 1 year ago

Because it’s a parser and compiler and transpiler of shader code. When there is a warning/error, the parser prints the error in a format that any editor can clickthrough to. But Xcode specificay needs abs paths. I can go to Make, but wanted to use ninja.

jhasse commented 1 year ago

It should print the warning/error as an absolute path.