Skip to content

Commit

Permalink
Recommend checking in cabal files
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Mar 10, 2020
1 parent 3873c35 commit 3d0d235
Show file tree
Hide file tree
Showing 5 changed files with 691 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ tags
/_site/
/.dir-locals.el
/.git/
/stack.cabal
/subs/*/*.cabal
/etc/scripts/stack-scripts.cabal
.hspec-failures
better-cache/
/subs/*/*.cabal
stack*.yaml.lock
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ 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)

* We now recommend checking in generated cabal files for repos. When generating lock files for
extra-deps that only include `package.yaml` files, a deprecation warning will be generated.
See [#5210](https://github.com/commercialhaskell/stack/issues/5210).

Other enhancements:
* Add `build-output-timestamps` flag in yaml. Setting it to true
prefixes each build log output line with a timestamp.
Expand Down
4 changes: 4 additions & 0 deletions doc/stack_yaml_vs_cabal_package_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,7 @@ depend on a package already present in the snapshot you've selected, there's no
need to add it explicitly to your `stack.yaml` file: it's already there
implicitly via the `resolver` setting. This is what you do the majority of the
time, such as when you add `vector` or `mtl` as a `build-depends` value.

## Should I check in generated cabal files?

Yes, you should. This recommendation was changed in [issue #5210](https://github.com/commercialhaskell/stack/issues/5210), please see the discussion there.
9 changes: 5 additions & 4 deletions etc/scripts/release.hs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ rules global@Global{..} args = do

releaseCheckDir </> binaryExeFileName %> \out -> do
need [releaseBinDir </> binaryName </> stackExeFileName]

-- Run "git diff" so we can see what changes exist, in case things fail below
() <- cmd "git diff"

Stdout dirty <- cmd "git status --porcelain"
when (not gAllowDirty && not (null (trim dirty))) $
error ("Working tree is dirty. Use --" ++ allowDirtyOptName ++ " option to continue anyway.")
Expand All @@ -197,8 +201,6 @@ rules global@Global{..} args = do
(stackArgs global)
["--local-bin-path=" ++ tmpDir]
c
-- 'stack.cabal' is autogenerated by 'stack', delete to ensure not stale
_ <- liftIO $ tryJust (guard . isDoesNotExistError) (removeFile "stack.cabal")
() <- cmd0 "install" gBuildArgs integrationTestFlagArgs $ concat $ concat
[["--pedantic --no-haddock-deps "]
,[" --haddock" | gTestHaddocks]
Expand Down Expand Up @@ -240,6 +242,7 @@ rules global@Global{..} args = do
unless gUploadOnly $ releaseDir </> binaryExeFileName %> \out -> do
need [releaseBinDir </> binaryName </> stackExeFileName]
(Stdout versionOut) <- cmd (releaseBinDir </> binaryName </> stackExeFileName) "--version"
() <- cmd "git diff"
when (not gAllowDirty && "dirty" `isInfixOf` lower versionOut) $
error ("Refusing continue because 'stack --version' reports dirty. Use --" ++
allowDirtyOptName ++ " option to continue anyway.")
Expand Down Expand Up @@ -308,8 +311,6 @@ rules global@Global{..} args = do

releaseBinDir </> binaryName </> stackExeFileName %> \out -> do
alwaysRerun
-- 'stack.cabal' is autogenerated by 'stack', delete to ensure not stale
_ <- liftIO $ tryJust (guard . isDoesNotExistError) (removeFile "stack.cabal")
actionOnException
(cmd stackProgName
(stackArgs global)
Expand Down
Loading

0 comments on commit 3d0d235

Please sign in to comment.