Hadrian: implement key-value settings for builder options
They take the general form `foo.bar.baz [+]= some values`, where `=` completely overrides the arguments for a builder and `+=` extends them. We currenly only support settings for updating the GHC and C compiler options, of the form: ``` {stage0, ..., stage3 or *}.{package name or *} .ghc.{c, hs, link, deps, toolargs or *}.opts {stage0, ..., stage3 or *}.{package name or *} .cc.{c, deps or *}.opts ``` The supported settings and their use is covered in the new section of `hadrian/doc/user-settings.md`, while the implementation is explained in a new Note [Hadrian settings]. Most of the logic is implemented in a new module, `Settings.Parser`, which contains key-value assignment/extension parsers as well as utilities for specifying allowed settings at a high-level, generating a `Predicate` from such a description or generating the list of possible completions for a given string. The additions to the `Settings` module make use of this to describe the settings that Hadrian currently supports, and apply all such key-value settings (from the command line and `<root>/hadrian.settings`) to the flavour that Hadrian is going to proceed with. This new setting system comes with support for generating Bash completions, implemented in `hadrian/completion.sh` and Hadrian's `autocomplete` target: > source hadrian/completion.sh > hadrian/build.sh stage1.base.ghc.<TAB> stage1.base.ghc.c.opts stage1.base.ghc.hs.opts stage1.base.ghc.*.opts stage1.base.ghc.deps.opts stage1.base.ghc.link.opts stage1.base.ghc.toolargs.opts
Showing
- hadrian/completion.sh 7 additions, 0 deletionshadrian/completion.sh
- hadrian/doc/user-settings.md 111 additions, 15 deletionshadrian/doc/user-settings.md
- hadrian/hadrian.cabal 1 addition, 0 deletionshadrian/hadrian.cabal
- hadrian/src/CommandLine.hs 46 additions, 6 deletionshadrian/src/CommandLine.hs
- hadrian/src/Hadrian/BuildPath.hs 12 additions, 12 deletionshadrian/src/Hadrian/BuildPath.hs
- hadrian/src/Main.hs 4 additions, 2 deletionshadrian/src/Main.hs
- hadrian/src/Rules.hs 1 addition, 0 deletionshadrian/src/Rules.hs
- hadrian/src/Rules/Register.hs 1 addition, 1 deletionhadrian/src/Rules/Register.hs
- hadrian/src/Rules/SimpleTargets.hs 20 additions, 1 deletionhadrian/src/Rules/SimpleTargets.hs
- hadrian/src/Settings.hs 209 additions, 3 deletionshadrian/src/Settings.hs
- hadrian/src/Settings/Parser.hs 276 additions, 0 deletionshadrian/src/Settings/Parser.hs
Loading
Please register or sign in to comment