xcknife 0.6.3 → 0.11.0
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 +5 -5
- data/.gitignore +2 -1
- data/.ruby-version +1 -1
- data/.travis.yml +12 -7
- data/Gemfile.lock +35 -0
- data/OWNERS.yml +2 -0
- data/README.md +13 -4
- data/Rakefile +3 -3
- data/TestDumper/README.md +16 -2
- data/TestDumper/TestDumper.xcodeproj/project.pbxproj +27 -5
- data/TestDumper/TestDumper.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- data/TestDumper/TestDumper.xcodeproj/xcshareddata/xcschemes/TestDumper.xcscheme +1 -1
- data/TestDumper/TestDumper/Initialize.m +94 -41
- data/TestDumper/build.sh +3 -2
- data/example/run_example.rb +1 -0
- data/lib/xcknife.rb +2 -1
- data/lib/xcknife/exceptions.rb +4 -2
- data/lib/xcknife/stream_parser.rb +53 -18
- data/lib/xcknife/test_dumper.rb +282 -46
- data/lib/xcknife/xcscheme_analyzer.rb +29 -0
- data/lib/xcknife/xctool_cmd_helper.rb +29 -4
- data/xcknife.gemspec +0 -3
- metadata +8 -7
- data/.gitmodules +0 -3
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
|
3
|
+
module XCKnife
|
4
|
+
module XcschemeAnalyzer
|
5
|
+
extend self
|
6
|
+
|
7
|
+
def extract_environment_variables(xscheme_data)
|
8
|
+
ret = {}
|
9
|
+
xml_root = REXML::Document.new(xscheme_data).root
|
10
|
+
|
11
|
+
|
12
|
+
action = xml_root.elements["//TestAction"]
|
13
|
+
return ret if action.nil?
|
14
|
+
if action.attributes['shouldUseLaunchSchemeArgsEnv'] == "YES"
|
15
|
+
action = xml_root.elements["//LaunchAction"]
|
16
|
+
end
|
17
|
+
return ret if action.nil?
|
18
|
+
env_elements = action.elements[".//EnvironmentVariables"]
|
19
|
+
return ret if env_elements.nil?
|
20
|
+
env_elements.elements.each do |e|
|
21
|
+
attrs = e.attributes
|
22
|
+
if attrs["isEnabled"] == "YES"
|
23
|
+
ret[attrs["key"]] = attrs["value"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
ret
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'set'
|
2
|
+
|
2
3
|
module XCKnife
|
3
4
|
module XCToolCmdHelper
|
4
5
|
def only_arguments_for_a_partition_set(output_type, partition_set)
|
@@ -24,17 +25,41 @@ module XCKnife
|
|
24
25
|
end
|
25
26
|
|
26
27
|
# only-testing is available since Xcode 8
|
27
|
-
def xcodebuild_only_arguments(single_partition)
|
28
|
-
|
28
|
+
def xcodebuild_only_arguments(single_partition, meta_partition = nil)
|
29
|
+
only_targets = if meta_partition
|
30
|
+
single_partition.keys.to_set & meta_partition.flat_map(&:keys).group_by(&:to_s).select{|_,v| v.size == 1 }.map(&:first).to_set
|
31
|
+
else
|
32
|
+
Set.new
|
33
|
+
end
|
34
|
+
|
35
|
+
only_target_arguments = only_targets.sort.map { |test_target| "-only-testing:#{test_target}" }
|
36
|
+
|
37
|
+
only_class_arguments = single_partition.flat_map do |test_target, classes|
|
38
|
+
next [] if only_targets.include?(test_target)
|
39
|
+
|
29
40
|
classes.sort.map do |clazz|
|
30
41
|
"-only-testing:#{test_target}/#{clazz}"
|
31
42
|
end
|
43
|
+
end.sort
|
44
|
+
|
45
|
+
only_target_arguments + only_class_arguments
|
46
|
+
end
|
32
47
|
|
48
|
+
# skip-testing is available since Xcode 8
|
49
|
+
def xcodebuild_skip_arguments(single_partition, test_time_for_partitions)
|
50
|
+
excluded_targets = test_time_for_partitions.keys.to_set - single_partition.keys.to_set
|
51
|
+
skipped_target_arguments = excluded_targets.sort.map { |test_target| "-skip-testing:#{test_target}" }
|
52
|
+
|
53
|
+
skipped_classes_arguments = single_partition.flat_map do |test_target, classes|
|
54
|
+
all_classes = test_time_for_partitions[test_target].keys.to_set
|
55
|
+
(all_classes - classes.to_set).sort.map { |test_class| "-skip-testing:#{test_target}/#{test_class}" }
|
33
56
|
end
|
57
|
+
|
58
|
+
skipped_target_arguments + skipped_classes_arguments
|
34
59
|
end
|
35
60
|
|
36
61
|
def xcodebuild_only_arguments_for_a_partition_set(partition_set)
|
37
62
|
partition_set.map { |partition| xctool_only_arguments(partition) }
|
38
63
|
end
|
39
64
|
end
|
40
|
-
end
|
65
|
+
end
|
data/xcknife.gemspec
CHANGED
@@ -17,9 +17,6 @@ Gem::Specification.new do |s|
|
|
17
17
|
Works by leveraging xctool's json-streams timing and test data.
|
18
18
|
DESCRIPTION
|
19
19
|
|
20
|
-
# Only allow gem to be pushed to https://rubygems.org
|
21
|
-
s.metadata["allowed_push_host"] = 'https://rubygems.org'
|
22
|
-
|
23
20
|
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR).reject { |f| f =~ /^spec/} + ["TestDumper/TestDumper.dylib"]
|
24
21
|
s.bindir = 'bin'
|
25
22
|
s.executables = ['xcknife', 'xcknife-min', 'xcknife-test-dumper']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcknife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,18 +38,20 @@ extensions: []
|
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
40
|
- ".gitignore"
|
41
|
-
- ".gitmodules"
|
42
41
|
- ".rspec"
|
43
42
|
- ".ruby-version"
|
44
43
|
- ".travis.yml"
|
45
44
|
- CONTRIBUTING.md
|
46
45
|
- Gemfile
|
46
|
+
- Gemfile.lock
|
47
47
|
- LICENSE
|
48
|
+
- OWNERS.yml
|
48
49
|
- README.md
|
49
50
|
- Rakefile
|
50
51
|
- TestDumper/README.md
|
51
52
|
- TestDumper/TestDumper.dylib
|
52
53
|
- TestDumper/TestDumper.xcodeproj/project.pbxproj
|
54
|
+
- TestDumper/TestDumper.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
|
53
55
|
- TestDumper/TestDumper.xcodeproj/xcshareddata/xcschemes/TestDumper.xcscheme
|
54
56
|
- TestDumper/TestDumper/Info.plist
|
55
57
|
- TestDumper/TestDumper/Initialize.m
|
@@ -69,13 +71,13 @@ files:
|
|
69
71
|
- lib/xcknife/runner.rb
|
70
72
|
- lib/xcknife/stream_parser.rb
|
71
73
|
- lib/xcknife/test_dumper.rb
|
74
|
+
- lib/xcknife/xcscheme_analyzer.rb
|
72
75
|
- lib/xcknife/xctool_cmd_helper.rb
|
73
76
|
- xcknife.gemspec
|
74
77
|
homepage: https://github.com/square/xcknife
|
75
78
|
licenses:
|
76
79
|
- Apache-2.0
|
77
|
-
metadata:
|
78
|
-
allowed_push_host: https://rubygems.org
|
80
|
+
metadata: {}
|
79
81
|
post_install_message:
|
80
82
|
rdoc_options: []
|
81
83
|
require_paths:
|
@@ -91,8 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
93
|
- !ruby/object:Gem::Version
|
92
94
|
version: '0'
|
93
95
|
requirements: []
|
94
|
-
|
95
|
-
rubygems_version: 2.4.5.1
|
96
|
+
rubygems_version: 3.0.8
|
96
97
|
signing_key:
|
97
98
|
specification_version: 4
|
98
99
|
summary: Simple tool for optimizing XCTest runs across machines
|
data/.gitmodules
DELETED