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

Support for carthage --cache-builds flag #47

Closed
t089 opened this issue Mar 16, 2017 · 10 comments
Closed

Support for carthage --cache-builds flag #47

t089 opened this issue Mar 16, 2017 · 10 comments

Comments

@t089
Copy link

t089 commented Mar 16, 2017

Hey,

carthage 0.20.0 introduced the --cache-builds flag, which generates .NAME.version version files for each built framework. When building a dependency carthage will use these version files to check if a corresponding build artefact is already available and skip the build. Would be great if rome could store these version files alongside the frameworks in the S3 cache and restore them during a rome download.

Thank you!

@tmspzz
Copy link
Owner

tmspzz commented Mar 17, 2017

Interesting, I will take a look at that.

Notes to self:

  • I think I get the idea and this can work great with Rome.
  • Where are these files stored? Are they loose in the "Build" directory?
  • How to bundle each file with the framework? Not bundle it and download it separately?

@tmspzz
Copy link
Owner

tmspzz commented Mar 17, 2017

@t089 Maybe I ask what the use case for this is?

Usually the workflow with rome resembles the following:

rome download --platform ios && rome list --missing --platform ios | awk '{print $1}' | xargs carthage build --platform ios

So carthage is only triggered to build the frameworks that are currently missing from the cache.

@t089
Copy link
Author

t089 commented Mar 17, 2017

Very good questing. Let me explain:

Say you have a dependency FrameworkA that itself depends on FrameworkB and FrameworkC.

Now, FramworkA needs an update. In your example Rome would fail to download FramworkA from cache and would trigger a carthage build. Carthage would then build FrameworkA but would also build its dependencies FrameworkB and FrameworkC, although they did not change and are already present in the Build/ folder (because Rome downloaded them). With the new --cache-builds option carthage can reuse the existing FrameworkB and FrameworkC build artefacts, but only if the corresponding version file exists.

We are working a lot with internal frameworks that are included in the main app as carthage dependencies. Our frameworks also have some 3rd party dependencies and it's always painful to watch carthage build stuff that is already there waiting to be used...

@tmspzz
Copy link
Owner

tmspzz commented Mar 17, 2017

@t089 I understand. Thanks for explaining, I think we have the same issue but never noticed.

Do you have any opinion on the implementation details I have made a note of to myself in the first comment?

@tmspzz
Copy link
Owner

tmspzz commented Mar 19, 2017

@t089 Please try pre-release https://github.com/blender/Rome/releases/tag/v0.10.0.21

Let me know if it works as expected and I will proceed with a full release.

@t089
Copy link
Author

t089 commented Mar 20, 2017

Awesome, that was quick, nice work. May I ask which route of implementing it you chose? I ran a quick test rome upload and it reported Uploaded .Xy.version to: Xy/.Xy.version-3.3.1. But rome download xy did not seem to restore the version file locally.

@tmspzz
Copy link
Owner

tmspzz commented Mar 20, 2017

I implemented the following:

  • Version Files are uploaded to <git-repo-name>/.<git-repo-name>.version-<carthage-resolved-version-hash>
  • Version Files are restored to Carthage/Build

Seems to work for me, I'm running:

$ rm  Carthage/Build/.KeychainAccess.version #remove the original version

$ rm ~/Library/Caches/Rome/KeychainAccess/.KeychainAccess.version-v2.4.0 #remove the local cached version

$ rome download KeychainAccess --platform iOS -v #download framework
09:07:12 2017-03-20 - Found KeychainAccess in local cache at: /Users/blender/Library/Caches/Rome/KeychainAccess/iOS/KeychainAccess.framework-v2.4.0.zip
09:07:12 2017-03-20 - Staring to unzip KeychainAccess.framework-v2.4.0.zip
09:07:12 2017-03-20 - Unzipped KeychainAccess from: KeychainAccess.framework-v2.4.0.zip
09:07:12 2017-03-20 - Found KeychainAccess.dSYM in local cache at: /Users/blender/Library/Caches/Rome/KeychainAccess/iOS/KeychainAccess.framework.dSYM-v2.4.0.zip
09:07:12 2017-03-20 - Staring to unzip KeychainAccess.framework.dSYM-v2.4.0.zip
09:07:12 2017-03-20 - Unzipped KeychainAccess from: KeychainAccess.framework.dSYM-v2.4.0.zip
09:07:12 2017-03-20 - Started downloading .KeychainAccess.version from: KeychainAccess/.KeychainAccess.version-v2.4.0
09:07:21 2017-03-20 - Downloaded 0.0 MB of 0.0 MB for .KeychainAccess.version
09:07:21 2017-03-20 - Downloaded .KeychainAccess.version from: KeychainAccess/.KeychainAccess.version-v2.4.0
09:07:21 2017-03-20 - Copying .KeychainAccess.version to: /Users/blender/Library/Caches/Rome/KeychainAccess/.KeychainAccess.version-v2.4.0

$ ls Carthage/Build/.KeychainAccess.version 
-rw-r--r--  1 blender  staff   661B Mar 20 09:07 Carthage/Build/.KeychainAccess.version

@t089
Copy link
Author

t089 commented Mar 20, 2017

Oh, boy was probably too early in the morning 💤, of course I was using the pre-release version binary only for the upload but not for the download command. Ok, seems to work for me as well. Thank you 👍

@tmspzz
Copy link
Owner

tmspzz commented Mar 20, 2017

Great, I will test a little more and hopefully promote the tag to full release :)

@t089 Thanks for suggesting this feature. I look forward to hear more feedback.

@tmspzz
Copy link
Owner

tmspzz commented Mar 21, 2017

Looks like it's working. Full release it is!

@tmspzz tmspzz closed this as completed Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants