lix/src/libexpr
Eelco Dolstra 08c53923db * A primitive operation `dependencyClosure' to do automatic dependency
determination (e.g., finding the header files dependencies of a C
  file) in Nix low-level builds automatically.

  For instance, in the function `compileC' in make/lib/default.nix, we
  find the header file dependencies of C file `main' as follows:

    localIncludes =
      dependencyClosure {
        scanner = file:
          import (findIncludes {
            inherit file;
          });
        startSet = [main];
      };

  The function works by "growing" the set of dependencies, starting
  with the set `startSet', and calling the function `scanner' for each
  file to get its dependencies (which should yield a list of strings
  representing relative paths).  For instance, when `scanner' is
  called on a file `foo.c' that includes the line

    #include "../bar/fnord.h"

  then `scanner' should yield ["../bar/fnord.h"].  This list of
  dependencies is absolutised relative to the including file and added
  to the set of dependencies.  The process continues until no more
  dependencies are found (hence its a closure).

  `dependencyClosure' yields a list that contains in alternation a
  dependency, and its relative path to the directory of the start
  file, e.g.,

    [ /bla/bla/foo.c
      "foo.c"
      /bla/bar/fnord.h
      "../bar/fnord.h"
    ]

  These relative paths are necessary for the builder that compiles
  foo.c to reconstruct the relative directory structure expected by
  foo.c.

  The advantage of `dependencyClosure' over the old approach (using
  the impure `__currentTime') is that it's completely pure, and more
  efficient because it only rescans for dependencies (i.e., by
  building the derivations yielded by `scanner') if sources have
  actually changed.  The old approach rescanned every time.
2005-08-14 12:38:47 +00:00
..
eval.cc * Added a list concatenation operator: 2005-07-25 15:05:34 +00:00
eval.hh * Added a list concatenation operator: 2005-07-25 15:05:34 +00:00
lexer.l * Added a list concatenation operator: 2005-07-25 15:05:34 +00:00
Makefile.am * Build dynamic libraries. 2005-07-22 14:52:45 +00:00
nix.sdf * Wat cleanups. 2005-07-16 23:19:20 +00:00
nixexpr-ast.def * Added a list concatenation operator: 2005-07-25 15:05:34 +00:00
nixexpr.cc * Prevent repeated wrapping of closed terms 2005-07-19 11:48:05 +00:00
nixexpr.hh * ATermMap needs an assignment operator, otherwise we are screwed. 2005-05-08 10:28:19 +00:00
parser.cc * Check for duplicate attributes and formal parameters in Nix 2005-03-10 11:33:46 +00:00
parser.hh * Use a map to lookup primops. 2004-02-04 16:03:29 +00:00
parser.y * Added a list concatenation operator: 2005-07-25 15:05:34 +00:00
primops.cc * A primitive operation `dependencyClosure' to do automatic dependency 2005-08-14 12:38:47 +00:00