Skip to content

Commit

Permalink
tidy, fix bug with use of --internal, --executable; fix travis config…
Browse files Browse the repository at this point in the history
… so deploy works even w/ cabal and macos
  • Loading branch information
phlummox committed Jan 4, 2017
1 parent ab1a732 commit f6d17d3
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 20 deletions.
36 changes: 26 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ matrix:
# compiler: ": #stack 7.10.2"
# addons: {apt: {packages: [libgmp-dev]}}

- env: BUILD=stack ARGS="--resolver lts-6" PKG_FLAGS="--flag hup:enablewebtests"
- env: BUILD=stack ARGS="--resolver lts-6" GHCVER=7.10.3 CABALVER=1.22 PKG_FLAGS="--flag hup:enablewebtests"
compiler: ": #stack 7.10.3"
addons: {apt: {packages: [libgmp-dev]}}
addons: {apt: {packages: [libgmp-dev,cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}

- env: BUILD=stack ARGS="--resolver lts-7" PKG_FLAGS="--flag hup:enablewebtests"
- env: BUILD=stack ARGS="--resolver lts-7" GHCVER=7.10.3 CABALVER=1.22 PKG_FLAGS="--flag hup:enablewebtests"
compiler: ": #stack 8.0.1"
addons: {apt: {packages: [libgmp-dev]}}
addons: {apt: {packages: [libgmp-dev,cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}

- env: BUILD=stack ARGS="--resolver lts-7" PKG_FLAGS="--flag hup:-enablewebtests"
- env: BUILD=stack ARGS="--resolver lts-7" GHCVER=7.10.3 CABALVER=1.22 PKG_FLAGS="--flag hup:-enablewebtests"
compiler: ": #stack 8.0.1"
addons: {apt: {packages: [libgmp-dev]}}
addons: {apt: {packages: [libgmp-dev,cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}

# Build on macOS in addition to Linux
- env: BUILD=stack ARGS="" PKG_FLAGS="--flag hup:enablewebtests"
Expand All @@ -97,8 +97,12 @@ before_install:
if [ `uname` = "Darwin" ]
then
travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
stack setup
stack install cabal-install
export PATH=`stack path --compiler-bin`:$PATH
else
travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
stack setup
fi
# Use the more reliable S3 mirror of Hackage
Expand All @@ -110,6 +114,10 @@ before_install:
then
echo 'jobs: $ncpus' >> $HOME/.cabal/config
fi
- stack --version
- cabal --version
- ghc --version
- travis_retry cabal update

install:
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
Expand All @@ -121,9 +129,6 @@ install:
stack --no-terminal --install-ghc $ARGS test $PKG_FLAGS --bench --only-dependencies
;;
cabal)
cabal --version
travis_retry cabal update
# Get the list of packages from the stack.yaml file
PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
Expand Down Expand Up @@ -165,9 +170,20 @@ script:
esac
set +ex
before_deploy:
- PKGVER=$(cabal info . | head -n 1 | cut -d ' ' -f 2)
- SRC_TGZ=$PKGVER.tar.gz
- |
if [ ! -f "$SRC_TGZ" ] ; then
stack sdist;
distdir=`stack path --dist-dir`;
cp $distdir/$SRC_TGZ .;
fi
- ls -al "$SRC_TGZ"; true

deploy:
file: dist/${SRC_TGZ}
provider: releases
file: "$SRC_TGZ"
skip_cleanup: true
# overwrite: true
api_key:
Expand Down
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

5 changes: 3 additions & 2 deletions hup.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ executable hup
hs-source-dirs: src
main-is: Main.hs
other-modules:
Types
, CmdArgs
CmdArgs
, CmdArgs.PatchHelp
, DefaultServerUrl
, Paths_hup
, SanityCheck
, Types
, Upload
if flag(PatchHelpMessage)
other-modules: CmdArgs.PatchHelp
Expand Down
1 change: 0 additions & 1 deletion lib/Distribution/Hup/Upload.hs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ postPkg url fileName fileConts userAuth = do
maybe (LBS.readFile fileName) return fileConts
(Options opt) = defaultOptions userAuth
formBody = formDataBody [partFileRequestBodyM "package" fileName conts]

opt <$> (formBody =<< parseRequest url)

-- | Build a @PUT@ request to upload package documentation.
Expand Down
13 changes: 7 additions & 6 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ stackBuildDocs dir (Package pkg ver) = do
localpkgdb <- rstrip <$> silently (run "stack" ["path", "--local-pkg-db"])
let verboseCommands = if verbose hc then ["-v2"] else []
let haddockExtraArgs = let args = haddockArgs hc
in if null args
in (if null args
then []
else ["--haddock-options=" <>T.pack(haddockArgs hc)]
let cabalExtraArgs =(if executables hc then ["--executables"] else [])
++(if tests hc then ["--tests"] else [])
++(if internal hc then ["--internal"] else [])
else ["--haddock-options=" <>T.pack(haddockArgs hc)])
++ (if executables hc then ["--executables"] else [])
++(if tests hc then ["--tests"] else [])
++(if internal hc then ["--internal"] else [])
let cabalExtraArgs =(if tests hc then ["--enable-tests"] else [])
echo "configuring"
let builddir= toTextIgnore $ dir </> "dist"
run_ "cabal" $["configure", "--builddir="<>builddir,
Expand All @@ -141,7 +142,7 @@ stackBuildDocs dir (Package pkg ver) = do
"--html-location=/package/$pkg-$version/docs",
"--contents-location=/package/$pkg-$version"]
++ hyperlinkFlag ++ verboseCommands
++ haddockExtraArgs ++ cabalExtraArgs
++ haddockExtraArgs
pkg <- return $ T.pack pkg
ver <- return $ T.pack ver
let srcDir = builddir </> "doc" </> "html" </> pkg
Expand Down

0 comments on commit f6d17d3

Please sign in to comment.