xcode-archive-cache 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,146 @@
1
+ module XcodeArchiveCache
2
+ module Xcodebuild
3
+ ARCHIVE_ACTION = "archive"
4
+ GENERIC_DESTINATION = "generic"
5
+
6
+ class Executor
7
+ # @param [String] configuration
8
+ # @param [String] platform
9
+ # @param [String] destination
10
+ # @param [String] action
11
+ # @param [String] args
12
+ #
13
+ def initialize(configuration, platform, destination, action, args)
14
+ @configuration = configuration
15
+ @platform = platform
16
+ @destinations = destination.split("|")
17
+ @action = action
18
+ @args = args
19
+ @shell_executor = XcodeArchiveCache::Shell::Executor.new
20
+ end
21
+
22
+ # @param [String] project_path
23
+ #
24
+ def load_build_settings(project_path)
25
+ flags = [project_flag(project_path),
26
+ configuration_flag,
27
+ destination_flag,
28
+ all_targets_flag,
29
+ show_build_settings_flag,
30
+ args,
31
+ action]
32
+ command = compile_command(flags)
33
+ shell_executor.execute_for_output(command)
34
+ end
35
+
36
+ # @param [String] project_path
37
+ # @param [String] scheme
38
+ # @param [String] derived_data_path
39
+ #
40
+ def build(project_path, scheme, derived_data_path)
41
+ flags = [project_flag(project_path),
42
+ configuration_flag,
43
+ destination_flag,
44
+ scheme_flag(scheme),
45
+ derived_data_path_flag(derived_data_path),
46
+ args,
47
+ action]
48
+ command = "#{compile_command(flags)} | xcpretty"
49
+ shell_executor.execute(command, true)
50
+ end
51
+
52
+ private
53
+
54
+ # @return [String]
55
+ #
56
+ attr_reader :configuration
57
+
58
+ # @return [String]
59
+ #
60
+ attr_reader :platform
61
+
62
+ # @return [Array<String>]
63
+ #
64
+ attr_reader :destinations
65
+
66
+ # @return [String]
67
+ #
68
+ attr_reader :action
69
+
70
+ # @return [String]
71
+ #
72
+ attr_reader :args
73
+
74
+ # @return [XcodeArchiveCache::Shell::Executor]
75
+ #
76
+ attr_accessor :shell_executor
77
+
78
+ # @param [Array<String>] flags
79
+ #
80
+ # @return [String]
81
+ #
82
+ def compile_command(flags)
83
+ "xcodebuild #{flags.join(" ")}"
84
+ end
85
+
86
+ # @param [String] project_path
87
+ #
88
+ # @return [String]
89
+ #
90
+ def project_flag(project_path)
91
+ "-project '#{project_path}'"
92
+ end
93
+
94
+ # @return [String]
95
+ #
96
+ def configuration_flag
97
+ "-configuration '#{configuration}'"
98
+ end
99
+
100
+ # @return [String]
101
+ #
102
+ def destination_flag
103
+ platform_regexp = Regexp.new("#{platform}", Regexp::IGNORECASE)
104
+ destination_by_platform = destinations.select {|destination| destination.match?(platform_regexp)}.first
105
+
106
+ # archives can only be made with generic destination
107
+ #
108
+ inferred_destination = action == ARCHIVE_ACTION ? GENERIC_DESTINATION : destination_by_platform
109
+ if inferred_destination == nil
110
+ raise Informative, "Destination not set for #{platform} platform"
111
+ end
112
+
113
+ destination_specifier = inferred_destination == GENERIC_DESTINATION ? "generic/platform=#{platform}" : inferred_destination
114
+ "-destination '#{destination_specifier}'"
115
+ end
116
+
117
+ # @return [String]
118
+ #
119
+ def all_targets_flag
120
+ "-alltargets"
121
+ end
122
+
123
+ # @param [String] scheme
124
+ #
125
+ # @return [String]
126
+ #
127
+ def scheme_flag(scheme)
128
+ "-scheme '#{scheme}'"
129
+ end
130
+
131
+ # @param [String] path
132
+ #
133
+ # @return [String]
134
+ #
135
+ def derived_data_path_flag(path)
136
+ "-derivedDataPath '#{path}'"
137
+ end
138
+
139
+ # @return [String]
140
+ #
141
+ def show_build_settings_flag
142
+ "-showBuildSettings"
143
+ end
144
+ end
145
+ end
146
+ end
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcode-archive-cache
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Ilya Dyakonov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-07-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: xcodeproj
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubyzip
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: xcpretty
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: claide
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ description:
70
+ email:
71
+ executables:
72
+ - xcode-archive-cache
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - bin/xcode-archive-cache
77
+ - lib/artifact_cache/abstract_storage.rb
78
+ - lib/artifact_cache/archiver.rb
79
+ - lib/artifact_cache/artifact_extractor.rb
80
+ - lib/artifact_cache/local_storage.rb
81
+ - lib/build/performer.rb
82
+ - lib/build/product_extractor.rb
83
+ - lib/build_graph/builder.rb
84
+ - lib/build_graph/graph.rb
85
+ - lib/build_graph/native_target_finder.rb
86
+ - lib/build_graph/node.rb
87
+ - lib/build_graph/rebuild_evaluator.rb
88
+ - lib/build_graph/sha_calculator.rb
89
+ - lib/build_settings/extractor.rb
90
+ - lib/build_settings/filter.rb
91
+ - lib/build_settings/loader.rb
92
+ - lib/build_settings/parser.rb
93
+ - lib/build_settings/string_interpolator.rb
94
+ - lib/command/command.rb
95
+ - lib/command/inject.rb
96
+ - lib/config/config.rb
97
+ - lib/config/dsl.rb
98
+ - lib/injection/build_flags_changer.rb
99
+ - lib/injection/dependency_remover.rb
100
+ - lib/injection/framework_embedder.rb
101
+ - lib/injection/headers_mover.rb
102
+ - lib/injection/injector.rb
103
+ - lib/injection/pods_script_fixer.rb
104
+ - lib/injection/storage.rb
105
+ - lib/logs/logs.rb
106
+ - lib/runner/runner.rb
107
+ - lib/shell/executor.rb
108
+ - lib/xcode-archive-cache.rb
109
+ - lib/xcodebuild/executor.rb
110
+ homepage:
111
+ licenses: []
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.7.7
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: Xcode archive cache
133
+ test_files: []