Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.ninja not reloaded if generated with an absolute path #1240

Open
Maratyszcza opened this issue Feb 14, 2017 · 5 comments
Open

build.ninja not reloaded if generated with an absolute path #1240

Maratyszcza opened this issue Feb 14, 2017 · 5 comments

Comments

@Maratyszcza
Copy link

According to the manual, If the top-level Ninja file is specified as an output of any build statement and it is out of date, Ninja will rebuild and reload it before building the targets requested by the user.

I have a build.ninja file where all paths are absolute. I have a rule that re-runs generator if configuration script changed, i.e.

/home/user/project/build.ninja: regenerate /home/user/project/configure.py

All build targets have depend on /home/user/project/build.ninja as an order-only dependency.

If I run Ninja without arguments after a change in configure.py, it runs the generator to re-generate build.ninja, but doesn't reload the file, and uses old, no longer valid rules to build the project. However, if I run it as ninja -f /home/user/project/build.ninja, it would re-run the generator, reload build.ninja and rebuild the changed rule. Looks like a path normalization bug.

@jonesmz

This comment was marked as abuse.

@Maratyszcza
Copy link
Author

I don't know, don't use Ninja lately

@jonesmz

This comment was marked as abuse.

@justinian
Copy link

Hi @jonesmz, this is still reproducible with Ninja 1.10.0.git built just now from git:

justin@rhea ~/t/ninja> cat build.txt
rule message
  command = echo "messaging"; cp $in $out

rule regen
  command = echo "regenerating"; cp $in $out
  generator = 1

build /home/justin/tmp/ninja/other.txt: message /home/justin/tmp/ninja/other.in
build /home/justin/tmp/ninja/build.ninja: regen /home/justin/tmp/ninja/build.txt

justin@rhea ~/t/ninja> cp build.txt build.ninja
justin@rhea ~/t/ninja> echo "some text" > other.in
justin@rhea ~/t/ninja> ~/src/external/ninja/ninja -j1 -v
[1/1] echo "messaging"; cp /home/justin/tmp/ninja/other.in /home/justin/tmp/ninja/other.txt
messaging
justin@rhea ~/t/ninja> touch build.txt other.in
justin@rhea ~/t/ninja> ~/src/external/ninja/ninja -j1 -v
[1/2] echo "messaging"; cp /home/justin/tmp/ninja/other.in /home/justin/tmp/ninja/other.txt
messaging
[2/2] echo "regenerating"; cp /home/justin/tmp/ninja/build.txt /home/justin/tmp/ninja/build.ninja
regenerating
justin@rhea ~/t/ninja> # edit build.txt and build.ninja to use just 'build.ninja' as the rule output
justin@rhea ~/t/ninja> touch build.txt other.in                                                                                                                                                                                                                 justin@rhea ~/t/ninja> ~/src/external/ninja/ninja -j1 -v                                                                                                                                                                                                        [1/1] echo "regenerating"; cp /home/justin/tmp/ninja/build.txt build.ninja
regenerating
[1/1] echo "messaging"; cp /home/justin/tmp/ninja/other.in /home/justin/tmp/ninja/other.txt
messaging
justin@rhea ~/t/ninja> ~/src/external/ninja/ninja --version
1.10.0.git

@actboy168
Copy link

actboy168 commented Aug 30, 2021

I encountered the same problem. If the build statement uses a relative path, but uses ninja -f [absolute path], it will not be able to reload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants