cocoapods-binary icon indicating copy to clipboard operation
cocoapods-binary copied to clipboard

Specify binary for test_spec dependencies

Open kylefleming opened this issue 5 years ago • 1 comments

Hi,

Description

I have a pod (it's currently included as a local development pod) that has a test_spec that includes dependencies (Quick in this case). I'm including the pod along with its tests using pod 'pod-name', testspecs: ["Tests"]. I would like to be able to specify that the dependencies of the test_spec should be compiled as binary. However, since the test target is generated automatically, I don't see a clear way of doing this. If possible, I want to avoid creating a dummy target or adding these test_spec dependencies to an unrelated target. I also don't want to enable all_binary!.

Is there a way to specify that these test_spec dependency pods should be built as binary?

Sample code

My use case is essentially this:

# MyPod.podspec

Pod::Spec.new do |s|
  s.name = "MyPod"
  s.test_spec 'Tests' do |test_spec|
    test_spec.dependency 'Quick'
  end
end
# Podfile

plugin 'cocoapods-binary'
use_frameworks!

target 'ProjectTarget' do
  pod 'MyPod', path: '.', testspecs: ["Tests"]
  ## How do I declare Quick to be built as a binary?
  # pod 'Quick', binary: true
end

Discussion

Since specifying the binary flag seems to be an all or nothing thing for any particular pod, would it make sense to add a way to specify that a pod should be built as binary without using a parameter on the pod directive? I'm imagining something like the following:

# Podfile

plugin 'cocoapods-binary'
use_frameworks!

binary 'PodA'

target 'TargetA' do
  pod 'PodA'
end

target 'TargetB' do
  pod 'PodA', '~> 2.1.0'
end

kylefleming avatar Apr 29 '19 18:04 kylefleming

Thank for your detail description. It doesn't be supported right now. Actually, I didn't take care about the test specs when I'm building the plugin. Currently, I have no interest in improving test specs 😂.

I don't think a separated flag for specifying binary is a good choice, as it add a new structure to the podfile, which has cognitive cost.

leavez avatar May 09 '19 09:05 leavez