cocoapods 1.8.4 → 1.9.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +69 -1
  3. data/lib/cocoapods.rb +1 -0
  4. data/lib/cocoapods/command/setup.rb +1 -0
  5. data/lib/cocoapods/executable.rb +1 -1
  6. data/lib/cocoapods/gem_version.rb +1 -1
  7. data/lib/cocoapods/generator/embed_frameworks_script.rb +36 -6
  8. data/lib/cocoapods/generator/prepare_artifacts_script.rb +244 -0
  9. data/lib/cocoapods/installer.rb +6 -5
  10. data/lib/cocoapods/installer/analyzer.rb +137 -59
  11. data/lib/cocoapods/installer/analyzer/pod_variant.rb +27 -12
  12. data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +11 -2
  13. data/lib/cocoapods/installer/project_cache/project_cache_analyzer.rb +10 -2
  14. data/lib/cocoapods/installer/project_cache/project_installation_cache.rb +15 -2
  15. data/lib/cocoapods/installer/project_cache/target_cache_key.rb +7 -5
  16. data/lib/cocoapods/installer/user_project_integrator.rb +1 -10
  17. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +100 -19
  18. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +3 -0
  19. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +29 -4
  20. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +7 -2
  21. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +106 -45
  22. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +68 -1
  23. data/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb +29 -14
  24. data/lib/cocoapods/sandbox/file_accessor.rb +32 -21
  25. data/lib/cocoapods/sources_manager.rb +9 -2
  26. data/lib/cocoapods/target.rb +11 -14
  27. data/lib/cocoapods/target/aggregate_target.rb +78 -18
  28. data/lib/cocoapods/target/build_settings.rb +64 -31
  29. data/lib/cocoapods/target/pod_target.rb +236 -87
  30. data/lib/cocoapods/user_interface/error_report.rb +14 -4
  31. data/lib/cocoapods/validator.rb +2 -0
  32. data/lib/cocoapods/xcode.rb +7 -0
  33. data/lib/cocoapods/{target → xcode}/framework_paths.rb +14 -1
  34. data/lib/cocoapods/xcode/linkage_analyzer.rb +22 -0
  35. data/lib/cocoapods/xcode/xcframework.rb +81 -0
  36. data/lib/cocoapods/xcode/xcframework/xcframework_slice.rb +51 -0
  37. metadata +12 -8
  38. data/lib/cocoapods/target/build_type.rb +0 -139
@@ -175,10 +175,8 @@ EOS
175
175
  if source.is_a?(Pod::CDNSource)
176
176
  "#{repo.basename} - CDN - #{source.url}"
177
177
  elsif source.git?
178
- Dir.chdir(repo) do
179
- sha = `git rev-parse HEAD 2>&1`.strip
180
- "#{repo.basename} - git - #{source.url} @ #{sha}"
181
- end
178
+ sha = git_hash(source)
179
+ "#{repo.basename} - git - #{source.url} @ #{sha}"
182
180
  else
183
181
  "#{repo.basename} - #{source.type}"
184
182
  end
@@ -188,6 +186,18 @@ EOS
188
186
  def original_command
189
187
  "#{$PROGRAM_NAME} #{ARGV.join(' ')}"
190
188
  end
189
+
190
+ private
191
+
192
+ # @param [Source] source
193
+ # a git source
194
+ #
195
+ # @return [String] the current git SHA
196
+ def git_hash(source)
197
+ Dir.chdir(source.repo) do
198
+ `git rev-parse HEAD 2>&1`
199
+ end
200
+ end
191
201
  end
192
202
  end
193
203
  end
@@ -39,6 +39,7 @@ module Pod
39
39
  # the platforms to lint.
40
40
  #
41
41
  def initialize(spec_or_path, source_urls, platforms = [])
42
+ @use_frameworks = true
42
43
  @linter = Specification::Linter.new(spec_or_path)
43
44
  @source_urls = if @linter.spec && @linter.spec.dependencies.empty? && @linter.spec.recursive_subspecs.all? { |s| s.dependencies.empty? }
44
45
  []
@@ -57,6 +58,7 @@ module Pod
57
58
  end
58
59
  result
59
60
  end
61
+ @use_frameworks = true
60
62
  end
61
63
 
62
64
  #-------------------------------------------------------------------------#
