Skip to content

Commit 0af792f

Browse files
authoredApr 17, 2019
Merge branch '0.5.0' into custom_options
2 parents 3043ef2 + e2b96c4 commit 0af792f

18 files changed

+814
-14
lines changed
 

‎cocoapods-binary.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
1313
spec.homepage = 'https://github.com/leavez/cocoapods-binary'
1414
spec.license = 'MIT'
1515

16-
spec.files = `git ls-files`.split($/).reject{|f| f.start_with? "test/"}
16+
spec.files = `git ls-files`.split($/).reject{|f| f.start_with?("test/") || f.start_with?('demo/')}
1717
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
1818
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
1919
spec.require_paths = ['lib']

‎demo/.bundle/config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
BUNDLE_PATH: "./.bundler_cache"

‎demo/.gitignore

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
# Created by https://www.gitignore.io/api/xcode,cocoapods
3+
# Edit at https://www.gitignore.io/?templates=xcode,cocoapods
4+
5+
### CocoaPods ###
6+
## CocoaPods GitIgnore Template
7+
8+
# CocoaPods - Only use to conserve bandwidth / Save time on Pushing
9+
# - Also handy if you have a large number of dependant pods
10+
# - AS PER https://guides.cocoapods.org/using/using-cocoapods.html NEVER IGNORE THE LOCK FILE
11+
Pods/
12+
13+
### Xcode ###
14+
# Xcode
15+
#
16+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
17+
18+
## User settings
19+
xcuserdata/
20+
21+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
22+
*.xcscmblueprint
23+
*.xccheckout
24+
25+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
26+
build/
27+
DerivedData/
28+
*.moved-aside
29+
*.pbxuser
30+
!default.pbxuser
31+
*.mode1v3
32+
!default.mode1v3
33+
*.mode2v3
34+
!default.mode2v3
35+
*.perspectivev3
36+
!default.perspectivev3
37+
38+
### Xcode Patch ###
39+
*.xcodeproj/*
40+
!*.xcodeproj/project.pbxproj
41+
!*.xcodeproj/xcshareddata/
42+
!*.xcworkspace/contents.xcworkspacedata
43+
/*.gcno
44+
**/xcshareddata/WorkspaceSettings.xcsettings
45+
46+
# End of https://www.gitignore.io/api/xcode,cocoapods
47+
48+
49+
# the bundler local cache
50+
.bundler_cache/

‎demo/Gemfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
# frozen_string_literal: true
3+
source "https://rubygems.org"
4+
5+
gem 'cocoapods', '1.6.1'
6+
gem 'cocoapods-binary', :path => "../"
7+

