Skip to content

Commit

Permalink
Fix #131 & Impl. Carthage 0.30.1 Static Support
Browse files Browse the repository at this point in the history
  • Loading branch information
tmspzz committed Jul 10, 2018
1 parent ab0e93d commit c5f860e
Show file tree
Hide file tree
Showing 14 changed files with 259 additions and 177 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ cabal.sandbox.config
*.hp
*.eventlog
.stack-work/
.vscode/
cabal.project.local
codex.tags
_Dangerfile.tmp
hscope.out
TAGS
TAGS
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ before_install:
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

# Download and instal hlint
- rake hlint:install[2.0.9]
- rake hlint:install[2.1.8]

install:
# Run bundler and install the dependencies in vendor/bundle
Expand Down
38 changes: 19 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
atomos (0.1.2)
claide (1.0.2)
claide-plugins (0.9.2)
Expand Down Expand Up @@ -48,12 +48,12 @@ GEM
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
coderay (1.1.1)
coderay (1.1.2)
colored2 (3.1.2)
concurrent-ruby (1.0.5)
cork (0.3.0)
colored2 (~> 3.1)
danger (5.3.3)
danger (5.6.2)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
Expand All @@ -62,50 +62,50 @@ GEM
faraday-http-cache (~> 1.0)
git (~> 1)
kramdown (~> 1.5)
no_proxy_fix
octokit (~> 4.7)
terminal-table (~> 1)
danger-hlint (0.0.3)
danger-hlint (0.0.5)
danger-plugin-api (~> 1.0)
danger-plugin-api (1.0.0)
danger (> 2.0)
escape (0.0.4)
faraday (0.12.1)
faraday (0.15.2)
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday (~> 0.8)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
git (1.3.0)
git (1.4.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
kramdown (1.14.0)
method_source (0.8.2)
kramdown (1.17.0)
method_source (0.9.0)
minitest (5.11.3)
molinillo (0.6.5)
multipart-post (2.0.0)
nanaimo (0.2.5)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
octokit (4.7.0)
no_proxy_fix (0.1.2)
octokit (4.9.0)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
pry (0.10.4)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
public_suffix (2.0.5)
ruby-macho (1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.2)
ruby-macho (1.2.0)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
slop (3.6.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.3.0)
unicode-display_width (1.4.0)
xcodeproj (1.5.9)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.2)
Expand All @@ -123,4 +123,4 @@ DEPENDENCIES
pry