@@ -0,0 +1,7 @@
1
+ module Pod
2
+ module Xcode
3
+ autoload :LinkageAnalyzer, 'cocoapods/xcode/linkage_analyzer'
4
+ autoload :XCFramework, 'cocoapods/xcode/xcframework'
5
+ autoload :FrameworkPaths, 'cocoapods/xcode/framework_paths'
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Pod
2
- class Target
2
+ module Xcode
3
3
  class FrameworkPaths
4
4
  # @return [String] the path to the .framework
5
5
  #
@@ -36,6 +36,19 @@ module Pod
36
36
  def all_paths
37
37
  [source_path, dsym_path, bcsymbolmap_paths].flatten.compact
38
38
  end
39
+
40
+ # @param [Pathname] path the path to the `.framework` bundle
41
+ #
42
+ # @return [FrameworkPaths] the path of the framework with dsym & bcsymbolmap paths, if found
43
+ #
44
+ def self.from_path(path)
45
+ dsym_name = "#{path.basename}.dSYM"
46
+ dsym_path = Pathname.new("#{path.dirname}/#{dsym_name}")
47
+ dsym_path = nil unless dsym_path.exist?
48
+ bcsymbolmap_paths = Pathname.glob(path.dirname, '*.bcsymbolmap')
49
+
50
+ FrameworkPaths.new(path, dsym_path, bcsymbolmap_paths)
51
+ end
39
52
  end
40
53
  end
41
54
  end
@@ -0,0 +1,22 @@
1
+ require 'macho'
2
+
3
+ module Pod
4
+ module Xcode
5
+ class LinkageAnalyzer
6
+ # @param [Pathname] binary
7
+ # The file to be checked for being a dynamic Mach-O binary.
8
+ #
9
+ # @return [Boolean] Whether `binary` can be dynamically linked.
10
+ #
11
+ def self.dynamic_binary?(binary)
12
+ @cached_dynamic_binary_results ||= {}
13
+ return @cached_dynamic_binary_results[binary] unless @cached_dynamic_binary_results[binary].nil?
14
+ return false unless binary.file?
15
+
16
+ @cached_dynamic_binary_results[binary] = MachO.open(binary).dylib?
17
+ rescue MachO::MachOError
18
+ @cached_dynamic_binary_results[binary] = false
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cocoapods/xcode/xcframework/xcframework_slice'
4
+
5
+ module Pod
6
+ module Xcode
7
+ class XCFramework
8
+ # @return [Pathname] path the path to the .xcframework on disk
9
+ #
10
+ attr_reader :path
11
+
12
+ # @return [Pod::Version] the format version of the .xcframework
13
+ #
14
+ attr_reader :format_version
15
+
16
+ # @return [Array<XCFramework::Slice>] the slices contained inside this .xcframework
17
+ #
18
+ attr_reader :slices
19
+
20
+ # @return [Hash] the contents of the parsed plist
21
+ #
22
+ attr_reader :plist
23
+
24
+ # Initializes an XCFramework instance with a path on disk
25
+ #
26
+ # @param [Pathname, String] path
27
+ # The path to the .xcframework on disk
28
+ #
29
+ # @return [XCFramework] the xcframework at the given path
30
+ #
31
+ def initialize(path)
32
+ @path = Pathname.new(path).tap do |p|
33
+ raise 'Absolute path is required' unless p.absolute?
34
+ end
35
+
36
+ @plist = Xcodeproj::Plist.read_from_path(plist_path)
37
+ parse_plist_contents
38
+ end
39
+
40
+ # @return [Pathname] the path to the Info.plist
41
+ #
42
+ def plist_path
43
+ path + 'Info.plist'
44
+ end
45
+
46
+ # @return [String] the basename of the framework
47
+ #
48
+ def name
49
+ File.basename(path, '.xcframework')
50
+ end
51
+
52
+ # @return [Boolean] true if any slices use dynamic linkage
53
+ #
54
+ def includes_dynamic_slices?
55
+ slices.any? { |slice| Xcode::LinkageAnalyzer.dynamic_binary?(slice.binary_path) }
56
+ end
57
+
58
+ # @return [Boolean] true if any slices use dynamic linkage
59
+ #
60
+ def includes_static_slices?
61
+ slices.any? { |slice| !Xcode::LinkageAnalyzer.dynamic_binary?(slice.binary_path) }
62
+ end
63
+
64
+ private
65
+
66
+ def parse_plist_contents
67
+ @format_version = Pod::Version.new(plist['XCFrameworkFormatVersion'])
68
+ @slices = plist['AvailableLibraries'].map do |library|
69
+ identifier = library['LibraryIdentifier']
70
+ relative_path = library['LibraryPath']
71
+ archs = library['SupportedArchitectures']
72
+ platform_name = library['SupportedPlatform']
73
+ platform_variant = library['SupportedPlatformVariant']
74
+
75
+ slice_path = path.join(identifier).join(relative_path)
76
+ XCFramework::Slice.new(slice_path, identifier, archs, platform_name, platform_variant)
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,51 @@
1
+ module Pod
2
+ module Xcode
3
+ class XCFramework
4
+ class Slice
5
+ # @return [Pathname] the path to the .framework root of this framework slice
6
+ #
7
+ attr_reader :path
8
+
9
+ # @return [Array<String>] list of supported architectures
10
+ #
11
+ attr_reader :supported_archs
12
+
13
+ # @return [String] the framework identifier
14
+ #
15
+ attr_reader :identifier
16
+
17
+ # @return [Platform] the supported platform
18
+ #
19
+ attr_reader :platform
20
+
21
+ # @return [Symbol] the platform variant. Either :simulator or nil
22
+ #
23
+ attr_reader :platform_variant
24
+
25
+ def initialize(path, identifier, archs, platform, platform_variant = nil)
26
+ @path = path
27
+ @identifier = identifier
28
+ @supported_archs = archs
29
+ @platform = Pod::Platform.new(platform)
30
+ @platform_variant = platform_variant.to_sym unless platform_variant.nil?
31
+ end
32
+
33
+ # @return [String] the name of the framework
34
+ #
35
+ def name
36
+ @name ||= File.basename(path, '.framework')
37
+ end
38
+
39
+ def simulator_variant?
40
+ @platform_variant == :simulator
41
+ end
42
+
43
+ # @return [Pathname] the path to the bundled binary
44
+ #
45
+ def binary_path
46
+ path + name
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4
4
+ version: 1.9.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-10-16 00:00:00.000000000 Z
14
+ date: 2019-12-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cocoapods-core
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 1.8.4
22
+ version: 1.9.0.beta.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.8.4
29
+ version: 1.9.0.beta.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: claide
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -207,7 +207,7 @@ dependencies:
207
207
  requirements:
208
208
  - - ">="
209
209
  - !ruby/object:Gem::Version
210
- version: 1.11.1
210
+ version: 1.14.0
211
211
  - - "<"
212
212
  - !ruby/object:Gem::Version
213
213
  version: '2.0'
@@ -217,7 +217,7 @@ dependencies:
217
217
  requirements:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
- version: 1.11.1
220
+ version: 1.14.0
221
221
  - - "<"
222
222
  - !ruby/object:Gem::Version
223
223
  version: '2.0'
@@ -460,6 +460,7 @@ files:
460
460
  - lib/cocoapods/generator/info_plist_file.rb
461
461
  - lib/cocoapods/generator/module_map.rb
462
462
  - lib/cocoapods/generator/prefix_header.rb
463
+ - lib/cocoapods/generator/prepare_artifacts_script.rb
463
464
  - lib/cocoapods/generator/umbrella_header.rb
464
465
  - lib/cocoapods/hooks_manager.rb
465
466
  - lib/cocoapods/installer.rb
@@ -529,14 +530,17 @@ files:
529
530
  - lib/cocoapods/target.rb
530
531
  - lib/cocoapods/target/aggregate_target.rb
531
532
  - lib/cocoapods/target/build_settings.rb
532
- - lib/cocoapods/target/build_type.rb
533
- - lib/cocoapods/target/framework_paths.rb
534
533
  - lib/cocoapods/target/pod_target.rb
535
534
  - lib/cocoapods/user_interface.rb
536
535
  - lib/cocoapods/user_interface/error_report.rb
537
536
  - lib/cocoapods/user_interface/inspector_reporter.rb
538
537
  - lib/cocoapods/validator.rb
539
538
  - lib/cocoapods/version_metadata.rb
539
+ - lib/cocoapods/xcode.rb
540
+ - lib/cocoapods/xcode/framework_paths.rb
541
+ - lib/cocoapods/xcode/linkage_analyzer.rb
542
+ - lib/cocoapods/xcode/xcframework.rb
543
+ - lib/cocoapods/xcode/xcframework/xcframework_slice.rb
540
544
  homepage: https://github.com/CocoaPods/CocoaPods
541
545
  licenses:
542
546
  - MIT