‎demo/Gemfile.lock

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
PATH
2+
remote: ..
3+
specs:
4+
cocoapods-binary (0.4.3)
5+
cocoapods (>= 1.5.0, < 2.0)
6+
fourflusher (~> 2.0)
7+
8+
GEM
9+
remote: https://rubygems.org/
10+
specs:
11+
CFPropertyList (3.0.0)
12+
activesupport (4.2.11.1)
13+
i18n (~> 0.7)
14+
minitest (~> 5.1)
15+
thread_safe (~> 0.3, >= 0.3.4)
16+
tzinfo (~> 1.1)
17+
atomos (0.1.3)
18+
claide (1.0.2)
19+
cocoapods (1.6.1)
20+
activesupport (>= 4.0.2, < 5)
21+
claide (>= 1.0.2, < 2.0)
22+
cocoapods-core (= 1.6.1)
23+
cocoapods-deintegrate (>= 1.0.2, < 2.0)
24+
cocoapods-downloader (>= 1.2.2, < 2.0)
25+
cocoapods-plugins (>= 1.0.0, < 2.0)
26+
cocoapods-search (>= 1.0.0, < 2.0)
27+
cocoapods-stats (>= 1.0.0, < 2.0)
28+
cocoapods-trunk (>= 1.3.1, < 2.0)
29+
cocoapods-try (>= 1.1.0, < 2.0)
30+
colored2 (~> 3.1)
31+
escape (~> 0.0.4)
32+
fourflusher (>= 2.2.0, < 3.0)
33+
gh_inspector (~> 1.0)
34+
molinillo (~> 0.6.6)
35+
nap (~> 1.0)
36+
ruby-macho (~> 1.4)
37+
xcodeproj (>= 1.8.1, < 2.0)
38+
cocoapods-core (1.6.1)
39+
activesupport (>= 4.0.2, < 6)
40+
fuzzy_match (~> 2.0.4)
41+
nap (~> 1.0)
42+
cocoapods-deintegrate (1.0.4)
43+
cocoapods-downloader (1.2.2)
44+
cocoapods-plugins (1.0.0)
45+
nap
46+
cocoapods-search (1.0.0)
47+
cocoapods-stats (1.1.0)
48+
cocoapods-trunk (1.3.1)
49+
nap (>= 0.8, < 2.0)
50+
netrc (~> 0.11)
51+
cocoapods-try (1.1.0)
52+
colored2 (3.1.2)
53+
concurrent-ruby (1.1.5)
54+
escape (0.0.4)
55+
fourflusher (2.2.0)
56+
fuzzy_match (2.0.4)
57+
gh_inspector (1.1.3)
58+
i18n (0.9.5)
59+
concurrent-ruby (~> 1.0)
60+
minitest (5.11.3)
61+
molinillo (0.6.6)
62+
nanaimo (0.2.6)
63+
nap (1.1.0)
64+
netrc (0.11.0)
65+
ruby-macho (1.4.0)
66+
thread_safe (0.3.6)
67+
tzinfo (1.2.5)
68+
thread_safe (~> 0.1)
69+
xcodeproj (1.8.2)
70+
CFPropertyList (>= 2.3.3, < 4.0)
71+
atomos (~> 0.1.3)
72+
claide (>= 1.0.2, < 2.0)
73+
colored2 (~> 3.1)
74+
nanaimo (~> 0.2.6)
75+
76+
PLATFORMS
77+
ruby
78+
79+
DEPENDENCIES
80+
cocoapods (= 1.6.1)
81+
cocoapods-binary!
82+
83+
BUNDLED WITH
84+
2.0.1

‎demo/Podfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
platform :ios, '9.0'
2+
plugin 'cocoapods-binary'
3+
4+
use_frameworks!
5+
all_binary!
6+
7+
8+
target 'demo' do
9+
10+
pod 'Masonry'
11+
12+
end

‎demo/Podfile.lock

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
PODS:
2+
- Masonry (1.1.0)
3+
4+
DEPENDENCIES:
5+
- Masonry
6+
7+
SPEC REPOS:
8+
https://github.com/cocoapods/specs.git:
9+
- Masonry
10+
11+
SPEC CHECKSUMS:
12+
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
13+
14+
PODFILE CHECKSUM: 5daab9dbab4736d6a1b3df2ffa8d856285c16553
15+
16+
COCOAPODS: 1.6.1

‎demo/demo.xcodeproj/project.pbxproj

+417
Large diffs are not rendered by default.

‎demo/demo.xcworkspace/contents.xcworkspacedata

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

‎demo/demo/AppDelegate.swift

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//
2+
// AppDelegate.swift
3+
// demo
4+
//
5+
// Created by Leavez on 2019/04/16.
6+
// Copyright © 2019 binary. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
@UIApplicationMain
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
14+
var window: UIWindow?
15+
16+
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18+
// Override point for customization after application launch.
19+
20+
let viewController = ViewController(nibName: nil, bundle: nil)
21+
let window = UIWindow(frame: UIScreen.main.bounds)
22+
window.rootViewController = viewController
23+
self.window = window
24+
window.makeKeyAndVisible()
25+
26+
return true
27+
}
28+
29+
func applicationWillResignActive(_ application: UIApplication) {
30+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
31+
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
32+
}
33+
34+
func applicationDidEnterBackground(_ application: UIApplication) {
35+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
36+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
37+
}
38+
39+
func applicationWillEnterForeground(_ application: UIApplication) {
40+
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
41+
}
42+
43+
func applicationDidBecomeActive(_ application: UIApplication) {
44+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
45+
}
46+
47+
func applicationWillTerminate(_ application: UIApplication) {
48+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
49+
}
50+
51+
52+
}
53+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
6+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7+
</dependencies>
8+
<scenes>
9+
<!--View Controller-->
10+
<scene sceneID="EHf-IW-A2E">
11+
<objects>
12+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
13+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
14+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
17+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18+
</view>
19+
</viewController>
20+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
21+
</objects>
22+
<point key="canvasLocation" x="53" y="375"/>
23+
</scene>
24+
</scenes>
25+
</document>

