Skip to content

Commit 5b67946

Browse files
committed
Don't require build plan to upload #400
1 parent 59313c9 commit 5b67946

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Display information on why a snapshot was rejected [#381](https://github.com/commercialhaskell/stack/issues/381)
1010
* Give a reason for unregistering packages [#389](https://github.com/commercialhaskell/stack/issues/389)
1111
* `stack exec` accepts the `--no-ghc-package-path` parameter
12+
* Don't require build plan to upload [#400](https://github.com/commercialhaskell/stack/issues/400)
1213

1314
Bug fixes:
1415

src/Stack/Upload.hs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,8 @@ promptPassword = do
191191
-- | Turn the given settings into an @Uploader@.
192192
--
193193
-- Since 0.1.0.0
194-
mkUploader :: FilePath -- ^ runghc
195-
-> Config -> UploadSettings -> IO Uploader
196-
mkUploader runghc config us = do
194+
mkUploader :: Config -> UploadSettings -> IO Uploader
195+
mkUploader config us = do
197196
manager <- usGetManager us
198197
(creds, fromFile') <- loadCreds $ usCredsSource us config
199198
when (not fromFile' && usSaveCreds us) $ saveCreds config creds
@@ -203,7 +202,7 @@ mkUploader runghc config us = do
203202
, checkStatus = \_ _ _ -> Nothing
204203
}
205204
return Uploader
206-
{ upload_ = \fp0 -> withTarball runghc fp0 $ \fp -> do
205+
{ upload_ = \fp0 -> withTarball fp0 $ \fp -> do
207206
let formData = [partFile "package" fp]
208207
req2 <- formDataBody formData req1
209208
let req3 = applyBasicAuth
@@ -238,9 +237,8 @@ mkUploader runghc config us = do
238237

239238
-- | Given either a file, return it. Given a directory, run @cabal sdist@ and
240239
-- get the resulting tarball.
241-
withTarball :: FilePath -- ^ runghc
242-
-> FilePath -> (FilePath -> IO a) -> IO a
243-
withTarball _runghc fp0 inner = do
240+
withTarball :: FilePath -> (FilePath -> IO a) -> IO a
241+
withTarball fp0 inner = do
244242
isFile <- doesFileExist fp0
245243
if isFile then inner fp0 else withSystemTempDirectory "stackage-upload-tarball" $ \dir -> do
246244
isDir <- doesDirectoryExist fp0

src/main/Main.hs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Control.Exception
1313
import Control.Monad
1414
import Control.Monad.IO.Class
1515
import Control.Monad.Logger
16-
import Control.Monad.Reader (ask,asks)
16+
import Control.Monad.Reader (ask)
1717
import Data.Char (toLower)
1818
import Data.List
1919
import qualified Data.List as List
@@ -27,7 +27,6 @@ import qualified Data.Text as T
2727
import qualified Data.Text.IO as T
2828
import Data.Traversable
2929
import Network.HTTP.Client
30-
import Network.HTTP.Client.Conduit (getHttpManager)
3130
import Options.Applicative.Args
3231
import Options.Applicative.Builder.Extra
3332
import Options.Applicative.Simple
@@ -491,15 +490,12 @@ updateCmd () go@GlobalOpts{..} = do
491490

492491
-- | Upload to Hackage
493492
uploadCmd :: [String] -> GlobalOpts -> IO ()
494-
uploadCmd args0 go = withBuildConfig go ExecStrategy $ do
495-
let args = if null args0 then ["."] else args0
496-
config <- asks getConfig
497-
manager <- asks getHttpManager
498-
menv <- getMinimalEnvOverride
499-
runghc <- join $ System.Process.Read.findExecutable menv "runghc"
493+
uploadCmd args0 go = do
494+
(manager,lc) <- loadConfigWithOpts go
495+
let config = lcConfig lc
496+
args = if null args0 then ["."] else args0
500497
liftIO $ do
501498
uploader <- Upload.mkUploader
502-
(toFilePath runghc)
503499
config
504500
$ Upload.setGetManager (return manager)
505501
Upload.defaultUploadSettings

0 commit comments

Comments
 (0)