From 881fb864f2638bed8b2ec96a27ee88cb1bb946b1 Mon Sep 17 00:00:00 2001 From: walker Date: Mon, 15 Mar 2021 02:10:34 +0800 Subject: [PATCH 01/15] [GL][add ] --- .gitignore | 2 ++ lib/cocoapods-binary/Main.rb | 8 ++++++++ lib/cocoapods-binary/Prebuild.rb | 5 +++++ lib/cocoapods-binary/gem_version.rb | 2 +- lib/cocoapods-binary/helper/podfile_options.rb | 7 +++++-- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 85dd667..1465c7c 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ test/Binary.xcworkspace/contents.xcworkspacedata test/Binary.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist test/Podfile test/Podfile.lock + +*.gem \ No newline at end of file diff --git a/lib/cocoapods-binary/Main.rb b/lib/cocoapods-binary/Main.rb index 78fcf41..33e193d 100644 --- a/lib/cocoapods-binary/Main.rb +++ b/lib/cocoapods-binary/Main.rb @@ -12,6 +12,11 @@ def all_binary! DSL.prebuild_all = true end + # Fobidden dependency auto build to binary + def forbidden_dependency_binary! + DSL.forbidden_dependency_binary = true + end + # Enable bitcode for prebuilt frameworks def enable_bitcode_for_prebuilt_frameworks! DSL.bitcode_enabled = true @@ -56,6 +61,9 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) end private + class_attr_accessor :forbidden_dependency_binary + forbidden_dependency_binary = false + class_attr_accessor :prebuild_all prebuild_all = false diff --git a/lib/cocoapods-binary/Prebuild.rb b/lib/cocoapods-binary/Prebuild.rb index 77bc834..98e3449 100644 --- a/lib/cocoapods-binary/Prebuild.rb +++ b/lib/cocoapods-binary/Prebuild.rb @@ -109,6 +109,11 @@ def prebuild_frameworks! targets = self.pod_targets end + if Pod::Podfile::DSL.forbidden_dependency_binary + forbidden_dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || [] + targets = targets - forbidden_dependency_targets + end + targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } diff --git a/lib/cocoapods-binary/gem_version.rb b/lib/cocoapods-binary/gem_version.rb index fd912f8..2f2cd56 100644 --- a/lib/cocoapods-binary/gem_version.rb +++ b/lib/cocoapods-binary/gem_version.rb @@ -1,3 +1,3 @@ module CocoapodsBinary - VERSION = "0.4.4" + VERSION = "0.4.5" end diff --git a/lib/cocoapods-binary/helper/podfile_options.rb b/lib/cocoapods-binary/helper/podfile_options.rb index ebbc402..8ed6823 100644 --- a/lib/cocoapods-binary/helper/podfile_options.rb +++ b/lib/cocoapods-binary/helper/podfile_options.rb @@ -81,8 +81,11 @@ def prebuild_pod_targets if not Podfile::DSL.prebuild_all targets = targets.select { |pod_target| prebuild_names.include?(pod_target.pod_name) } end - dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || [] - targets = (targets + dependency_targets).uniq + + if not Podfile::DSL.forbidden_dependency_binary + dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || [] + targets = (targets + dependency_targets).uniq + end # filter should not prebuild explict_should_not_names = target_definition.should_not_prebuild_framework_pod_names From b0b9c839922d480dfa76a4020ad70a63bb147f0f Mon Sep 17 00:00:00 2001 From: walker Date: Mon, 15 Mar 2021 02:10:34 +0800 Subject: [PATCH 02/15] [GL][add `forbidden_dependency_binary!`] --- .gitignore | 2 ++ lib/cocoapods-binary/Main.rb | 8 ++++++++ lib/cocoapods-binary/Prebuild.rb | 5 +++++ lib/cocoapods-binary/gem_version.rb | 2 +- lib/cocoapods-binary/helper/podfile_options.rb | 7 +++++-- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 85dd667..1465c7c 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ test/Binary.xcworkspace/contents.xcworkspacedata test/Binary.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist test/Podfile test/Podfile.lock + +*.gem \ No newline at end of file diff --git a/lib/cocoapods-binary/Main.rb b/lib/cocoapods-binary/Main.rb index 78fcf41..33e193d 100644 --- a/lib/cocoapods-binary/Main.rb +++ b/lib/cocoapods-binary/Main.rb @@ -12,6 +12,11 @@ def all_binary! DSL.prebuild_all = true end + # Fobidden dependency auto build to binary + def forbidden_dependency_binary! + DSL.forbidden_dependency_binary = true + end + # Enable bitcode for prebuilt frameworks def enable_bitcode_for_prebuilt_frameworks! DSL.bitcode_enabled = true @@ -56,6 +61,9 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) end private + class_attr_accessor :forbidden_dependency_binary + forbidden_dependency_binary = false + class_attr_accessor :prebuild_all prebuild_all = false diff --git a/lib/cocoapods-binary/Prebuild.rb b/lib/cocoapods-binary/Prebuild.rb index 77bc834..98e3449 100644 --- a/lib/cocoapods-binary/Prebuild.rb +++ b/lib/cocoapods-binary/Prebuild.rb @@ -109,6 +109,11 @@ def prebuild_frameworks! targets = self.pod_targets end + if Pod::Podfile::DSL.forbidden_dependency_binary + forbidden_dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || [] + targets = targets - forbidden_dependency_targets + end + targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } diff --git a/lib/cocoapods-binary/gem_version.rb b/lib/cocoapods-binary/gem_version.rb index fd912f8..2f2cd56 100644 --- a/lib/cocoapods-binary/gem_version.rb +++ b/lib/cocoapods-binary/gem_version.rb @@ -1,3 +1,3 @@ module CocoapodsBinary - VERSION = "0.4.4" + VERSION = "0.4.5" end diff --git a/lib/cocoapods-binary/helper/podfile_options.rb b/lib/cocoapods-binary/helper/podfile_options.rb index ebbc402..8ed6823 100644 --- a/lib/cocoapods-binary/helper/podfile_options.rb +++ b/lib/cocoapods-binary/helper/podfile_options.rb @@ -81,8 +81,11 @@ def prebuild_pod_targets if not Podfile::DSL.prebuild_all targets = targets.select { |pod_target| prebuild_names.include?(pod_target.pod_name) } end - dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || [] - targets = (targets + dependency_targets).uniq + + if not Podfile::DSL.forbidden_dependency_binary + dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || [] + targets = (targets + dependency_targets).uniq + end # filter should not prebuild explict_should_not_names = target_definition.should_not_prebuild_framework_pod_names From 536023ff245b865cd73648ca9756d5c16903b40e Mon Sep 17 00:00:00 2001 From: ghostlordstar Date: Mon, 15 Mar 2021 09:49:08 +0800 Subject: [PATCH 03/15] update README for `forbidden_dependency_binary!` --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8fdb80d..117acee 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +fork for https://github.com/muukii/cocoapods-binary + +add `forbidden_dependency_binary!`, Prevent the automatic compilation of dependent libraries into binary as well. + +--- + > ⚠️ This is a temporaly forked repository. https://github.com/leavez/cocoapods-binary/pull/137 From 6b723cdf708c86d059738474e10d0cea33bb43ec Mon Sep 17 00:00:00 2001 From: ghostlordstar Date: Mon, 15 Mar 2021 09:49:44 +0800 Subject: [PATCH 04/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 117acee..1e3c0d9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -fork for https://github.com/muukii/cocoapods-binary +Forked from https://github.com/muukii/cocoapods-binary add `forbidden_dependency_binary!`, Prevent the automatic compilation of dependent libraries into binary as well. From 85aa760ee864a6313ab91e5bf6227ec97d53fd57 Mon Sep 17 00:00:00 2001 From: walker Date: Wed, 14 Jul 2021 00:31:24 +0800 Subject: [PATCH 05/15] [GL][merge https://github.com/leavez/cocoapods-binary/pull/148] --- lib/cocoapods-binary/Prebuild.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cocoapods-binary/Prebuild.rb b/lib/cocoapods-binary/Prebuild.rb index 98e3449..6f3cb79 100644 --- a/lib/cocoapods-binary/Prebuild.rb +++ b/lib/cocoapods-binary/Prebuild.rb @@ -97,7 +97,8 @@ def prebuild_frameworks! targets = root_names_to_update.map do |pod_name| tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache) if tars.nil? || tars.empty? - raise "There's no target named (#{pod_name}) in Pod.xcodeproj.\n #{self.pod_targets.map(&:name)}" if t.nil? + # https://github.com/leavez/cocoapods-binary/pull/148 + raise "There's no target named (#{pod_name}) in Pod.xcodeproj.\n #{self.pod_targets.map(&:name)}" if tars.nil? end tars end.flatten From 6c6b387a292c47f10fb1f9ff6f10e16b15e92d09 Mon Sep 17 00:00:00 2001 From: walker Date: Wed, 14 Jul 2021 00:31:46 +0800 Subject: [PATCH 06/15] [GL][merge https://github.com/leavez/cocoapods-binary/pull/142] --- lib/cocoapods-binary/Integration.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/cocoapods-binary/Integration.rb b/lib/cocoapods-binary/Integration.rb index 660b013..0f39f87 100644 --- a/lib/cocoapods-binary/Integration.rb +++ b/lib/cocoapods-binary/Integration.rb @@ -88,7 +88,16 @@ def mirror_with_symlink(source, basefolder, target_folder) path_objects = hash[name] if path_objects != nil path_objects.each do |object| - make_link(object.real_file_path, object.target_file_path) + # make_link(object.real_file_path, object.target_file_path) + # https://github.com/leavez/cocoapods-binary/pull/142 + target_file_path = object.target_file_path + real_file_path = object.real_file_path + case File.extname(real_file_path) + when '.xib' + real_file_path = real_file_path.sub_ext(".nib") + target_file_path = target_file_path.sub(".xib", ".nib") + end + make_link(real_file_path, target_file_path) end end end # of for each From d79dfb9d20e564936d24e535c095026b4af65036 Mon Sep 17 00:00:00 2001 From: Hansen Date: Wed, 28 Jul 2021 19:29:43 +0800 Subject: [PATCH 07/15] =?UTF-8?q?[GL][=E5=BC=80=E5=A7=8B=E5=BC=80=E5=8F=91?= =?UTF-8?q?Podfile=5Flocal=E5=8A=9F=E8=83=BD]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 2 +- demo/Gemfile.lock | 26 ++++++++++++++------------ demo/Podfile | 4 ++-- demo/Podfile.lock | 16 +++++++++++++++- demo/Podfile_local | 2 ++ lib/cocoapods-binary/gem_version.rb | 2 +- 6 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 demo/Podfile_local diff --git a/Gemfile.lock b/Gemfile.lock index 9db2d0f..bc9e1ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cocoapods-binary (0.4.4) + cocoapods-binary (0.4.6) cocoapods (>= 1.5.0, < 2.0) fourflusher (~> 2.0) xcpretty (~> 0.3.0) diff --git a/demo/Gemfile.lock b/demo/Gemfile.lock index 7c0bc1d..cb0ff05 100644 --- a/demo/Gemfile.lock +++ b/demo/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - cocoapods-binary (0.4.4) + cocoapods-binary (0.4.6) cocoapods (>= 1.5.0, < 2.0) fourflusher (~> 2.0) xcpretty (~> 0.3.0) @@ -10,12 +10,12 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.3) - activesupport (5.2.4.4) + activesupport (5.2.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) @@ -60,37 +60,39 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.7) + concurrent-ruby (1.1.9) escape (0.0.4) - ethon (0.12.0) - ffi (>= 1.3.0) - ffi (1.13.1) + ethon (0.14.0) + ffi (>= 1.15.0) + ffi (1.15.3) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.8.5) + i18n (1.8.10) concurrent-ruby (~> 1.0) - json (2.3.1) - minitest (5.14.2) + json (2.5.1) + minitest (5.14.4) molinillo (0.6.6) nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) public_suffix (4.0.6) + rexml (3.2.5) rouge (2.0.7) ruby-macho (1.4.0) thread_safe (0.3.6) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (1.2.8) + tzinfo (1.2.9) thread_safe (~> 0.1) - xcodeproj (1.19.0) + xcodeproj (1.20.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) + rexml (~> 3.2.4) xcpretty (0.3.0) rouge (~> 2.0.7) diff --git a/demo/Podfile b/demo/Podfile index e91f600..2a5f26b 100644 --- a/demo/Podfile +++ b/demo/Podfile @@ -2,11 +2,11 @@ platform :ios, '9.0' plugin 'cocoapods-binary' use_frameworks! -all_binary! - +#all_binary! target 'demo' do pod 'Masonry' + pod 'Moya', :binary => true end diff --git a/demo/Podfile.lock b/demo/Podfile.lock index f58bbb7..6b7a1c3 100644 --- a/demo/Podfile.lock +++ b/demo/Podfile.lock @@ -1,16 +1,30 @@ PODS: + - Alamofire (4.9.1) - Masonry (1.1.0) + - Moya (13.0.1): + - Moya/Core (= 13.0.1) + - Moya/Core (13.0.1): + - Alamofire (~> 4.1) + - Result (~> 4.1) + - Result (4.1.0) DEPENDENCIES: - Masonry + - Moya SPEC REPOS: trunk: + - Alamofire - Masonry + - Moya + - Result SPEC CHECKSUMS: + Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 + Moya: f4a4b80ff2f8a4ffc208dfb31cd91636622fee6e + Result: bd966fac789cc6c1563440b348ab2598cc24d5c7 -PODFILE CHECKSUM: 5daab9dbab4736d6a1b3df2ffa8d856285c16553 +PODFILE CHECKSUM: 3ce0f1842cd4e2647ed42da70d44c9392b1a014d COCOAPODS: 1.10.0 diff --git a/demo/Podfile_local b/demo/Podfile_local new file mode 100644 index 0000000..6d1897c --- /dev/null +++ b/demo/Podfile_local @@ -0,0 +1,2 @@ + +forbidden_dependency_binary! \ No newline at end of file diff --git a/lib/cocoapods-binary/gem_version.rb b/lib/cocoapods-binary/gem_version.rb index 2f2cd56..8bc0d11 100644 --- a/lib/cocoapods-binary/gem_version.rb +++ b/lib/cocoapods-binary/gem_version.rb @@ -1,3 +1,3 @@ module CocoapodsBinary - VERSION = "0.4.5" + VERSION = "0.4.6" end From c5a8e2b663f5da11a1068427e732cd0d5a31f5fd Mon Sep 17 00:00:00 2001 From: walker Date: Thu, 9 Sep 2021 04:18:51 +0800 Subject: [PATCH 08/15] [GL][Support to configure the `cocoapods-binary` plug-in separately through `BinPodfile`.] --- demo/BinPodfile | 6 ++++++ demo/Podfile_local | 2 -- lib/cocoapods-binary/Main.rb | 16 ++++++++++++++++ test.rb | 15 +++++++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 demo/BinPodfile delete mode 100644 demo/Podfile_local create mode 100644 test.rb diff --git a/demo/BinPodfile b/demo/BinPodfile new file mode 100644 index 0000000..acc1c9f --- /dev/null +++ b/demo/BinPodfile @@ -0,0 +1,6 @@ + +# You can write the `cocoapods-binary` plugin configuration in this file. +# Prevent frequent modification of `Podfile` on CI machines. + +# e.g +forbidden_dependency_binary! diff --git a/demo/Podfile_local b/demo/Podfile_local deleted file mode 100644 index 6d1897c..0000000 --- a/demo/Podfile_local +++ /dev/null @@ -1,2 +0,0 @@ - -forbidden_dependency_binary! \ No newline at end of file diff --git a/lib/cocoapods-binary/Main.rb b/lib/cocoapods-binary/Main.rb index 33e193d..1bfa786 100644 --- a/lib/cocoapods-binary/Main.rb +++ b/lib/cocoapods-binary/Main.rb @@ -84,6 +84,22 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) Pod::HooksManager.register('cocoapods-binary', :pre_install) do |installer_context| require_relative 'helper/feature_switches' + + # sync Podfile_bin, refer to `https://github.com/tripleCC/cocoapods-bin` + bin_project_root = Pod::Config.instance.project_root + bin_path = File.join(bin_project_root.to_s, 'BinPodfile') + next unless File.exist?(bin_path) + bin_contents = File.open(bin_path, 'r:utf-8', &:read) + bin_podfile = Pod::Config.instance.podfile + bin_podfile.instance_eval do + begin + eval(bin_contents, nil, bin_path) + rescue Exception => e + bin_message = "Invalid `#{bin_path}` file: #{e.message}" + raise Pod::DSLError.new(bin_message, bin_path, e, bin_contents) + end + end + if Pod.is_prebuild_stage next end diff --git a/test.rb b/test.rb new file mode 100644 index 0000000..d676e46 --- /dev/null +++ b/test.rb @@ -0,0 +1,15 @@ +require 'cocoapods-binary/gem_version.rb' + +build_ret = %x(gem build cocoapods-binary.gemspec) + +if ( build_ret.downcase =~ /(.*)successfully(.*)/ ) + puts "sudo gem install cocoapods-binary-#{CocoapodsBinary::VERSION}.gem" + puts "#{%x(sudo gem install cocoapods-binary-#{CocoapodsBinary::VERSION}.gem)}" +end + +Dir::chdir("demo") +puts "Begin run `Bundle update`" +puts "#{%x(Bundle update)}" + +puts "Begin run `Pod install`" +puts "#{%x(pod install)}" \ No newline at end of file From 9c54bc779a89445dd561bdaf5f05399efddafe11 Mon Sep 17 00:00:00 2001 From: walker Date: Thu, 9 Sep 2021 08:45:49 +0800 Subject: [PATCH 09/15] [GL][add all_not_prebuild! configration.] --- demo/BinPodfile | 2 ++ lib/cocoapods-binary/Main.rb | 48 ++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/demo/BinPodfile b/demo/BinPodfile index acc1c9f..f051b02 100644 --- a/demo/BinPodfile +++ b/demo/BinPodfile @@ -4,3 +4,5 @@ # e.g forbidden_dependency_binary! + +all_not_prebuild! \ No newline at end of file diff --git a/lib/cocoapods-binary/Main.rb b/lib/cocoapods-binary/Main.rb index 1bfa786..96daa18 100644 --- a/lib/cocoapods-binary/Main.rb +++ b/lib/cocoapods-binary/Main.rb @@ -12,6 +12,12 @@ def all_binary! DSL.prebuild_all = true end + # Disable prebuiding for all pods + # it has a high priority to other binary settings + def all_not_prebuild! + DSL.all_not_prebuild = true + end + # Fobidden dependency auto build to binary def forbidden_dependency_binary! DSL.forbidden_dependency_binary = true @@ -67,6 +73,9 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) class_attr_accessor :prebuild_all prebuild_all = false + class_attr_accessor :all_not_prebuild + all_not_prebuild = false + class_attr_accessor :bitcode_enabled bitcode_enabled = false @@ -143,27 +152,30 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) Pod::Installer.force_disable_integration true # don't integrate targets Pod::Config.force_disable_write_lockfile true # disbale write lock file for perbuild podfile Pod::Installer.disable_install_complete_message true # disable install complete message - - # make another custom sandbox - standard_sandbox = installer_context.sandbox - prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox) - - # get the podfile for prebuild - prebuild_podfile = Pod::Podfile.from_ruby(podfile.defined_in_file) - - # install - lockfile = installer_context.lockfile - binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile) - - if binary_installer.have_exact_prebuild_cache? && !update - binary_installer.install_when_cache_hit! + + if Pod::Podfile::DSL.all_not_prebuild # Disable prebuild + Pod::UI.puts "\n All do not need to be compiled!(all_not_prebuild!)" else - binary_installer.update = update - binary_installer.repo_update = repo_update - binary_installer.install! + # make another custom sandbox + standard_sandbox = installer_context.sandbox + prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox) + + # get the podfile for prebuild + prebuild_podfile = Pod::Podfile.from_ruby(podfile.defined_in_file) + + # install + lockfile = installer_context.lockfile + binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile) + + if binary_installer.have_exact_prebuild_cache? && !update + binary_installer.install_when_cache_hit! + else + binary_installer.update = update + binary_installer.repo_update = repo_update + binary_installer.install! + end end - # reset the environment Pod.is_prebuild_stage = false Pod::Installer.force_disable_integration false From 2363f19c438c1d05f99a39440cd97397b36a5b37 Mon Sep 17 00:00:00 2001 From: Hansen Date: Thu, 9 Sep 2021 19:18:10 +0800 Subject: [PATCH 10/15] [GL][update test.rb] --- test.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test.rb b/test.rb index d676e46..6cfb34a 100644 --- a/test.rb +++ b/test.rb @@ -2,9 +2,13 @@ build_ret = %x(gem build cocoapods-binary.gemspec) +rm_ret = %x(rm -rf Gemfile.lock) + +version=CocoapodsBinary::VERSION +puts "version :#{version}" if ( build_ret.downcase =~ /(.*)successfully(.*)/ ) - puts "sudo gem install cocoapods-binary-#{CocoapodsBinary::VERSION}.gem" - puts "#{%x(sudo gem install cocoapods-binary-#{CocoapodsBinary::VERSION}.gem)}" + puts "sudo gem install cocoapods-binary-#{version}.gem" + puts "#{%x(sudo gem install cocoapods-binary-#{version}.gem)}" end Dir::chdir("demo") From 56ca0780c5b133d8ebd10b3e2139e2d21047820c Mon Sep 17 00:00:00 2001 From: Hansen Date: Sat, 11 Sep 2021 02:11:52 +0800 Subject: [PATCH 11/15] [GL][update test.rb] --- test.rb | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/test.rb b/test.rb index 6cfb34a..31b47a7 100644 --- a/test.rb +++ b/test.rb @@ -1,19 +1,25 @@ require 'cocoapods-binary/gem_version.rb' - +# build gem +puts " 💫 begin build [cocoapods-binary]...\n" build_ret = %x(gem build cocoapods-binary.gemspec) -rm_ret = %x(rm -rf Gemfile.lock) - -version=CocoapodsBinary::VERSION -puts "version :#{version}" +# build success if ( build_ret.downcase =~ /(.*)successfully(.*)/ ) - puts "sudo gem install cocoapods-binary-#{version}.gem" - puts "#{%x(sudo gem install cocoapods-binary-#{version}.gem)}" + puts "\n✅ build [cocoapods-binary] successfully!" + + gemFile = /cocoapods-binary-.*/.match(build_ret) # match gem file + puts "\n💫 begin install #{gemFile} ...\n" + install_ret = %x(sudo gem install #{gemFile}) # install gem file + + if (install_ret.downcase =~ /(.*)successfully installed cocoapods-binary-(.*)/) + Dir::chdir("demo") + puts "\n✅ install gem success.\n\n💫 Begin run `Pod install`" + puts "#{%x(pod install)}" # pod install + else + puts "❗️install #{gemFile} failed!" + end +else + puts "❗️build [cocoapods-binary] failed!" end -Dir::chdir("demo") -puts "Begin run `Bundle update`" -puts "#{%x(Bundle update)}" -puts "Begin run `Pod install`" -puts "#{%x(pod install)}" \ No newline at end of file From 3762c4426eb386c73cd61d312a81eea3404ed775 Mon Sep 17 00:00:00 2001 From: Hansen Date: Sat, 11 Sep 2021 02:13:50 +0800 Subject: [PATCH 12/15] [GL][fix `all_not_prebuild!` bug.] --- lib/cocoapods-binary/Main.rb | 69 +++++++++++++++++------------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/lib/cocoapods-binary/Main.rb b/lib/cocoapods-binary/Main.rb index 96daa18..edb57cb 100644 --- a/lib/cocoapods-binary/Main.rb +++ b/lib/cocoapods-binary/Main.rb @@ -94,7 +94,7 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) require_relative 'helper/feature_switches' - # sync Podfile_bin, refer to `https://github.com/tripleCC/cocoapods-bin` + # sync BinPodfile, refer to `https://github.com/tripleCC/cocoapods-bin` bin_project_root = Pod::Config.instance.project_root bin_path = File.join(bin_project_root.to_s, 'BinPodfile') next unless File.exist?(bin_path) @@ -123,46 +123,44 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) exit end end - - - # -- step 1: prebuild framework --- - # Execute a sperated pod install, to generate targets for building framework, - # then compile them to framework files. - require_relative 'helper/prebuild_sandbox' - require_relative 'Prebuild' - - 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 - Pod::Podfile::DSL.enable_prebuild_patch true # enable sikpping for prebuild targets - Pod::Installer.force_disable_integration true # don't integrate targets - Pod::Config.force_disable_write_lockfile true # disbale write lock file for perbuild podfile - Pod::Installer.disable_install_complete_message true # disable install complete message + # Check prebuild enable if Pod::Podfile::DSL.all_not_prebuild # Disable prebuild - Pod::UI.puts "\n All do not need to be compiled!(all_not_prebuild!)" + Pod::UI.puts "⚠️ Disable prebuild!" else + Pod::UI.puts "🚀 Prebuild frameworks" + + # -- step 1: prebuild framework --- + # Execute a sperated pod install, to generate targets for building framework, + # then compile them to framework files. + require_relative 'helper/prebuild_sandbox' + require_relative 'Prebuild' + + # 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 + include ObjectSpace + update = nil + repo_update = nil + ObjectSpace.each_object(Pod::Installer) { |installer| + update = installer.update + repo_update = installer.repo_update + } + + # control features + Pod.is_prebuild_stage = true + Pod::Podfile::DSL.enable_prebuild_patch true # enable sikpping for prebuild targets + Pod::Installer.force_disable_integration true # don't integrate targets + Pod::Config.force_disable_write_lockfile true # disbale write lock file for perbuild podfile + Pod::Installer.disable_install_complete_message true # disable install complete message + # make another custom sandbox standard_sandbox = installer_context.sandbox prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox) - + # get the podfile for prebuild prebuild_podfile = Pod::Podfile.from_ruby(podfile.defined_in_file) - + # install lockfile = installer_context.lockfile binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile) @@ -175,7 +173,7 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) binary_installer.install! end end - + # reset the environment Pod.is_prebuild_stage = false Pod::Installer.force_disable_integration false @@ -183,8 +181,7 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) 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 --- # install Pod::UI.puts "\n" From 5ea658b5438d9cf69a593593f57a1085482cadd9 Mon Sep 17 00:00:00 2001 From: Hansen Date: Sat, 11 Sep 2021 02:17:34 +0800 Subject: [PATCH 13/15] [GL][update to version: 0.4.7, update Gemfile.lock.] --- Gemfile.lock | 2 +- demo/Gemfile.lock | 2 +- lib/cocoapods-binary/gem_version.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bc9e1ed..18c38c6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cocoapods-binary (0.4.6) + cocoapods-binary (0.4.7) cocoapods (>= 1.5.0, < 2.0) fourflusher (~> 2.0) xcpretty (~> 0.3.0) diff --git a/demo/Gemfile.lock b/demo/Gemfile.lock index cb0ff05..af32a7f 100644 --- a/demo/Gemfile.lock +++ b/demo/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - cocoapods-binary (0.4.6) + cocoapods-binary (0.4.7) cocoapods (>= 1.5.0, < 2.0) fourflusher (~> 2.0) xcpretty (~> 0.3.0) diff --git a/lib/cocoapods-binary/gem_version.rb b/lib/cocoapods-binary/gem_version.rb index 8bc0d11..0b21f91 100644 --- a/lib/cocoapods-binary/gem_version.rb +++ b/lib/cocoapods-binary/gem_version.rb @@ -1,3 +1,3 @@ module CocoapodsBinary - VERSION = "0.4.6" + VERSION = "0.4.7" end From 0421ab8ab229d22b925b651d8acdf928da8abd95 Mon Sep 17 00:00:00 2001 From: Hansen Date: Sat, 11 Sep 2021 02:50:15 +0800 Subject: [PATCH 14/15] [GL][update README.md]. --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e3c0d9..776c1cf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,15 @@ Forked from https://github.com/muukii/cocoapods-binary -add `forbidden_dependency_binary!`, Prevent the automatic compilation of dependent libraries into binary as well. +## Change log + + +2012/09/11 +* Support to configure the `cocoapods-binary` plug-in separately through `BinPodfile`. +* Add `all_not_prebuild!` for prebuild. +* Add a `test.rb` script to help you test quickly. + +2021/03/15 +* add `forbidden_dependency_binary!`, Prevent the automatic compilation of dependent libraries into binary as well. --- @@ -90,7 +99,20 @@ If your `Pods` folder is excluded from git, you may add `keep_source_code_for_pr If bitcode is needed, add a `enable_bitcode_for_prebuilt_frameworks!` before all targets in Podfile +If you want to disable binary for all pods, you can use `all_not_prebuild!`, it has high priority to other binary settings. + +If you need to frequently modify the configuration of `cocoapods-binary`, but do not want to synchronize to the git repository, you can use `BinPodfile`, add `BinPodfile` to your `.gitignor`file. +```ruby + +# You can write the `cocoapods-binary` plugin configuration in this file. +# Prevent frequent modification of `Podfile` on CI machines. + +# e.g +forbidden_dependency_binary! + +all_not_prebuild! +``` #### Known Issues - doesn't support watchos now From 1937fa99c6a4e352e28fe367ef050b4e8b76b3d7 Mon Sep 17 00:00:00 2001 From: Hansen Date: Mon, 13 Sep 2021 12:58:26 +0800 Subject: [PATCH 15/15] [GL][update README] --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 776c1cf..6a9168c 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Forked from https://github.com/muukii/cocoapods-binary 2012/09/11 -* Support to configure the `cocoapods-binary` plug-in separately through `BinPodfile`. -* Add `all_not_prebuild!` for prebuild. +* Support to configure the `cocoapods-binary` plug-in separately through `BinPodfile`. [more >>](#BinPodfile) +* Add `all_not_prebuild!` for prebuild. [more >>](#all_not_probuild) * Add a `test.rb` script to help you test quickly. 2021/03/15 @@ -99,9 +99,9 @@ If your `Pods` folder is excluded from git, you may add `keep_source_code_for_pr If bitcode is needed, add a `enable_bitcode_for_prebuilt_frameworks!` before all targets in Podfile -If you want to disable binary for all pods, you can use `all_not_prebuild!`, it has high priority to other binary settings. +`all_not_probuild`: If you want to disable binary for all pods, you can use `all_not_prebuild!`, it has high priority to other binary settings. -If you need to frequently modify the configuration of `cocoapods-binary`, but do not want to synchronize to the git repository, you can use `BinPodfile`, add `BinPodfile` to your `.gitignor`file. +BinPodfie: If you need to frequently modify the configuration of `cocoapods-binary`, but do not want to synchronize to the git repository, you can use `BinPodfile`, add `BinPodfile` to your `.gitignor`file. ```ruby