cocoapods-alexandria 0.1.2 → 0.1.3

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: 9539b27efca25b290026d937d2d28407e3b414effd938d1337b95aec2d487b9e
4
- data.tar.gz: '088ca39962209fca143365c249390476a99ad64c1fb06f5c11169a7859e59761'
3
+ metadata.gz: 78e151c7ffabfa1fbd96664cb624d48be0f71951cfaed1f9fec9e100cc89cf1d
4
+ data.tar.gz: 8d587ba944d86a928421700b9a46f4aabebd1282ea44db6fc8bdc41628dd59df
5
5
  SHA512:
6
- metadata.gz: abdca4dbad35bc4b9b81ee4881290c3e2afedc5bac990bc551dbb093cbee54edd1465d7b817ad8b541474cd3e45431dd249c3342ec1bf5da0f6f29244d2f5e85
7
- data.tar.gz: adda88838d7b846af0733018dd4f8124b1ae6be0a80612c084295beb23dd1a747bafbe299b3b92d37447d659e65fcc0178048901da03232b0fad54d41e7c1627
6
+ metadata.gz: c6dc83e067aabe9c0e890f1ad579e7abcd546c234fe2dbd692e9614a238f38809181ea47d892f65e567f6cbdaf50b2eba9e93feb61749d7ad02bb83d29c3af76
7
+ data.tar.gz: e035c88b38adbb67c12c42b753cdf7de4670842d342f26c7eb87e405a085ff54e8c849b35b65f469aac347fb02003610cec93f3234d28fff9a8990544e72e559
@@ -1,3 +1,3 @@
1
1
  module CocoapodsAlexandria
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -24,13 +24,7 @@ module PodAlexandria
24
24
  target_name,
25
25
  {
26
26
  'configFiles' => configurations,
27
- 'dependencies' => get_dependencies_from_xcconfig(xcconfig).map { |dependency|
28
- if dependency.exists?
29
- { 'framework' => dependency.path, 'embed' => dependency.is_dynamic? }
30
- else
31
- { 'sdk' => dependency.sdk }
32
- end
33
- }
27
+ 'dependencies' => get_dependencies_from_xcconfig(xcconfig).map(&:xcodegen_info)
34
28
  }
35
29
  ]
36
30
  end
@@ -43,7 +37,8 @@ module PodAlexandria
43
37
  def self.get_dependencies_from_xcconfig(file)
44
38
  File.readlines(file).select { |line| line.start_with?('OTHER_LDFLAGS') }.first
45
39
  &.split('=')&.at(1)&.tr('"', '') # get value (and remove quotes)
46
- &.gsub('-framework', '')&.gsub('-ObjC', '') # remove unneeded flags
40
+ &.gsub('-framework ', '-f')&.gsub('-weak_framework ', '-wf') # replace framework with fake linker flag
41
+ &.gsub('-ObjC', '') # remove unneeded flags
47
42
  &.split&.drop(1) # remove inherited
48
43
  &.map { |d| Dependency.new(d) } || []
49
44
  end
@@ -1,11 +1,30 @@
1
1
  module PodAlexandria
2
2
  class Dependency
3
- attr_reader :value
3
+ attr_reader :flag
4
+ attr_reader :module_name
4
5
 
5
6
  def initialize(value)
6
- @value = value
7
+ @flag = value.start_with?('-wf') ? 'wf' : value[1]
8
+ @module_name = value.delete_prefix('-l').delete_prefix('-f').delete_prefix('-wf')
7
9
  end
8
10
 
11
+ def xcodegen_info
12
+ if exists?
13
+ {
14
+ 'framework' => path,
15
+ 'embed' => is_dynamic?,
16
+ 'weak' => is_weak?
17
+ }
18
+ else
19
+ {
20
+ 'sdk' => sdk,
21
+ 'weak' => is_weak?
22
+ }
23
+ end
24
+ end
25
+
26
+ private
27
+
9
28
  def path
10
29
  binary = Dir["Rome/*.{framework,xcframework}/**/#{binary_name}"].first
11
30
  binary&.split(File::SEPARATOR)&.first(2)&.join(File::SEPARATOR)
@@ -15,7 +34,7 @@ module PodAlexandria
15
34
  if is_library?
16
35
  "lib#{module_name}.tbd"
17
36
  else
18
- "#{value}.framework"
37
+ "#{module_name}.framework"
19
38
  end
20
39
  end
21
40
 
@@ -26,17 +45,19 @@ module PodAlexandria
26
45
  def is_dynamic?
27
46
  if path.end_with? 'xcframework'
28
47
  any_arch = Dir["#{path}/*/*.framework"].first
29
- binary = "#{any_arch}/#{value}"
48
+ binary = "#{any_arch}/#{module_name}"
30
49
  else
31
- binary = "#{path}/#{value}"
50
+ binary = "#{path}/#{module_name}"
32
51
  end
33
52
  !%x(file #{binary} | grep dynamic).to_s.strip.empty?
34
53
  end
35
54
 
36
- private
37
-
38
55
  def is_library?
39
- value.start_with? '-l'
56
+ flag == 'l'
57
+ end
58
+
59
+ def is_weak?
60
+ flag == 'wf'
40
61
  end
41
62
 
42
63
  def binary_name
@@ -46,9 +67,5 @@ module PodAlexandria
46
67
  module_name
47
68
  end
48
69
  end
49
-
50
- def module_name
51
- value.delete_prefix('-l')
52
- end
53
70
  end
54
71
  end
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.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Jennes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-11 00:00:00.000000000 Z
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods