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

$in, $out, $in_newline don't work in variables set on build edges (only on rules) #687

Open
nico opened this issue Nov 17, 2013 · 0 comments

Comments

@nico
Copy link
Collaborator

nico commented Nov 17, 2013

This is because $in & co are evaluated by an EdgeEnv, and when ParseEdge evaluates the bindings for a build edge, it doesn't build an EdgeEnv.

My use case is something like this, where commands are always set on build edges, never intentionally on a rule:

rule do
  command = exit 1
build array_type_info.o: do array_type_info.cc
  description = armeabi C++: src/array_type_info.cc
  command = clang++ -c -o array_type_info.o array_type_info.cc
# Many more build lines like this

This is for a system that currently generates makefiles, and where it's hard to know rules in advance, so not really using rules makes things easier. I'd like to say $in and $out in the command of the build, so that input and output aren't repeated. (In practice, listing them twice seems to work well, even if the outputs are very long lists like they are for link lines. But it'd be nice if this worked for self-consistency too.)

nico added a commit to nico/ninja that referenced this issue May 21, 2014
* $in only makes sense on rules, not edges (see issue ninja-build#687)
* Remove unneccesary clear() line at end of test
nico added a commit to nico/ninja that referenced this issue May 21, 2014
…le too.

Fixes ninja-build#730.  This has always been broken, but due to ninja-build#690 more paths are now
escaped (e.g. paths containing + characters, like file.c++).  Also see
discussion in ninja-build#689.

The approach is to give EdgeEnv an enum deciding on whether or not to escape
file names, and provide functions that evaluate depfile and rspfile with that
set that to kNoEscape.  (depfile=$out.d doesn't make sense on edges with
multiple outputs.)

This should be relatively safe, as $in and $out can't be used on edges, only
on rules (ninja-build#687).
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

1 participant