From 57ee7bf77e0c2e4c281f25dfae13e13b2e56300a Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Fri, 1 Sep 2023 13:47:48 +0100 Subject: [PATCH] Fix absolute path for -f and update readme --- README.md | 11 ++++++++--- config.go | 8 ++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 64cb171..157e006 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,9 @@ Lua. If you are familiar with Make, you can learn Knit very quickly. Knit tracks more of your build to give you better incremental builds. For example, Knit automatically adds an implicit dependency on a rule's recipe, so if you change a recipe (either directly or through a variable change), Knit -will automatically re-run all rules that were affected. +will automatically re-run all rules that were affected. Knit will also skip +build steps dynamically if it can determine that they will be unchanged from +the previous run (even if earlier dependencies were changed). Knit has support for namespaced sub-builds that execute relative to their directory, but Knit avoids build fragmentation because sub-builds don't rely on @@ -32,8 +34,11 @@ will be useful to you too. Everyone hates something about their build system so if you have feedback or a request, let me know! The project is new enough that your feedback may be seriously taken into account. -I have written an article with more details about Knit -[here](https://zyedidia.github.io/blog/posts/3-knit-better-make/). +**Articles**: I have written two articles with more details about Knit +[here](https://zyedidia.github.io/blog/posts/3-knit-better-make/) and +[here](https://zyedidia.github.io/blog/posts/4-incremental-d-knit/) (this +article is specifically about D, but the optimization Knit applies is general +and not tied to D specifically). # Features diff --git a/config.go b/config.go index b0ee0f9..1da210c 100644 --- a/config.go +++ b/config.go @@ -46,6 +46,14 @@ func DefaultBuildFile() (string, bool) { } func FindBuildFile(name string) (string, string, error) { + if filepath.IsAbs(name) { + if existsFile(name) { + return name, filepath.Dir(name), nil + } else { + return "", "", errors.New("does not exist") + } + } + wd, err := os.Getwd() if err != nil { return "", "", err