cocoapods-alexandria 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-alexandria/env_local/pre_install.rb +27 -4
- data/lib/cocoapods-alexandria/gem_version.rb +1 -1
- data/lib/cocoapods-alexandria/helper/user_options.rb +6 -0
- data/lib/cocoapods-alexandria/xcodegen/dependencies_generator.rb +13 -13
- data/lib/cocoapods-alexandria/xcodegen/dependency.rb +29 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9400a2ed133bb3f4f14db6c3d24a6df569875130386e59734e02558b05913143
|
4
|
+
data.tar.gz: 57dc2f0f5d526cffb5c8c0958a684d55be0413d64fada2df4426aa6b4c5615eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca10b51f5ff9059f9fc3007191555e4b7af0b51c13f7d77295a8d6676c8c551b597db4f0d7da2498adb95cc6016dc53b75faa70e88823f03a015b0b5dbd942a
|
7
|
+
data.tar.gz: 2285e47798e9eb4207099d09e9eb5053fccc2021a43e7d9adf0c5801ca508808615a86a0a24f20ad27702093039ac89d2dc714718a592e8de3b224e5a674eaf8
|
@@ -8,17 +8,40 @@ module PodAlexandria
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
Pod::UI.puts
|
11
|
+
Pod::UI.puts 'Cocoapods Alexandria running in local mode.'
|
12
12
|
|
13
|
-
|
13
|
+
if should_predownload_dep
|
14
|
+
Pod::UI.title 'Pre-downloading dependency for XcodeGen'
|
15
|
+
predownload_dep
|
16
|
+
end
|
17
|
+
|
18
|
+
Pod::UI.title 'Generating project using XcodeGen'
|
14
19
|
XcodeGen::cleanupRome
|
15
20
|
XcodeGen::clearDependencies(options.xcodegen_dependencies_file)
|
16
21
|
XcodeGen::generate
|
17
22
|
|
18
|
-
Pod::UI.title
|
23
|
+
Pod::UI.title 'Preparing environment...'
|
19
24
|
podfile.prepare_for_xcodegen
|
20
25
|
|
21
|
-
Pod::UI.title
|
26
|
+
Pod::UI.title 'Continuing with normal CocoaPods'
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def should_predownload_dep
|
32
|
+
File.readlines('project.yml').grep(/Pods\/AppwiseCore\/XcodeGen/).any? &&
|
33
|
+
!File.directory?('Pods/AppwiseCore/XcodeGen')
|
34
|
+
end
|
35
|
+
|
36
|
+
def predownload_dep
|
37
|
+
system(
|
38
|
+
'rm -rf Pods/AppwiseCore && '\
|
39
|
+
'mkdir -p Pods && '\
|
40
|
+
'rm -f /tmp/ac.zip && '\
|
41
|
+
'curl -L "https://github.com/appwise-labs/AppwiseCore/archive/master.zip" > /tmp/ac.zip && '\
|
42
|
+
'unzip -q -d Pods /tmp/ac.zip && '\
|
43
|
+
'mv Pods/AppwiseCore-master Pods/AppwiseCore'
|
44
|
+
)
|
22
45
|
end
|
23
46
|
end
|
24
47
|
end
|
@@ -3,17 +3,23 @@ module PodAlexandria
|
|
3
3
|
attr_reader :environment_configs
|
4
4
|
attr_reader :force_bitcode
|
5
5
|
attr_reader :xcodegen_dependencies_file
|
6
|
+
attr_reader :do_not_embed_dependencies_in_targets
|
6
7
|
|
7
8
|
def initialize(installer_context, user_options)
|
8
9
|
@environment_configs = user_options.fetch('environment_configs', default_configurations(installer_context))
|
9
10
|
@force_bitcode = user_options.fetch('force_bitcode', true)
|
10
11
|
@xcodegen_dependencies_file = user_options.fetch('xcodegen_dependencies_file', 'projectDependencies.yml')
|
12
|
+
@do_not_embed_dependencies_in_targets = user_options.fetch('do_not_embed_dependencies_in_targets', [])
|
11
13
|
end
|
12
14
|
|
13
15
|
def environment_configs_for(target)
|
14
16
|
environment_configs[normalize_target(target)]
|
15
17
|
end
|
16
18
|
|
19
|
+
def allow_embed_dependencies_for(target)
|
20
|
+
!do_not_embed_dependencies_in_targets.include?(normalize_target(target))
|
21
|
+
end
|
22
|
+
|
17
23
|
private
|
18
24
|
|
19
25
|
def default_configurations(installer_context)
|
@@ -6,7 +6,12 @@ module PodAlexandria
|
|
6
6
|
# and also checking if they are linked dynamically or not.
|
7
7
|
def self.generate_dependencies(installer_context, options)
|
8
8
|
targets = installer_context.umbrella_targets.map { |target|
|
9
|
-
generate_for_target(
|
9
|
+
generate_for_target(
|
10
|
+
installer_context,
|
11
|
+
target,
|
12
|
+
options.environment_configs_for(target.cocoapods_target_label),
|
13
|
+
options.allow_embed_dependencies_for(target.cocoapods_target_label)
|
14
|
+
)
|
10
15
|
}.to_h
|
11
16
|
|
12
17
|
File.open(options.xcodegen_dependencies_file, 'w') { |file|
|
@@ -16,7 +21,7 @@ module PodAlexandria
|
|
16
21
|
|
17
22
|
private
|
18
23
|
|
19
|
-
def self.generate_for_target(installer_context, target, configurations)
|
24
|
+
def self.generate_for_target(installer_context, target, configurations, allow_embed)
|
20
25
|
target_name = target.cocoapods_target_label.sub(/^Pods-/, '')
|
21
26
|
xcconfig = config_file_for_target(installer_context, target)
|
22
27
|
|
@@ -24,13 +29,7 @@ module PodAlexandria
|
|
24
29
|
target_name,
|
25
30
|
{
|
26
31
|
'configFiles' => configurations,
|
27
|
-
'dependencies' => get_dependencies_from_xcconfig(xcconfig).map { |
|
28
|
-
if dependency.exists?
|
29
|
-
{ 'framework' => dependency.path, 'embed' => dependency.is_dynamic? }
|
30
|
-
else
|
31
|
-
{ 'sdk' => dependency.sdk }
|
32
|
-
end
|
33
|
-
}
|
32
|
+
'dependencies' => get_dependencies_from_xcconfig(xcconfig).map { |d| d.xcodegen_info(allow_embed) }
|
34
33
|
}
|
35
34
|
]
|
36
35
|
end
|
@@ -42,10 +41,11 @@ module PodAlexandria
|
|
42
41
|
|
43
42
|
def self.get_dependencies_from_xcconfig(file)
|
44
43
|
File.readlines(file).select { |line| line.start_with?('OTHER_LDFLAGS') }.first
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
&.split('=')&.at(1)&.tr('"', '') # get value (and remove quotes)
|
45
|
+
&.gsub('-framework ', '-f')&.gsub('-weak_framework ', '-wf') # replace framework with fake linker flag
|
46
|
+
&.gsub('-ObjC', '') # remove unneeded flags
|
47
|
+
&.split&.drop(1) # remove inherited
|
48
|
+
&.map { |d| Dependency.new(d) } || []
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -1,11 +1,30 @@
|
|
1
1
|
module PodAlexandria
|
2
2
|
class Dependency
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :flag
|
4
|
+
attr_reader :module_name
|
4
5
|
|
5
6
|
def initialize(value)
|
6
|
-
@
|
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(allow_embed)
|
12
|
+
if exists?
|
13
|
+
{
|
14
|
+
'framework' => path,
|
15
|
+
'embed' => is_dynamic? && allow_embed,
|
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
|
-
"#{
|
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}/#{
|
48
|
+
binary = "#{any_arch}/#{module_name}"
|
30
49
|
else
|
31
|
-
binary = "#{path}/#{
|
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
|
-
|
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.
|
4
|
+
version: 0.2.0
|
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-
|
11
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|