Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0cfa27a897 | ||
|
|
d5c0101154 | ||
|
|
5dc20e3c98 | ||
|
|
a60a69d9f4 | ||
|
|
8eae79faa4 | ||
|
|
30cbf7f1c5 | ||
|
|
33ae8908bd | ||
|
|
02383b2538 | ||
|
|
551d99c5d8 | ||
|
|
75f0ae9f2b | ||
|
|
671ebddf20 | ||
|
|
5962d88538 |
@ -55,7 +55,7 @@ module Pod
|
||||
walk(real_file_folder) do |child|
|
||||
source = child
|
||||
# only make symlink to file and `.framework` folder
|
||||
if child.directory? and child.extname == ".framework"
|
||||
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?
|
||||
@ -167,6 +167,32 @@ module Pod
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
# to avoid the warning of missing license
|
||||
spec.attributes_hash["license"] = {}
|
||||
end
|
||||
@ -217,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
|
||||
@ -227,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
|
||||
|
||||
@ -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
|
||||
@ -80,13 +92,14 @@ Pod::HooksManager.register('cocoapods-binary', :pre_install) do |installer_conte
|
||||
prebuild_podfile = Pod::Podfile.from_ruby(podfile.defined_in_file)
|
||||
|
||||
# install
|
||||
binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile , nil)
|
||||
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
|
||||
|
||||
|
||||
@ -126,10 +126,11 @@ module Pod
|
||||
if target.static_framework? and !target.resource_paths.empty?
|
||||
framework_path = output_path + target.framework_name
|
||||
standard_sandbox_path = sandbox.standard_sanbox_path
|
||||
path_objects = target.resource_paths.select{|f| f.start_with? "${PODS_ROOT}"}.map do |path|
|
||||
path_objects = target.resource_paths.map do |path|
|
||||
object = Prebuild::Passer::ResourcePath.new
|
||||
object.real_file_path = framework_path + File.basename(path)
|
||||
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s)
|
||||
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
|
||||
object.target_file_path = path.gsub("${PODS_CONFIGURATION_BUILD_DIR}", standard_sandbox_path.to_s) if path.start_with? "${PODS_CONFIGURATION_BUILD_DIR}"
|
||||
object
|
||||
end
|
||||
Prebuild::Passer.resources_to_copy_for_static_framework[target.name] = path_objects
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
module CocoapodsBinary
|
||||
VERSION = "0.4.1"
|
||||
VERSION = "0.4.2"
|
||||
end
|
||||
|
||||
@ -11,13 +11,16 @@ module Pod
|
||||
|
||||
## --- option for setting using prebuild framework ---
|
||||
def parse_prebuild_framework(name, requirements)
|
||||
should_prebuild = Pod::Podfile::DSL.prebuild_all
|
||||
|
||||
options = requirements.last
|
||||
return requirements unless options.is_a?(Hash)
|
||||
if options.is_a?(Hash) && options[Pod::Prebuild.keyword] != nil
|
||||
should_prebuild = options.delete(Pod::Prebuild.keyword)
|
||||
requirements.pop if options.empty?
|
||||
end
|
||||
|
||||
should_prebuild_framework = options.delete(Pod::Prebuild.keyword)
|
||||
pod_name = Specification.root_name(name)
|
||||
set_prebuild_for_pod(pod_name, should_prebuild_framework)
|
||||
requirements.pop if options.empty?
|
||||
set_prebuild_for_pod(pod_name, should_prebuild)
|
||||
end
|
||||
|
||||
def set_prebuild_for_pod(pod_name, should_prebuild)
|
||||
|
||||
@ -24,7 +24,7 @@ def build_for_iosish_platform(sandbox,
|
||||
|
||||
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=x86_64', 'ONLY_ACTIVE_ARCH=NO'])
|
||||
@ -53,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
|
||||
@ -134,4 +145,3 @@ module Pod
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user