BUNDLED WITH
1.16.1
1.16.2
20 changes: 17 additions & 3 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,26 @@ romeVersion = (0, 16, 0, 45)
-- Main
main :: IO ()
main = do
let opts = info (Opts.helper <*> Opts.flag' Nothing (Opts.long "version" <> Opts.help "Prints the version information" <> Opts.hidden ) <|> Just <$> parseRomeOptions) (header "S3 cache tool for Carthage" )
let opts = info
( Opts.helper
<*> Opts.flag'
Nothing
( Opts.long "version"
<> Opts.help "Prints the version information"
<> Opts.hidden
)
<|> Just
<$> parseRomeOptions
)
(header "S3 cache tool for Carthage")
cmd <- execParser opts
case cmd of
Nothing -> putStrLn $ romeVersionToString romeVersion ++ " - Romam uno die non fuisse conditam."
Nothing ->
putStrLn
$ romeVersionToString romeVersion
++ " - Romam uno die non fuisse conditam."
Just romeOptions -> do
p <- runExceptT $ runRomeWithOptions romeOptions romeVersion
case p of
Right _ -> return ()
Left e -> die e
Left e -> die e
25 changes: 13 additions & 12 deletions src/Caches/Local/Downloading.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Caches.Local.Downloading where

import Configuration (carthageBuildDirectory,
carthageBuildDirectoryForPlatform)
carthageArtifactsBuildDirectoryForPlatform)
import Control.Monad.Except
import Control.Monad.Trans.Resource (runResourceT)
import qualified Data.ByteString.Lazy as LBS
Expand Down Expand Up @@ -33,7 +33,7 @@ getFrameworkFromLocalCache :: MonadIO m
getFrameworkFromLocalCache lCacheDir
(CachePrefix prefix)
reverseRomeMap
(FrameworkVersion f@(FrameworkName fwn) version)
(FrameworkVersion f@(Framework fwn fwt) version)
platform = do
frameworkExistsInLocalCache <- liftIO . doesFileExist $ frameworkLocalCachePath prefix
if frameworkExistsInLocalCache
Expand Down Expand Up @@ -78,7 +78,7 @@ getBcsymbolmapFromLocalCache :: MonadIO m
getBcsymbolmapFromLocalCache lCacheDir
(CachePrefix prefix)
reverseRomeMap
(FrameworkVersion f@(FrameworkName fwn) version)
(FrameworkVersion f@(Framework fwn fwt) version)
platform
dwarfUUID = do
let finalBcsymbolmapLocalPath = bcsymbolmapLocalCachePath prefix
Expand All @@ -104,7 +104,7 @@ getDSYMFromLocalCache :: MonadIO m
getDSYMFromLocalCache lCacheDir
(CachePrefix prefix)
reverseRomeMap
(FrameworkVersion f@(FrameworkName fwn) version)
(FrameworkVersion f@(Framework fwn fwt) version)
platform = do
let finalDSYMLocalPath = dSYMLocalCachePath prefix
dSYMExistsInLocalCache <- liftIO . doesFileExist $ finalDSYMLocalPath
Expand All @@ -128,7 +128,7 @@ getAndUnzipBcsymbolmapFromLocalCache :: MonadIO m
-> ExceptT String (ReaderT (CachePrefix, Bool) m) ()
getAndUnzipBcsymbolmapFromLocalCache lCacheDir
reverseRomeMap
fVersion@(FrameworkVersion f@(FrameworkName fwn) version)
fVersion@(FrameworkVersion f@(Framework fwn fwt) version)
platform
dwarfUUID = do
(cachePrefix@(CachePrefix prefix), verbose) <- ask
Expand All @@ -143,7 +143,7 @@ getAndUnzipBcsymbolmapFromLocalCache lCacheDir
remoteFrameworkUploadPath = remoteFrameworkPath platform reverseRomeMap f version
bcsymbolmapZipName d = bcsymbolmapArchiveName d version
bcsybolmapPath d = platformBuildDirectory </> bcsymbolmapNameFrom d
platformBuildDirectory = carthageBuildDirectoryForPlatform platform
platformBuildDirectory = carthageArtifactsBuildDirectoryForPlatform platform f



Expand All @@ -156,7 +156,7 @@ getAndUnzipBcsymbolmapsFromLocalCache :: MonadIO m
-> ExceptT String (ReaderT (CachePrefix, Bool) m) ()
getAndUnzipBcsymbolmapsFromLocalCache lCacheDir
reverseRomeMap
fVersion@(FrameworkVersion f@(FrameworkName fwn) _)
fVersion@(FrameworkVersion f@(Framework fwn fwt) _)
platform = do
(_, verbose) <- ask
let sayFunc = if verbose then sayLnWithTime else sayLn
Expand All @@ -167,7 +167,7 @@ getAndUnzipBcsymbolmapsFromLocalCache lCacheDir
dwarfUUIDs
where
frameworkNameWithFrameworkExtension = appendFrameworkExtensionTo f
platformBuildDirectory = carthageBuildDirectoryForPlatform platform
platformBuildDirectory = carthageArtifactsBuildDirectoryForPlatform platform f
frameworkDirectory = platformBuildDirectory </> frameworkNameWithFrameworkExtension


Expand All @@ -181,7 +181,7 @@ getAndUnzipBcsymbolmapsFromLocalCache' :: MonadIO m
-> ExceptT DWARFOperationError (ReaderT (CachePrefix, Bool) m) ()
getAndUnzipBcsymbolmapsFromLocalCache' lCacheDir
reverseRomeMap
fVersion@(FrameworkVersion f@(FrameworkName fwn) _)
fVersion@(FrameworkVersion f@(Framework fwn fwt) _)
platform = do

