diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..112d60c --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,32 @@ +name: Tests + +on: [push] + +jobs: + build: + runs-on: macos-latest + steps: + - name: Cache multiple paths + uses: actions/cache@v2 + with: + path: | + cocoapods + bundler + key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} + - uses: maxim-lobanov/setup-xcode@v1.1 + with: + xcode-version: '12.2' + - uses: actions/checkout@v1 + - name: Set up Ruby 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x + - name: Test + run: | + gem install bundler + bundle install --path=${BUNDLE_PATH:-vendor/bundle} + bundle exec pod setup + rake install + cd test + sh test.sh + cd .. 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/.travis.yml b/.travis.yml index 9327854..8002639 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,14 @@ -osx_image: xcode9.3 +osx_image: xcode12.2 language: objective-c cache: - cocoapods - bundler +gemfile: test/Gemfile before_install: -- gem install cocoapods +- unset CPATH +install: +- bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle} +- bundle exec pod setup script: - rake install - cd test diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..18c38c6 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,118 @@ +PATH + remote: . + specs: + cocoapods-binary (0.4.7) + cocoapods (>= 1.5.0, < 2.0) + fourflusher (~> 2.0) + xcpretty (~> 0.3.0) + +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.3) + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + atomos (0.1.3) + bacon (1.2.0) + claide (1.0.3) + cocoapods (1.10.0) + addressable (~> 2.6) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.10.0) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.4.0, < 2.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.6.6) + nap (~> 1.0) + ruby-macho (~> 1.4) + xcodeproj (>= 1.19.0, < 2.0) + cocoapods-core (1.10.0) + activesupport (> 5.0, < 6) + addressable (~> 2.6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.4) + cocoapods-downloader (1.4.0) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.0) + cocoapods-trunk (1.5.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored2 (3.1.2) + concurrent-ruby (1.1.7) + escape (0.0.4) + ethon (0.12.0) + ffi (>= 1.3.0) + ffi (1.13.1) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + httpclient (2.8.3) + i18n (1.8.5) + concurrent-ruby (~> 1.0) + json (2.3.1) + minitest (5.14.2) + mocha (1.11.2) + mocha-on-bacon (0.2.3) + mocha (>= 0.13.0) + molinillo (0.6.6) + nanaimo (0.3.0) + nap (1.1.0) + netrc (0.11.0) + prettybacon (0.0.2) + bacon (~> 1.2) + public_suffix (4.0.6) + rake (13.0.1) + 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) + thread_safe (~> 0.1) + xcodeproj (1.19.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + xcpretty (0.3.0) + rouge (~> 2.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + bacon + bundler (> 1.3) + cocoapods + cocoapods-binary! + mocha + mocha-on-bacon + prettybacon + rake + +BUNDLED WITH + 2.1.4 diff --git a/README.md b/README.md index e1ba6c7..fe1c27e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,41 @@ +-> https://github.com/muukii/cocoapods-frost + +Forked from https://github.com/muukii/cocoapods-binary + +## Change log + + +2012/09/11 +* 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 +* 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 + +cocoapods-binary is not maintained now, because the owner of cocoapods-binary is currently busy. +Although, this plugin brings us a bunch of advantages in working iOS app development. +Respectfully, I created this forked repo inorder to gather PRs to fix issues and merge into the original repository in the future. + +## Installation + +``` +gem 'cocoapods-binary', git: "https://github.com/muukii/cocoapods-binary.git", branch: "master" +``` + +## Contribution + +Please submit a PR to my forked repo from `https://github.com/muukii/cocoapods-binary/pulls`. +I'll merge it. +**But I can't review well because I don't have much experience with Ruby. So I really need developers who can handle ruby code.** + +---

@@ -63,7 +101,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 +`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. +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 + +# 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 diff --git a/cocoapods-binary.gemspec b/cocoapods-binary.gemspec index 697aeb2..de525fb 100644 --- a/cocoapods-binary.gemspec +++ b/cocoapods-binary.gemspec @@ -22,6 +22,6 @@ Gem::Specification.new do |spec| spec.add_dependency "fourflusher", "~> 2.0" spec.add_dependency "xcpretty", "~> 0.3.0" - spec.add_development_dependency 'bundler', '~> 1.3' + spec.add_development_dependency 'bundler', '> 1.3' spec.add_development_dependency 'rake' end diff --git a/demo/BinPodfile b/demo/BinPodfile new file mode 100644 index 0000000..f051b02 --- /dev/null +++ b/demo/BinPodfile @@ -0,0 +1,8 @@ + +# 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! \ No newline at end of file diff --git a/demo/Gemfile b/demo/Gemfile index 5a134c1..3fc358f 100644 --- a/demo/Gemfile +++ b/demo/Gemfile @@ -2,6 +2,6 @@ # frozen_string_literal: true source "https://rubygems.org" -gem 'cocoapods', '1.6.1' +gem 'cocoapods', '1.10.0' gem 'cocoapods-binary', :path => "../" gem 'xcpretty' diff --git a/demo/Gemfile.lock b/demo/Gemfile.lock index 054eec4..af32a7f 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.7) cocoapods (>= 1.5.0, < 2.0) fourflusher (~> 2.0) xcpretty (~> 0.3.0) @@ -9,71 +9,90 @@ PATH GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.0) - activesupport (4.2.11.1) - i18n (~> 0.7) + CFPropertyList (3.0.3) + activesupport (5.2.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) atomos (0.1.3) - claide (1.0.2) - cocoapods (1.6.1) - activesupport (>= 4.0.2, < 5) + claide (1.0.3) + cocoapods (1.10.0) + addressable (~> 2.6) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.6.1) - cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.2, < 2.0) + cocoapods-core (= 1.10.0) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.4.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) - cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.1, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (>= 2.2.0, < 3.0) + fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) ruby-macho (~> 1.4) - xcodeproj (>= 1.8.1, < 2.0) - cocoapods-core (1.6.1) - activesupport (>= 4.0.2, < 6) + xcodeproj (>= 1.19.0, < 2.0) + cocoapods-core (1.10.0) + activesupport (> 5.0, < 6) + addressable (~> 2.6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) + netrc (~> 0.11) + public_suffix + typhoeus (~> 1.0) cocoapods-deintegrate (1.0.4) - cocoapods-downloader (1.2.2) + cocoapods-downloader (1.4.0) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.1.0) - cocoapods-trunk (1.3.1) + cocoapods-trunk (1.5.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) - cocoapods-try (1.1.0) + cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.9) escape (0.0.4) - fourflusher (2.2.0) + 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) - i18n (0.9.5) + httpclient (2.8.3) + i18n (1.8.10) concurrent-ruby (~> 1.0) - minitest (5.11.3) + json (2.5.1) + minitest (5.14.4) molinillo (0.6.6) - nanaimo (0.2.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) - tzinfo (1.2.5) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.9) thread_safe (~> 0.1) - xcodeproj (1.8.2) + 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.2.6) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) xcpretty (0.3.0) rouge (~> 2.0.7) @@ -81,9 +100,9 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.6.1) + cocoapods (= 1.10.0) cocoapods-binary! xcpretty BUNDLED WITH - 2.0.1 + 2.1.4 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 abaf4d6..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: - https://github.com/cocoapods/specs.git: + trunk: + - Alamofire - Masonry + - Moya + - Result SPEC CHECKSUMS: + Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 + Moya: f4a4b80ff2f8a4ffc208dfb31cd91636622fee6e + Result: bd966fac789cc6c1563440b348ab2598cc24d5c7 -PODFILE CHECKSUM: 5daab9dbab4736d6a1b3df2ffa8d856285c16553 +PODFILE CHECKSUM: 3ce0f1842cd4e2647ed42da70d44c9392b1a014d -COCOAPODS: 1.6.1 +COCOAPODS: 1.10.0 diff --git a/demo/demo.xcodeproj/project.pbxproj b/demo/demo.xcodeproj/project.pbxproj index 556833b..27d7f5d 100644 --- a/demo/demo.xcodeproj/project.pbxproj +++ b/demo/demo.xcodeproj/project.pbxproj @@ -8,25 +8,22 @@ /* Begin PBXBuildFile section */ 2E1AEA2ADE0B2C6D0E8CB73C /* BDWebImage_demo.m in Sources */ = {isa = PBXBuildFile; fileRef = 89A7B09D8E1B9A5928206B3D /* BDWebImage_demo.m */; }; - 7ADC04F6B6AD86B4711FC662 /* Pods_demo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0282097ED33E34DF2FB40193 /* Pods_demo.framework */; }; + 4E7F0A1DEF72401732631637 /* Pods_demo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 044EC92A39312500E33210F0 /* Pods_demo.framework */; }; 8BC2E4C8225F2B8600EC0609 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BC2E4C7225F2B8600EC0609 /* AppDelegate.swift */; }; 8BC2E4CA225F2B8600EC0609 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BC2E4C9225F2B8600EC0609 /* ViewController.swift */; }; 8BC2E4D2225F2B8700EC0609 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8BC2E4D0225F2B8700EC0609 /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 0282097ED33E34DF2FB40193 /* Pods_demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_demo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 6F9AD13F2ED88EAB7A9128D7 /* libPods-demoTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-demoTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 044EC92A39312500E33210F0 /* Pods_demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_demo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4CF2798C779A4B1DB1ED95EA /* Pods-demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo.release.xcconfig"; path = "Target Support Files/Pods-demo/Pods-demo.release.xcconfig"; sourceTree = ""; }; 89A7B09D8E1B9A5928206B3D /* BDWebImage_demo.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = BDWebImage_demo.m; sourceTree = ""; }; 8BC2E4C4225F2B8600EC0609 /* demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8BC2E4C7225F2B8600EC0609 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 8BC2E4C9225F2B8600EC0609 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 8BC2E4D1225F2B8700EC0609 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 8BC2E4D3225F2B8700EC0609 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9A8064F1F3E5738D234C80E2 /* Pods-demoTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demoTests.release.xcconfig"; path = "Target Support Files/Pods-demoTests/Pods-demoTests.release.xcconfig"; sourceTree = ""; }; - C55F7BF03CC970F91505F490 /* Pods-demoTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demoTests.debug.xcconfig"; path = "Target Support Files/Pods-demoTests/Pods-demoTests.debug.xcconfig"; sourceTree = ""; }; - E9C2707150376AA5D63E8BAE /* Pods-demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo.release.xcconfig"; path = "Target Support Files/Pods-demo/Pods-demo.release.xcconfig"; sourceTree = ""; }; - F8A8B289BFEAE54B0D540472 /* Pods-demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo.debug.xcconfig"; path = "Target Support Files/Pods-demo/Pods-demo.debug.xcconfig"; sourceTree = ""; }; + D04236F5B998AFD90E6F891E /* Pods-demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo.debug.xcconfig"; path = "Target Support Files/Pods-demo/Pods-demo.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -34,22 +31,13 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 7ADC04F6B6AD86B4711FC662 /* Pods_demo.framework in Frameworks */, + 4E7F0A1DEF72401732631637 /* Pods_demo.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 03BCE6F733E8AF8755385CE8 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 6F9AD13F2ED88EAB7A9128D7 /* libPods-demoTests.a */, - 0282097ED33E34DF2FB40193 /* Pods_demo.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 48064E0CABFB2B206E032E3B /* demos */ = { isa = PBXGroup; children = ( @@ -65,7 +53,7 @@ 8BC2E4C6225F2B8600EC0609 /* demo */, 8BC2E4C5225F2B8600EC0609 /* Products */, D25B1A678978B02ABFF01D1C /* Pods */, - 03BCE6F733E8AF8755385CE8 /* Frameworks */, + F46AC028BDE2AFC77F39ED2B /* Frameworks */, ); sourceTree = ""; }; @@ -92,14 +80,20 @@ D25B1A678978B02ABFF01D1C /* Pods */ = { isa = PBXGroup; children = ( - F8A8B289BFEAE54B0D540472 /* Pods-demo.debug.xcconfig */, - E9C2707150376AA5D63E8BAE /* Pods-demo.release.xcconfig */, - C55F7BF03CC970F91505F490 /* Pods-demoTests.debug.xcconfig */, - 9A8064F1F3E5738D234C80E2 /* Pods-demoTests.release.xcconfig */, + D04236F5B998AFD90E6F891E /* Pods-demo.debug.xcconfig */, + 4CF2798C779A4B1DB1ED95EA /* Pods-demo.release.xcconfig */, ); path = Pods; sourceTree = ""; }; + F46AC028BDE2AFC77F39ED2B /* Frameworks */ = { + isa = PBXGroup; + children = ( + 044EC92A39312500E33210F0 /* Pods_demo.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -107,11 +101,11 @@ isa = PBXNativeTarget; buildConfigurationList = 8BC2E4E1225F2B8800EC0609 /* Build configuration list for PBXNativeTarget "demo" */; buildPhases = ( - 4A7278B702427200DBDC45CB /* [CP] Check Pods Manifest.lock */, + 81ED7638A0CD08711B1D7EB7 /* [CP] Check Pods Manifest.lock */, 8BC2E4C0225F2B8600EC0609 /* Sources */, 8BC2E4C1225F2B8600EC0609 /* Frameworks */, 8BC2E4C2225F2B8600EC0609 /* Resources */, - 27E132FE722A29856F619A3D /* [CP] Embed Pods Frameworks */, + 5801A456D772620A7851D8CB /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -167,31 +161,24 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 27E132FE722A29856F619A3D /* [CP] Embed Pods Frameworks */ = { + 5801A456D772620A7851D8CB /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-demo/Pods-demo-frameworks.sh", - "${PODS_ROOT}/Masonry/Masonry.framework", - "${PODS_ROOT}/Masonry/Masonry.framework.dSYM", + "${PODS_ROOT}/Target Support Files/Pods-demo/Pods-demo-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - ); - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework", - "${DWARF_DSYM_FOLDER_PATH}/Masonry.framework.dSYM", + "${PODS_ROOT}/Target Support Files/Pods-demo/Pods-demo-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-demo/Pods-demo-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 4A7278B702427200DBDC45CB /* [CP] Check Pods Manifest.lock */ = { + 81ED7638A0CD08711B1D7EB7 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -358,7 +345,7 @@ }; 8BC2E4E2225F2B8800EC0609 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F8A8B289BFEAE54B0D540472 /* Pods-demo.debug.xcconfig */; + baseConfigurationReference = D04236F5B998AFD90E6F891E /* Pods-demo.debug.xcconfig */; buildSettings = { CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = demo/Info.plist; @@ -375,7 +362,7 @@ }; 8BC2E4E3225F2B8800EC0609 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E9C2707150376AA5D63E8BAE /* Pods-demo.release.xcconfig */; + baseConfigurationReference = 4CF2798C779A4B1DB1ED95EA /* Pods-demo.release.xcconfig */; buildSettings = { CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = demo/Info.plist; diff --git a/lib/cocoapods-binary/Integration.rb b/lib/cocoapods-binary/Integration.rb index 8ef76e1..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 @@ -286,4 +295,78 @@ class EmbedFrameworksScript end end end -end \ No newline at end of file +end + +module Pod + module Generator + class CopydSYMsScript + old_method = instance_method(:generate) + define_method(:generate) do + script = old_method.bind(self).() + script = script.gsub(/-av/, "-r -L -p -t -g -o -D -v") + end + end + end + end + + module Pod + module Generator + class CopyXCFrameworksScript + old_method = instance_method(:script) + define_method(:script) do + script = old_method.bind(self).() + script = script.gsub(/-av/, "-r -L -p -t -g -o -D -v") + end + end + end + end + + Pod::Installer::Xcode::PodsProjectGenerator::PodTargetInstaller.define_singleton_method(:dsym_paths) do |target| + dsym_paths = target.framework_paths.values.flatten.reject { |fmwk_path| fmwk_path.dsym_path.nil? }.map(&:dsym_path) + dsym_paths.concat(target.xcframeworks.values.flatten.flat_map { |xcframework| xcframework_dsyms(xcframework.path) }) + dsym_paths.uniq + end + + module Pod + class Installer + class Xcode + class PodsProjectGenerator + class PodTargetIntegrator + old_method = instance_method(:add_copy_xcframeworks_script_phase) + define_method(:add_copy_xcframeworks_script_phase) do |native_target| + script_path = "${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}" + + input_paths_by_config = {} + output_paths_by_config = {} + + xcframeworks = target.xcframeworks.values.flatten + + if use_input_output_paths? && !xcframeworks.empty? + input_file_list_path = target.copy_xcframeworks_script_input_files_path + input_file_list_relative_path = "${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}" + input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path) + input_paths = input_paths_by_config[input_paths_key] = [] + + framework_paths = xcframeworks.map { |xcf| "${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}" } + input_paths.concat framework_paths + + output_file_list_path = target.copy_xcframeworks_script_output_files_path + output_file_list_relative_path = "${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}" + output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path) + output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf| + "#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.name}" + end + end + + if xcframeworks.empty? + UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target) + else + UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target( + native_target, script_path, input_paths_by_config, output_paths_by_config) + end + end + end + end + end + end + end diff --git a/lib/cocoapods-binary/Main.rb b/lib/cocoapods-binary/Main.rb index 78fcf41..edb57cb 100644 --- a/lib/cocoapods-binary/Main.rb +++ b/lib/cocoapods-binary/Main.rb @@ -12,6 +12,17 @@ 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 + end + # Enable bitcode for prebuilt frameworks def enable_bitcode_for_prebuilt_frameworks! DSL.bitcode_enabled = true @@ -56,9 +67,15 @@ 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 + class_attr_accessor :all_not_prebuild + all_not_prebuild = false + class_attr_accessor :bitcode_enabled bitcode_enabled = false @@ -76,6 +93,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 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) + 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 @@ -90,56 +123,57 @@ 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 - - # 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! + + # Check prebuild enable + if Pod::Podfile::DSL.all_not_prebuild # Disable prebuild + Pod::UI.puts "⚠️ Disable prebuild!" else - binary_installer.update = update - binary_installer.repo_update = repo_update - binary_installer.install! + 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) + + 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 @@ -147,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" diff --git a/lib/cocoapods-binary/Prebuild.rb b/lib/cocoapods-binary/Prebuild.rb index 77bc834..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 @@ -109,6 +110,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..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.4" + VERSION = "0.4.7" 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 diff --git a/lib/cocoapods-binary/rome/build_framework.rb b/lib/cocoapods-binary/rome/build_framework.rb index 10c8571..44e217e 100644 --- a/lib/cocoapods-binary/rome/build_framework.rb +++ b/lib/cocoapods-binary/rome/build_framework.rb @@ -188,7 +188,7 @@ def self.build(sandbox_root_path, target, output_path, bitcode_enabled = false, def self.remove_build_dir(sandbox_root) path = build_dir(sandbox_root) - path.rmtree if path.exist? + # path.rmtree if path.exist? end private diff --git a/test.rb b/test.rb new file mode 100644 index 0000000..31b47a7 --- /dev/null +++ b/test.rb @@ -0,0 +1,25 @@ +require 'cocoapods-binary/gem_version.rb' +# build gem +puts " 💫 begin build [cocoapods-binary]...\n" +build_ret = %x(gem build cocoapods-binary.gemspec) + +# build success +if ( build_ret.downcase =~ /(.*)successfully(.*)/ ) + 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 + + diff --git a/test/Gemfile b/test/Gemfile index 9a3ea13..240e3e0 100644 --- a/test/Gemfile +++ b/test/Gemfile @@ -2,6 +2,6 @@ # frozen_string_literal: true source "https://rubygems.org" -gem 'cocoapods', '1.6.1' +gem 'cocoapods', '1.10.0' gem 'cocoapods-binary', :path => "../" diff --git a/test/change_podfile.py b/test/change_podfile.py index 5f31510..95b5098 100644 --- a/test/change_podfile.py +++ b/test/change_podfile.py @@ -53,7 +53,7 @@ def addSwiftPod(): """ keep_source_code_for_prebuilt_frameworks! -pod "RxCocoa", :binary => true +pod "RxCocoa", "~> 4.0", :binary => true pod "Literal", :binary => true """), """ @@ -70,7 +70,7 @@ def revertToSourceCode(): """ keep_source_code_for_prebuilt_frameworks! -pod "RxCocoa", :binary => true +pod "RxCocoa", "~> 4.0", :binary => true pod "Literal" """), """ diff --git a/test/test.sh b/test/test.sh old mode 100644 new mode 100755 index 4aa46dc..99e6466 --- a/test/test.sh +++ b/test/test.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e +set -ex build() { xcodebuild -workspace Binary.xcworkspace -scheme Binary ONLY_ACTIVE_ARCH=YES CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -quiet || exit 1