cocoapods-alexandria 0.2.3 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46cf82205ab24e541ad33a1ca9a006bcdcca91b9d74de55bcca6f30cfd3d20a5
4
- data.tar.gz: 07fb6b9a0ab2303f8101b078d36ca57afb8d3a05b954d4bbcb46e85f95d6d540
3
+ metadata.gz: eba5dd06d1fde3d97386d1333d408561de1e7ac99e5bc4699db45b9b7f6ab67a
4
+ data.tar.gz: ebc430e13e2fa6c1682487ab7cb1aa886f73cec78b5c8578f643018c179da960
5
5
  SHA512:
6
- metadata.gz: 27422e274948754cc86b5d80bf18d8a4c145a33fd7702056c541d2f138b5e46bf397f5c639cdd0b4ffdc47adeb3b64e23e0ae13734b6b866c71992ce7750f5b8
7
- data.tar.gz: 390bb68dbb97befcb794831b5834aa6e4520e7b4b823dfc471a54fc309c646f54fd1d56db3fb403c75dafc865a3b10a725819f0c7c0fa2a7916e7da59a94aa94
6
+ metadata.gz: 50ee3e10c737b7abfed342dd8d9f5d35b94ad32d8750c815122ac04b075a3fc01ce35708a42b55aea181017516bd648259aa0cfacf239e108950121be6754efb
7
+ data.tar.gz: 6b22e61d5c6d5e6ba795f69dfc156cdd987c5275ab6395f2ffe5f4f471d4d9a6bc85e838b2fd02da4e280b5dcc0114f21d0bb4f8a09b1c0edab42516fb27ad9f
@@ -1,3 +1,3 @@
1
1
  module CocoapodsAlexandria
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.6'
3
3
  end
@@ -15,15 +15,17 @@ module PodAlexandria
15
15
  deployment_target = target.platform_deployment_target
16
16
  target_label = target.cocoapods_target_label
17
17
 
18
- # build each dependency of target
19
- spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
20
-
21
- spec_names.map { |root_name, module_name|
22
- next if skip_build?(root_name, module_name, sdk)
23
- if File.directory?(build_path(target, module_name, sdk))
24
- build_path(target, module_name, sdk)
18
+ # find & build all dependencies
19
+ project.all_dependencies_for(target).map { |target|
20
+ # skip if already built (product, or by other target)
21
+ next if skip_build?(target, sdk)
22
+
23
+ # may already be built (by another target)
24
+ if File.directory?(build_path(target, sdk))
25
+ Pod::UI.puts "Already built '#{target.name}'."
26
+ build_path(target, sdk)
25
27
  else
26
- xcodebuild(root_name, module_name, sdk, deployment_target)
28
+ xcodebuild(target, sdk, deployment_target)
27
29
  end
28
30
  }.compact
29
31
  end
@@ -34,38 +36,72 @@ module PodAlexandria
34
36
  { :ios => 'iphoneos', :osx => 'macosx', :tvos => 'appletvos', :watchos => 'watchos' }
35
37
  end
36
38
 
37
- def skip_build?(target, module_name, sdk)
38
- File.directory?(destination_path(module_name)) ||
39
- File.directory?(build_path(target, module_name, sdk)) ||
40
- !is_native_target?(target)
39
+ def skip_build?(target, sdk)
40
+ File.directory?(destination_path(target))
41
41
  end
42
42
 
43
- def is_native_target?(target_name)
44
- project.targets
45
- .find { |t| t.name == target_name }
46
- .is_a?(Xcodeproj::Project::Object::PBXNativeTarget)
47
- end
48
-
49
- def xcodebuild(target, module_name, sdk, deployment_target)
50
- args = %W(-project #{sandbox.project_path.realdirpath} -scheme #{target} -configuration #{configuration} -sdk #{sdk})
43
+ def xcodebuild(target, sdk, deployment_target)
44
+ args = %W(-project #{sandbox.project_path.realdirpath} -scheme #{target.name} -configuration #{configuration} -sdk #{sdk})
51
45
  args += flags unless flags.nil?
52
46
 
53
- Pod::UI.puts "Building '#{target}' for #{sdk}..."
47
+ Pod::UI.puts "Building '#{target.name}' for #{sdk}..."
54
48
  Pod::Executable.execute_command 'xcodebuild', args, true
55
49
 
56
- build_path(target, module_name, sdk)
50
+ build_path(target, sdk)
57
51
  end
58
52
 
59
53
  def project
60
54
  @project ||= Xcodeproj::Project.open(sandbox.project_path)
61
55
  end
62
56
 
63
- def build_path(target, module_name, sdk)
64
- "#{build_dir}/#{configuration}-#{sdk}/#{target}/#{module_name}.framework"
57
+ def build_path(target, sdk)
58
+ # Note: using target.product_name is wrong in some cases (Cocoapods project generation bug)
59
+ # See https://github.com/CocoaPods/CocoaPods/issues/8007
60
+ "#{build_dir}/#{configuration}-#{sdk}/#{target.name}/#{target.product_reference.name}"
61
+ end
62
+
63
+ def destination_path(target)
64
+ # Note: using target.product_name is wrong in some cases (Cocoapods project generation bug)
65
+ # See https://github.com/CocoaPods/CocoaPods/issues/8007
66
+ "#{destination}/#{target.product_reference.name}"
67
+ end
68
+ end
69
+ end
70
+
71
+ module Xcodeproj
72
+ class Project
73
+ module Object
74
+ class AbstractTarget
75
+ def is_native?
76
+ is_a?(Xcodeproj::Project::Object::PBXNativeTarget)
77
+ end
78
+ end
79
+
80
+ class PBXNativeTarget
81
+ def is_bundle?
82
+ product_type == 'com.apple.product-type.bundle'
83
+ end
84
+
85
+ def all_dependencies
86
+ dependencies
87
+ .filter { |d| d.target.is_native? && !d.target.is_bundle? }
88
+ .map { |d| [d.target] + d.target.all_dependencies }
89
+ .flatten.uniq
90
+ end
91
+ end
92
+ end
93
+
94
+ def all_dependencies_for(umbrella_target)
95
+ target(umbrella_target.cocoapods_target_label).all_dependencies
65
96
  end
66
97
 
67
- def destination_path(module_name)
68
- "#{destination}/#{module_name}.framework"
98
+ def target(target_name)
99
+ result = targets.find { |t| t.name == target_name }
100
+ if result.is_native?
101
+ return result
102
+ else
103
+ return nil
104
+ end
69
105
  end
70
106
  end
71
107
  end
@@ -90,12 +90,12 @@ module PodAlexandria
90
90
 
91
91
  def delete(spec)
92
92
  name = spec_modules[spec] || module_name(spec)
93
- paths = Dir["#{destination}/#{name}.{framework,xcframework}"]
93
+ paths = Dir["#{destination}/#{name}.{a,framework,xcframework}"]
94
94
 
95
95
  if !paths.empty?
96
- paths.each { |path| FileUtils.remove_dir(path, true) }
96
+ paths.each { |path| FileUtils.remove_entry(path, true) }
97
97
  else
98
- Pod::UI.warn "🤔 Could not delete #{destination}/#{name}.(xc)framework, it does not exist! (this is normal for newly added pods)"
98
+ Pod::UI.warn "🤔 Could not delete cached binary for #{name}, it does not exist! (this is normal for newly added pods)"
99
99
  end
100
100
  end
101
101
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-alexandria
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Jennes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-05 00:00:00.000000000 Z
11
+ date: 2022-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods