Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to lts 11.13 #128

Merged
merged 7 commits into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ cabal.project.local
codex.tags
_Dangerfile.tmp
hscope.out
TAGS
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ addons:
# The different configurations we want to test. You could also do things like
# change flags or use --stack-yaml to point to a different file.
env:
- ARGS="--resolver=lts-8"
- ARGS="--resolver=lts-9"
- ARGS="--resolver=lts-11.13"

before_install:
# Update ruby
Expand Down
8 changes: 4 additions & 4 deletions Rome.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Rome
version: 0.15.0.43
version: 0.16.0.45
synopsis: An S3 cache for Carthage
description: Please see README.md
homepage: https://github.com/blender/Rome
Expand All @@ -11,7 +11,7 @@ copyright: 2016, 2017, 2018 Tommaso Piazza
category: Utility
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
cabal-version: >=1.24

library
hs-source-dirs: src
Expand Down Expand Up @@ -39,8 +39,8 @@ library


build-depends: base >= 4.7 && < 5
, amazonka >= 1.4
, amazonka-s3 >= 1.4
, amazonka >= 1.6
, amazonka-s3 >= 1.6
, exceptions >= 0.8
, lens >= 4.13
, parsec >= 3.1.10
Expand Down
2 changes: 1 addition & 1 deletion app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import System.Exit


romeVersion :: RomeVersion
romeVersion = (0, 15, 0, 43)
romeVersion = (0, 16, 0, 45)



Expand Down
12 changes: 6 additions & 6 deletions src/Caches/Local/Downloading.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Control.Monad.Except
import Control.Monad.Trans.Resource (runResourceT)
import qualified Data.ByteString.Lazy as LBS
import Data.Carthage.TargetPlatform
import qualified Data.Conduit as C (($$))
import qualified Data.Conduit as C (runConduit, (.|))
import qualified Data.Conduit.Binary as C (sinkLbs, sourceFile)
import Data.Romefile
import System.Directory
Expand Down Expand Up @@ -37,7 +37,7 @@ getFrameworkFromLocalCache lCacheDir
platform = do
frameworkExistsInLocalCache <- liftIO . doesFileExist $ frameworkLocalCachePath prefix
if frameworkExistsInLocalCache
then liftIO . runResourceT $ C.sourceFile (frameworkLocalCachePath prefix) C.$$ C.sinkLbs
then liftIO . runResourceT . C.runConduit $ C.sourceFile (frameworkLocalCachePath prefix) C..| C.sinkLbs
else throwError $ "Error: could not find " <> fwn <> " in local cache at : " <> frameworkLocalCachePath prefix
where
frameworkLocalCachePath cPrefix = lCacheDir </> cPrefix </> remoteFrameworkUploadPath
Expand All @@ -57,7 +57,7 @@ getVersionFileFromLocalCache lCacheDir
versionFileExistsInLocalCache <- liftIO . doesFileExist $ versionFileLocalCachePath

if versionFileExistsInLocalCache
then liftIO . runResourceT $ C.sourceFile versionFileLocalCachePath C.$$ C.sinkLbs
then liftIO . runResourceT . C.runConduit $ C.sourceFile versionFileLocalCachePath C..| C.sinkLbs
else throwError $ "Error: could not find " <> versionFileName <> " in local cache at : " <> versionFileLocalCachePath
where
versionFileName = versionFileNameForGitRepoName $ fst gitRepoNameAndVersion
Expand All @@ -84,7 +84,7 @@ getBcsymbolmapFromLocalCache lCacheDir
let finalBcsymbolmapLocalPath = bcsymbolmapLocalCachePath prefix
bcSymbolmapExistsInLocalCache <- liftIO . doesFileExist $ finalBcsymbolmapLocalPath
if bcSymbolmapExistsInLocalCache
then liftIO . runResourceT $ C.sourceFile finalBcsymbolmapLocalPath C.$$ C.sinkLbs
then liftIO . runResourceT . C.runConduit $ C.sourceFile finalBcsymbolmapLocalPath C..| C.sinkLbs
else throwError $ "Error: could not find " <> bcsymbolmapName <> " in local cache at : " <> finalBcsymbolmapLocalPath
where
remoteBcsymbolmapUploadPath = remoteBcsymbolmapPath dwarfUUID platform reverseRomeMap f version
Expand All @@ -109,7 +109,7 @@ getDSYMFromLocalCache lCacheDir
let finalDSYMLocalPath = dSYMLocalCachePath prefix
dSYMExistsInLocalCache <- liftIO . doesFileExist $ finalDSYMLocalPath
if dSYMExistsInLocalCache
then liftIO . runResourceT $ C.sourceFile finalDSYMLocalPath C.$$ C.sinkLbs
then liftIO . runResourceT . C.runConduit $ C.sourceFile finalDSYMLocalPath C..| C.sinkLbs
else throwError $ "Error: could not find " <> dSYMName <> " in local cache at : " <> finalDSYMLocalPath
where
dSYMLocalCachePath cPrefix = lCacheDir </> cPrefix </> remotedSYMUploadPath
Expand Down Expand Up @@ -295,7 +295,7 @@ getAndSaveVersionFileFromLocalCache lCacheDir gitRepoNameAndVersion = do
let sayFunc = if verbose then sayLnWithTime else sayLn
versionFileBinary <- getVersionFileFromLocalCache lCacheDir cachePrefix gitRepoNameAndVersion
sayFunc $ "Found " <> versionFileName <> " in local cache at: " <> finalVersionFileLocalCachePath
saveBinaryToFile versionFileBinary versionFileLocalPath
liftIO $ saveBinaryToFile versionFileBinary versionFileLocalPath
sayFunc $ "Copied " <> versionFileName <> " to: " <> versionFileLocalPath

where
Expand Down
20 changes: 11 additions & 9 deletions src/Caches/S3/Downloading.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ module Caches.S3.Downloading where

import Caches.Common
import Configuration (carthageBuildDirectoryForPlatform)
import Control.Exception (try)
import Control.Lens (view)
import Control.Monad
import Control.Monad.Except
import Control.Monad.Reader (ReaderT, ask, withReaderT)
import Control.Monad.Reader (runReaderT, ReaderT, ask, withReaderT)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS
import Data.Carthage.TargetPlatform
import qualified Data.Conduit as C (Conduit, await, yield,
(=$=))
import qualified Data.Conduit as C (ConduitT, await, yield,
(.|))
import qualified Data.Conduit.Binary as C (sinkLbs)
import Data.Either (lefts)
import Data.Maybe (fromMaybe)
Expand Down Expand Up @@ -201,10 +202,11 @@ getArtifactFromS3 :: S3.BucketName -- ^ The cache definition
-> ExceptT String (ReaderT (AWS.Env, Bool) IO) LBS.ByteString
getArtifactFromS3 s3BucketName
remotePath
name = do
eitherArtifact <- AWS.trying AWS._Error $ downloadBinary s3BucketName remotePath name
artifactName = do
env <- ask
eitherArtifact <- liftIO $ try $ runReaderT (downloadBinary s3BucketName remotePath artifactName) env
case eitherArtifact of
Left e -> throwError $ "Error: could not download " <> name <> " : " <> awsErrorToString e
Left e -> throwError $ "Error: could not download " <> artifactName <> " : " <> awsErrorToString e
Right artifactBinary -> return artifactBinary


Expand All @@ -213,7 +215,7 @@ getArtifactFromS3 s3BucketName
downloadBinary :: S3.BucketName
-> FilePath
-> FilePath
-> ExceptT String (ReaderT (AWS.Env, Bool) IO) LBS.ByteString
-> ReaderT (AWS.Env, Bool) IO LBS.ByteString
downloadBinary s3BucketName objectRemotePath objectName = do
(env, verbose) <- ask
AWS.runResourceT . AWS.runAWS env $ do
Expand All @@ -228,9 +230,9 @@ downloadBinary s3BucketName objectRemotePath objectName = do

