sifive / wake

The SiFive wake build tool
Other
86 stars 28 forks source link

Allow relative-to-current-directory DB queries #1662

Open ag-eitilt opened 2 weeks ago

ag-eitilt commented 2 weeks ago

Currently, wake -o queries the file relative to the workspace root, even if the current directory is elsewhere:

.../path/in/workspace$ ls
output.ext
.../path/in/workspace$ wake -o output.ext
No jobs matched query
.../path/in/workspace$ wake -o path/in/workspace/output.ext
# write: path/in/workspace/output.ext (502480) [inspect.visibility=hidden,]
$ <write> -m 0644 path/in/workspace/output.ext

The more natural UX would be to prepend the path from the workspace root to the current directory to -o and -i arguments, so that the first form would work; however doing so would break the second form. I personally think that's an acceptable tradeoff, but I'm certainly willing to be convinced otherwise.

ag-eitilt commented 1 week ago

Potential difficulties with this are how it would still work with globs, as well as where the database has been copied elsewhere.

Very difficult to track both the workspace root and the current directory, and resolve contradictions between those. Paths will still be relative to the wakeroot, but how would you know what to munge?

colinschmidt commented 1 week ago

One of a family of scenarios that seems particularly tricky:

/src$ wake <invocation that writes to build/ouput.txt>
/src$ cp wake.db /tmp
/src$ cd /tmp
/src$ touch .wakeroot
/tmp$ mkdir foo
/tmp$ cd foo
/tmp/foo$ wake -o output.txt