Compare commits

..

12 Commits

Author SHA1 Message Date
leavez
0cfa27a897 bump to 0.4.2 2019-03-24 23:54:11 +08:00
leavez
d5c0101154 lipo the dsym of simulator 2019-03-24 21:45:02 +08:00
Leave
5dc20e3c98
Merge pull request #48 from leavez/dsym
fix missing of dSYM for dynamic framework
2019-03-18 01:35:51 +08:00
leavez
a60a69d9f4 fix copying dsym 2019-03-18 01:23:37 +08:00
Leavez
8eae79faa4 copy dsym files when building framwork 2019-03-17 20:18:05 +08:00
Leavez
30cbf7f1c5 remove additional bicode flag 2019-03-17 18:35:44 +08:00
Leave
33ae8908bd Merge pull request #32 from dev4dev/bitcode-fix
Added missing flag for enabling bitcode
2019-03-17 18:33:52 +08:00
Leave
02383b2538 Merge pull request #47 from hardworker/update_options_passing
Update behaviour fixing (issue #38)
2019-03-17 18:33:00 +08:00
Leavez
551d99c5d8 fix all_binary 2019-03-05 15:42:14 +08:00
Leave
75f0ae9f2b Merge pull request #45 from leavez/fix#29
Fix #29
2019-03-05 01:38:19 +08:00
leavez
671ebddf20 fix resource_bundle bugs when static framework
fix https://github.com/leavez/cocoapods-binary/issues/29
2019-03-05 01:00:43 +08:00
hardworker
5962d88538 Added lockfile parameter passing to installer initializer 2019-02-27 01:18:38 +08:00
28 changed files with 176 additions and 1007 deletions

View File

@ -1,13 +1,9 @@
<p align="center"><img src="/test/logo.png" width="622"></p>
# cocoapods-binary
[![Build Status](https://travis-ci.org/leavez/cocoapods-binary.svg?branch=master)](https://travis-ci.org/leavez/cocoapods-binary)
A CocoaPods plugin to integrate pods in form of prebuilt frameworks, not source code, by adding **just one flag** in podfile. Speed up compiling dramatically.
Good news: Introduction on cocoapods offical site: [Pre-compiling dependencies](http://guides.cocoapods.org/plugins/pre-compiling-dependencies.html) ( NOTE: This plugin is a community work, not official.)
## Why
You may wonder why CocoaPods doesn't have a function to integrate libs in form of binaries, if there are dozens or hundreds of pods in your podfile and compile them for a great many times meaninglessly. Too many source code of libs slow down your compile and the response of IDE (e.g. code completion), and then reduce work efficiency, leaving us time to think about the meaning of life.

View File

@ -2,8 +2,6 @@ require_relative 'helper/podfile_options'
require_relative 'helper/feature_switches'
require_relative 'helper/prebuild_sandbox'
require_relative 'helper/passer'
require_relative 'helper/names'
# NOTE:
@ -26,9 +24,13 @@ module Pod
# make a symlink to target folder
prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)
# if spec used in multiple platforms, it may return multiple paths
target_names = prebuild_sandbox.existed_target_names_for_pod_name(self.name)
real_file_folder = prebuild_sandbox.framework_folder_path_for_pod_name(self.name)
target_folder = standard_sanbox.pod_dir(self.name)
target_folder.rmtree if target_folder.exist?
target_folder.mkdir
# make a relatvie symbol link for all children
def walk(path, &action)
path.children.each do |child|
result = action.call(child, &action)
@ -48,51 +50,31 @@ module Pod
target = target_folder + source.relative_path_from(basefolder)
make_link(source, target)
end
target_names.each do |name|
# symbol link copy all substructure
real_file_folder = prebuild_sandbox.framework_folder_path_for_target_name(name)
# If have only one platform, just place int the root folder of this pod.
# If have multiple paths, we use a sperated folder to store different
# platform frameworks. e.g. AFNetworking/AFNetworking-iOS/AFNetworking.framework
target_folder = standard_sanbox.pod_dir(self.name)
if target_names.count > 1
target_folder += real_file_folder.basename
# symbol link copy all substructure
walk(real_file_folder) do |child|
source = child
# only make symlink to file and `.framework` folder
if child.directory? and [".framework", ".dSYM"].include? child.extname
mirror_with_symlink(source, real_file_folder, target_folder)
next false # return false means don't go deeper
elsif child.file?
mirror_with_symlink(source, real_file_folder, target_folder)
next true
else
next true
end
target_folder.rmtree if target_folder.exist?
target_folder.mkpath
end
walk(real_file_folder) do |child|
source = child
# only make symlink to file and `.framework` folder
if child.directory? and child.extname == ".framework"
mirror_with_symlink(source, real_file_folder, target_folder)
next false # return false means don't go deeper
elsif child.file?
mirror_with_symlink(source, real_file_folder, target_folder)
next true
else
next true
end
# symbol link copy resource for static framework
hash = Prebuild::Passer.resources_to_copy_for_static_framework || {}
path_objects = hash[self.name]
if path_objects != nil
path_objects.each do |object|
make_link(object.real_file_path, object.target_file_path)
end
# symbol link copy resource for static framework
hash = Prebuild::Passer.resources_to_copy_for_static_framework || {}
path_objects = hash[name]
if path_objects != nil
path_objects.each do |object|
make_link(object.real_file_path, object.target_file_path)
end
end
end # of for each
end # of method
end
end
end
end
@ -113,7 +95,7 @@ module Pod
changes = Pod::Prebuild::Passer.prebuild_pods_changes
updated_names = []
if changes == nil
updated_names = PrebuildSandbox.from_standard_sandbox(self.sandbox).exsited_framework_pod_names
updated_names = PrebuildSandbox.from_standard_sandbox(self.sandbox).exsited_framework_names
else
added = changes.added
changed = changes.changed
@ -145,59 +127,58 @@ module Pod
# call original
old_method2.bind(self).()
# ...
# ...
# ...
# after finishing the very complex orginal function
# check
self.validate_every_pod_only_have_one_form
# check the prebuilt targets
targets = self.prebuild_pod_targets
targets_have_different_platforms = targets.select {|t| t.pod_name != t.name }
# prepare
cache = []
def add_vendered_framework(spec, platform, added_framework_file_path)
if spec.attributes_hash[platform] == nil
spec.attributes_hash[platform] = {}
end
vendored_frameworks = spec.attributes_hash[platform]["vendored_frameworks"] || []
vendored_frameworks = [vendored_frameworks] if vendored_frameworks.kind_of?(String)
vendored_frameworks += [added_framework_file_path]
spec.attributes_hash[platform]["vendored_frameworks"] = vendored_frameworks
end
def empty_source_files(spec)
spec.attributes_hash["source_files"] = []
["ios", "watchos", "tvos", "osx"].each do |plat|
if spec.attributes_hash[plat] != nil
spec.attributes_hash[plat]["source_files"] = []
end
end
if targets_have_different_platforms.count > 0
names = targets_have_different_platforms.map(&:pod_name)
STDERR.puts "[!] Binary doesn't support pods who integrate in 2 or more platforms simultaneously: #{names}".red
exit
end
specs = self.analysis_result.specifications
prebuilt_specs = (specs.select do |spec|
self.prebuild_pod_names.include? spec.root.name
end)
# make sturcture to fast get target by name
name_to_target_hash = self.pod_targets.reduce({}) do |sum, target|
sum[target.name] = target
sum
end
prebuilt_specs.each do |spec|
# `spec` may be a subspec, so we use the root's name
root_name = spec.root.name
target = name_to_target_hash[root_name]
next if Prebuild::Passer.target_names_to_skip_integration_framework.include? target.pod_name
# Use the prebuild framworks as vendered frameworks
# get_corresponding_targets
targets = Pod.fast_get_targets_for_pod_name(spec.root.name, self.pod_targets, cache)
targets.each do |target|
# the framework_file_path rule is decided when `install_for_prebuild`,
# as to compitable with older version and be less wordy.
framework_file_path = target.framework_name
framework_file_path = target.name + "/" + framework_file_path if targets.count > 1
add_vendered_framework(spec, target.platform.name.to_s, framework_file_path)
# use the prebuilt framework
original_vendored_frameworks = spec.attributes_hash["vendored_frameworks"] || []
if original_vendored_frameworks.kind_of?(String)
original_vendored_frameworks = [original_vendored_frameworks]
end
original_vendored_frameworks += [target.framework_name]
spec.attributes_hash["vendored_frameworks"] = original_vendored_frameworks
spec.attributes_hash["source_files"] = []
# to remove the resurce bundle target.
# When specify the "resource_bundles" in podspec, xcode will generate a bundle
# target after pod install. But the bundle have already built when the prebuit
# phase and saved in the framework folder. We will treat it as a normal resource
# file.
# https://github.com/leavez/cocoapods-binary/issues/29
if spec.attributes_hash["resource_bundles"]
bundle_names = spec.attributes_hash["resource_bundles"].keys
spec.attributes_hash["resource_bundles"] = nil
spec.attributes_hash["resources"] ||= []
spec.attributes_hash["resources"] += bundle_names.map{|n| n+".bundle"}
end
# Clean the source files
# we just add the prebuilt framework to specific platform and set no source files
# for all platform, so it doesn't support the sence that 'a pod perbuild for one
# platform and not for another platform.'
empty_source_files(spec)
# to remove the resurce bundle target.
# When specify the "resource_bundles" in podspec, xcode will generate a bundle
@ -262,8 +243,9 @@ module Pod
# ---- this is added by cocoapods-binary ---
# Readlink cannot handle relative symlink well, so we override it to a new one
# If the path isn't an absolute path, we add a realtive prefix.
old_read_link=`which readlink`
readlink () {
path=`/usr/bin/readlink $1`;
path=`$old_read_link $1`;
if [ $(echo "$path" | cut -c 1-1) = '/' ]; then
echo $path;
else
@ -272,6 +254,10 @@ module Pod
}
# ---
SH
# patch the rsync for copy dSYM symlink
script = script.gsub "rsync --delete", "rsync --copy-links --delete"
patch + script
end
end

View File

@ -48,7 +48,7 @@ Pod::HooksManager.register('cocoapods-binary', :pre_install) do |installer_conte
# check user_framework is on
podfile = installer_context.podfile
podfile.target_definition_list.each do |target_definition|
next if target_definition.prebuild_framework_pod_names.empty?
next if target_definition.prebuild_framework_names.empty?
if not target_definition.uses_frameworks?
STDERR.puts "[!] Cocoapods-binary requires `use_frameworks!`".red
exit
@ -64,6 +64,18 @@ Pod::HooksManager.register('cocoapods-binary', :pre_install) do |installer_conte
Pod::UI.puts "🚀 Prebuild frameworks"
# Fetch original installer (which is running this pre-install hook) options,
# then pass them to our installer to perform update if needed
# Looks like this is the most appropriate way to figure out that something should be updated
update = nil
repo_update = nil
include ObjectSpace
ObjectSpace.each_object(Pod::Installer) { |installer|
update = installer.update
repo_update = installer.repo_update
}
# control features
Pod.is_prebuild_stage = true
@ -83,11 +95,11 @@ Pod::HooksManager.register('cocoapods-binary', :pre_install) do |installer_conte
lockfile = installer_context.lockfile
binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile)
if binary_installer.have_exact_prebuild_cache?
if binary_installer.have_exact_prebuild_cache? && !update
binary_installer.install_when_cache_hit!
else
binary_installer.repo_update = false
binary_installer.update = false
binary_installer.update = update
binary_installer.repo_update = repo_update
binary_installer.install!
end
@ -98,7 +110,6 @@ Pod::HooksManager.register('cocoapods-binary', :pre_install) do |installer_conte
Pod::Podfile::DSL.enable_prebuild_patch false
Pod::Config.force_disable_write_lockfile false
Pod::Installer.disable_install_complete_message false
Pod::UserInterface.warnings = [] # clean the warning in the prebuild step, it's duplicated.
# -- step 2: pod install ---

View File

@ -43,9 +43,11 @@ module Pod
unchanged = changes.unchanged
deleted = changes.deleted
exsited_framework_pod_names = sandbox.exsited_framework_pod_names
unchange_framework_names = (added + unchanged)
exsited_framework_names = sandbox.exsited_framework_names
missing = unchanged.select do |pod_name|
not exsited_framework_pod_names.include?(pod_name)
not exsited_framework_names.include?(pod_name)
end
needed = (added + changed + deleted + missing)
@ -56,7 +58,7 @@ module Pod
# The install method when have completed cache
def install_when_cache_hit!
# just print log
self.sandbox.exsited_framework_target_names.each do |name|
self.sandbox.exsited_framework_names.each do |name|
UI.puts "Using #{name}"
end
end
@ -80,21 +82,24 @@ module Pod
deleted = changes.deleted
existed_framework_folder.mkdir unless existed_framework_folder.exist?
exsited_framework_pod_names = sandbox.exsited_framework_pod_names
exsited_framework_names = sandbox.exsited_framework_names
# additions
missing = unchanged.select do |pod_name|
not exsited_framework_pod_names.include?(pod_name)
not exsited_framework_names.include?(pod_name)
end
root_names_to_update = (added + changed + missing)
# transform names to targets
cache = []
targets = root_names_to_update.map do |pod_name|
Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)
end.flatten
name_to_target_hash = self.pod_targets.reduce({}) do |sum, target|
sum[target.name] = target
sum
end
targets = root_names_to_update.map do |root_name|
name_to_target_hash[root_name]
end || []
# add the dendencies
dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []
@ -112,8 +117,8 @@ module Pod
Pod::Prebuild.remove_build_dir(sandbox_path)
targets.each do |target|
next unless target.should_build?
output_path = sandbox.framework_folder_path_for_target_name(target.name)
output_path = sandbox.framework_folder_path_for_pod_name(target.name)
output_path.mkpath unless output_path.exist?
Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled)
@ -130,7 +135,6 @@ module Pod
end
Prebuild::Passer.resources_to_copy_for_static_framework[target.name] = path_objects
end
end
Pod::Prebuild.remove_build_dir(sandbox_path)
@ -138,12 +142,12 @@ module Pod
# copy vendored libraries and frameworks
targets.each do |target|
root_path = self.sandbox.pod_dir(target.name)
target_folder = sandbox.framework_folder_path_for_target_name(target.name)
target_folder = sandbox.framework_folder_path_for_pod_name(target.name)
# If target shouldn't build, we copy all the original files
# This is for target with only .a and .h files
if not target.should_build?
Prebuild::Passer.target_names_to_skip_integration_framework << target.name
Prebuild::Passer.target_names_to_skip_integration_framework << target.pod_name
FileUtils.cp_r(root_path, target_folder, :remove_destination => true)
next
end
@ -161,20 +165,15 @@ module Pod
end
end
end
# save the pod_name for prebuild framwork in sandbox
targets.each do |target|
sandbox.save_pod_name_for_target target
end
# Remove useless files
# remove useless pods
all_needed_names = self.pod_targets.map(&:name).uniq
useless_target_names = sandbox.exsited_framework_target_names.reject do |name|
useless_names = sandbox.exsited_framework_names.reject do |name|
all_needed_names.include? name
end
useless_target_names.each do |name|
path = sandbox.framework_folder_path_for_target_name(name)
useless_names.each do |name|
path = sandbox.framework_folder_path_for_pod_name(name)
path.rmtree if path.exist?
end

