on master help sign in
V2 upload by default, --server-url option when building
commitd0138fae7aa50ad7afc1359e94000a44199c014c authorMichael Snoyman <michael@snoyman.com> dateWed 18 Mar 2015, 15:17 (12 years ago) parent5258076
4 files changed+23−7
ChangeLog.md+4 Stackage/CompleteBuild.hs+11−5 Stackage/Upload.hs+1 app/stackage.hs+7−2
ChangeLog.md+4
@@ -1,3 +1,7 @@
1+## 0.6.1
2+
3+* Switch to V2 upload by default
4+
15## 0.6.0
26
37* Upload bundle V2 stuff
Stackage/CompleteBuild.hs+11−5
@@ -40,7 +40,8 @@ data BuildFlags = BuildFlags
4040 , bfEnableExecDyn :: !Bool
4141 , bfVerbose :: !Bool
4242 , bfSkipCheck :: !Bool
43− , bfUploadV2 :: !Bool
43+ , bfUploadV1 :: !Bool
44+ , bfServer :: !StackageServer
4445 } deriving (Show)
4546
4647data BuildType = Nightly | LTS BumpType
@@ -253,7 +254,11 @@ completeBuild buildType buildFlags = withManager tlsManagerSettings $ \man -> do
253254 }
254255
255256 when (bfDoUpload buildFlags) $
256− finallyUpload (bfUploadV2 buildFlags) settings man
257+ finallyUpload
258+ (not $ bfUploadV1 buildFlags)
259+ (bfServer buildFlags)
260+ settings
261+ man
257262
258263justUploadNightly
259264 :: Text -- ^ nightly date
@@ -261,7 +266,7 @@ justUploadNightly
261266justUploadNightly day = do
262267 plan <- decodeFileEither (fpToString $ nightlyPlanFile day)
263268 >>= either throwM return
264− withManager tlsManagerSettings $ finallyUpload False $ nightlySettings day plan
269+ withManager tlsManagerSettings $ finallyUpload False def $ nightlySettings day plan
265270
266271getStackageAuthToken :: IO Text
267272getStackageAuthToken = do
@@ -273,8 +278,9 @@ getStackageAuthToken = do
273278-- | The final part of the complete build process: uploading a bundle,
274279-- docs and a distro to hackage.
275280finallyUpload :: Bool -- ^ use v2 upload
281+ -> StackageServer
276282 -> Settings -> Manager -> IO ()
277−finallyUpload useV2 settings@Settings{..} man = do
283+finallyUpload useV2 server settings@Settings{..} man = do
278284 putStrLn "Uploading bundle to Stackage Server"
279285
280286 token <- getStackageAuthToken
@@ -282,7 +288,7 @@ finallyUpload useV2 settings@Settings{..} man = do
282288 if useV2
283289 then do
284290 res <- flip uploadBundleV2 man UploadBundleV2
285− { ub2Server = def
291+ { ub2Server = server
286292 , ub2AuthToken = token
287293 , ub2Bundle = bundleDest
288294 }
Stackage/Upload.hs+1
@@ -17,6 +17,7 @@ module Stackage.Upload
1717 , uploadBundleV2
1818 , UploadBundleV2 (..)
1919 , def
20+ , StackageServer
2021 , unStackageServer
2122 ) where
2223
app/stackage.hs+7−2
@@ -110,8 +110,13 @@ main =
110110 (long "skip-check" <>
111111 help "Skip the check phase, and pass --allow-newer to cabal configure") <*>
112112 switch
113− (long "upload-v2" <>
114− help "Use the V2 upload code")
113+ (long "upload-v1" <>
114+ help "Use the V1 upload code") <*>
115+ (fmap fromString (strOption
116+ (long "server-url" <>
117+ metavar "SERVER-URL" <>
118+ showDefault <> value (T.unpack $ unStackageServer def) <>
119+ help "Server to upload bundle to")))
115120
116121 nightlyUploadFlags = fromString <$> strArgument
117122 (metavar "DATE" <>