xcode-archive-cache 0.0.6 → 0.0.7
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/artifact_cache/local_storage.rb +29 -0
- data/lib/build_graph/builder.rb +22 -22
- data/lib/build_graph/graph.rb +10 -4
- data/lib/build_graph/sha_calculator.rb +1 -9
- data/lib/build_settings/loader.rb +23 -9
- data/lib/config/dsl.rb +4 -0
- data/lib/injection/framework_embedder.rb +2 -0
- data/lib/injection/injector.rb +7 -2
- data/lib/runner/runner.rb +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95a23e762c8efb7296e5d0faa4387c4ed39f4e373a821437f0440e7bdf759d8f
|
4
|
+
data.tar.gz: 933fae20075b13c5447217e38f917a35c8b42b9999076316ffdb264043e6b532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 926f44d73815c5bdaf3e535bbb01e0c3d7aaa8a1c1e813baf054d85e1ab08904b2066975be0866c51f6e474a7ce3a2236c044c1a06486adc480b4eaf90d9ba2b
|
7
|
+
data.tar.gz: 81d379f00051d87a5c6440a9f5c6648fedad99d75c36f39f21f59443c786de4b614e2ecd37f7d2014643b99bac9e8a2dbcb0637decdb114772d59f9779e23e43
|
@@ -18,6 +18,9 @@ module XcodeArchiveCache
|
|
18
18
|
File.exist?(path) ? path : nil
|
19
19
|
end
|
20
20
|
|
21
|
+
# @param [XcodeArchiveCache::BuildGraph::Node] node
|
22
|
+
# @param [String] path
|
23
|
+
#
|
21
24
|
def store(node, path)
|
22
25
|
archive_path = path_inside_cache_dir(node)
|
23
26
|
archive_directory = File.expand_path("..", archive_path)
|
@@ -26,6 +29,7 @@ module XcodeArchiveCache
|
|
26
29
|
end
|
27
30
|
|
28
31
|
archiver.archive(path, archive_path)
|
32
|
+
save_state(node, archive_path)
|
29
33
|
end
|
30
34
|
|
31
35
|
private
|
@@ -38,9 +42,34 @@ module XcodeArchiveCache
|
|
38
42
|
#
|
39
43
|
attr_reader :archiver
|
40
44
|
|
45
|
+
# @param [XcodeArchiveCache::BuildGraph::Node] node
|
46
|
+
#
|
47
|
+
# @return [String]
|
48
|
+
#
|
41
49
|
def path_inside_cache_dir(node)
|
42
50
|
File.join(cache_dir_path, node.name, node.sha)
|
43
51
|
end
|
52
|
+
|
53
|
+
# @param [XcodeArchiveCache::BuildGraph::Node] node
|
54
|
+
# @param [String] archive_path
|
55
|
+
#
|
56
|
+
# Simply writes build settings and dependency SHAs to a file
|
57
|
+
# Useful for debugging and investigation purposes
|
58
|
+
#
|
59
|
+
def save_state(node, archive_path)
|
60
|
+
state_file_path = archive_path + ".state"
|
61
|
+
|
62
|
+
if File.exist?(state_file_path)
|
63
|
+
raise ArgumentError.new, "State file already exists: #{state_file_path}"
|
64
|
+
end
|
65
|
+
|
66
|
+
dependency_shas = node.dependencies
|
67
|
+
.map {|dependency| dependency.name + ": " + dependency.sha}
|
68
|
+
.join("\n")
|
69
|
+
state = node.build_settings.filtered_to_string + "\n\nDependencies:\n" + dependency_shas + "\n"
|
70
|
+
|
71
|
+
File.write(state_file_path, state)
|
72
|
+
end
|
44
73
|
end
|
45
74
|
end
|
46
75
|
end
|
data/lib/build_graph/builder.rb
CHANGED
@@ -19,11 +19,10 @@ module XcodeArchiveCache
|
|
19
19
|
def build_graph(dependent_target, dependency_target)
|
20
20
|
native_target_finder.set_platform_name_filter(dependency_target.platform_name)
|
21
21
|
|
22
|
-
|
23
|
-
graph = Graph.new(dependency_target.project, build_settings)
|
22
|
+
graph = Graph.new(dependency_target.project)
|
24
23
|
|
25
24
|
add_to_graph(dependency_target, graph, true)
|
26
|
-
load_settings(graph)
|
25
|
+
load_settings(graph, dependent_target)
|
27
26
|
calculate_shas(graph)
|
28
27
|
|
29
28
|
graph
|
@@ -122,32 +121,33 @@ module XcodeArchiveCache
|
|
122
121
|
end
|
123
122
|
|
124
123
|
# @param [XcodeArchiveCache::BuildGraph::Graph] graph
|
124
|
+
# @param [Xcodeproj::Project::Object::PBXNativeTarget] dependent_target
|
125
125
|
#
|
126
|
-
def load_settings(graph)
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
counter += 1
|
139
|
-
end
|
126
|
+
def load_settings(graph, dependent_target)
|
127
|
+
project_paths = graph.nodes
|
128
|
+
.map {|node| node.native_target}
|
129
|
+
.push(dependent_target)
|
130
|
+
.map {|target| target.project.path}
|
131
|
+
.sort
|
132
|
+
.uniq
|
133
|
+
info("loading settings for #{project_paths.length} projects")
|
134
|
+
build_settings_loader.load_settings(project_paths)
|
135
|
+
|
136
|
+
graph.dependent_build_settings = get_settings(dependent_target)
|
137
|
+
graph.nodes.each {|node| node.build_settings = get_settings(node.native_target)}
|
140
138
|
end
|
141
139
|
|
142
140
|
|
143
141
|
# @param [Xcodeproj::Project::Object::PBXNativeTarget] target
|
144
142
|
#
|
145
|
-
def
|
146
|
-
info("
|
143
|
+
def get_settings(target)
|
144
|
+
info("getting settings for #{target.display_name}")
|
145
|
+
build_settings = build_settings_loader.get_settings(target.project.path, target.display_name)
|
146
|
+
unless build_settings
|
147
|
+
raise Informative, "No build settings loaded for #{target.display_name}"
|
148
|
+
end
|
147
149
|
|
148
|
-
|
149
|
-
build_settings_loader.load_settings(project_path)
|
150
|
-
build_settings_loader.get_settings(project_path, target.display_name)
|
150
|
+
build_settings
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
data/lib/build_graph/graph.rb
CHANGED
@@ -11,24 +11,30 @@ module XcodeArchiveCache
|
|
11
11
|
|
12
12
|
# @return [XcodeArchiveCache::BuildSettings::Container] root target build settings
|
13
13
|
#
|
14
|
-
|
14
|
+
attr_accessor :dependent_build_settings
|
15
15
|
|
16
16
|
# @param [Xcodeproj::Project] project
|
17
|
-
# @param [XcodeArchiveCache::BuildSettings::Container] dependent_build_settings
|
18
17
|
#
|
19
|
-
def initialize(project
|
18
|
+
def initialize(project)
|
20
19
|
@nodes = []
|
21
20
|
@project = project
|
22
|
-
@dependent_build_settings = dependent_build_settings
|
23
21
|
end
|
24
22
|
|
25
23
|
# @param [String] name
|
26
24
|
# Native target display name
|
27
25
|
#
|
26
|
+
# @return [XcodeArchiveCache::BuildGraph::Node]
|
27
|
+
#
|
28
28
|
def node_by_name(name)
|
29
29
|
nodes.select {|node| node.name == name}.first
|
30
30
|
end
|
31
31
|
|
32
|
+
# @return [XcodeArchiveCache::BuildGraph::Node]
|
33
|
+
#
|
34
|
+
def root_node
|
35
|
+
nodes.select {|node| node.is_root}.first
|
36
|
+
end
|
37
|
+
|
32
38
|
def to_s
|
33
39
|
nodes.map(&:to_s).join("\n")
|
34
40
|
end
|
@@ -14,7 +14,7 @@ module XcodeArchiveCache
|
|
14
14
|
end
|
15
15
|
|
16
16
|
auxiliary_file = Tempfile.new(node.name)
|
17
|
-
build_settings =
|
17
|
+
build_settings = node.build_settings.filtered_to_string
|
18
18
|
save_auxiliary_data(build_settings, dependency_shas, auxiliary_file)
|
19
19
|
|
20
20
|
input_paths = list_input_paths(node)
|
@@ -66,14 +66,6 @@ module XcodeArchiveCache
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
# @param [Hash{String => String}] hash
|
70
|
-
#
|
71
|
-
# @return [String]
|
72
|
-
#
|
73
|
-
def settings_hash_to_string(hash)
|
74
|
-
hash.map {|name, value| "#{name} = #{value}"}.join("\n")
|
75
|
-
end
|
76
|
-
|
77
69
|
# @param [Tempfile] tempfile
|
78
70
|
# @param [String] build_settings
|
79
71
|
# @param [Array<String>] dependency_shas
|
@@ -29,6 +29,12 @@ module XcodeArchiveCache
|
|
29
29
|
def ==(other)
|
30
30
|
other && other.all == all && other.filtered == filtered
|
31
31
|
end
|
32
|
+
|
33
|
+
# @return [String]
|
34
|
+
#
|
35
|
+
def filtered_to_string
|
36
|
+
filtered.map {|name, value| "#{name} = #{value}"}.join("\n")
|
37
|
+
end
|
32
38
|
end
|
33
39
|
|
34
40
|
class Loader
|
@@ -41,21 +47,29 @@ module XcodeArchiveCache
|
|
41
47
|
@settings = Hash.new
|
42
48
|
end
|
43
49
|
|
44
|
-
# @param [String]
|
50
|
+
# @param [Array<String>] project_paths
|
45
51
|
#
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
def load_settings(project_paths)
|
53
|
+
paths_without_settings = project_paths.select {|path| settings[path] == nil}
|
54
|
+
|
55
|
+
threads = paths_without_settings.map do |path|
|
56
|
+
Thread.new(path) do |project_path|
|
57
|
+
Thread.current.abort_on_exception = true
|
58
|
+
[project_path, executor.load_build_settings(project_path)]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
threads.each do |thread|
|
63
|
+
project_path, all_targets_settings = thread.value
|
64
|
+
settings[project_path] = extractor.extract_per_target(all_targets_settings)
|
65
|
+
end
|
54
66
|
end
|
55
67
|
|
56
68
|
# @param [String] project_path
|
57
69
|
# @param [String] target_name
|
58
70
|
#
|
71
|
+
# @return [Hash{String => String}] build settings for target or nil
|
72
|
+
#
|
59
73
|
def get_settings(project_path, target_name)
|
60
74
|
return nil unless settings[project_path]
|
61
75
|
|
data/lib/config/dsl.rb
CHANGED
@@ -12,6 +12,8 @@ module XcodeArchiveCache
|
|
12
12
|
# @param [Xcodeproj::Project::Object::PBXNativeTarget] target
|
13
13
|
#
|
14
14
|
def embed(framework_file_paths, target)
|
15
|
+
return unless target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]
|
16
|
+
|
15
17
|
dynamic_framework_file_paths = framework_file_paths.select do |path|
|
16
18
|
binary_name = File.basename(path, ".framework")
|
17
19
|
binary_path = File.join(path, binary_name)
|
data/lib/injection/injector.rb
CHANGED
@@ -29,6 +29,11 @@ module XcodeArchiveCache
|
|
29
29
|
# @param [Xcodeproj::Project::Object::PBXNativeTarget] target
|
30
30
|
#
|
31
31
|
def perform_outgoing_injection(graph, target)
|
32
|
+
root_node = graph.root_node
|
33
|
+
if root_node.native_target.project == target.project && root_node.native_target.uuid == target.uuid
|
34
|
+
return
|
35
|
+
end
|
36
|
+
|
32
37
|
graph.nodes.each do |node|
|
33
38
|
headers_mover.prepare_headers_for_injection(node)
|
34
39
|
add_as_prebuilt_dependency(node, target, node.is_root)
|
@@ -61,7 +66,7 @@ module XcodeArchiveCache
|
|
61
66
|
attr_reader :configuration_name
|
62
67
|
|
63
68
|
# @return [Storage]
|
64
|
-
#
|
69
|
+
#
|
65
70
|
attr_reader :storage
|
66
71
|
|
67
72
|
# @return [HeadersMover]
|
@@ -101,7 +106,7 @@ module XcodeArchiveCache
|
|
101
106
|
|
102
107
|
nodes
|
103
108
|
.select {|node| node.rebuild}
|
104
|
-
.each {
|
109
|
+
.each {|node| add_header_paths_to_target(node.native_target, header_storage_paths)}
|
105
110
|
end
|
106
111
|
|
107
112
|
# @param [Xcodeproj::Project::Object::PBXNativeTarget] target
|
data/lib/runner/runner.rb
CHANGED
@@ -29,7 +29,7 @@ module XcodeArchiveCache
|
|
29
29
|
file_path = File.absolute_path(config.file_path)
|
30
30
|
|
31
31
|
if config.is_a?(XcodeArchiveCache::Config::Project)
|
32
|
-
return [Xcodeproj::Project.
|
32
|
+
return [Xcodeproj::Project.open(file_path)]
|
33
33
|
elsif config.is_a?(XcodeArchiveCache::Config::Workspace)
|
34
34
|
workspace = Xcodeproj::Workspace.new_from_xcworkspace(file_path)
|
35
35
|
workspace_dir = File.expand_path("..", file_path)
|
@@ -37,7 +37,7 @@ module XcodeArchiveCache
|
|
37
37
|
return workspace.file_references.map {|file_reference| Xcodeproj::Project.open(file_reference.absolute_path(workspace_dir))}
|
38
38
|
end
|
39
39
|
|
40
|
-
raise Informative, "Configuration misses
|
40
|
+
raise Informative, "Configuration misses entry point -- must have either a project or a workspace"
|
41
41
|
end
|
42
42
|
|
43
43
|
def run
|
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.
|
4
|
+
version: 0.0.7
|
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-07-
|
11
|
+
date: 2019-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|
@@ -107,8 +107,9 @@ files:
|
|
107
107
|
- lib/shell/executor.rb
|
108
108
|
- lib/xcode-archive-cache.rb
|
109
109
|
- lib/xcodebuild/executor.rb
|
110
|
-
homepage:
|
111
|
-
licenses:
|
110
|
+
homepage: https://github.com/sweatco/xcode-archive-cache
|
111
|
+
licenses:
|
112
|
+
- MIT
|
112
113
|
metadata: {}
|
113
114
|
post_install_message:
|
114
115
|
rdoc_options: []
|
@@ -118,16 +119,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
119
|
requirements:
|
119
120
|
- - ">="
|
120
121
|
- !ruby/object:Gem::Version
|
121
|
-
version:
|
122
|
+
version: 2.0.0
|
122
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
124
|
requirements:
|
124
125
|
- - ">="
|
125
126
|
- !ruby/object:Gem::Version
|
126
127
|
version: '0'
|
127
128
|
requirements: []
|
128
|
-
|
129
|
-
rubygems_version: 2.7.7
|
129
|
+
rubygems_version: 3.0.4
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
|
-
summary: Xcode archive
|
132
|
+
summary: Native targets cache for Xcode archive builds.
|
133
133
|
test_files: []
|