Skip to content

Commit a077cdc

Browse files
authored
Merge branch 'master' into 3483-file-watch-components
2 parents aaa1547 + 468fab8 commit a077cdc

34 files changed

Lines changed: 480 additions & 165 deletions

File tree

.hlint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
- ignore: {name: "Use &&&"}
1717
- ignore: {name: "Redundant compare"}
1818

19+
# Added in hlint-2.0.10, ignoring for now
20+
- ignore: {name: "Unnecessary hiding"}
21+
- ignore: {name: "Use lambda-case"}
22+
1923
- ignore: {name: "Use fewer imports", within: [
2024
"System.Process.Read", # Related to 'Hide post-AMP warnings' comment
2125
"Stack.Exec" # ifdef for System.Process.Read

ChangeLog.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,12 @@ Behavior changes:
4242
* Addition of `stack build --copy-compiler-tool`, to allow tools like
4343
intero to be installed globally for a particular compiler.
4444
[#2643](https://github.com/commercialhaskell/stack/issues/2643)
45-
* Stack will now try to detect the width of the running terminal
46-
(only on POSIX for the moment) and use that to better display
47-
output messages. Work is ongoing, so some messages will not
48-
be optimal yet. The terminal width can be overriden with the
49-
new `--terminal-width` command-line option (this works even on
50-
non-POSIX).
5145
* Stack will ask before saving hackage credentials to file. This new
5246
prompt can be avoided by using the `save-hackage-creds` setting. Please
5347
see [#2159](https://github.com/commercialhaskell/stack/issues/2159).
48+
* The `pvp-bounds` feature is no longer fully functional, due to some
49+
issues with the Cabal library's printer. See
50+
[#3550](https://github.com/commercialhaskell/stack/issues/3550).
5451

5552
Other enhancements:
5653

@@ -118,6 +115,23 @@ Other enhancements:
118115
* Avoid spurious rebuilds when using `--file-watch` by not watching files for
119116
executable, test and benchmark components that aren't a target. See:
120117
[#3483](https://github.com/commercialhaskell/stack/issues/3483).
118+
* Stack will now try to detect the width of the running terminal
119+
(only on POSIX for the moment) and use that to better display
120+
output messages. Work is ongoing, so some messages will not
121+
be optimal yet. The terminal width can be overriden with the
122+
new `--terminal-width` command-line option (this works even on
123+
non-POSIX).
124+
* Passing non local packages as targets to `stack ghci` will now
125+
cause them to be used as `-package` args along with package
126+
hiding.
127+
* Detect when user changed .cabal file instead of package.yaml. This
128+
was implemented upstream in hpack. See
129+
[#3383](https://github.com/commercialhaskell/stack/issues/3383).
130+
* Automatically run `autoreconf -i` as necessary when a `configure`
131+
script is missing. See
132+
[#3534](https://github.com/commercialhaskell/stack/issues/3534)
133+
* GHC bindists can now be identified by their SHA256 checksum in addition to
134+
their SHA1 checksum, allowing for more security in download.
121135

122136
Bug fixes:
123137

doc/GUIDE.md

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ The following changes will be made to stack.yaml:
10851085
- aeson-0.10.0.0
10861086
- aeson-compat-0.3.0.0
10871087
- attoparsec-0.13.0.1
1088-
- conduit-extra-1.1.9.2
1088+
- conduit-extra-1.2.0
10891089
- email-validate-2.2.0
10901090
- hex-0.1.2
10911091
- http-api-data-0.2.2
@@ -1579,8 +1579,9 @@ what needs to be removed:
15791579
We've already used `stack exec` used multiple times in this guide. As you've
15801580
likely already guessed, it allows you to run executables, but with a slightly
15811581
modified environment. In particular: `stack exec` looks for executables on
1582-
stack's bin paths, and sets a few additional environment variables (like
1583-
`GHC_PACKAGE_PATH`, which tells GHC which package databases to use).
1582+
stack's bin paths, and sets a few additional environment variables (like adding
1583+
those paths to `PATH`, and setting `GHC_PACKAGE_PATH`, which tells GHC which
1584+
package databases to use).
15841585
15851586
If you want to see exactly what the modified environment looks like, try:
15861587
@@ -1789,7 +1790,7 @@ it. Here is an example:
17891790
-}
17901791
```
17911792
1792-
## Finding project configs, and the implicit global
1793+
## Finding project configs, and the implicit global project
17931794
17941795
Whenever you run something with stack, it needs a `stack.yaml` project file. The
17951796
algorithm stack uses to find this is:
@@ -1820,6 +1821,15 @@ configuration. It has no impact on projects at all. Every package you install
18201821
with it is put into isolated databases just like everywhere else. The only magic
18211822
is that it's the catch-all project whenever you're running stack somewhere else.
18221823
1824+
## Setting stack root location
1825+
1826+
`stack path --stack-root` will tell you the location of the "stack root". Among
1827+
other things, this is where stack stores downloaded programs and snapshot
1828+
packages. This location can be configured by setting the STACK_ROOT environment
1829+
variable or passing the `--stack-root` commandline option. It is particularly
1830+
useful to do this on Windows, where filepaths are limited (MAX_PATH), and things
1831+
can break when this limit is exceeded.
1832+
18231833
## `stack.yaml` vs `.cabal` files
18241834
18251835
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)__
18991909
* [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
19001910
* [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.
19011911
1902-
## More resources
1903-
1904-
There are lots of resources available for learning more about stack:
1905-
1906-
* `stack --help`
1907-
* `stack --version` — identify the version and Git hash of the stack executable
1908-
* `--verbose` (or `-v`) — much more info about internal operations (useful for bug reports)
1909-
* The [home page](http://haskellstack.org)
1910-
* The [stack mailing list](https://groups.google.com/d/forum/haskell-stack)
1911-
* The [the FAQ](faq.md)
1912-
* The [stack wiki](https://github.com/commercialhaskell/stack/wiki)
1913-
* The [haskell-stack tag on Stack Overflow](http://stackoverflow.com/questions/tagged/haskell-stack)
1914-
* [Another getting started with stack tutorial](http://seanhess.github.io/2015/08/04/practical-haskell-getting-started.html)
1915-
* [Why is stack not cabal?](https://www.fpcomplete.com/blog/2015/06/why-is-stack-not-cabal)
1916-
19171912
19181913
## Fun features
19191914
@@ -1962,11 +1957,11 @@ As a starting point you can use [the "simple" template](https://github.com/comme
19621957
An introduction into template-writing and a place for submitting official templates,
19631958
you will find at [the stack-templates repository](https://github.com/commercialhaskell/stack-templates#readme).
19641959
1965-
### IDE
1960+
### Editor integration
19661961
1967-
stack has a work-in-progress suite of editor integrations, to do things like
1968-
getting type information in Emacs. For more information, see
1969-
[stack-ide](https://github.com/commercialhaskell/stack-ide#readme).
1962+
For editor integration, stack has a related project called
1963+
[intero](https://github.com/commercialhaskell/intero). It is particularly well
1964+
supported by emacs, but some other editors have integration for it as well.
19701965
19711966
### Visualizing dependencies
19721967
@@ -2039,11 +2034,11 @@ image:
20392034
and then run `stack image container` and then `docker images` to list
20402035
the images.
20412036

2042-
Note that the executable will be built in the development environment
2043-
and copied to the container, so the dev OS must match that of the
2037+
Note that the executable will be built in the development environment
2038+
and copied to the container, so the dev OS must match that of the
20442039
container OS. This is easily accomplished using [Docker integration](docker_integration.md),
2045-
under which the exe emitted by `stack build` will be built on the
2046-
Docker container, not the local OS.
2040+
under which the exe emitted by `stack build` will be built on the
2041+
Docker container, not the local OS.
20472042

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

2157+
### Further reading
2158+
2159+
For more commands and uses, see [the official GHC chapter on
2160+
profiling](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html),
2161+
[the Haskell wiki](https://wiki.haskell.org/How_to_profile_a_Haskell_program),
2162+
and [the chapter on profiling in Real World
2163+
Haskell](http://book.realworldhaskell.org/read/profiling-and-optimization.html).
2164+
21622165
### Tracing
21632166

21642167
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
21732176
flags to disable the default behavior of removing such information from compiled
21742177
libraries and executables.
21752178

2176-
### Further reading
2179+
## More resources
21772180

2178-
For more commands and uses, see [the official GHC chapter on
2179-
profiling](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html),
2180-
[the Haskell wiki](https://wiki.haskell.org/How_to_profile_a_Haskell_program),
2181-
and [the chapter on profiling in Real World
2182-
Haskell](http://book.realworldhaskell.org/read/profiling-and-optimization.html).
2181+
There are lots of resources available for learning more about stack:
2182+
2183+
* `stack --help`
2184+
* `stack --version` — identify the version and Git hash of the stack executable
2185+
* `--verbose` (or `-v`) — much more info about internal operations (useful for bug reports)
2186+
* The [home page](http://haskellstack.org)
2187+
* The [stack mailing list](https://groups.google.com/d/forum/haskell-stack)
2188+
* The [the FAQ](faq.md)
2189+
* The [stack wiki](https://github.com/commercialhaskell/stack/wiki)
2190+
* The [haskell-stack tag on Stack Overflow](http://stackoverflow.com/questions/tagged/haskell-stack)
2191+
* [Another getting started with stack tutorial](http://seanhess.github.io/2015/08/04/practical-haskell-getting-started.html)
2192+
* [Why is stack not cabal?](https://www.fpcomplete.com/blog/2015/06/why-is-stack-not-cabal)

doc/yaml_configuration.md

Lines changed: 102 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ __NOTE__ It is highly recommended that you only use SHA1 values for a
208208
Git or Mercurial commit. Other values may work, but they are not
209209
officially supported, and may result in unexpected behavior (namely,
210210
Stack will not automatically pull to update to new versions).
211+
Another problem with this is that your build will not be deterministic,
212+
because when someone else tries to build the project they can get a
213+
different checkout of the package.
211214

212215
A common practice in the Haskell world is to use "megarepos", or
213216
repositories with multiple packages in various subdirectories. Some
@@ -318,7 +321,7 @@ user-message: ! 'Warning: Some packages were found to be incompatible with the r
318321
Warning: Specified resolver could not satisfy all dependencies. Some external packages
319322
have been added as dependencies.
320323
321-
You can suppress this message by removing it from stack.yaml
324+
You can omit this message by removing it from stack.yaml
322325
323326
'
324327
```
@@ -619,6 +622,13 @@ setup-info: "https://raw.githubusercontent.com/fpco/stackage-content/master/stac
619622

620623
(Since 0.1.5)
621624

625+
__NOTE__ As of Stack 1.6.0, this feature does not reliably work, due
626+
to issues with the Cabal library's printer. Stack will generate a
627+
warning when a lossy conversion occurs, in which case you may need to
628+
disable this setting. See
629+
[#3550](https://github.com/commercialhaskell/stack/issues/3550) for
630+
more information.
631+
622632
When using the `sdist` and `upload` commands, this setting determines whether
623633
the cabal file's dependencies should be modified to reflect PVP lower and upper
624634
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
797807
set per project by passing `-p "category:value"` to the `stack new` command.
798808
* _copyright_ - sets the `copyright` property in cabal. It is typically the
799809
name of the holder of the copyright on the package and the year(s) from which
800-
copyright is claimed. For example: `Copyright: (c) 2006-2007 Joe Bloggs`
810+
copyright is claimed. For example: `Copyright (c) 2006-2007 Joe Bloggs`
801811
* _github-username_ - used to generate `homepage` and `source-repository` in
802812
cabal. For instance `github-username: myusername` and `stack new my-project new-template`
803813
would result:
@@ -817,7 +827,7 @@ templates:
817827
author-name: Your Name
818828
author-email: youremail@example.com
819829
category: Your Projects Category
820-
copyright: 'Copyright: (c) 2017 Your Name'
830+
copyright: 'Copyright (c) 2017 Your Name'
821831
github-username: yourusername
822832
```
823833

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

860870
Since 1.6.0
861871

862-
# urls
872+
### urls
863873

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

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

875885
**Note:** The `latest-snapshot-url` field has been deprecated in favor of `latest-snapshot`
876886
and will be removed in a future version of `stack`.
887+
888+
### jobs
889+
890+
Specifies how many build tasks should be run in parallel. This can be overloaded
891+
on the commandline via `-jN`, for example `-j2`. The default is to use the
892+
number of processors reported by your CPU. One usage for this might be to avoid
893+
running out of memory by setting it to 1, like this:
894+
895+
```yaml
896+
jobs: 1
897+
```
898+
899+
### work-dir
900+
901+
Specifies relative path of work directory (default is `.stack-work`. This can
902+
also be specified by env var or cli flag, in particular, the earlier items in
903+
this list take precedence:
904+
905+
1. `--work-dir DIR` passed on the commandline
906+
2. `work-dir` in stack.yaml
907+
3. `STACK_WORK` environment variable
908+
909+
Since 0.1.10.0
910+
911+
### skip-msys
912+
913+
Skips checking for and installing msys2 when stack is setting up the
914+
environment. This is only useful on Windows machines, and usually doesn't make
915+
sense in project configurations, just in `config.yaml`. Defaults to `false`, so
916+
if this is used, it only really makes sense to use it like this:
917+
918+
```yaml
919+
skip-msys: true
920+
```
921+
922+
Since 0.1.2.0
923+
924+
### concurrent-tests
925+
926+
This option specifies whether test-suites should be executed concurrently with
927+
each-other. The default for this is true, since this is usually fine and it
928+
often means that tests can complete earlier. However, if some test-suites
929+
require exclusive access to some resource, or require a great deal of CPU or
930+
memory resources, then it makes sense to set this to `false` (the default is
931+
`true`).
932+
933+
```yaml
934+
concurrent-tests: false
935+
```
936+
937+
Since 0.1.2.0
938+
939+
### extra-path
940+
941+
This option specifies additional directories to prepend to the PATH environment
942+
variable. These will be used when resolving the location of executables, and
943+
will also be visible in the `PATH` variable of processes run by stack.
944+
945+
For example, to prepend `/path-to-some-dep/bin` to your PATh:
946+
947+
```yaml
948+
extra-path:
949+
- /path-to-some-dep/bin
950+
```
951+
952+
One thing to note is that other paths added by stack - things like the project's
953+
bin dir and the compiler's bin dir - will take precedence over those specified
954+
here (the automatic paths get prepended).
955+
956+
Since 0.1.4.0
957+
958+
### local-programs-path
959+
960+
This overrides the location of the programs directory, where tools like ghc and
961+
msys get installed.
962+
963+
On most systems, this defaults to a folder called `programs`
964+
within the stack root directory. On windows, if the `LOCALAPPDATA` environment
965+
variable exists, then it defaults to `$LOCALAPPDATA/Programs/stack/`, which
966+
follows windows conventions.
967+
968+
Since 1.3.0
969+
970+
### default-template
971+
972+
This option specifies which template to use with `stack new`, when none is
973+
specified. The default is called `new-template`. The other templates are listed
974+
in [the stack-templates repo](https://github.com/commercialhaskell/stack-templates/).

hlint.sh renamed to etc/scripts/hlint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
set -eux
44

5+
cd "$(dirname "$0")/../.."
56
hlint src/
67
hlint src/ --cpp-define=WINDOWS=1
78
hlint test/ --cpp-simple

package.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ library:
263263
when:
264264
- condition: 'os(windows)'
265265
then:
266-
source-dirs: windows/
266+
source-dirs: src/windows/
267267
else:
268-
source-dirs: unix/
268+
source-dirs: src/unix/
269269
executables:
270270
stack:
271271
main: Main.hs

src/Data/Attoparsec/Interpreter.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
22
{-# LANGUAGE OverloadedStrings #-}
3+
{-# LANGUAGE CPP #-}
34
{- | This module implements parsing of additional arguments embedded in a
45
comment when stack is invoked as a script interpreter
56
@@ -139,14 +140,18 @@ getInterpreterArgs file = do
139140

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

147148
decodeError e =
148149
case e of
150+
#if MIN_VERSION_conduit_extra(1,2,0)
151+
ParseError ctxs _ (Position line col _) ->
152+
#else
149153
ParseError ctxs _ (Position line col) ->
154+
#endif
150155
if null ctxs
151156
then "Parse error"
152157
else ("Expecting " ++ intercalate " or " ctxs)

0 commit comments

Comments
 (0)