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

Add cache prefix to remote framework upload path with engine #192

Merged
merged 3 commits into from
Jun 19, 2019

Conversation

BalestraPatrick
Copy link
Contributor

This fixes an issue where if a cachePrefix was specified and the Romefile was set up to use an engine, the path passed to the engine would not be prefixed with cachePrefix.

  • Before the patch:
    $ rome list --cache-prefix MyAmazingPrefix passed Alamofire/iOS/Alamofire.framework-4.8.2.zip to the engine script.
  • After the patch:
    $ rome list --cache-prefix MyAmazingPrefix passes MyAmazingPrefix /Alamofire/iOS/Alamofire.framework-4.8.2.zip to the engine script.

@hlintBot
Copy link

hlintBot commented Jun 18, 2019

15 Warnings
⚠️ src/Lib.hs#L262 - Found Reduce duplication

let finalRepositoryMapEntries
      = if _noIgnore noIgnoreFlag then repositoryMapEntries else
          repositoryMapEntries `filterRomeFileEntriesByPlatforms`
            ignoreMapEntries
let repositoryMap = toRepositoryMap finalRepositoryMapEntries
let reverseRepositoryMap
      = toInvertedRepositoryMap finalRepositoryMapEntries
let finalIgnoreNames
      = if _noIgnore noIgnoreFlag then [] else ignoreFrameworks

Why Not

Combine with src/Lib.hs:365:5

    
⚠️ src/Lib.hs#L281 - Found Reduce duplication

let filteredCurrentMapEntries
      = currentMapEntries `filterRomeFileEntriesByPlatforms`
          ignoreMapEntries
let currentFrameworks
      = concatMap (snd . romeFileEntryToTuple) filteredCurrentMapEntries
let currentFrameworkVersions
      = map (flip FrameworkVersion currentVersion) currentFrameworks
let currentInvertedMap
      = toInvertedRepositoryMap filteredCurrentMapEntries

Why Not

Combine with src/Lib.hs:401:15

    
⚠️ src/Lib.hs#L301 - Found Redundant bracket

if _noSkipCurrent noSkipCurrentFlag then
  (currentFrameworkVersions `filterOutFrameworksAndVersionsIfNotIn`
     finalIgnoreNames)
  else []

Why Not

if _noSkipCurrent noSkipCurrentFlag then
  currentFrameworkVersions `filterOutFrameworksAndVersionsIfNotIn`
    finalIgnoreNames
  else []

    
⚠️ src/Lib.hs#L927 - Found Reduce duplication

dwarfUUIDs <- dwarfUUIDsFrom (frameworkDirectory </> fwn)
maybeUUIDsArchives <- liftIO $
                        forM dwarfUUIDs $
                          \ dwarfUUID ->
                            runMaybeT $
                              do dwarfArchive <- exceptToMaybeT $
                                                   createZipArchive (bcSymbolMapPath dwarfUUID)
                                                     verbose
                                 return (dwarfUUID, dwarfArchive)
unless skipLocalCache $
  forM_ maybeUUIDsArchives $
    mapM $
      \ (dwarfUUID, dwarfArchive) ->
        maybe (return ()) liftIO $
          runReaderT <$>
            (saveBcsymbolmapToLocalCache <$> mlCacheDir <*> Just dwarfUUID <*>
               Just dwarfArchive
               <*> Just reverseRomeMap
               <*> Just fVersion
               <*> Just platform)
            <*> Just (cachePrefix, s, verbose)

Why Not

Combine with src/Lib.hs:1135:7

    
⚠️ src/Lib.hs#L962 - Found Reduce duplication

frameworkNameWithFrameworkExtension = appendFrameworkExtensionTo f
platformBuildDirectory
  = carthageArtifactsBuildDirectoryForPlatform platform f
frameworkDirectory
  = platformBuildDirectory </> frameworkNameWithFrameworkExtension
dSYMNameWithDSYMExtension
  = frameworkNameWithFrameworkExtension <> ".dSYM"
dSYMdirectory
  = platformBuildDirectory </> dSYMNameWithDSYMExtension
bcSymbolMapPath d
  = platformBuildDirectory </> bcsymbolmapNameFrom d

Why Not

Combine with src/Lib.hs:1042:3

    
⚠️ src/Lib.hs#L962 - Found Reduce duplication

frameworkNameWithFrameworkExtension = appendFrameworkExtensionTo f
platformBuildDirectory
  = carthageArtifactsBuildDirectoryForPlatform platform f
frameworkDirectory
  = platformBuildDirectory </> frameworkNameWithFrameworkExtension
dSYMNameWithDSYMExtension
  = frameworkNameWithFrameworkExtension <> ".dSYM"
dSYMdirectory
  = platformBuildDirectory </> dSYMNameWithDSYMExtension
bcSymbolMapPath d
  = platformBuildDirectory </> bcsymbolmapNameFrom d

Why Not

Combine with src/Lib.hs:1170:3

    
⚠️ src/Lib.hs#L1228 - Found Reduce duplication

saveBinaryToLocalCache lCacheDir versionFileBinary
  (prefix </> versionFileRemotePath)
  versionFileName
  verbose
liftIO $ saveBinaryToFile versionFileBinary versionFileLocalPath
sayFunc $
  "Copied " <> versionFileName <> " to: " <> versionFileLocalPath

Why Not

Combine with src/Lib.hs:1742:17

    
⚠️ src/Lib.hs#L1243 - Found Reduce duplication

versionFileName
  = versionFileNameForProjectName $ fst projectNameAndVersion
versionFileLocalPath = carthageBuildDirectory </> versionFileName
versionFileRemotePath = remoteVersionFilePath projectNameAndVersion

Why Not

Combine with src/Lib.hs:1757:3

    
⚠️ src/Lib.hs#L1344 - Found Reduce duplication

saveBinaryToLocalCache lCacheDir frameworkBinary
  (prefix </> remoteFrameworkUploadPath)
  fwn
  verbose
deleteFrameworkDirectory fVersion platform verbose
unzipBinary frameworkBinary fwn frameworkZipName verbose <*
  ifExists frameworkExecutablePath
    (makeExecutable frameworkExecutablePath)

Why Not

Combine with src/Lib.hs:1557:17

    
⚠️ src/Lib.hs#L1376 - Found Reduce duplication

let symbolmapLoggingName
      = fwn <> "." <> bcsymbolmapNameFrom dwarfUUID
let bcsymbolmapZipName d = bcsymbolmapArchiveName d version
let localBcsymbolmapPathFrom d
      = platformBuildDirectory </> bcsymbolmapNameFrom d

Why Not

Combine with src/Lib.hs:1588:21

    
⚠️ src/Lib.hs#L1386 - Found Reduce duplication

saveBinaryToLocalCache lCacheDir symbolmapBinary
  (prefix </> remoteBcSymbolmapUploadPathFromDwarf dwarfUUID)
  fwn
  verbose
deleteFile (localBcsymbolmapPathFrom dwarfUUID) verbose
unzipBinary symbolmapBinary symbolmapLoggingName
  (bcsymbolmapZipName dwarfUUID)
  verbose

Why Not

Combine with src/Lib.hs:1598:21

    
⚠️ src/Lib.hs#L1421 - Found Reduce duplication

saveBinaryToLocalCache lCacheDir dSYMBinary
  (prefix </> remotedSYMUploadPath)
  dSYMName
  verbose
deleteDSYMDirectory fVersion platform verbose
unzipBinary dSYMBinary dSYMName dSYMZipName verbose

Why Not

Combine with src/Lib.hs:1632:17

    
⚠️ src/Lib.hs#L1432 - Found Reduce duplication

frameworkZipName = frameworkArchiveName f version
remoteFrameworkUploadPath
  = remoteFrameworkPath platform reverseRomeMap f version
remoteBcSymbolmapUploadPathFromDwarf dwarfUUID
  = remoteBcsymbolmapPath dwarfUUID platform reverseRomeMap f version
dSYMZipName = dSYMArchiveName f version
remotedSYMUploadPath
  = remoteDsymPath platform reverseRomeMap f version
platformBuildDirectory
  = carthageArtifactsBuildDirectoryForPlatform platform f
dSYMName = fwn <> ".dSYM"
frameworkExecutablePath
  = frameworkBuildBundleForPlatform platform f </> fwn

Why Not

Combine with src/Lib.hs:1643:3

    
⚠️ src/Lib.hs#L1474 - Found Use lambda-case

\ e ->
  case e of
      ErrorGettingDwarfUUIDs -> sayFunc $
                                  "Error: Cannot retrieve symbolmaps ids for " <> fwn
      (FailedDwarfUUIDs dwardUUIDsAndErrors) -> mapM_ (sayFunc . snd)
                                                  dwardUUIDsAndErrors

Why Not

\case
    ErrorGettingDwarfUUIDs -> sayFunc $
                                "Error: Cannot retrieve symbolmaps ids for " <> fwn
    (FailedDwarfUUIDs dwardUUIDsAndErrors) -> mapM_ (sayFunc . snd)
                                                dwardUUIDsAndErrors

    
⚠️ src/Lib.hs#L1686 - Found Use lambda-case

\ e ->
  case e of
      ErrorGettingDwarfUUIDs -> sayFunc $
                                  "Error: Cannot retrieve symbolmaps ids for " <> fwn
      (FailedDwarfUUIDs dwardUUIDsAndErrors) -> mapM_ (sayFunc . snd)
                                                  dwardUUIDsAndErrors

Why Not

\case
    ErrorGettingDwarfUUIDs -> sayFunc $
                                "Error: Cannot retrieve symbolmaps ids for " <> fwn
    (FailedDwarfUUIDs dwardUUIDsAndErrors) -> mapM_ (sayFunc . snd)
                                                dwardUUIDsAndErrors

    

Generated by 🚫 Danger

@BalestraPatrick BalestraPatrick force-pushed the fix-engine-cache-prefix-probing branch from cf46546 to bb149a3 Compare June 18, 2019 20:46
@BalestraPatrick BalestraPatrick force-pushed the fix-engine-cache-prefix-probing branch from bb149a3 to 1b45880 Compare June 19, 2019 06:37
@tmspzz
Copy link
Owner

tmspzz commented Jun 19, 2019

👏 Thanks! Well done!

@tmspzz tmspzz merged commit 5458036 into tmspzz:master Jun 19, 2019
@tmspzz tmspzz deleted the fix-engine-cache-prefix-probing branch June 19, 2019 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants