Skip to content

Commit

Permalink
Merge branch 'master' into apply-specific-ghc-options-after-general-3573
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg authored Nov 27, 2017
2 parents d060d24 + 839378a commit 66d8950
Showing 37 changed files with 450 additions and 140 deletions.
4 changes: 4 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
@@ -16,6 +16,10 @@
- ignore: {name: "Use &&&"}
- ignore: {name: "Redundant compare"}

# Added in hlint-2.0.10, ignoring for now
- ignore: {name: "Unnecessary hiding"}
- ignore: {name: "Use lambda-case"}

- ignore: {name: "Use fewer imports", within: [
"System.Process.Read", # Related to 'Hide post-AMP warnings' comment
"Stack.Exec" # ifdef for System.Process.Read
17 changes: 17 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -48,6 +48,9 @@ Behavior changes:
* `ghc-options:` for specific packages will now come after the options
specified for all packages / particular sets of packages. See
[#3573](https://github.com/commercialhaskell/stack/issues/3573).
* The `pvp-bounds` feature is no longer fully functional, due to some
issues with the Cabal library's printer. See
[#3550](https://github.com/commercialhaskell/stack/issues/3550).

Other enhancements:

@@ -118,6 +121,17 @@ Other enhancements:
be optimal yet. The terminal width can be overriden with the
new `--terminal-width` command-line option (this works even on
non-POSIX).
* Passing non local packages as targets to `stack ghci` will now
cause them to be used as `-package` args along with package
hiding.
* Detect when user changed .cabal file instead of package.yaml. This
was implemented upstream in hpack. See
[#3383](https://github.com/commercialhaskell/stack/issues/3383).
* Automatically run `autoreconf -i` as necessary when a `configure`
script is missing. See
[#3534](https://github.com/commercialhaskell/stack/issues/3534)
* GHC bindists can now be identified by their SHA256 checksum in addition to
their SHA1 checksum, allowing for more security in download.

Bug fixes:

@@ -179,6 +193,9 @@ Bug fixes:
* Fixes a bug that has existed since 1.5.0, where
`stack setup --upgrade-cabal` would say that Cabal is already the latest
version, when it wasn't.
* Ensure that an `extra-dep` from a local directory is not treated as
a `$locals` for GHC options purposes. See
[#3574](https://github.com/commercialhaskell/stack/issues/3574).


## 1.5.1
76 changes: 43 additions & 33 deletions doc/GUIDE.md
Original file line number Diff line number Diff line change
@@ -1085,7 +1085,7 @@ The following changes will be made to stack.yaml:
- aeson-0.10.0.0
- aeson-compat-0.3.0.0
- attoparsec-0.13.0.1
- conduit-extra-1.1.9.2
- conduit-extra-1.2.0
- email-validate-2.2.0
- hex-0.1.2
- http-api-data-0.2.2
@@ -1579,8 +1579,9 @@ what needs to be removed:
We've already used `stack exec` used multiple times in this guide. As you've
likely already guessed, it allows you to run executables, but with a slightly
modified environment. In particular: `stack exec` looks for executables on
stack's bin paths, and sets a few additional environment variables (like
`GHC_PACKAGE_PATH`, which tells GHC which package databases to use).
stack's bin paths, and sets a few additional environment variables (like adding
those paths to `PATH`, and setting `GHC_PACKAGE_PATH`, which tells GHC which
package databases to use).
If you want to see exactly what the modified environment looks like, try:
@@ -1789,7 +1790,7 @@ it. Here is an example:
-}
```
## Finding project configs, and the implicit global
## Finding project configs, and the implicit global project
Whenever you run something with stack, it needs a `stack.yaml` project file. The
algorithm stack uses to find this is:
@@ -1820,6 +1821,15 @@ configuration. It has no impact on projects at all. Every package you install
with it is put into isolated databases just like everywhere else. The only magic
is that it's the catch-all project whenever you're running stack somewhere else.
## Setting stack root location
`stack path --stack-root` will tell you the location of the "stack root". Among
other things, this is where stack stores downloaded programs and snapshot
packages. This location can be configured by setting the STACK_ROOT environment
variable or passing the `--stack-root` commandline option. It is particularly
useful to do this on Windows, where filepaths are limited (MAX_PATH), and things
can break when this limit is exceeded.
## `stack.yaml` vs `.cabal` files
Now that we've covered a lot of stack use cases, this quick summary of
@@ -1899,21 +1909,6 @@ __Other tools for comparison (including active and historical)__
* [cabal-src](https://hackage.haskell.org/package/cabal-src) is mostly irrelevant in the presence of both stack and cabal sandboxes, both of which make it easier to add additional package sources easily. The mega-sdist executable that ships with cabal-src is, however, still relevant. Its functionality may some day be folded into stack
* [stackage-cli](https://hackage.haskell.org/package/stackage-cli) was an initial attempt to make cabal-install work more easily with curated snapshots, but due to a slight impedance mismatch between cabal.config constraints and snapshots, it did not work as well as hoped. It is deprecated in favor of stack.
## More resources
There are lots of resources available for learning more about stack:
* `stack --help`
* `stack --version` — identify the version and Git hash of the stack executable
* `--verbose` (or `-v`) — much more info about internal operations (useful for bug reports)
* The [home page](http://haskellstack.org)
* The [stack mailing list](https://groups.google.com/d/forum/haskell-stack)
* The [the FAQ](faq.md)
* The [stack wiki](https://github.com/commercialhaskell/stack/wiki)
* The [haskell-stack tag on Stack Overflow](http://stackoverflow.com/questions/tagged/haskell-stack)
* [Another getting started with stack tutorial](http://seanhess.github.io/2015/08/04/practical-haskell-getting-started.html)
* [Why is stack not cabal?](https://www.fpcomplete.com/blog/2015/06/why-is-stack-not-cabal)
## Fun features
@@ -1962,11 +1957,11 @@ As a starting point you can use [the "simple" template](https://github.com/comme
An introduction into template-writing and a place for submitting official templates,
you will find at [the stack-templates repository](https://github.com/commercialhaskell/stack-templates#readme).
### IDE
### Editor integration
stack has a work-in-progress suite of editor integrations, to do things like
getting type information in Emacs. For more information, see
[stack-ide](https://github.com/commercialhaskell/stack-ide#readme).
For editor integration, stack has a related project called
[intero](https://github.com/commercialhaskell/intero). It is particularly well
supported by emacs, but some other editors have integration for it as well.
### Visualizing dependencies
@@ -2039,11 +2034,11 @@ image:
and then run `stack image container` and then `docker images` to list
the images.

Note that the executable will be built in the development environment
and copied to the container, so the dev OS must match that of the
Note that the executable will be built in the development environment
and copied to the container, so the dev OS must match that of the
container OS. This is easily accomplished using [Docker integration](docker_integration.md),
under which the exe emitted by `stack build` will be built on the
Docker container, not the local OS.
under which the exe emitted by `stack build` will be built on the
Docker container, not the local OS.

The executable will be stored under `/usr/local/bin/<your-project>-exe`
in the running container.
@@ -2159,6 +2154,14 @@ build:
executable-profiling: true
```

### Further reading

For more commands and uses, see [the official GHC chapter on
profiling](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html),
[the Haskell wiki](https://wiki.haskell.org/How_to_profile_a_Haskell_program),
and [the chapter on profiling in Real World
Haskell](http://book.realworldhaskell.org/read/profiling-and-optimization.html).

### Tracing

To generate a backtrace in case of exceptions during a test or benchmarks run,
@@ -2173,10 +2176,17 @@ using the `--no-strip`, `--no-library-stripping`, and `--no-executable-stripping
flags to disable the default behavior of removing such information from compiled
libraries and executables.

### Further reading
## More resources

For more commands and uses, see [the official GHC chapter on
profiling](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html),
[the Haskell wiki](https://wiki.haskell.org/How_to_profile_a_Haskell_program),
and [the chapter on profiling in Real World
Haskell](http://book.realworldhaskell.org/read/profiling-and-optimization.html).
There are lots of resources available for learning more about stack:

* `stack --help`
* `stack --version` — identify the version and Git hash of the stack executable
* `--verbose` (or `-v`) — much more info about internal operations (useful for bug reports)
* The [home page](http://haskellstack.org)
* The [stack mailing list](https://groups.google.com/d/forum/haskell-stack)
* The [the FAQ](faq.md)
* The [stack wiki](https://github.com/commercialhaskell/stack/wiki)
* The [haskell-stack tag on Stack Overflow](http://stackoverflow.com/questions/tagged/haskell-stack)
* [Another getting started with stack tutorial](http://seanhess.github.io/2015/08/04/practical-haskell-getting-started.html)
* [Why is stack not cabal?](https://www.fpcomplete.com/blog/2015/06/why-is-stack-not-cabal)
104 changes: 101 additions & 3 deletions doc/yaml_configuration.md
Original file line number Diff line number Diff line change
@@ -208,6 +208,9 @@ __NOTE__ It is highly recommended that you only use SHA1 values for a
Git or Mercurial commit. Other values may work, but they are not
officially supported, and may result in unexpected behavior (namely,
Stack will not automatically pull to update to new versions).
Another problem with this is that your build will not be deterministic,
because when someone else tries to build the project they can get a
different checkout of the package.

A common practice in the Haskell world is to use "megarepos", or
repositories with multiple packages in various subdirectories. Some
@@ -619,6 +622,13 @@ setup-info: "https://raw.githubusercontent.com/fpco/stackage-content/master/stac

(Since 0.1.5)

__NOTE__ As of Stack 1.6.0, this feature does not reliably work, due
to issues with the Cabal library's printer. Stack will generate a
warning when a lossy conversion occurs, in which case you may need to
disable this setting. See
[#3550](https://github.com/commercialhaskell/stack/issues/3550) for
more information.

When using the `sdist` and `upload` commands, this setting determines whether
the cabal file's dependencies should be modified to reflect PVP lower and upper
bounds. Values are `none` (unchanged), `upper` (add upper bounds), `lower` (add
@@ -797,7 +807,7 @@ The 5 parameters are: `author-email`, `author-name`, `category`, `copyright` and
set per project by passing `-p "category:value"` to the `stack new` command.
* _copyright_ - sets the `copyright` property in cabal. It is typically the
name of the holder of the copyright on the package and the year(s) from which
copyright is claimed. For example: `Copyright: (c) 2006-2007 Joe Bloggs`
copyright is claimed. For example: `Copyright (c) 2006-2007 Joe Bloggs`
* _github-username_ - used to generate `homepage` and `source-repository` in
cabal. For instance `github-username: myusername` and `stack new my-project new-template`
would result:
@@ -817,7 +827,7 @@ templates:
author-name: Your Name
author-email: youremail@example.com
category: Your Projects Category
copyright: 'Copyright: (c) 2017 Your Name'
copyright: 'Copyright (c) 2017 Your Name'
github-username: yourusername
```

@@ -859,7 +869,7 @@ For more information, see

Since 1.6.0

# urls
### urls

Customize the URLs where `stack` looks for snapshot build plans.

@@ -874,3 +884,91 @@ urls:

**Note:** The `latest-snapshot-url` field has been deprecated in favor of `latest-snapshot`
and will be removed in a future version of `stack`.

### jobs

Specifies how many build tasks should be run in parallel. This can be overloaded
on the commandline via `-jN`, for example `-j2`. The default is to use the
number of processors reported by your CPU. One usage for this might be to avoid
running out of memory by setting it to 1, like this:

```yaml
jobs: 1
```

### work-dir

Specifies relative path of work directory (default is `.stack-work`. This can
also be specified by env var or cli flag, in particular, the earlier items in
this list take precedence:

1. `--work-dir DIR` passed on the commandline
2. `work-dir` in stack.yaml
3. `STACK_WORK` environment variable

Since 0.1.10.0

### skip-msys

Skips checking for and installing msys2 when stack is setting up the
environment. This is only useful on Windows machines, and usually doesn't make
sense in project configurations, just in `config.yaml`. Defaults to `false`, so
if this is used, it only really makes sense to use it like this:

```yaml
skip-msys: true
```

Since 0.1.2.0

### concurrent-tests

This option specifies whether test-suites should be executed concurrently with
each-other. The default for this is true, since this is usually fine and it
often means that tests can complete earlier. However, if some test-suites
require exclusive access to some resource, or require a great deal of CPU or
memory resources, then it makes sense to set this to `false` (the default is
`true`).

```yaml
concurrent-tests: false
```

Since 0.1.2.0

### extra-path

This option specifies additional directories to prepend to the PATH environment
variable. These will be used when resolving the location of executables, and
will also be visible in the `PATH` variable of processes run by stack.

For example, to prepend `/path-to-some-dep/bin` to your PATh:

```yaml
extra-path:
- /path-to-some-dep/bin
```

One thing to note is that other paths added by stack - things like the project's
bin dir and the compiler's bin dir - will take precedence over those specified
here (the automatic paths get prepended).

Since 0.1.4.0

### local-programs-path

This overrides the location of the programs directory, where tools like ghc and
msys get installed.

On most systems, this defaults to a folder called `programs`
within the stack root directory. On windows, if the `LOCALAPPDATA` environment
variable exists, then it defaults to `$LOCALAPPDATA/Programs/stack/`, which
follows windows conventions.

Since 1.3.0

### default-template

This option specifies which template to use with `stack new`, when none is
specified. The default is called `new-template`. The other templates are listed
in [the stack-templates repo](https://github.com/commercialhaskell/stack-templates/).
1 change: 1 addition & 0 deletions hlint.sh → etc/scripts/hlint.sh
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

set -eux

cd "$(dirname "$0")/../.."
hlint src/
hlint src/ --cpp-define=WINDOWS=1
hlint test/ --cpp-simple
4 changes: 2 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
@@ -263,9 +263,9 @@ library:
when:
- condition: 'os(windows)'
then:
source-dirs: windows/
source-dirs: src/windows/
else:
source-dirs: unix/
source-dirs: src/unix/
executables:
stack:
main: Main.hs
9 changes: 7 additions & 2 deletions src/Data/Attoparsec/Interpreter.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{- | This module implements parsing of additional arguments embedded in a
comment when stack is invoked as a script interpreter
@@ -139,14 +140,18 @@ getInterpreterArgs file = do

parseArgStr str =
case P.parseOnly (argsParser Escaping) (pack str) of
Left err -> handleFailure ("Error parsing command specified in the \
\stack options comment: " ++ err)
Left err -> handleFailure ("Error parsing command specified in the "
++ "stack options comment: " ++ err)
Right [] -> handleFailure "Empty argument list in stack options comment"
Right args -> return args

decodeError e =
case e of
#if MIN_VERSION_conduit_extra(1,2,0)
ParseError ctxs _ (Position line col _) ->
#else
ParseError ctxs _ (Position line col) ->
#endif
if null ctxs
then "Parse error"
else ("Expecting " ++ intercalate " or " ctxs)
Loading

0 comments on commit 66d8950

Please sign in to comment.