xcode-archive-cache 0.0.8.pre.1 → 0.0.8.pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/build/product_extractor.rb +24 -24
- data/lib/build_graph/node.rb +14 -0
- data/lib/injection/injector.rb +8 -5
- data/lib/injection/pods_script_fixer.rb +48 -8
- data/lib/runner/runner.rb +1 -1
- 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: 52f8f43f53d74aef2d09148fe876d585c3cacf6f8f280a493684e235fb718d7f
|
|
4
|
+
data.tar.gz: 71df654b2b3d8e4bc867357b83e86bf6f2aea403f9d15c2552bdefe1d3688331
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2e2ebc240b6ec293000cc023e65ed11a563ba841cb3dfafbab7e8d1ceaae0d9a21d2d9d0b556ff450495be9f20384adb27b34f68614f716aedf1e1aab9c28e4
|
|
7
|
+
data.tar.gz: 472d0209a2a24f01c8f07a7e33bdafbd85d915dbfd358f1f0799ca47ba3b34456f11d09ba67bc38874b95452f8e88d2e6540ae3ed5ab654a9cc6206a5d51cc64
|
|
@@ -11,9 +11,13 @@ module XcodeArchiveCache
|
|
|
11
11
|
@shell_executor = XcodeArchiveCache::Shell::Executor.new
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
# @param [XcodeArchiveCache::BuildGraph::Node] built_node
|
|
15
|
+
#
|
|
16
|
+
# @return [Array<String>]
|
|
17
|
+
#
|
|
18
|
+
def list_product_contents(built_node)
|
|
19
|
+
file_paths = list_products(built_node)
|
|
20
|
+
file_paths.select {|path| File.exist?(path)}.map {|path| File.realpath(path)}
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
private
|
|
@@ -32,11 +36,15 @@ module XcodeArchiveCache
|
|
|
32
36
|
|
|
33
37
|
# @param [XcodeArchiveCache::BuildGraph::Node] built_node
|
|
34
38
|
#
|
|
35
|
-
|
|
39
|
+
# @return [Array<String>]
|
|
40
|
+
#
|
|
41
|
+
def list_products(built_node)
|
|
36
42
|
if built_node.has_framework_product?
|
|
37
|
-
list_framework_products(
|
|
38
|
-
elsif built_node.
|
|
39
|
-
|
|
43
|
+
list_framework_products(built_node)
|
|
44
|
+
elsif built_node.has_acceptable_product?
|
|
45
|
+
list_single_product(built_node)
|
|
46
|
+
else
|
|
47
|
+
raise Informative, "#{built_node.name} has unsupported product type: #{built_node.native_target.product_type}"
|
|
40
48
|
end
|
|
41
49
|
end
|
|
42
50
|
|
|
@@ -44,8 +52,8 @@ module XcodeArchiveCache
|
|
|
44
52
|
#
|
|
45
53
|
# @return [Array<String>]
|
|
46
54
|
#
|
|
47
|
-
def list_framework_products(
|
|
48
|
-
framework_glob = get_main_product_glob(
|
|
55
|
+
def list_framework_products(built_node)
|
|
56
|
+
framework_glob = get_main_product_glob(built_node)
|
|
49
57
|
framework_path = Dir.glob(framework_glob).first
|
|
50
58
|
unless framework_path
|
|
51
59
|
raise Informative, "Framework product not found for #{built_node.name}"
|
|
@@ -63,21 +71,21 @@ module XcodeArchiveCache
|
|
|
63
71
|
#
|
|
64
72
|
# @return [Array<String>]
|
|
65
73
|
#
|
|
66
|
-
def
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
unless
|
|
70
|
-
raise Informative, "
|
|
74
|
+
def list_single_product(built_node)
|
|
75
|
+
product_glob = get_main_product_glob(built_node)
|
|
76
|
+
product_path = Dir.glob(product_glob).first
|
|
77
|
+
unless product_path
|
|
78
|
+
raise Informative, "Product of type #{built_node.native_target.product_type} not found for #{built_node.name}"
|
|
71
79
|
end
|
|
72
80
|
|
|
73
|
-
[
|
|
81
|
+
[product_path]
|
|
74
82
|
end
|
|
75
83
|
|
|
76
84
|
# @param [XcodeArchiveCache::BuildGraph::Node] built_node
|
|
77
85
|
#
|
|
78
86
|
# @return [String]
|
|
79
87
|
#
|
|
80
|
-
def get_main_product_glob(
|
|
88
|
+
def get_main_product_glob(built_node)
|
|
81
89
|
product_name = built_node.native_target.product_reference.name ?
|
|
82
90
|
built_node.native_target.product_reference.name :
|
|
83
91
|
built_node.native_target.product_reference.path
|
|
@@ -86,14 +94,6 @@ module XcodeArchiveCache
|
|
|
86
94
|
File.basename(product_name))
|
|
87
95
|
end
|
|
88
96
|
|
|
89
|
-
# @param [XcodeArchiveCache::BuildGraph::Node] built_node
|
|
90
|
-
#
|
|
91
|
-
# @return [String]
|
|
92
|
-
#
|
|
93
|
-
def configuration_dir(built_node)
|
|
94
|
-
"#{configuration}-#{built_node.native_target.sdk}"
|
|
95
|
-
end
|
|
96
|
-
|
|
97
97
|
# @param [String] framework_path
|
|
98
98
|
#
|
|
99
99
|
# @return [Array<String>]
|
data/lib/build_graph/node.rb
CHANGED
|
@@ -55,6 +55,14 @@ module XcodeArchiveCache
|
|
|
55
55
|
native_target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:static_library]
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
def has_bundle_product?
|
|
59
|
+
native_target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:bundle]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def has_acceptable_product?
|
|
63
|
+
ACCEPTABLE_PRODUCT_TYPES.include?(native_target.product_type)
|
|
64
|
+
end
|
|
65
|
+
|
|
58
66
|
# @return [String]
|
|
59
67
|
#
|
|
60
68
|
def product_file_name
|
|
@@ -112,6 +120,12 @@ module XcodeArchiveCache
|
|
|
112
120
|
dependency_names = dependencies.length > 0 ? dependencies.map(&:name).join(", ") : "<none>"
|
|
113
121
|
"#{name}\n\troot: #{is_root}\n\tproduct: #{product_file_name}\n\tsha: #{sha_string}\n\tstate: #{state}\n\tdependent: #{dependent_names}\n\tdependencies: #{dependency_names}"
|
|
114
122
|
end
|
|
123
|
+
|
|
124
|
+
private
|
|
125
|
+
|
|
126
|
+
ACCEPTABLE_PRODUCT_TYPES = [Xcodeproj::Constants::PRODUCT_TYPE_UTI[:framework],
|
|
127
|
+
Xcodeproj::Constants::PRODUCT_TYPE_UTI[:static_library],
|
|
128
|
+
Xcodeproj::Constants::PRODUCT_TYPE_UTI[:bundle]].freeze
|
|
115
129
|
end
|
|
116
130
|
end
|
|
117
131
|
end
|
data/lib/injection/injector.rb
CHANGED
|
@@ -49,6 +49,7 @@ module XcodeArchiveCache
|
|
|
49
49
|
#
|
|
50
50
|
if graph.node_by_name(get_pods_target_name(target))
|
|
51
51
|
pods_fixer.fix_embed_frameworks_script(target, graph, storage.container_dir_path)
|
|
52
|
+
pods_fixer.fix_copy_resources_script(target, graph, storage.container_dir_path)
|
|
52
53
|
else
|
|
53
54
|
framework_nodes = graph.nodes.select {|node| node.has_framework_product?}
|
|
54
55
|
framework_file_paths = framework_nodes.map {|node| File.join(storage.get_storage_path(node), node.product_file_name)}
|
|
@@ -113,10 +114,10 @@ module XcodeArchiveCache
|
|
|
113
114
|
# @param [Array<String>] paths
|
|
114
115
|
#
|
|
115
116
|
def add_header_paths_to_target(target, paths)
|
|
116
|
-
debug("adding #{paths} to #{target.display_name}")
|
|
117
|
-
|
|
118
117
|
return if paths == nil
|
|
119
118
|
|
|
119
|
+
debug("adding #{paths} to #{target.display_name}")
|
|
120
|
+
|
|
120
121
|
build_configuration = find_build_configuration(target)
|
|
121
122
|
paths.each do |path|
|
|
122
123
|
build_flags_changer.add_headers_search_path(build_configuration, path)
|
|
@@ -153,12 +154,14 @@ module XcodeArchiveCache
|
|
|
153
154
|
def add_as_prebuilt_dependency(prebuilt_node, dependent_target, should_link)
|
|
154
155
|
debug("adding #{prebuilt_node.name} as prebuilt to #{dependent_target.display_name}")
|
|
155
156
|
|
|
157
|
+
unless prebuilt_node.has_acceptable_product?
|
|
158
|
+
raise Informative, "#{prebuilt_node.name} has unsupported product type: #{prebuilt_node.native_target.product_type}"
|
|
159
|
+
end
|
|
160
|
+
|
|
156
161
|
if prebuilt_node.has_framework_product?
|
|
157
162
|
add_as_prebuilt_framework(prebuilt_node, dependent_target)
|
|
158
163
|
elsif prebuilt_node.has_static_library_product?
|
|
159
164
|
add_as_prebuilt_static_lib(prebuilt_node, dependent_target, should_link)
|
|
160
|
-
else
|
|
161
|
-
raise ArgumentError.new, "#{prebuilt_node.name} has unsupported product type: #{prebuilt_node.native_target.product_type}"
|
|
162
165
|
end
|
|
163
166
|
|
|
164
167
|
debug("done with #{prebuilt_node.name} for #{dependent_target.display_name}")
|
|
@@ -197,7 +200,7 @@ module XcodeArchiveCache
|
|
|
197
200
|
def find_build_configuration(target)
|
|
198
201
|
build_configuration = target.build_configurations.select {|configuration| configuration.name == configuration_name}.first
|
|
199
202
|
unless build_configuration
|
|
200
|
-
raise
|
|
203
|
+
raise Informative, "#{configuration_name} build configuration not found on target #{node.name}"
|
|
201
204
|
end
|
|
202
205
|
|
|
203
206
|
build_configuration
|
|
@@ -17,14 +17,19 @@ module XcodeArchiveCache
|
|
|
17
17
|
file_path = find_embed_frameworks_script(target, build_settings)
|
|
18
18
|
return unless file_path
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
graph.nodes.each do |node|
|
|
23
|
-
relative_product_path = "#{node.native_target.display_name}/#{node.product_file_name}"
|
|
24
|
-
script = script.gsub("${BUILT_PRODUCTS_DIR}/#{relative_product_path}", File.join(products_dir, relative_product_path))
|
|
25
|
-
end
|
|
20
|
+
fix_script(file_path, graph, products_dir)
|
|
21
|
+
end
|
|
26
22
|
|
|
27
|
-
|
|
23
|
+
# @param [Xcodeproj::Project::Object::PBXNativeTarget] target
|
|
24
|
+
# @param [XcodeArchiveCache::BuildGraph::Graph] graph
|
|
25
|
+
# @param [String] products_dir
|
|
26
|
+
#
|
|
27
|
+
def fix_copy_resources_script(target, graph, products_dir)
|
|
28
|
+
build_settings = graph.dependent_build_settings
|
|
29
|
+
file_path = find_copy_resources_script(target, build_settings)
|
|
30
|
+
return unless file_path
|
|
31
|
+
|
|
32
|
+
fix_script(file_path, graph, products_dir)
|
|
28
33
|
end
|
|
29
34
|
|
|
30
35
|
private
|
|
@@ -39,8 +44,27 @@ module XcodeArchiveCache
|
|
|
39
44
|
# @return [String]
|
|
40
45
|
#
|
|
41
46
|
def find_embed_frameworks_script(target, build_settings)
|
|
47
|
+
find_script(target, build_settings, "[CP] Embed Pods Frameworks")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @param [Xcodeproj::Project::Object::PBXNativeTarget] target
|
|
51
|
+
# @param [XcodeArchiveCache::BuildSettings::Container] build_settings
|
|
52
|
+
#
|
|
53
|
+
# @return [String]
|
|
54
|
+
#
|
|
55
|
+
def find_copy_resources_script(target, build_settings)
|
|
56
|
+
find_script(target, build_settings, "[CP] Copy Pods Resources")
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @param [Xcodeproj::Project::Object::PBXNativeTarget] target
|
|
60
|
+
# @param [XcodeArchiveCache::BuildSettings::Container] build_settings
|
|
61
|
+
# @param [String] script_name
|
|
62
|
+
#
|
|
63
|
+
# @return [String]
|
|
64
|
+
#
|
|
65
|
+
def find_script(target, build_settings, script_name)
|
|
42
66
|
target.shell_script_build_phases.each do |phase|
|
|
43
|
-
if phase.display_name ==
|
|
67
|
+
if phase.display_name == script_name
|
|
44
68
|
return build_settings_interpolator.interpolate(phase.shell_script, build_settings)
|
|
45
69
|
.gsub(/^"|"$/, "")
|
|
46
70
|
.strip
|
|
@@ -49,6 +73,22 @@ module XcodeArchiveCache
|
|
|
49
73
|
|
|
50
74
|
nil
|
|
51
75
|
end
|
|
76
|
+
|
|
77
|
+
# @param [String] file_path
|
|
78
|
+
# @param [XcodeArchiveCache::BuildGraph::Node] graph
|
|
79
|
+
# @param [String] products_dir
|
|
80
|
+
#
|
|
81
|
+
def fix_script(file_path, graph, products_dir)
|
|
82
|
+
info("fixing #{file_path}")
|
|
83
|
+
script = File.read(file_path)
|
|
84
|
+
graph.nodes.each do |node|
|
|
85
|
+
relative_product_path = "#{node.native_target.display_name}/#{node.product_file_name}"
|
|
86
|
+
absolute_product_path = File.join(products_dir, relative_product_path)
|
|
87
|
+
script = script.gsub(Regexp.new("\"[^\"]+\/#{node.product_file_name}\""), "\"#{absolute_product_path}\"")
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
File.open(file_path, "w") {|file| file.puts(script)}
|
|
91
|
+
end
|
|
52
92
|
end
|
|
53
93
|
end
|
|
54
94
|
end
|
data/lib/runner/runner.rb
CHANGED
|
@@ -131,7 +131,7 @@ module XcodeArchiveCache
|
|
|
131
131
|
graph.nodes
|
|
132
132
|
.select(&:waiting_for_rebuild)
|
|
133
133
|
.each do |node|
|
|
134
|
-
file_paths = @product_extractor.list_product_contents(
|
|
134
|
+
file_paths = @product_extractor.list_product_contents(node)
|
|
135
135
|
@injection_storage.store_products(node, file_paths)
|
|
136
136
|
@cache_storage.store(node, @injection_storage.get_storage_path(node))
|
|
137
137
|
node.state = :rebuilt_and_cached
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xcode-archive-cache
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.8.pre.
|
|
4
|
+
version: 0.0.8.pre.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ilya Dyakonov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-08-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: xcodeproj
|