Skip to content

Commit 384181d

Browse files
committed
release.hs: option to disable testing Haddocks
1 parent e32f3a1 commit 384181d

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

etc/scripts/osx-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ set -xe
44
RELEASE_SCRIPT=.local/bin/stack-release-script
55
rm -f "$RELEASE_SCRIPT"
66
(cd etc/scripts && stack --install-ghc build)
7-
$(cd etc/scripts && stack exec which stack-release-script) --arch=x86_64 --upload-label="Mac OS X 64-bit" release
7+
$(cd etc/scripts && stack exec which stack-release-script) --no-test-haddocks --arch=x86_64 --upload-label="Mac OS X 64-bit" release

etc/scripts/release.hs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ main =
5858
gArch = arch
5959
gBinarySuffix = ""
6060
gUploadLabel = Nothing
61+
gTestHaddocks = True
6162
gProjectRoot = "" -- Set to real value velow.
6263
global0 = foldl (flip id) Global{..} flags
6364
-- Need to get paths after options since the '--arch' argument can effect them.
@@ -98,7 +99,10 @@ options =
9899
"Extra suffix to add to binary executable archive filename."
99100
, Option "" [uploadLabelOptName]
100101
(ReqArg (\v -> Right $ \g -> g{gUploadLabel = Just v}) "LABEL")
101-
"Label to give the uploaded release asset" ]
102+
"Label to give the uploaded release asset"
103+
, Option "" [noTestHaddocksOptName] (NoArg $ Right $ \g -> g{gTestHaddocks = False})
104+
"Disable testing building haddocks."
105+
]
102106

103107
-- | Shake rules.
104108
rules :: Global -> [String] -> Rules ()
@@ -148,7 +152,8 @@ rules global@Global{..} args = do
148152
let cmd0 = cmd (releaseBinDir </> binaryName </> stackExeFileName)
149153
(stackArgs global)
150154
["--local-bin-path=" ++ tmpDir]
151-
() <- cmd0 "install --pedantic --haddock --no-haddock-deps"
155+
() <- cmd0 $ concat $ concat
156+
[["install --pedantic --no-haddock-deps"], [" --haddock" | gTestHaddocks]]
152157
() <- cmd0 "install cabal-install"
153158
let cmd' = cmd (AddPath [tmpDir] []) stackProgName (stackArgs global)
154159
() <- cmd' "clean"
@@ -612,6 +617,10 @@ binaryVariantOptName = "binary-variant"
612617
uploadLabelOptName :: String
613618
uploadLabelOptName = "upload-label"
614619

620+
-- | @--no-test-haddocks@ command-line option name.
621+
noTestHaddocksOptName :: String
622+
noTestHaddocksOptName = "no-test-haddocks"
623+
615624
-- | Arguments to pass to all 'stack' invocations.
616625
stackArgs :: Global -> [String]
617626
stackArgs Global{..} = ["--install-ghc", "--arch=" ++ display gArch]
@@ -659,5 +668,6 @@ data Global = Global
659668
, gHomeDir :: !FilePath
660669
, gArch :: !Arch
661670
, gBinarySuffix :: !String
662-
, gUploadLabel ::(Maybe String)}
671+
, gUploadLabel :: (Maybe String)
672+
, gTestHaddocks :: !Bool }
663673
deriving (Show)

etc/scripts/vagrant-releases.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ with_vagrant() {
1010
vagrant up
1111
vagrant provision
1212
vagrant rsync
13-
vagrant ssh -c "export GITHUB_AUTH_TOKEN=$GITHUB_AUTH_TOKEN; export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID; export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY; export AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION; gpg --import /vagrant/.stack-work/gpg-secret-key.asc; cd /vagrant && (cd etc/scripts && stack --install-ghc build) && \$(cd etc/scripts && stack exec which stack-release-script) $2"
13+
vagrant ssh -c "export GITHUB_AUTH_TOKEN=$GITHUB_AUTH_TOKEN; export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID; export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY; export AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION; gpg --import /vagrant/.stack-work/gpg-secret-key.asc; cd /vagrant && (cd etc/scripts && stack --install-ghc build) && \$(cd etc/scripts && stack exec which stack-release-script) --no-test-haddocks $2"
1414
vagrant halt
1515
popd
1616
}

etc/scripts/windows-releases.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cd etc\scripts
1010
stack --install-ghc install
1111
if errorlevel 1 exit /b
1212
cd ..\..
13-
%RELEASE_SCRIPT% --arch=i386 --upload-label="Windows 32-bit" release
13+
%RELEASE_SCRIPT% --no-test-haddocks --arch=i386 --upload-label="Windows 32-bit" release
1414
if errorlevel 1 exit /b
15-
%RELEASE_SCRIPT% --arch=x86_64 --upload-label="Windows 64-bit" release
15+
%RELEASE_SCRIPT% --no-test-haddocks --arch=x86_64 --upload-label="Windows 64-bit" release
1616
if errorlevel 1 exit /b

0 commit comments

Comments
 (0)