xcode-archive-cache 0.0.8 → 0.0.9
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_graph/native_target_finder.rb +45 -11
- data/lib/injection/injector.rb +1 -0
- 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: 0f444a19221b84c55a31be3d82277eef653239bdec9299d65b1252c1874dae15
|
4
|
+
data.tar.gz: 9f1927ba1c9bf360d83a3b4febf128b069b8d846eca236a8d8f9bd848de9af24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0b85c53b4127976dfee59597aade6e6e7d0064841b8ea240446f9f7482bf3bd438a482cc3d75bd86caa917c040fe5e9f89f3c35e07291fdb8cd08d3f5b6b9e6
|
7
|
+
data.tar.gz: c52f972d48a54b9331985d0b7a39f8e131a77a0e46c3cb8c0501422f313deb279b4ed9d0974fb99be7cd83f40a40feb374ae3d6f0feb73b5376089d7d574324a
|
@@ -5,13 +5,21 @@ module XcodeArchiveCache
|
|
5
5
|
# @param [Array<Xcodeproj::Project>] projects
|
6
6
|
#
|
7
7
|
def initialize(projects)
|
8
|
-
@all_targets = projects
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
@all_targets = extract_targets(projects)
|
9
|
+
end
|
10
|
+
|
11
|
+
# @param [Array<Xcodeproj::Project>] projects
|
12
|
+
#
|
13
|
+
# @return [Array<Xcodeproj::Project::Object::PBXNativeTarget>]
|
14
|
+
#
|
15
|
+
def extract_targets(projects)
|
16
|
+
projects
|
17
|
+
.map {|project| unnest(project)}
|
18
|
+
.flatten
|
19
|
+
.uniq
|
20
|
+
.map(&:native_targets)
|
21
|
+
.flatten
|
22
|
+
.select {|target| !target.test_target_type?}
|
15
23
|
end
|
16
24
|
|
17
25
|
# @param [String] platform_name
|
@@ -36,9 +44,26 @@ module XcodeArchiveCache
|
|
36
44
|
#
|
37
45
|
def find_for_file(file)
|
38
46
|
if file.file_ref.is_a?(Xcodeproj::Project::Object::PBXReferenceProxy)
|
39
|
-
project = file.file_ref.remote_ref.container_portal_object
|
40
47
|
product_reference_uuid = file.file_ref.remote_ref.remote_global_id_string
|
41
|
-
find_with_product_ref_uuid(
|
48
|
+
target = find_with_product_ref_uuid(product_reference_uuid)
|
49
|
+
if target == nil
|
50
|
+
project = file.file_ref.remote_ref.container_portal_object
|
51
|
+
target = find_in_project(project, product_reference_uuid)
|
52
|
+
|
53
|
+
# allow all targets from this project
|
54
|
+
# to be linked to that exact project
|
55
|
+
#
|
56
|
+
# otherwise, injection will operate on different Xcodeproj::Project objects
|
57
|
+
# resulting to only the last target being actually removed
|
58
|
+
#
|
59
|
+
@all_targets += extract_targets([project])
|
60
|
+
end
|
61
|
+
|
62
|
+
if target == nil
|
63
|
+
raise Informative, "Target for #{file.file_ref.path} not found"
|
64
|
+
end
|
65
|
+
|
66
|
+
target
|
42
67
|
elsif file.file_ref.is_a?(Xcodeproj::Project::Object::PBXFileReference)
|
43
68
|
# products of sibling project targets are added as PBXFileReferences
|
44
69
|
targets = find_with_product_path(file.file_ref.path)
|
@@ -54,7 +79,7 @@ module XcodeArchiveCache
|
|
54
79
|
#
|
55
80
|
def find_for_product_name(product_name)
|
56
81
|
all_targets.select {|native_target| native_target.name == product_name || native_target.product_reference.display_name == product_name}
|
57
|
-
|
82
|
+
.first
|
58
83
|
end
|
59
84
|
|
60
85
|
private
|
@@ -85,7 +110,16 @@ module XcodeArchiveCache
|
|
85
110
|
#
|
86
111
|
# @return [Xcodeproj::Project::Object::PBXNativeTarget]
|
87
112
|
#
|
88
|
-
def find_with_product_ref_uuid(
|
113
|
+
def find_with_product_ref_uuid(uuid)
|
114
|
+
all_targets.select {|target| target.product_reference.uuid == uuid}.first
|
115
|
+
end
|
116
|
+
|
117
|
+
# @param [Xcodeproj::Project] project
|
118
|
+
# @param [String] uuid
|
119
|
+
#
|
120
|
+
# @return [Xcodeproj::Project::Object::PBXNativeTarget]
|
121
|
+
#
|
122
|
+
def find_in_project(project, uuid)
|
89
123
|
project.native_targets.select {|target| target.product_reference.uuid == uuid}.first
|
90
124
|
end
|
91
125
|
|
data/lib/injection/injector.rb
CHANGED
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Dyakonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|