dwarfUUIDs <- withExceptT (const ErrorGettingDwarfUUIDs) $ dwarfUUIDsFrom (frameworkDirectory </> fwn)
Expand All @@ -197,11 +197,12 @@ getAndUnzipBcsymbolmapsFromLocalCache' lCacheDir

where
frameworkNameWithFrameworkExtension = appendFrameworkExtensionTo f
platformBuildDirectory = carthageBuildDirectoryForPlatform platform
platformBuildDirectory = carthageArtifactsBuildDirectoryForPlatform platform f
frameworkDirectory = platformBuildDirectory </> frameworkNameWithFrameworkExtension




-- | Retrieves a Frameworks and the corresponding dSYMs from a local cache for given `TargetPlatform`s, then unzips the contents
getAndUnzipFrameworksAndArtifactsFromLocalCache :: MonadIO m
=> FilePath -- ^ The cache definition
Expand Down Expand Up @@ -232,7 +233,7 @@ getAndUnzipFrameworkFromLocalCache :: MonadIO m
-> ExceptT String (ReaderT (CachePrefix , Bool) m) ()
getAndUnzipFrameworkFromLocalCache lCacheDir
reverseRomeMap
fVersion@(FrameworkVersion f@(FrameworkName fwn) version)
fVersion@(FrameworkVersion f@(Framework fwn fwt) version)
platform = do
(cachePrefix@(CachePrefix prefix), verbose) <- ask
let sayFunc = if verbose then sayLnWithTime else sayLn
Expand All @@ -257,7 +258,7 @@ getAndUnzipDSYMFromLocalCache :: MonadIO m
-> ExceptT String (ReaderT (CachePrefix, Bool) m) ()
getAndUnzipDSYMFromLocalCache lCacheDir
reverseRomeMap
fVersion@(FrameworkVersion f@(FrameworkName fwn) version)
fVersion@(FrameworkVersion f@(Framework fwn fwt) version)
platform = do
(cachePrefix@(CachePrefix prefix), verbose) <- ask
let finalDSYMLocalPath = dSYMLocalCachePath prefix
Expand Down
8 changes: 4 additions & 4 deletions src/Caches/Local/Uploading.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Control.Monad.Reader (ReaderT, ask)
import qualified Data.ByteString.Lazy as LBS
import Data.Carthage.TargetPlatform
import Data.Monoid ((<>))
import Data.Romefile (FrameworkName (..))
import Data.Romefile (Framework (..))
import System.Directory
import System.FilePath ((</>))
import Types hiding (version)
Expand All @@ -30,7 +30,7 @@ saveFrameworkToLocalCache :: FilePath -- ^ The cache definition.
saveFrameworkToLocalCache lCacheDir
frameworkArchive
reverseRomeMap
(FrameworkVersion f@(FrameworkName _) version)
(FrameworkVersion f@(Framework _ _) version)
platform = do
(CachePrefix prefix, SkipLocalCacheFlag skipLocalCache, verbose) <- ask
unless skipLocalCache $
Expand All @@ -56,7 +56,7 @@ saveDsymToLocalCache :: FilePath -- ^ The cache definition.
saveDsymToLocalCache lCacheDir
dSYMArchive
reverseRomeMap
(FrameworkVersion f@(FrameworkName fwn) version)
(FrameworkVersion f@(Framework fwn fwt) version)
platform = do
(CachePrefix prefix, SkipLocalCacheFlag skipLocalCache, verbose) <- ask
unless skipLocalCache $
Expand All @@ -83,7 +83,7 @@ saveBcsymbolmapToLocalCache lCacheDir
dwarfUUID
dwarfArchive
reverseRomeMap
(FrameworkVersion f@(FrameworkName _) version)
(FrameworkVersion f@(Framework _ _) version)
platform = do
(CachePrefix prefix, SkipLocalCacheFlag skipLocalCache, verbose) <- ask
unless skipLocalCache $
Expand Down
Loading

0 comments on commit c5f860e

Please sign in to comment.