Core icon indicating copy to clipboard operation
Core copied to clipboard

Add a Podfile option to reuse an external source specification

Open igor-makarov opened this issue 5 years ago • 8 comments

If a dependency was already defined using an external source, reuse that definition:

    # define an external source
    target 'TargetA' do
      pod 'JSONKit', :podspec => 'https://example.com/JSONKit.podspec'
    end
    # reuse it
    target 'TargetB' do
      pod 'JSONKit', :use_previous_external_source => true
    end

igor-makarov avatar Sep 03 '19 08:09 igor-makarov

Why does this need to be an option? It seems like we can default to this . behavior?

segiddins avatar Oct 01 '19 22:10 segiddins

Agreed. further more this can also be a method inside the Podfile to simplify this?

dnkoutso avatar Oct 01 '19 23:10 dnkoutso

@segiddins - Are we certain that this won't break any existing flow? @dnkoutso - Can you specify what kind of interface you're imagining?

igor-makarov avatar Oct 03 '19 05:10 igor-makarov

def jsonkit_pod
  pod 'JSONKit', :podspec => 'https://example.com/JSONKit.podspec'
end

And then use that method across targets?

dnkoutso avatar Oct 03 '19 16:10 dnkoutso

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?

igor-makarov avatar Oct 03 '19 17:10 igor-makarov

Inferring sounds good.

dnkoutso avatar Dec 04 '19 23:12 dnkoutso

Tried to hack it today, this seems non trivial.

I'll try to find time for it on the weekend.

igor-makarov avatar Dec 05 '19 06:12 igor-makarov

Done, figured it out!

Some of the tests were failing because iterating over dependencies mutated the target definitions.
I've changed some of the getters on TargetDefinition to not add a nil value to the hash in the getter. This didn't break anything AFAIK but please review it thoroughly.

igor-makarov avatar Dec 07 '19 13:12 igor-makarov