Compare commits

...

12 Commits
info ... 0.4.2

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
6 changed files with 73 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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)

View File

@ -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