Skip to content
Commit bf58b772 authored by Alp Mestanogullari's avatar Alp Mestanogullari
Browse files

Hadrian: make the default target sensitive to the CWD

tl;dr: With this patch, running 'build.sh' with no target has a different
behaviour depending on where we run it from (the current working directory).
If under a package directory, Hadrian will rebuild just that package. If
under a test directory, Hadrian will run just the tests under that directory.

This required putting a few pieces together:

- The build.* scripts are now more flexible, we can run them from somewhere
  else than $TOP. They figure out $TOP, get the directory from which they were
  called (1) and pass it all to the 'hadrian' executable.
- Hadrian takes a new argument, --target-dir, whose value ends up being (1)
  from above.
- If --target-dir is $TOP, we build a complete GHC distribution.
- If --target-dir is a (subdirectory of a) package's directory, we (re)build
  just that package (and what might be required to build it, if it's not there
  already).
- If --target-dir is a (subdirectory of a) test directory (i.e it contains an
  all.T file), we run just the tests that live under the said test directory.

This patch introduces a new module, Rules.TargetDirs, which provides a mapping
from path components to package/test dir targets using a trie, generated from
the `pkgPath` of all known packages as well as all the directories anywhere
under $TOP that contain `all.T` files.
parent f3ad6740
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment