Skip to content

Add s3 support #1

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

Merged
merged 3 commits into from
May 22, 2019
Merged

Add s3 support #1

merged 3 commits into from
May 22, 2019

Conversation

jaximan
Copy link

@jaximan jaximan commented May 11, 2019

Let me know if I can improve my changes, first time code in Ruby, maybe there is better way for some steps

jaximan and others added 2 commits May 10, 2019 22:04
[WIP] fix condition when target shouldn't build, but target_folder not exists
@Rag0n
Copy link
Owner

Rag0n commented May 12, 2019

Sorry for the slow response

@jaximan
Copy link
Author

jaximan commented May 13, 2019

@Rag0n No worries.

@jaximan
Copy link
Author

jaximan commented May 17, 2019

@Rag0n Any luck on review my changes?

end

# Path of the target's cache
#
# @return [Pathname]
def self.framework_cache_path_for(target, options)
framework_cache_path = cache_root + xcode_version
framework_cache_path = Pathname.new('')
if include_cache_root
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include_cache_root parameter is missing in method signature. Also I would rather split this method in two separate methods: local_framework_cache_path and s3_framework_cache_path, because flag parameter is a code smell.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Dir.mktmpdir {|dir|
s3.bucket(Podfile::DSL.s3_options[:bucket]).object("#{s3_cache_path}").get(response_target: "#{dir}/framework.zip")
unzip("#{dir}/framework.zip", path)
return true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this return relates to mktmpdir's closure scope. And because of it return value of self.has? is actually equal to the return value of Dir.mktmpdir. Instead you should assign result to true

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -12,27 +14,89 @@ class SharedCache
# @return [Boolean]
def self.has?(target, options)
if Podfile::DSL.shared_cache_enabled
framework_cache_path_for(target, options).exist?
path = framework_cache_path_for(target, options, true)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather move local and s3 checks into separate methods to improve readability and here just call them: has_local_cache_for(target, options) || has_s3_cache_for(target, options)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Rag0n
Copy link
Owner

Rag0n commented May 17, 2019

@jaximan
Actually I have reviewed PR 5 days ago and forgot to click on submit review :/

@jaximan
Copy link
Author

jaximan commented May 20, 2019

@Rag0n Made a changes based on your comments. There is one problem I have, fastlane-plugin-s3 is using aws sdk v2 with hardcoded version, which is incompatible with these changes. Not sure of moving to v2 or introduce version bump for that plugin.

@Rag0n
Copy link
Owner

Rag0n commented May 22, 2019

Looks good. I think it would be better to move to v2, but it's not a big issue. I mean I can merge it as is.

@jaximan
Copy link
Author

jaximan commented May 22, 2019

Let's merge it, I created PR for that library: fastlane-community/fastlane-plugin-s3#72
Will see if they open to upgrade, if not I will send you another PR then.

@Rag0n Rag0n merged commit b5fd780 into Rag0n:shared_cache May 22, 2019
@jaximan jaximan deleted the patch-1 branch May 25, 2019 00:07
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