View File

@ -1,3 +1,3 @@
module CocoapodsBinary
VERSION = "0.4.1"
VERSION = "0.4.2"
end

View File

@ -38,6 +38,11 @@ module Pod
end
if should_prebuild and (not local)
if current_target_definition.platform == :watchos
# watchos isn't supported currently
Pod::UI.warn "Binary doesn't support watchos currently: #{name}. You can manually set `binary => false` for this pod to suppress this warning."
return
end
old_method.bind(self).(name, *args)
end
end

View File

@ -1,78 +0,0 @@
# ABOUT NAMES
#
# There are many kinds of name in cocoapods. Two main names are widely used in this plugin.
# - root_spec.name (spec.root_name, targe.pod_name):
# aka "pod_name"
# the name we use in podfile. the concept.
#
# - target.name:
# aka "target_name"
# the name of the final target in xcode project. the final real thing.
#
# One pod may have multiple targets in xcode project, due to one pod can be used in mutiple
# platform simultaneously. So one `root_spec.name` may have multiple coresponding `target.name`s.
# Therefore, map a spec to/from targets is a little complecated. It's one to many.
#
# Tool to transform Pod_name to target efficiently
module Pod
def self.fast_get_targets_for_pod_name(pod_name, targets, cache)
pod_name_to_targets_hash = nil
if cache.empty?
pod_name_to_targets_hash = targets.reduce({}) do |sum, target|
array = sum[target.pod_name] || []
array << target
sum[target.pod_name] = array
sum
end
cache << pod_name_to_targets_hash
else
pod_name_to_targets_hash = cache.first
end
pod_name_to_targets_hash[pod_name] || []
end
end
# Target:
# def pod_name
# root_spec.name
# end
# def name
# pod_name + #{scope_suffix}
# end
# def product_module_name
# root_spec.module_name
# end
# def framework_name
# "#{product_module_name}.framework"
# end
# def product_name
# if requires_frameworks?
# framework_name
# else
# static_library_name
# end
# end
# def product_basename
# if requires_frameworks?
# product_module_name
# else
# label
# end
# end
# def framework_name
# "#{product_module_name}.framework"
# end

View File

@ -11,7 +11,6 @@ module Pod
## --- option for setting using prebuild framework ---
def parse_prebuild_framework(name, requirements)
should_prebuild = Pod::Podfile::DSL.prebuild_all
options = requirements.last
@ -27,25 +26,28 @@ module Pod
def set_prebuild_for_pod(pod_name, should_prebuild)
if should_prebuild == true
@prebuild_framework_pod_names ||= []
@prebuild_framework_pod_names.push pod_name
# watchos isn't supported currently
return if self.platform == :watchos
@prebuild_framework_names ||= []
@prebuild_framework_names.push pod_name
else
@should_not_prebuild_framework_pod_names ||= []
@should_not_prebuild_framework_pod_names.push pod_name
@should_not_prebuild_framework_names ||= []
@should_not_prebuild_framework_names.push pod_name
end
end
def prebuild_framework_pod_names
names = @prebuild_framework_pod_names || []
def prebuild_framework_names
names = @prebuild_framework_names || []
if parent != nil and parent.kind_of? TargetDefinition
names += parent.prebuild_framework_pod_names
names += parent.prebuild_framework_names
end
names
end
def should_not_prebuild_framework_pod_names
names = @should_not_prebuild_framework_pod_names || []
def should_not_prebuild_framework_names
names = @should_not_prebuild_framework_names || []
if parent != nil and parent.kind_of? TargetDefinition
names += parent.should_not_prebuild_framework_pod_names
names += parent.should_not_prebuild_framework_names
end
names
end
@ -69,16 +71,16 @@ module Pod
class Installer
def prebuild_pod_targets
@prebuild_pod_targets ||= (
all = []
aggregate_targets = self.aggregate_targets
aggregate_targets = self.aggregate_targets.select { |a| a.platform != :watchos }
aggregate_targets.each do |aggregate_target|
target_definition = aggregate_target.target_definition
targets = aggregate_target.pod_targets || []
# filter prebuild
prebuild_names = target_definition.prebuild_framework_pod_names
prebuild_names = target_definition.prebuild_framework_names
if not Podfile::DSL.prebuild_all
targets = targets.select { |pod_target| prebuild_names.include?(pod_target.pod_name) }
end
@ -86,7 +88,7 @@ module Pod
targets = (targets + dependency_targets).uniq
# filter should not prebuild
explict_should_not_names = target_definition.should_not_prebuild_framework_pod_names
explict_should_not_names = target_definition.should_not_prebuild_framework_names
targets = targets.reject { |pod_target| explict_should_not_names.include?(pod_target.pod_name) }
all += targets
@ -94,7 +96,6 @@ module Pod
all = all.reject {|pod_target| sandbox.local?(pod_target.pod_name) }
all.uniq
)
end
# the root names who needs prebuild, including dependency pods.
@ -102,27 +103,6 @@ module Pod
@prebuild_pod_names ||= self.prebuild_pod_targets.map(&:pod_name)
end
def validate_every_pod_only_have_one_form
multi_targets_pods = self.pod_targets.group_by do |t|
t.pod_name
end.select do |k, v|
v.map{|t| t.platform.name }.count > 1
end
multi_targets_pods = multi_targets_pods.reject do |name, targets|
contained = targets.map{|t| self.prebuild_pod_targets.include? t }
contained.uniq.count == 1 # all equal
end
return if multi_targets_pods.empty?
warnings = "One pod can only be prebuilt or not prebuilt. These pod have different forms in multiple targets:\n"
warnings += multi_targets_pods.map{|name, targets| " #{name}: #{targets.map{|t|t.platform.name}}"}.join("\n")
raise Informative, warnings
end
end
end

View File

@ -1,5 +1,3 @@
require_relative "names"
module Pod
class PrebuildSandbox < Sandbox
@ -21,53 +19,31 @@ module Pod
self.root + "GeneratedFrameworks"
end
# @param name [String] pass the target.name (may containing platform suffix)
# @return [Pathname] the folder containing the framework file.
def framework_folder_path_for_target_name(name)
def framework_folder_path_for_pod_name(name)
self.generate_framework_path + name
end
def exsited_framework_target_names
exsited_framework_name_pairs.map {|pair| pair[0]}.uniq
end
def exsited_framework_pod_names
exsited_framework_name_pairs.map {|pair| pair[1]}.uniq
end
def existed_target_names_for_pod_name(pod_name)
exsited_framework_name_pairs.select {|pair| pair[1] == pod_name }.map { |pair| pair[0]}
end
def save_pod_name_for_target(target)
folder = framework_folder_path_for_target_name(target.name)
return unless folder.exist?
flag_file_path = folder + "#{target.pod_name}.pod_name"
File.write(flag_file_path.to_s, "")
end
private
def pod_name_for_target_folder(target_folder_path)
name = Pathname.new(target_folder_path).children.find do |child|
child.to_s.end_with? ".pod_name"
end
name = name.basename(".pod_name").to_s unless name.nil?
name ||= Pathname.new(target_folder_path).basename.to_s # for compatibility with older version
end
# Array<[target_name, pod_name]>
def exsited_framework_name_pairs
def exsited_framework_names
return [] unless generate_framework_path.exist?
generate_framework_path.children().map do |framework_path|
if framework_path.directory? && (not framework_path.children.empty?)
[framework_path.basename.to_s, pod_name_for_target_folder(framework_path)]
generate_framework_path.children().map do |framework_name|
if framework_name.directory?
if not framework_name.children.empty?
File.basename(framework_name)
else
nil
end
else
nil
end
end.reject(&:nil?).uniq
end.reject(&:nil?)
end
def framework_existed?(root_name)
return false unless generate_framework_path.exist?
generate_framework_path.children().any? do |child|
child.basename.to_s == root_name
end
end
end
end

View File

@ -15,26 +15,25 @@ def build_for_iosish_platform(sandbox,
target,
device,
simulator,
bitcode_enabled,
simulator_default_arch)
bitcode_enabled)
deployment_target = target.platform.deployment_target.to_s
target_label = target.label # name with platform if it's used in multiple platforms
target_label = target.label
Pod::UI.puts "Prebuilding #{target_label}..."
other_options = []
if bitcode_enabled
other_options += ['OTHER_CFLAGS="-fembed-bitcode"']
other_options += ['BITCODE_GENERATION_MODE=bitcode']
end
xcodebuild(sandbox, target_label, device, deployment_target, other_options)
xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ["ARCHS=#{simulator_default_arch}",'ONLY_ACTIVE_ARCH=NO'])
xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])
# paths
target_name = target.name # equals target.label, like "AFNeworking-iOS" when AFNetworking is used in multiple platforms.
root_name = target.pod_name
module_name = target.product_module_name
device_framwork_path = "#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{module_name}.framework"
simulator_framwork_path = "#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{module_name}.framework"
device_framwork_path = "#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework"
simulator_framwork_path = "#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework"
device_binary = device_framwork_path + "/#{module_name}"
simulator_binary = simulator_framwork_path + "/#{module_name}"
@ -42,7 +41,7 @@ def build_for_iosish_platform(sandbox,
# the device_lib path is the final output file path
# combine the bianries
tmp_lipoed_binary_path = "#{build_dir}/#{target_name}"
tmp_lipoed_binary_path = "#{build_dir}/#{root_name}"
lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`
puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true
@ -54,6 +53,17 @@ def build_for_iosish_platform(sandbox,
FileUtils.cp_r simulator_swiftmodule_path + "/.", device_swiftmodule_path
end
# handle the dSYM files
device_dsym = "#{device_framwork_path}.dSYM"
if File.exist? device_dsym
# lipo the simulator dsym
tmp_lipoed_binary_path = "#{output_path}/#{module_name}.draft"
lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_framwork_path}.dSYM/Contents/Resources/DWARF/#{module_name}`
puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
FileUtils.mv tmp_lipoed_binary_path, "#{device_framwork_path}.dSYM/Contents/Resources/DWARF/#{module_name}", :force => true
FileUtils.mv device_dsym, output_path, :force => true
end
# output
output_path.mkpath unless output_path.exist?
FileUtils.mv device_framwork_path, output_path, :force => true
@ -94,10 +104,10 @@ module Pod
# -- build the framework
case target.platform.name
when :ios then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'iphoneos', 'iphonesimulator', bitcode_enabled, "x86_64")
when :ios then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'iphoneos', 'iphonesimulator', bitcode_enabled)
when :osx then xcodebuild(sandbox, target.label)
# when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator')
when :watchos then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'watchos', 'watchsimulator', true, "i386")
# when :watchos then build_for_iosish_platform(sandbox, build_dir, target, 'watchos', 'watchsimulator')
else raise "Unsupported platform for '#{target.name}': '#{target.platform.name}'" end
raise Pod::Informative, 'The build directory was not found in the expected location.' unless build_dir.directory?
@ -135,4 +145,3 @@ module Pod
end
end

View File

@ -10,59 +10,9 @@
3E1E218020A0B66900EFA102 /* import.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E1E217F20A0B66900EFA102 /* import.swift */; };
3E83E326207BC00E0057855A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E83E325207BC00E0057855A /* AppDelegate.swift */; };
3E83E328207BC00E0057855A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E83E327207BC00E0057855A /* ViewController.swift */; };
3EEAFD8720F1056D009A9D22 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3EEAFD8520F1056D009A9D22 /* Interface.storyboard */; };
3EEAFD8920F1056D009A9D22 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3EEAFD8820F1056D009A9D22 /* Assets.xcassets */; };
3EEAFD9020F1056E009A9D22 /* BinaryWatch Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 3EEAFD8F20F1056E009A9D22 /* BinaryWatch Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
3EEAFD9520F1056E009A9D22 /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEAFD9420F1056E009A9D22 /* InterfaceController.swift */; };
3EEAFD9720F1056E009A9D22 /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEAFD9620F1056E009A9D22 /* ExtensionDelegate.swift */; };
3EEAFD9920F1056E009A9D22 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3EEAFD9820F1056E009A9D22 /* Assets.xcassets */; };
3EEAFD9D20F1056E009A9D22 /* BinaryWatch.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 3EEAFD8320F1056D009A9D22 /* BinaryWatch.app */; };
3EEAFDA720F10610009A9D22 /* import.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEAFDA620F10610009A9D22 /* import.swift */; };
AEBC61E3160A9AC38C3A210D /* Pods_Binary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5687B1A81F152DBEF5CD4432 /* Pods_Binary.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
3EEAFD9120F1056E009A9D22 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 3E83E31A207BC00E0057855A /* Project object */;
proxyType = 1;
remoteGlobalIDString = 3EEAFD8E20F1056E009A9D22;
remoteInfo = "BinaryWatch Extension";
};
3EEAFD9B20F1056E009A9D22 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 3E83E31A207BC00E0057855A /* Project object */;
proxyType = 1;
remoteGlobalIDString = 3EEAFD8220F1056D009A9D22;
remoteInfo = BinaryWatch;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
3EEAFDA320F1056E009A9D22 /* Embed App Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
3EEAFD9020F1056E009A9D22 /* BinaryWatch Extension.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
3EEAFDA520F1056E009A9D22 /* Embed Watch Content */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "$(CONTENTS_FOLDER_PATH)/Watch";
dstSubfolderSpec = 16;
files = (
3EEAFD9D20F1056E009A9D22 /* BinaryWatch.app in Embed Watch Content */,
);
name = "Embed Watch Content";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1856F5E2BE44EDB1E470521A /* Pods-Binary.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Binary.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Binary/Pods-Binary.debug.xcconfig"; sourceTree = "<group>"; };
3E1E217F20A0B66900EFA102 /* import.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = import.swift; sourceTree = "<group>"; };
@ -70,16 +20,6 @@
3E83E325207BC00E0057855A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
3E83E327207BC00E0057855A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
3E83E331207BC0120057855A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3EEAFD8320F1056D009A9D22 /* BinaryWatch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BinaryWatch.app; sourceTree = BUILT_PRODUCTS_DIR; };
3EEAFD8620F1056D009A9D22 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = "<group>"; };
3EEAFD8820F1056D009A9D22 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
3EEAFD8A20F1056E009A9D22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3EEAFD8F20F1056E009A9D22 /* BinaryWatch Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "BinaryWatch Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
3EEAFD9420F1056E009A9D22 /* InterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceController.swift; sourceTree = "<group>"; };
3EEAFD9620F1056E009A9D22 /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = "<group>"; };
3EEAFD9820F1056E009A9D22 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
3EEAFD9A20F1056E009A9D22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3EEAFDA620F10610009A9D22 /* import.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = import.swift; sourceTree = "<group>"; };
5687B1A81F152DBEF5CD4432 /* Pods_Binary.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Binary.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7EB848DBE64BD495BCC04ECC /* Pods-Binary.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Binary.release.xcconfig"; path = "Pods/Target Support Files/Pods-Binary/Pods-Binary.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -93,13 +33,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
3EEAFD8C20F1056E009A9D22 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@ -107,8 +40,6 @@
isa = PBXGroup;
children = (
3E83E324207BC00E0057855A /* Binary */,
3EEAFD8420F1056D009A9D22 /* BinaryWatch */,
3EEAFD9320F1056E009A9D22 /* BinaryWatch Extension */,
3E83E323207BC00E0057855A /* Products */,
E8117D681BF19C1B3D847824 /* Pods */,
8E13F0A6AED19C681C2CD7D5 /* Frameworks */,
@ -119,8 +50,6 @@
isa = PBXGroup;
children = (
3E83E322207BC00E0057855A /* Binary.app */,
3EEAFD8320F1056D009A9D22 /* BinaryWatch.app */,
3EEAFD8F20F1056E009A9D22 /* BinaryWatch Extension.appex */,
);
name = Products;
sourceTree = "<group>";
@ -136,28 +65,6 @@
path = Binary;
sourceTree = "<group>";
};
3EEAFD8420F1056D009A9D22 /* BinaryWatch */ = {
isa = PBXGroup;
children = (
3EEAFD8520F1056D009A9D22 /* Interface.storyboard */,
3EEAFD8820F1056D009A9D22 /* Assets.xcassets */,
3EEAFD8A20F1056E009A9D22 /* Info.plist */,
);
path = BinaryWatch;
sourceTree = "<group>";
};
3EEAFD9320F1056E009A9D22 /* BinaryWatch Extension */ = {
isa = PBXGroup;
children = (
3EEAFD9420F1056E009A9D22 /* InterfaceController.swift */,
3EEAFD9620F1056E009A9D22 /* ExtensionDelegate.swift */,
3EEAFDA620F10610009A9D22 /* import.swift */,
3EEAFD9820F1056E009A9D22 /* Assets.xcassets */,
3EEAFD9A20F1056E009A9D22 /* Info.plist */,
);
path = "BinaryWatch Extension";
sourceTree = "<group>";
};
8E13F0A6AED19C681C2CD7D5 /* Frameworks */ = {
isa = PBXGroup;
children = (
@ -187,71 +94,29 @@
3E83E31F207BC00E0057855A /* Frameworks */,
3E83E320207BC00E0057855A /* Resources */,
9937F6A880D56826534273F0 /* [CP] Embed Pods Frameworks */,
3EEAFDA520F1056E009A9D22 /* Embed Watch Content */,
);
buildRules = (
);
dependencies = (
3EEAFD9C20F1056E009A9D22 /* PBXTargetDependency */,
);
name = Binary;
productName = Binary;
productReference = 3E83E322207BC00E0057855A /* Binary.app */;
productType = "com.apple.product-type.application";
};
3EEAFD8220F1056D009A9D22 /* BinaryWatch */ = {
isa = PBXNativeTarget;
buildConfigurationList = 3EEAFDA420F1056E009A9D22 /* Build configuration list for PBXNativeTarget "BinaryWatch" */;
buildPhases = (
3EEAFD8120F1056D009A9D22 /* Resources */,
3EEAFDA320F1056E009A9D22 /* Embed App Extensions */,
);
buildRules = (
);
dependencies = (
3EEAFD9220F1056E009A9D22 /* PBXTargetDependency */,
);
name = BinaryWatch;
productName = BinaryWatch;
productReference = 3EEAFD8320F1056D009A9D22 /* BinaryWatch.app */;
productType = "com.apple.product-type.application.watchapp2";
};
3EEAFD8E20F1056E009A9D22 /* BinaryWatch Extension */ = {
isa = PBXNativeTarget;
buildConfigurationList = 3EEAFDA220F1056E009A9D22 /* Build configuration list for PBXNativeTarget "BinaryWatch Extension" */;
buildPhases = (
3EEAFD8B20F1056E009A9D22 /* Sources */,
3EEAFD8C20F1056E009A9D22 /* Frameworks */,
3EEAFD8D20F1056E009A9D22 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "BinaryWatch Extension";
productName = "BinaryWatch Extension";
productReference = 3EEAFD8F20F1056E009A9D22 /* BinaryWatch Extension.appex */;
productType = "com.apple.product-type.watchkit2-extension";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
3E83E31A207BC00E0057855A /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1000;
LastSwiftUpdateCheck = 0930;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = me.leavez;
TargetAttributes = {
3E83E321207BC00E0057855A = {
CreatedOnToolsVersion = 9.3;
};
3EEAFD8220F1056D009A9D22 = {
CreatedOnToolsVersion = 10.0;
};
3EEAFD8E20F1056E009A9D22 = {
CreatedOnToolsVersion = 10.0;
};
};
};
buildConfigurationList = 3E83E31D207BC00E0057855A /* Build configuration list for PBXProject "Binary" */;
@ -268,8 +133,6 @@
projectRoot = "";
targets = (
3E83E321207BC00E0057855A /* Binary */,
3EEAFD8220F1056D009A9D22 /* BinaryWatch */,
3EEAFD8E20F1056E009A9D22 /* BinaryWatch Extension */,
);
};
/* End PBXProject section */
@ -282,23 +145,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
3EEAFD8120F1056D009A9D22 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3EEAFD8920F1056D009A9D22 /* Assets.xcassets in Resources */,
3EEAFD8720F1056D009A9D22 /* Interface.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3EEAFD8D20F1056E009A9D22 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3EEAFD9920F1056E009A9D22 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
@ -353,42 +199,8 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
3EEAFD8B20F1056E009A9D22 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3EEAFD9720F1056E009A9D22 /* ExtensionDelegate.swift in Sources */,
3EEAFDA720F10610009A9D22 /* import.swift in Sources */,
3EEAFD9520F1056E009A9D22 /* InterfaceController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
3EEAFD9220F1056E009A9D22 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 3EEAFD8E20F1056E009A9D22 /* BinaryWatch Extension */;
targetProxy = 3EEAFD9120F1056E009A9D22 /* PBXContainerItemProxy */;
};
3EEAFD9C20F1056E009A9D22 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 3EEAFD8220F1056D009A9D22 /* BinaryWatch */;
targetProxy = 3EEAFD9B20F1056E009A9D22 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
3EEAFD8520F1056D009A9D22 /* Interface.storyboard */ = {
isa = PBXVariantGroup;
children = (
3EEAFD8620F1056D009A9D22 /* Base */,
);
name = Interface.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
3E83E332207BC0120057855A /* Debug */ = {
isa = XCBuildConfiguration;
@ -510,10 +322,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = Binary/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = me.leavez.Binary;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
@ -527,10 +336,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = Binary/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = me.leavez.Binary;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
@ -538,86 +344,6 @@
};
name = Release;
};
3EEAFD9E20F1056E009A9D22 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
IBSC_MODULE = BinaryWatch_Extension;
INFOPLIST_FILE = BinaryWatch/Info.plist;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
PRODUCT_BUNDLE_IDENTIFIER = me.leavez.Binary.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 5.0;
};
name = Debug;
};
3EEAFD9F20F1056E009A9D22 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
IBSC_MODULE = BinaryWatch_Extension;
INFOPLIST_FILE = BinaryWatch/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = me.leavez.Binary.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 5.0;
};
name = Release;
};
3EEAFDA020F1056E009A9D22 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "BinaryWatch Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
PRODUCT_BUNDLE_IDENTIFIER = me.leavez.Binary.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 5.0;
};
name = Debug;
};
3EEAFDA120F1056E009A9D22 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "BinaryWatch Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = me.leavez.Binary.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@ -639,24 +365,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
3EEAFDA220F1056E009A9D22 /* Build configuration list for PBXNativeTarget "BinaryWatch Extension" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3EEAFDA020F1056E009A9D22 /* Debug */,
3EEAFDA120F1056E009A9D22 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
3EEAFDA420F1056E009A9D22 /* Build configuration list for PBXNativeTarget "BinaryWatch" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3EEAFD9E20F1056E009A9D22 /* Debug */,
3EEAFD9F20F1056E009A9D22 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 3E83E31A207BC00E0057855A /* Project object */;

View File

@ -1,18 +0,0 @@
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -1,28 +0,0 @@
{
"assets" : [
{
"idiom" : "watch",
"filename" : "Circular.imageset",
"role" : "circular"
},
{
"idiom" : "watch",
"filename" : "Extra Large.imageset",
"role" : "extra-large"
},
{
"idiom" : "watch",
"filename" : "Modular.imageset",
"role" : "modular"
},
{
"idiom" : "watch",
"filename" : "Utilitarian.imageset",
"role" : "utilitarian"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -1,18 +0,0 @@
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -1,18 +0,0 @@
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -1,18 +0,0 @@
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -1,6 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -1,21 +0,0 @@
//
// ExtensionDelegate.swift
// BinaryWatch Extension
//
// Created by Gao on 2018/7/7.
// Copyright © 2018 me.leavez. All rights reserved.
//
import WatchKit
class ExtensionDelegate: NSObject, WKExtensionDelegate {
func applicationDidFinishLaunching() {
// Perform any final initialization of your application.
}
func applicationDidBecomeActive() {
// 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.
}
}

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>BinaryWatch Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>me.leavez.Binary.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>
<key>WKExtensionDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).ExtensionDelegate</string>
</dict>
</plist>

View File

@ -1,31 +0,0 @@
//
// InterfaceController.swift
// BinaryWatch Extension
//
// Created by Gao on 2018/7/7.
// Copyright © 2018 me.leavez. All rights reserved.
//
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
override func awake(withContext context: Any?) {
super.awake(withContext: context)
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
}

View File

@ -1 +0,0 @@

View File

@ -1,67 +0,0 @@
{
"images" : [
{
"size" : "24x24",
"idiom" : "watch",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "38mm"
},
{
"size" : "27.5x27.5",
"idiom" : "watch",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "42mm"
},
{
"size" : "29x29",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "watch",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "38mm"
},
{
"size" : "44x44",
"idiom" : "watch",
"scale" : "2x",
"role" : "longLook",
"subtype" : "42mm"
},
{
"size" : "86x86",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "38mm"
},
{
"size" : "98x98",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "42mm"
},
{
"idiom" : "watch-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -1,6 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="11134" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="AgC-eL-Hgc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="11055"/>
</dependencies>
<scenes>
<!--Interface Controller-->
<scene sceneID="aou-V4-d1y">
<objects>
<controller id="AgC-eL-Hgc" customClass="InterfaceController" customModuleProvider="target"/>
</objects>
</scene>
</scenes>
</document>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Binary</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>WKCompanionAppBundleIdentifier</key>
<string>me.leavez.Binary</string>
<key>WKWatchKitApp</key>
<true/>
</dict>
</plist>

View File

@ -25,12 +25,6 @@ def save_to_podfile(text):
file.write(text[1])
file.close()
path = os.path.dirname(os.path.abspath(__file__))
path += "/BinaryWatch Extension/import.swift"
file = open(path, "w+")
file.write( "" if len(text) <= 2 else text[2])
file.close()
def initial():
@ -42,9 +36,6 @@ pod "Masonry"
"""),
"""
import Masonry
class A {
let d = UIView().mas_top
}
""")
def addSwiftPod():
@ -58,10 +49,6 @@ pod "Literal", :binary => true
"""
import RxCocoa
import Literal
class A {
let a: CGRect = [1,2,3,4]
func dd() { NSObject().rx.observe(CGRect.self, "frame") }
}
""")
def revertToSourceCode():
@ -74,13 +61,7 @@ pod "Literal"
"""),
"""
import RxCocoa
import RxSwift
import Literal
class A {
let a: CGRect = [1,2,3,4]
let b = Observable.just(1)
func dd() { NSObject().rx.observe(CGRect.self, "frame") }
}
""")
def addDifferentNamePod():
@ -96,11 +77,6 @@ pod "lottie-ios", :binary => true
import Masonry
import Literal
import Lottie
class A {
let a: CGRect = [1,2,3,4]
let a2 = LOTAnimationView.self
let d = UIView().mas_top
}
""")
@ -117,12 +93,6 @@ import Masonry
import Literal
import Lottie
import AFNetworking
class A {
let a: CGRect = [1,2,3,4]
let a2 = LOTAnimationView.self
let b = AFNetworkReachabilityManager()
let d = UIView().mas_top
}
""")
def addVendoredLibPod():
@ -137,11 +107,6 @@ pod "GrowingIO", :binary => true
import Literal
import AFNetworking
import Instabug
class A {
let a: CGRect = [1,2,3,4]
let b = AFNetworkReachabilityManager()
let c = Instabug.self
}
""")
def deleteAPod():
@ -153,10 +118,6 @@ pod "AFNetworking/Reachability", :binary => true
"""
import Literal
import AFNetworking
class A {
let a: CGRect = [1,2,3,4]
let b = AFNetworkReachabilityManager()
}
""")
def universalFlag():
@ -170,67 +131,9 @@ pod "AFNetworking/Reachability"
"""
import Literal
import AFNetworking
class A {
let a: CGRect = [1,2,3,4]
let b = AFNetworkReachabilityManager()
}
""")
def multiplePlatforms():
return (wrapper(
"""
pod "Literal", :binary => true
pod "AFNetworking/Serialization", :binary => true
end
target 'BinaryWatch Extension' do
platform :watchos
pod "AFNetworking/Serialization", :binary => true
""") ,
"""
import Literal
import AFNetworking
class A {
let a: CGRect = [1,2,3,4]
func dd() { _ = AFURLRequestSerializationErrorDomain }
}
""",
"""
import AFNetworking
class A {
func dd() { _ = AFURLRequestSerializationErrorDomain }
}
"""
)
def multiplePlatformsWithALLFlag():
return (wrapper(
"""
all_binary!
pod "Literal"
pod "AFNetworking/Serialization"
end
target 'BinaryWatch Extension' do
platform :watchos
pod "AFNetworking/Serialization"
""") ,
"""
import Literal
import AFNetworking
class A {
let a: CGRect = [1,2,3,4]
func dd() { _ = AFURLRequestSerializationErrorDomain }
}
""",
"""
import AFNetworking
class A {
func dd() { _ = AFURLRequestSerializationErrorDomain }
}
"""
)
if __name__ == "__main__":

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -46,15 +46,5 @@ python change_podfile.py "universalFlag"
pod install
build
#
python change_podfile.py "multiplePlatforms"
pod install
build
#
python change_podfile.py "multiplePlatformsWithALLFlag"
pod install
build
#
exit 0