‎demo/demo/Info.plist

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
<key>LSRequiresIPhoneOS</key>
22+
<true/>
23+
<key>UILaunchStoryboardName</key>
24+
<string>LaunchScreen</string>
25+
<key>UIRequiredDeviceCapabilities</key>
26+
<array>
27+
<string>armv7</string>
28+
</array>
29+
<key>UISupportedInterfaceOrientations</key>
30+
<array>
31+
<string>UIInterfaceOrientationPortrait</string>
32+
<string>UIInterfaceOrientationLandscapeLeft</string>
33+
<string>UIInterfaceOrientationLandscapeRight</string>
34+
</array>
35+
<key>UISupportedInterfaceOrientations~ipad</key>
36+
<array>
37+
<string>UIInterfaceOrientationPortrait</string>
38+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
39+
<string>UIInterfaceOrientationLandscapeLeft</string>
40+
<string>UIInterfaceOrientationLandscapeRight</string>
41+
</array>
42+
</dict>
43+
</plist>

‎demo/demo/ViewController.swift

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// ViewController.swift
3+
// demo
4+
//
5+
// Created by Leavez on 2019/04/16.
6+
// Copyright © 2019 binary. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class ViewController: UIViewController {
12+
13+
override func viewDidLoad() {
14+
super.viewDidLoad()
15+
// Do any additional setup after loading the view.
16+
view.backgroundColor = .white
17+
}
18+
19+
20+
}
21+

‎demo/demo/demos/BDWebImage_demo.m

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
// this is a demo for usage
3+
#import <UIKit/UIKit.h>
4+
#import <Masonry/Masonry.h>
5+
void masonry_demo() {
6+
7+
UIView *parent_view = [UIView new];
8+
UIView *view1 = [UIView new];
9+
[parent_view addSubview:view1];
10+
11+
[view1 mas_makeConstraints:^(MASConstraintMaker *make) {
12+
make.edges.mas_equalTo(0);
13+
}];
14+
}
15+
16+

‎lib/cocoapods-binary/Prebuild.rb

+14-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,20 @@ def prebuild_frameworks!
126126
if target.static_framework? and !target.resource_paths.empty?
127127
framework_path = output_path + target.framework_name
128128
standard_sandbox_path = sandbox.standard_sanbox_path
129-
path_objects = target.resource_paths.map do |path|
129+
130+
resources = begin
131+
if Pod::VERSION.start_with? "1.5"
132+
target.resource_paths
133+
else
134+
# resource_paths is Hash{String=>Array<String>} on 1.6 and above
135+
# (use AFNetworking to generate a demo data)
136+
# https://github.com/leavez/cocoapods-binary/issues/50
137+
target.resource_paths.values.flatten
138+
end
139+
end
140+
raise "Wrong type: #{resources}" unless resources.kind_of? Array
141+
142+
path_objects = resources.map do |path|
130143
object = Prebuild::Passer::ResourcePath.new
131144
object.real_file_path = framework_path + File.basename(path)
132145
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'

‎lib/cocoapods-binary/gem_version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module CocoapodsBinary
2-
VERSION = "0.4.1"
2+
VERSION = "0.4.3"
33
end

‎lib/cocoapods-binary/rome/build_framework.rb

+34-11
Original file line numberDiff line numberDiff line change
@@ -39,45 +39,68 @@ def build_for_iosish_platform(sandbox,
3939
# paths
4040
root_name = target.pod_name
4141
module_name = target.product_module_name
42-
device_framwork_path = "#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework"
43-
simulator_framwork_path = "#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework"
42+
device_framework_path = "#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework"
43+
simulator_framework_path = "#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework"
4444

45-
device_binary = device_framwork_path + "/#{module_name}"
46-
simulator_binary = simulator_framwork_path + "/#{module_name}"
45+
device_binary = device_framework_path + "/#{module_name}"
46+
simulator_binary = simulator_framework_path + "/#{module_name}"
4747
return unless File.file?(device_binary) && File.file?(simulator_binary)
4848

4949
# the device_lib path is the final output file path
50-
# combine the bianries
50+
# combine the binaries
5151
tmp_lipoed_binary_path = "#{build_dir}/#{root_name}"
5252
lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`
5353
puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
5454
FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true
5555

5656
# collect the swiftmodule file for various archs.
57-
device_swiftmodule_path = device_framwork_path + "/Modules/#{module_name}.swiftmodule"
58-
simulator_swiftmodule_path = simulator_framwork_path + "/Modules/#{module_name}.swiftmodule"
57+
device_swiftmodule_path = device_framework_path + "/Modules/#{module_name}.swiftmodule"
58+
simulator_swiftmodule_path = simulator_framework_path + "/Modules/#{module_name}.swiftmodule"
5959
if File.exist?(device_swiftmodule_path)
6060
FileUtils.cp_r simulator_swiftmodule_path + "/.", device_swiftmodule_path
6161
end
6262

63+
# combine the generated swift headers
64+
# (In xcode 10.2, the generated swift headers vary for each archs)
65+
# https://github.com/leavez/cocoapods-binary/issues/58
66+
simulator_generated_swift_header_path = simulator_framework_path + "/Headers/#{module_name}-Swift.h"
67+
device_generated_swift_header_path = device_framework_path + "/Headers/#{module_name}-Swift.h"
68+
if File.exist? simulator_generated_swift_header_path
69+
device_header = File.read(device_generated_swift_header_path)
70+
simulator_header = File.read(simulator_generated_swift_header_path)
71+
# https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461
72+
combined_header_content = %Q{
73+
#if TARGET_OS_SIMULATOR // merged by cocoapods-binary
74+
75+
#{simulator_header}
76+
77+
#else // merged by cocoapods-binary
78+
79+
#{device_header}
80+
81+
#endif // merged by cocoapods-binary
82+
}
83+
File.write(device_generated_swift_header_path, combined_header_content.strip)
84+
end
85+
6386
# handle the dSYM files
64-
device_dsym = "#{device_framwork_path}.dSYM"
87+
device_dsym = "#{device_framework_path}.dSYM"
6588
if File.exist? device_dsym
6689
# lipo the simulator dsym
67-
simulator_dsym = "#{simulator_framwork_path}.dSYM"
90+
simulator_dsym = "#{simulator_framework_path}.dSYM"
6891
if File.exist? simulator_dsym
6992
tmp_lipoed_binary_path = "#{output_path}/#{module_name}.draft"
7093
lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`
7194
puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
72-
FileUtils.mv tmp_lipoed_binary_path, "#{device_framwork_path}.dSYM/Contents/Resources/DWARF/#{module_name}", :force => true
95+
FileUtils.mv tmp_lipoed_binary_path, "#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}", :force => true
7396
end
7497
# move
7598
FileUtils.mv device_dsym, output_path, :force => true
7699
end
77100

78101
# output
79102
output_path.mkpath unless output_path.exist?
80-
FileUtils.mv device_framwork_path, output_path, :force => true
103+
FileUtils.mv device_framework_path, output_path, :force => true
81104

82105
end
83106

0 commit comments

Comments
 (0)
Please sign in to comment.