where
objectKey = S3.ObjectKey . T.pack $ objectRemotePath
sink verbose totalLength = if verbose then printProgress objectName totalLength C.=$= C.sinkLbs else C.sinkLbs
sink verbose totalLength = if verbose then printProgress objectName totalLength C..| C.sinkLbs else C.sinkLbs

printProgress :: MonadIO m => String -> Int -> C.Conduit BS.ByteString m BS.ByteString
printProgress :: MonadIO m => String -> Int -> C.ConduitT BS.ByteString BS.ByteString m ()
printProgress objName totalLength = loop totalLength 0 0
where
loop t consumedLen lastLen = C.await >>= maybe (return ()) (\bs -> do
Expand Down
4 changes: 2 additions & 2 deletions src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ downloadVersionFileFromCaches s3BucketName (Just lCacheDir) gitRepoNameAndVersio
e2 <- runExceptT $ do
versionFileBinary <- getVersionFileFromS3 s3BucketName gitRepoNameAndVersion
saveBinaryToLocalCache lCacheDir versionFileBinary (prefix </> versionFileRemotePath) versionFileName verbose
saveBinaryToFile versionFileBinary versionFileLocalPath
liftIO $ saveBinaryToFile versionFileBinary versionFileLocalPath
sayFunc $ "Copied " <> versionFileName <> " to: " <> versionFileLocalPath
whenLeft sayFunc e2
) (env, cachePrefix, verbose)
Expand All @@ -600,7 +600,7 @@ downloadVersionFileFromCaches s3BucketName Nothing gitRepoNameAndVersion = do
eitherError <- liftIO $ runReaderT
(runExceptT $ do
versionFileBinary <- getVersionFileFromS3 s3BucketName gitRepoNameAndVersion
saveBinaryToFile versionFileBinary versionFileLocalPath
liftIO $ saveBinaryToFile versionFileBinary versionFileLocalPath
sayFunc $ "Copied " <> versionFileName <> " to: " <> versionFileLocalPath
)
(env, cachePrefix, verbose)
Expand Down
8 changes: 4 additions & 4 deletions src/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import Control.Arrow (left)
import Control.Exception as E (try)
import Control.Monad.Catch
import Control.Monad.Except
import Control.Monad.Trans.Resource (runResourceT)
import Control.Monad.Trans.Resource (runResourceT, MonadUnliftIO)
import Data.Aeson
import Data.Aeson.Types
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy as LBS
import Data.Carthage.Cartfile
import Data.Carthage.TargetPlatform
import Data.Char (isNumber)
import qualified Data.Conduit as C (($$))
import qualified Data.Conduit as C (runConduit, (.|))
import qualified Data.Conduit.Binary as C (sinkFile, sourceLbs)
import Data.Function (on)
import Data.List
Expand Down Expand Up @@ -510,13 +510,13 @@ unzipBinary objectBinary objectName objectZipName verbose = do


-- | Saves a ByteString to file
saveBinaryToFile :: MonadIO m
saveBinaryToFile :: (MonadUnliftIO m, MonadIO m)
=> LBS.ByteString -- ^ The `ByteString` to save.
-> FilePath -- ^ The destination path.
-> m ()
saveBinaryToFile binaryArtifact destinationPath = do
liftIO $ createDirectoryIfMissing True (dropFileName destinationPath)
liftIO . runResourceT $ C.sourceLbs binaryArtifact C.$$ C.sinkFile destinationPath
runResourceT $ C.runConduit $ C.sourceLbs binaryArtifact C..| C.sinkFile destinationPath



Expand Down
12 changes: 10 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: lts-9.0
resolver: lts-11.13

# User packages to be built.
# Various formats can be used as shown in the example below.
Expand All @@ -37,10 +37,18 @@ resolver: lts-9.0
# will not be run. This is useful for tweaking upstream packages.
packages:
- '.'
- location:
git: https://github.com/brendanhay/amazonka
commit: c9d8a62118b2269fb54b1e89c4e92106e8243050
subdirs:
- amazonka
- core
- amazonka-s3
extra-dep: true
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
extra-deps:
- zip-archive-0.3.2.1
- url-2.1.3
# Override default flag values for local packages and extra-deps
flags: {}

Expand Down