-
Notifications
You must be signed in to change notification settings - Fork 348
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 a Podfile option to reuse an external source specification #585
base: master
Are you sure you want to change the base?
Conversation
a7ac8fb
to
6e42515
Compare
Why does this need to be an option? It seems like we can default to this . behavior? |
Agreed. further more this can also be a method inside the |
@segiddins - Are we certain that this won't break any existing flow? |
6e42515
to
f29086f
Compare
def jsonkit_pod
pod 'JSONKit', :podspec => 'https://example.com/JSONKit.podspec'
end And then use that method across targets? |
That's what I'm using right now, but I thought a first-party way would be nicer for everyone. I do think that @segiddins is right - it can be inferred and not need a separate option. What do you think? |
Inferring sounds good. |
Tried to hack it today, this seems non trivial. I'll try to find time for it on the weekend. |
f29086f
to
d67843a
Compare
Done, figured it out! Some of the tests were failing because iterating over dependencies mutated the target definitions. |
if requirements.empty? || requirements.last.is_a?(Hash) | ||
theoretical_dependency = Dependency.new(name, requirements.last) | ||
if theoretical_dependency.external_source.nil? | ||
previously_defined_dependency = dependencies.find do |dependency| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how will this linear scan perform on very large podfiled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bit of a Shlemiel effect here, but ultimately it's all done in-memory and my profiling for 70 total pods shows an increase from 3% samples to 7%.
What do you think? Should I optimize now or can this be done later? I mean, I've made several optimizations recently that outweigh this by a margin 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably fine for now, but we might want to eventually put it in a hash for constant-time lookup
@@ -174,7 +174,7 @@ def abstract=(abstract) | |||
# @return [String] the inheritance mode for this target definition. | |||
# | |||
def inheritance | |||
get_hash_value('inheritance', 'complete') | |||
get_hash_value('inheritance') || 'complete' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed several getters to avoid mutating the hash because iterating over deps mutated them.
The code assumed, previously, (and implicitly) that deps only get evaluated after the Podfile
is completely scanned.
However, going over previously added deps before the entire Podfile
is scanned mutated things and now it doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍. Is there a test that will fail if we accidentally go back to the old behavior later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to continue this @igor-makarov ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hadn't had the time to think about this yet.. Sorry 😭
a5a891b
to
77365e0
Compare
77365e0
to
b64674c
Compare
If a dependency was already defined using an external source, reuse that definition: