Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pantry
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Jul 26, 2018
2 parents 2a4ff3f + 94d302c commit 3e378a7
Show file tree
Hide file tree
Showing 26 changed files with 199 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ tags
/.git/
/stack.cabal
/etc/scripts/stack-scripts.cabal
.hspec-failures
better-cache/
subs/
11 changes: 11 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Major changes:
must be specified in `extra-deps`.
* The `extra-dep` key in `packages` is no longer supported; please
move any such specifications to `extra-deps`.
* `GHCJS` support is being downgraded to 'experimental'. At time of writing the upcoming release is 1.8. A warning notifying the user of the experimental status of `GHCJS` will be incorporated into 1.8.

Behavior changes:

Expand Down Expand Up @@ -47,6 +48,9 @@ Behavior changes:
* Mustache templating is not applied to large files (over 50kb) to
avoid performance degredation. See:
[#4133](https://github.com/commercialhaskell/stack/issues/4133).
* `stack upload` signs the package by default, as documented. `--no-signature`
turns the signing off.
[#3739](https://github.com/commercialhaskell/stack/issues/3739)

Other enhancements:

Expand Down Expand Up @@ -84,6 +88,10 @@ Other enhancements:
* `stack ghci` now asks which main target to load before doing the build,
rather than after
* Bump to hpack 0.29.0
* With GHC 8.4 and later, Haddock is given the `--quickjump` flag.
* It is possible to specify the Hackage base URL to upload packages to, instead
of the default of `https://hackage.haskell.org/`, by using `hackage-base-url`
configuration option.

Bug fixes:

Expand Down Expand Up @@ -135,6 +143,9 @@ Bug fixes:
#3942).
* Fix invalid "While building Setup.hs" when Cabal calls fail. See:
[#3934](https://github.com/commercialhaskell/stack/issues/3934)
* `stack upload` signs the package by default, as documented. `--no-signature`
turns the signing off.
[#3739](https://github.com/commercialhaskell/stack/issues/3739)


## v1.7.1
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ Stack is a cross-platform program for developing Haskell projects. It is intende

See [haskellstack.org](http://haskellstack.org) or the [doc](./doc) directory for more
information.

### Subsystem maintainers

* GHCJS - [Matchwood](https://github.com/matchwood)
4 changes: 4 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,7 @@ project meeting the needs of Haskell users of all stripes.
If you'd like to get involved with Stack, check out the
[newcomer friendly](https://github.com/commercialhaskell/stack/issues?q=is%3Aopen+is%3Aissue+label%3a%22newcomer+friendly%22)
label on the Github issue tracker.

#### How to uninstall
Removing ``~/.stack`` and ``/usr/local/bin/stack`` should be sufficient. You may want to delete ``.stack-work`` folders in any Haskell projects that you have built.

7 changes: 6 additions & 1 deletion doc/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ environment:
global:
STACK_ROOT: "c:\\sr"

# Override the temp directory to avoid sed escaping issues
# See https://github.com/haskell/cabal/issues/5386
TMP: "c:\\tmp"

matrix:
- ARGS: ""
#- ARGS: "--resolver lts-2"
Expand All @@ -20,6 +24,7 @@ environment:
#- ARGS: "--resolver lts-7"
- ARGS: "--resolver lts-9"
- ARGS: "--resolver lts-11"
- ARGS: "--resolver lts-12"
#- ARGS: "--resolver nightly"

test_script:
Expand All @@ -29,4 +34,4 @@ test_script:

# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
# descriptor
- echo "" | stack %ARGS% --no-terminal test --pedantic
- echo "" | stack %ARGS% --no-terminal test
15 changes: 11 additions & 4 deletions doc/ghcjs.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="hidden-warning"><a href="https://docs.haskellstack.org/"><img src="https://rawgit.com/commercialhaskell/stack/master/doc/img/hidden-warning.svg"></a></div>

# GHCJS
# GHCJS (experimental)

To use GHCJS with stack, place a GHCJS version in the [`compiler`](yaml_configuration.md#compiler) field of `stack.yaml`. After this, all stack commands should work with GHCJS! In particular:
To use GHCJS with stack, place a GHCJS version in the [`compiler`](yaml_configuration.md#compiler) field of `stack.yaml`. After this, some stack commands should work with GHCJS. In particular:

* `stack setup` will install GHCJS from source and boot it, which takes a long time.

Expand All @@ -21,7 +21,13 @@ then you may need to install a different version of `node`. See

## Example Configurations

### Recent versions of GHCJS, repacked for stack
### GHCJS repacked for snapsnots lts-8 and lts-9

Please see the [ghcjs-stack-dist repository](https://github.com/matchwood/ghcjs-stack-dist) for `lts-8` and `lts-9` configurations and refer to the [README](https://github.com/matchwood/ghcjs-stack-dist/blob/master/README.md) for common issues.

Support for `> lts-9` snapshots (`GHC 8.2` and above) is currently [work in progress](https://github.com/matchwood/ghcjs-stack-dist/issues/10).

### GHCJS repacked for snapsnots < lts-8

These versions of GHCJS were created by
[Marcin Tolysz](https://github.com/tolysz), and were particularly crafted to
Expand Down Expand Up @@ -55,7 +61,7 @@ setup-info:
url: http://ghcjs.tolysz.org/ghc-8.0-2017-02-05-lts-7.19-9007019.tar.gz
sha1: d2cfc25f9cda32a25a87d9af68891b2186ee52f9
```
The later can be generated via: https://github.com/tolysz/prepare-ghcjs
The latter can be generated via: https://github.com/tolysz/prepare-ghcjs
the former is a bit more manual. Those bundles are only tested against the latest `node-7.4.0`.

In order to correctly boot and use ghcjs, one might need to install `alex` `happy` `hscolour` `hsc2hs` with the normal ghc.
Expand All @@ -64,6 +70,7 @@ Older resolvers:

|resolver|ghcjs|url|sha1|
|---|---|---|---|
| lts-7.19 |0.2.1| http://ghcjs.tolysz.org/ghc-8.0-2017-02-05-lts-7.19-9007019.tar.gz | d2cfc25f9cda32a25a87d9af68891b2186ee52f9 |
| lts-7.15 |0.2.1| http://ghcjs.tolysz.org/ghc-8.0-2017-01-11-lts-7.15-9007015.tar.gz | 30d34e9d704bdb799066387dfa1ba98b8884d932 |
| lts-7.14 |0.2.1| http://ghcjs.tolysz.org/ghc-8.0-2016-12-25-lts-7.14-9007014.tar.gz | 530c4ee5e19e2874e128431c7ad421e336df0303 |
| lts-7.13 |0.2.1| http://ghcjs.tolysz.org/ghc-8.0-2016-12-18-lts-7.13-9007013.tar.gz | 0d2ebe0931b29adca7cb9d9b9f77d60095bfb864 |
Expand Down
19 changes: 16 additions & 3 deletions doc/travis-complex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ matrix:
compiler: ": #stack 8.2.2"
addons: {apt: {packages: [libgmp-dev]}}

- env: BUILD=stack ARGS="--resolver lts-12"
compiler: ": #stack 8.4.3"
addons: {apt: {packages: [libgmp-dev]}}

# Nightly builds are allowed to fail
- env: BUILD=stack ARGS="--resolver nightly"
compiler: ": #stack nightly"
Expand Down Expand Up @@ -135,6 +139,10 @@ matrix:
compiler: ": #stack 8.2.2 osx"
os: osx

- env: BUILD=stack ARGS="--resolver lts-12"
compiler: ": #stack 8.4.3 osx"
os: osx

- env: BUILD=stack ARGS="--resolver nightly"
compiler: ": #stack nightly osx"
os: osx
Expand Down Expand Up @@ -176,9 +184,14 @@ install:
case "$BUILD" in
stack)
# Add in extra-deps for older snapshots, as necessary
stack --no-terminal --install-ghc $ARGS test --bench --dry-run || ( \
stack --no-terminal $ARGS build cabal-install && \
stack --no-terminal $ARGS solver --update-config)
#
# This is disabled by default, as relying on the solver like this can
# make builds unreliable. Instead, if you have this situation, it's
# recommended that you maintain multiple stack-lts-X.yaml files.
#stack --no-terminal --install-ghc $ARGS test --bench --dry-run || ( \
# stack --no-terminal $ARGS build cabal-install && \
# stack --no-terminal $ARGS solver --update-config)
# Build the dependencies
stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
Expand Down
11 changes: 11 additions & 0 deletions doc/yaml_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,17 @@ save-hackage-creds: true

Since 1.5.0

### hackage-base-url

Sets the address of the Hackage server to upload the package to. Default is
`https://hackage.haskell.org/`.

```yaml
hackage-base-url: https://hackage.example.com/
```

Since 1.8.0

### ignore-revision-mismatch

Cabal files in packages can be specified via exact revisions to deal
Expand Down
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
site_name: The Haskell Tool Stack
site_description: The Haskell Tool Stack
site_author: Stack contributors
repo_url: https://github.com/commercialhaskell/stack/tree/master/doc
repo_url: https://github.com/commercialhaskell/stack/
edit_uri: edit/stable/doc/
copyright: Copyright (c) 2015-2018, Stack contributors
docs_dir: doc
site_dir: _site
Expand All @@ -23,7 +24,7 @@ pages:
- Build command: build_command.md
- Dependency visualization: dependency_visualization.md
- Docker integration: docker_integration.md
- GHCJS: ghcjs.md
- GHCJS (experimental): ghcjs.md
- Nix integration: nix_integration.md
- Non-standard project initialization: nonstandard_project_init.md
- Shell auto-completion: shell_autocompletion.md
Expand Down
10 changes: 10 additions & 0 deletions src/Stack/Build/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1512,12 +1512,22 @@ singleBuild ac@ActionContext {..} ee@ExecuteEnv {..} task@Task {..} installedMap
("Warning: haddock not generating hyperlinked sources because 'HsColour' not\n" <>
"found on PATH (use 'stack install hscolour' to install).")
return ["--hyperlink-source" | hscolourExists]

-- For GHC 8.4 and later, provide the --quickjump option.
actualCompiler <- view actualCompilerVersionL
let quickjump =
case actualCompiler of
GhcVersion ghcVer
| ghcVer >= $(mkVersion "8.4") -> ["--haddock-option=--quickjump"]
_ -> []

cabal KeepTHLoading $ concat
[ ["haddock", "--html", "--hoogle", "--html-location=../$pkg-$version/"]
, sourceFlag
, ["--internal" | boptsHaddockInternal eeBuildOpts]
, [ "--haddock-option=" <> opt
| opt <- hoAdditionalArgs (boptsHaddockOpts eeBuildOpts) ]
, quickjump
]

let hasLibrary =
Expand Down
1 change: 1 addition & 0 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ configFromConfigMonoid
configDefaultTemplate = getFirst configMonoidDefaultTemplate
configDumpLogs = fromFirst DumpWarningLogs configMonoidDumpLogs
configSaveHackageCreds = fromFirst True configMonoidSaveHackageCreds
configHackageBaseUrl = fromFirst "https://hackage.haskell.org/" configMonoidHackageBaseUrl
clIgnoreRevisionMismatch = fromFirst False configMonoidIgnoreRevisionMismatch

configAllowDifferentUser <-
Expand Down
1 change: 0 additions & 1 deletion src/Stack/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ renderStackYaml p ignoredPackages dupPackages =
, "resolver: lts-3.5"
, "resolver: nightly-2015-09-21"
, "resolver: ghc-7.10.2"
, "resolver: ghcjs-0.1.0_ghc-7.10.2"
, ""
, "The location of a snapshot can be provided as a file or url. Stack assumes"
, "a snapshot provided as a file might change, whereas a url resource does not."
Expand Down
2 changes: 1 addition & 1 deletion src/Stack/Options/SDistParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sdistOptsParser signDefault = SDistOpts <$>
optional pvpBoundsOption <*>
ignoreCheckSwitch <*>
(if signDefault
then switch (long "no-signature" <> help "Do not sign & upload signatures")
then not <$> switch (long "no-signature" <> help "Do not sign & upload signatures")
else switch (long "sign" <> help "Sign & upload signatures")) <*>
strOption
(long "sig-server" <> metavar "URL" <> showDefault <>
Expand Down
11 changes: 11 additions & 0 deletions src/Stack/Setup/Installed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ listInstalled programsPath = do
x <- T.stripSuffix ".installed" $ T.pack $ toFilePath $ filename fp
parseToolText x

-- | See https://github.com/commercialhaskell/stack/issues/4086.
warnAboutGHCJS :: HasLogFunc env => RIO env ()
warnAboutGHCJS =
logWarn $ "Building a GHCJS project. " <> fromString ghcjsWarning

ghcjsWarning :: String
ghcjsWarning = unwords
[ "Note that GHCJS support in Stack is EXPERIMENTAL"
]

getCompilerVersion
:: (HasProcessContext env, HasLogFunc env)
=> WhichCompiler
Expand All @@ -101,6 +111,7 @@ getCompilerVersion wc =
logDebug $ "GHC version is: " <> display x
return x
Ghcjs -> do
warnAboutGHCJS
logDebug "Asking GHCJS for its version"
-- Output looks like
--
Expand Down
8 changes: 8 additions & 0 deletions src/Stack/Types/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ data Config =
-- command disallows this.
,configSaveHackageCreds :: !Bool
-- ^ Should we save Hackage credentials to a file?
,configHackageBaseUrl :: !Text
-- ^ Hackage base URL used when uploading packages
,configRunner :: !Runner
,configPantryConfig :: !PantryConfig
,configStackRoot :: !(Path Abs Dir)
Expand Down Expand Up @@ -744,6 +746,8 @@ data ConfigMonoid =
-- ^ See 'configDumpLogs'
, configMonoidSaveHackageCreds :: !(First Bool)
-- ^ See 'configSaveHackageCreds'
, configMonoidHackageBaseUrl :: !(First Text)
-- ^ See 'configHackageBaseUrl'
, configMonoidIgnoreRevisionMismatch :: !(First Bool)
-- ^ See 'configIgnoreRevisionMismatch'
}
Expand Down Expand Up @@ -841,6 +845,7 @@ parseConfigMonoidObject rootDir obj = do
configMonoidAllowDifferentUser <- First <$> obj ..:? configMonoidAllowDifferentUserName
configMonoidDumpLogs <- First <$> obj ..:? configMonoidDumpLogsName
configMonoidSaveHackageCreds <- First <$> obj ..:? configMonoidSaveHackageCredsName
configMonoidHackageBaseUrl <- First <$> obj ..:? configMonoidHackageBaseUrlName
configMonoidIgnoreRevisionMismatch <- First <$> obj ..:? configMonoidIgnoreRevisionMismatchName

return ConfigMonoid {..}
Expand Down Expand Up @@ -981,6 +986,9 @@ configMonoidDumpLogsName = "dump-logs"
configMonoidSaveHackageCredsName :: Text
configMonoidSaveHackageCredsName = "save-hackage-creds"

configMonoidHackageBaseUrlName :: Text
configMonoidHackageBaseUrlName = "hackage-base-url"

configMonoidIgnoreRevisionMismatchName :: Text
configMonoidIgnoreRevisionMismatchName = "ignore-revision-mismatch"

Expand Down
22 changes: 14 additions & 8 deletions src/Stack/Upload.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,14 @@ applyCreds creds req0 = do
-- sending a file like 'upload', this sends a lazy bytestring.
--
-- Since 0.1.2.1
uploadBytes :: HackageCreds
uploadBytes :: String -- ^ Hackage base URL
-> HackageCreds
-> String -- ^ tar file name
-> L.ByteString -- ^ tar file contents
-> IO ()
uploadBytes creds tarName bytes = do
uploadBytes baseUrl creds tarName bytes = do
let req1 = setRequestHeader "Accept" ["text/plain"]
"https://hackage.haskell.org/packages/"
(fromString $ baseUrl <> "packages/")
formData = [partFileRequestBody "package" tarName (RequestBodyLBS bytes)]
req2 <- formDataBody formData req1
req3 <- applyCreds creds req2
Expand Down Expand Up @@ -163,16 +164,21 @@ printBody res = runConduit $ getResponseBody res .| CB.sinkHandle stdout
-- | Upload a single tarball with the given @Uploader@.
--
-- Since 0.1.0.0
upload :: HackageCreds -> FilePath -> IO ()
upload creds fp = uploadBytes creds (takeFileName fp) =<< L.readFile fp
upload :: String -- ^ Hackage base URL
-> HackageCreds
-> FilePath
-> IO ()
upload baseUrl creds fp = uploadBytes baseUrl creds (takeFileName fp) =<< L.readFile fp

uploadRevision :: HackageCreds
uploadRevision :: String -- ^ Hackage base URL
-> HackageCreds
-> PackageIdentifier
-> L.ByteString
-> IO ()
uploadRevision creds ident@(PackageIdentifier name _) cabalFile = do
uploadRevision baseUrl creds ident@(PackageIdentifier name _) cabalFile = do
req0 <- parseRequest $ concat
[ "https://hackage.haskell.org/package/"
[ baseUrl
, "package/"
, displayC ident
, "/"
, displayC name
Expand Down
Loading

0 comments on commit 3e378a7

Please sign in to comment.