Skip to content
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

Fix copying framework when building a new version #84

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
osx_image: xcode9.3
osx_image: xcode10.2
language: objective-c
cache:
- cocoapods
- bundler
gemfile: test/Gemfile
before_install:
- gem install cocoapods
- unset CPATH
install:
- bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
- bundle exec pod setup
script:
- rake install
- cd test
Expand Down
2 changes: 1 addition & 1 deletion cocoapods-binary.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
spec.add_dependency "fourflusher", "~> 2.0"
spec.add_dependency "xcpretty", "~> 0.3.0"

spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'bundler', '> 1.3'
spec.add_development_dependency 'rake'
end
8 changes: 6 additions & 2 deletions lib/cocoapods-binary/rome/build_framework.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def build_for_iosish_platform(sandbox,
module_name = target.product_module_name
device_framework_path = "#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{module_name}.framework"
simulator_framework_path = "#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{module_name}.framework"
output_framework_path = "#{output_path}/#{module_name}.framework"

device_binary = device_framework_path + "/#{module_name}"
simulator_binary = simulator_framework_path + "/#{module_name}"
Expand Down Expand Up @@ -86,6 +87,7 @@ def build_for_iosish_platform(sandbox,

# handle the dSYM files
device_dsym = "#{device_framework_path}.dSYM"
device_dsym_output_path = "#{output_framework_path}.dSYM"
if File.exist? device_dsym
# lipo the simulator dsym
simulator_dsym = "#{simulator_framework_path}.dSYM"
Expand All @@ -96,12 +98,14 @@ def build_for_iosish_platform(sandbox,
FileUtils.mv tmp_lipoed_binary_path, "#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}", :force => true
end
# move
FileUtils.mv device_dsym, output_path, :force => true
FileUtils.rm_r device_dsym_output_path if Dir.exist? device_dsym_output_path
File.rename device_dsym, device_dsym_output_path
end

# output
output_path.mkpath unless output_path.exist?
FileUtils.mv device_framework_path, output_path, :force => true
FileUtils.rm_r output_framework_path if Dir.exist? output_framework_path
File.rename device_framework_path, output_framework_path

end

Expand Down
37 changes: 35 additions & 2 deletions test/change_podfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def addSwiftPod():
"""
keep_source_code_for_prebuilt_frameworks!

pod "RxCocoa", :binary => true
pod "RxCocoa", "~> 4.0", :binary => true
pod "Literal", :binary => true
"""),
"""
Expand All @@ -70,7 +70,7 @@ def revertToSourceCode():
"""
keep_source_code_for_prebuilt_frameworks!

pod "RxCocoa", :binary => true
pod "RxCocoa", "~> 4.0", :binary => true
pod "Literal"
"""),
"""
Expand Down Expand Up @@ -233,6 +233,39 @@ class A {
"""
)

def oldPodVersion():
return (wrapper(
"""
pod "ReactiveSwift", "= 3.0.0", :binary => true
""") ,
"""
import ReactiveSwift
class A {
// Works on 3.x but not 4.x
let a = A.b(SignalProducer<Int, NSError>.empty)
static func b<U: BindingSource>(_ b: U) -> Bool {
return true
}
}
"""
)

def upgradePodVersion():
return (wrapper(
"""
pod "ReactiveSwift", "= 4.0.0", :binary => true
""") ,
"""
import ReactiveSwift
class A {
func b() {
// Works on 4.x but not 3.x
Lifetime.make().token.dispose()
}
}
"""
)


if __name__ == "__main__":
arg = sys.argv[1]
Expand Down
4 changes: 2 additions & 2 deletions test/test.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh
set -e
set -ex

build() {
xcodebuild -workspace Binary.xcworkspace -scheme Binary ONLY_ACTIVE_ARCH=YES CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -quiet || exit 1
}

rm -rf Pods

cases=("initial" "addSwiftPod" "revertToSourceCode" "addDifferentNamePod" "addSubPod" "deleteAPod" "addVendoredLibPod" "universalFlag" "multiplePlatforms" "multiplePlatformsWithALLFlag")
cases=("initial" "addSwiftPod" "revertToSourceCode" "addDifferentNamePod" "addSubPod" "deleteAPod" "addVendoredLibPod" "universalFlag" "multiplePlatforms" "multiplePlatformsWithALLFlag" "oldPodVersion" "upgradePodVersion")
for action in ${cases[@]}; do
python change_podfile.py ${action}
bundle exec pod install
Expand Down