Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
.stack-root/
/.cabal-sandbox/
TAGS
Setup
/Setup/
cabal-dev/
cabal.sandbox.config
dist/
Expand Down
16 changes: 15 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,22 @@
Release notes:

Major changes:
* `setup-info-locations` yaml configuration now allows overwriting the default locations of `stack-setup-2.yaml`.
[#5031](https://github.com/commercialhaskell/stack/pull/5031)
[#2983](https://github.com/commercialhaskell/stack/issues/2983)
[#2913](https://github.com/commercialhaskell/stack/issues/2913)

* The `setup-info` configuration key now allows overwriting parts of the default `setup-info`

* The `--setup-info-yaml` command line flag now may be used in all stack commands such as `stack build`, and not only in `stack setup`

* The `--setup-info-yaml` may specify multiple locations for `stack-setup.yaml` files.

Behavior changes:
* Remove the deprecated `--stack-setup-yaml` command line argument in favor of `--setup-info-yaml`
[#2647](https://github.com/commercialhaskell/stack/issues/2647)

Other enhancements:

* Add `build-output-timestamps` flag in yaml. Setting it to true
prefixes each build log output line with a timestamp.

Expand All @@ -26,6 +37,9 @@ Other enhancements:

* Remove warning for using Stack with GHC 8.8 and Cabal 3.0.

* Allow relative paths in `--setup-info-yaml` and tool paths
[#3394](https://github.com/commercialhaskell/stack/issues/3394)

Bug fixes:

* Upgrade `pantry`: module mapping insertions into the database are now atomic.
Expand Down
5 changes: 2 additions & 3 deletions doc/install_and_upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,10 @@ If you're attempting to install stack from within China:

```
###ADD THIS IF YOU LIVE IN CHINA
setup-info: "http://mirrors.tuna.tsinghua.edu.cn/stackage/stack-setup.yaml"
setup-info-locations:
- "http://mirrors.tuna.tsinghua.edu.cn/stackage/stack-setup.yaml"
urls:
latest-snapshot: http://mirrors.tuna.tsinghua.edu.cn/stackage/snapshots.json
lts-build-plans: http://mirrors.tuna.tsinghua.edu.cn/stackage/lts-haskell/
nightly-build-plans: http://mirrors.tuna.tsinghua.edu.cn/stackage/stackage-nightly/
package-indices:
- name: Tsinghua
download-prefix: http://mirrors.tuna.tsinghua.edu.cn/hackage/package/
Expand Down
99 changes: 87 additions & 12 deletions doc/yaml_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,9 @@ Specify a variant binary distribution of GHC to use. Known values:
* `integersimple`: Use a GHC bindist that uses
[integer-simple instead of GMP](https://ghc.haskell.org/trac/ghc/wiki/ReplacingGMPNotes)
* any other value: Use a custom GHC bindist. You should specify
[setup-info](#setup-info) so `stack setup` knows where to download it, or
pass the `stack setup --ghc-bindist` argument on the command-line
[setup-info](#setup-info) or [setup-info-locations](#setup-info-locations)
so `stack setup` knows where to download it,
or pass the `stack setup --ghc-bindist` argument on the command-line

This option is incompatible with `system-ghc: true`.

Expand All @@ -630,13 +631,91 @@ Specify a specialized architecture bindist to use. Normally this is
determined automatically, but you can override the autodetected value here.
Possible arguments include `standard`, `gmp4`, `tinfo6`, and `nopie`.

### setup-info-locations

(Since 2.3)

Possible usages of this config are:
1. Using `stack` offline or behind a firewall
2. Extending the tools known to `stack` such as cutting-edge versions of `ghc` or builds for custom linux distributions.

The `setup-info` dictionary specifies locations for installation of Haskell-related tooling - it maps `(Tool, Platform, Version)` to the location where it can be obtained, such as `(GHC, Windows64, 8.6.5)` to the url hosting the `*.tar.xz` for GHC's installation.

By default, it's obtained from [stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml).

The `setup-info` dictionary is constructed in the following order:
1. `setup-info` yaml configuration - inline config
2. `--setup-info-yaml` command line arguments - urls or paths, multiple locations may be specified.
3. `setup-info-locations` yaml configuration - urls or paths

The first location which specifies the location of a tool `(Tool, Platform, Version)` takes precedence, so one can extend the default tools with a fallback to the default `setup-info` location:

```yaml
setup-info-locations:
- C:/stack-offline/my-stack-setup.yaml
- relative/inside/my/project/setup-info.yaml
- \\smbShare\stack\my-stack-setup.yaml
- http://stack-mirror.com/stack-setup.yaml
- https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml
```

The default `setup-info` location is included only if no locations in the `setup-info-locations` config or the `--setup-info-yaml` command line argument were specified.

Thus the following will cause `stack setup` not to consult github for the `setup-info`:
```yaml
setup-info-locations:
- C:/stack-offline/my-stack-setup.yaml
```

```yaml
setup-info-locations: []
```

Relative paths are resolved relative to the `stack.yaml` file - either in the local project or the global `stack.yaml` in the stack directory.

Relative paths may also be used inside paths to tool installs - such as for ghc or 7z, which allows vendoring the tools inside a monorepo.
For example:

Directory structure:
```
- src/
- installs/
- my-stack-setup.yaml
- 7z.exe
- 7z.dll
- ghc-8.2.2.tar.xz
- stack.yaml
```

In the project's `stack.yaml`:
```yaml
setup-info-locations:
- installs/my-stack-setup.yaml
```

In `installs/my-stack-setup.yaml`:
```yaml
sevenzexe-info:
url: "installs/7z.exe"

sevenzdll-info:
url: "installs/7z.dll"

ghc:
windows64:
8.2.2:
url: "installs/ghc-8.2.2.tar.xz"
```

### setup-info

(Since 0.1.5)

Allows augmenting from where tools like GHC and msys2 (on Windows) are
downloaded. Most useful for specifying locations of custom GHC binary
distributions (for use with the [ghc-variant](#ghc-variant) option):
distributions (for use with the [ghc-variant](#ghc-variant) option).

The format of this field is the same as in the default [stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml):

```yaml
setup-info:
Expand All @@ -646,19 +725,15 @@ setup-info:
url: "https://example.com/ghc-7.10.2-i386-unknown-mingw32-foo.tar.xz"
```

Or you can point to external setup-info:
This configuration **adds** the specified setup info metadata to the default;
Specifying this config **does not** prevent the default `stack-setup-2.yaml` from being consulted as a fallback.

If you need to **replace** the default setup-info, add the following:

```yaml
setup-info: "https://example.com/my-stack-setup-info.yaml"
setup-info-locations: []
```

This may be either URL or (since 1.2.0) absolute file path.

Note that this **adds** the specified setup info metadata to the default.
If you need to **replace** it, use the `stack --setup-info-yaml` command-line
argument instead. The default setup metadata is in
[stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml).

### pvp-bounds

(Since 0.1.5)
Expand Down
1 change: 1 addition & 0 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ configFromConfigMonoid
configGhcOptionsByName = coerce configMonoidGhcOptionsByName
configGhcOptionsByCat = coerce configMonoidGhcOptionsByCat
configSetupInfoLocations = configMonoidSetupInfoLocations
configSetupInfoInline = configMonoidSetupInfoInline
configPvpBounds = fromFirst (PvpBounds PvpBoundsNone False) configMonoidPvpBounds
configModifyCodePage = fromFirstTrue configMonoidModifyCodePage
configExplicitSetupDeps = configMonoidExplicitSetupDeps
Expand Down
10 changes: 8 additions & 2 deletions src/Stack/Options/ConfigParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ configOptsParser :: FilePath -> GlobalOptsContext -> Parser ConfigMonoid
configOptsParser currentDir hide0 =
(\stackRoot workDir buildOpts dockerOpts nixOpts systemGHC installGHC arch
ghcVariant ghcBuild jobs includes libs overrideGccPath overrideHpack
skipGHCCheck skipMsys localBin modifyCodePage allowDifferentUser
dumpLogs colorWhen -> mempty
skipGHCCheck skipMsys localBin setupInfoLocations modifyCodePage
allowDifferentUser dumpLogs colorWhen -> mempty
{ configMonoidStackRoot = stackRoot
, configMonoidWorkDir = workDir
, configMonoidBuildOpts = buildOpts
Expand All @@ -41,6 +41,7 @@ configOptsParser currentDir hide0 =
, configMonoidOverrideHpack = overrideHpack
, configMonoidSkipMsys = skipMsys
, configMonoidLocalBinPath = localBin
, configMonoidSetupInfoLocations = setupInfoLocations
, configMonoidModifyCodePage = modifyCodePage
, configMonoidAllowDifferentUser = allowDifferentUser
, configMonoidDumpLogs = dumpLogs
Expand Down Expand Up @@ -128,6 +129,11 @@ configOptsParser currentDir hide0 =
<> help "Install binaries to DIR"
<> hide
))
<*> many (
strOption
( long "setup-info-yaml"
<> help "Alternate URL or relative / absolute path for stack dependencies"
<> metavar "URL" ))
<*> firstBoolFlagsTrue
"modify-code-page"
"setting the codepage to support UTF-8 (Windows only)"
Expand Down
Loading