Subito-it / PodBuilder

A tool to precompile CocoaPods pods
Other
284 stars 28 forks source link

How to use switch command? #31

Closed chml closed 3 years ago

chml commented 3 years ago

Seems not working?

Demo: https://github.com/chml/BuilderTest.git

~/Desktop/BuilderTest/Example master*
❯ pod_builder switch AFNetworking -s

Did not find pod 'AFNetworking'
/Users/a/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/pod-builder-3.0.1/lib/pod_builder/command/switch.rb:20:in `block in call'
    /Users/a/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/pod-builder-3.0.1/lib/pod_builder/command/switch.rb:17:in `each'
    /Users/a/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/pod-builder-3.0.1/lib/pod_builder/command/switch.rb:17:in `call'
    /Users/a/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/pod-builder-3.0.1/exe/pod_builder:371:in `block in parse_commandline'
    /Users/a/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/pod-builder-3.0.1/exe/pod_builder:370:in `each'
    /Users/a/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/pod-builder-3.0.1/exe/pod_builder:370:in `parse_commandline'
    /Users/a/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/pod-builder-3.0.1/exe/pod_builder:386:in `<top (required)>'
    /Users/a/.rbenv/versions/2.7.2/bin/pod_builder:23:in `load'
    /Users/a/.rbenv/versions/2.7.2/bin/pod_builder:23:in `<main>'

Command failed!
tcamin commented 3 years ago

Thanks for the report, will look at it asap

tcamin commented 3 years ago

I pushed a few changes to master with (I hope) a more self-explanatory error for your specific use case. The issue is that in your sample repo AFNetworking is not explicitly declared in the PodBuilder's Podfile, being an implicit dep of the BuilderTest. While explicitly declaring all switchable pods might seem like a major limitation (and maybe to some extent it is), it allows to keep the switch command fast independently of the number of pods.

Try installing latest version:

$ git clone -b feature/catalyst_support https://github.com/Subito-it/PodBuilder.git $ cd PodBuilder $ sudo rake install

chml commented 3 years ago

I add pod 'AFNetworking' in PodBuilder/Podfile explicitly; and pod_builder switch -s AFNetworking seems to work, but now it can't switch back to prebuild mode; And ./Podfile changed to:

  8 target 'BuilderTest_Example' do
  9   pod 'AFNetworking' # pb<BuilderTest>
 10   pod 'BuilderTest', :path => 'PodBuilder/Prebuilt/BuilderTest' # pb<BuilderTest>
 11   pod 'AFNetworking' # pb<AFNetworking>
 12
 13   target 'BuilderTest_Tests' do
 14     inherit! :search_paths
 15
 16
 17   end
 18 end
chml commented 3 years ago

And there is another issue in the demo project:

 be pod_builder switch -s BuilderTest
Analyzing dependencies
[!] No podspec found for `BuilderTest` in `../..`

Seems switch command does't convert the local path ../../ back to '../'

tcamin commented 3 years ago

I pushed a couple of changes, both issues should be fixed.

chml commented 3 years ago

Works great now. Thank you!