@@ -1,139 +0,0 @@
1
- module Pod
2
- class Target
3
- class BuildType
4
- # @return [Array<Symbol>] known packaging options.
5
- #
6
- KNOWN_PACKAGING_OPTIONS = %i(library framework).freeze
7
-
8
- # @return [Array<Symbol>] known linking options.
9
- #
10
- KNOWN_LINKAGE_OPTIONS = %i(static dynamic).freeze
11
-
12
- # @return [Symbol] the packaging for this build type, one of KNOWN_PACKAGING_OPTIONS
13
- #
14
- attr_reader :packaging
15
-
16
- # @return [Symbol] the linkage for this build type, one of KNOWN_LINKAGE_OPTIONS
17
- #
18
- attr_reader :linkage
19
-
20
- attr_reader :hash
21
-
22
- def initialize(linkage: :static, packaging: :library)
23
- raise ArgumentError, "Invalid linkage option #{linkage.inspect}, valid options are #{KNOWN_LINKAGE_OPTIONS.inspect}" unless KNOWN_LINKAGE_OPTIONS.include?(linkage)
24
- raise ArgumentError, "Invalid packaging option #{packaging.inspect}, valid options are #{KNOWN_PACKAGING_OPTIONS.inspect}" unless KNOWN_PACKAGING_OPTIONS.include?(packaging)
25
-
26
- @packaging = packaging
27
- @linkage = linkage
28
- @hash = packaging.hash ^ linkage.hash
29
- end
30
-
31
- # @param [Specification] spec
32
- # the specification to infer the build type from
33
- #
34
- # @param [Boolean] host_requires_frameworks
35
- # whether the host target definition specified `use_frameworks!`
36
- #
37
- # @return [BuildType] the appropriate build type for the given spec,
38
- # based on whether the host target definition requires frameworks.
39
- #
40
- def self.infer_from_spec(spec, host_requires_frameworks: false)
41
- if host_requires_frameworks
42
- root_spec = spec && spec.root
43
- if root_spec && root_spec.static_framework
44
- static_framework
45
- else
46
- dynamic_framework
47
- end
48
- else
49
- static_library
50
- end
51
- end
52
-
53
- # @return [BuildType] the build type for a dynamic library
54
- #
55
- def self.dynamic_library
56
- new(:linkage => :dynamic, :packaging => :library)
57
- end
58
-
59
- # @return [BuildType] the build type for a static library
60
- #
61
- def self.static_library
62
- new(:linkage => :static, :packaging => :library)
63
- end
64
-
65
- # @return [BuildType] the build type for a dynamic framework
66
- #
67
- def self.dynamic_framework
68
- new(:linkage => :dynamic, :packaging => :framework)
69
- end
70
-
71
- # @return [BuildType] the build type for a static framework
72
- #
73
- def self.static_framework
74
- new(:linkage => :static, :packaging => :framework)
75
- end
76
-
77
- # @return [Boolean] whether the target is built dynamically
78
- #
79
- def dynamic?
80
- linkage == :dynamic
81
- end
82
-
83
- # @return [Boolean] whether the target is built statically
84
- #
85
- def static?
86
- linkage == :static
87
- end
88
-
89
- # @return [Boolean] whether the target is built as a framework
90
- #
91
- def framework?
92
- packaging == :framework
93
- end
94
-
95
- # @return [Boolean] whether the target is built as a library
96
- #
97
- def library?
98
- packaging == :library
99
- end
100
-
101
- # @return [Boolean] whether the target is built as a dynamic framework
102
- #
103
- def dynamic_framework?
104
- dynamic? && framework?
105
- end
106
-
107
- # @return [Boolean] whether the target is built as a dynamic library
108
- #
109
- def dynamic_library?
110
- dynamic? && library?
111
- end
112
-
113
- # @return [Boolean] whether the target is built as a static framework
114
- #
115
- def static_framework?
116
- static? && framework?
117
- end
118
-
119
- # @return [Boolean] whether the target is built as a static library
120
- #
121
- def static_library?
122
- static? && library?
123
- end
124
-
125
- def to_s
126
- "#{linkage} #{packaging}"
127
- end
128
-
129
- def inspect
130
- "#<#{self.class} linkage=#{linkage} packaging=#{packaging}>"
131
- end
132
-
133
- def ==(other)
134
- linkage == other.linkage &&
135
- packaging == other.packaging
136
- end
137
- end
138
- end
139
- end