xcjobs 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77fa2599099b33acbf2d9810c44d794383bb6704
4
- data.tar.gz: 66592101cff663dd0ad07d5adf8b0780b6da2b35
3
+ metadata.gz: f32da1984b26234e750171374e06b8f80d4239e5
4
+ data.tar.gz: 58446dc2854f728e56bee1e98d3e4a465f6cfe62
5
5
  SHA512:
6
- metadata.gz: 9cbc57bd73906258ce007277f0cf9db4656172ce261240ddab7dddb913e19b88874652d7a22ee1a55bba51c6f842e6350584ffe2c8260ce87aaeac3252f72ca8
7
- data.tar.gz: 76debdf38cdadc9f6a9c72be8672797316e0d7bb5ba9bcfab51f15e4206ababdc7bfbad26220d658d7b922484c44d32a3706fe89b0473565d6991d9c5e9f531f
6
+ metadata.gz: ccbb36c27d38e9128c63db56530007f3c06f0ba82b786e28cd8a14f0d0f2f0da4317a95f38adfe2240df30d67c4877254f99c1f80880b3da0a381b4bd6967cd7
7
+ data.tar.gz: 512b672869af92b52bb38072479340a838068f56f8f8e476c2983b9f02c2ab9295f3427bcff31c6bd9a5d93e790f71efa64a119e15b8ae62d7997bab53389c30
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # XCJobs
2
- [![Gem Version](https://badge.fury.io/rb/xcjobs.svg)](http://badge.fury.io/rb/xcjobs) [![Build Status](https://travis-ci.org/kishikawakatsumi/xcjobs.svg?branch=master)](https://travis-ci.org/kishikawakatsumi/xcjobs) [![Coverage Status](https://img.shields.io/coveralls/kishikawakatsumi/xcjobs.svg)](https://coveralls.io/r/kishikawakatsumi/xcjobs?branch=master) [![Code Climate](https://codeclimate.com/github/kishikawakatsumi/xcjobs/badges/gpa.svg)](https://codeclimate.com/github/kishikawakatsumi/xcjobs) [![Dependency Status](https://gemnasium.com/kishikawakatsumi/xcjobs.svg)](https://gemnasium.com/kishikawakatsumi/xcjobs)
2
+ [![Gem Version](https://badge.fury.io/rb/xcjobs.svg)](http://badge.fury.io/rb/xcjobs)
3
+ [![Circle CI](https://circleci.com/gh/kishikawakatsumi/xcjobs.svg?style=svg)](https://circleci.com/gh/kishikawakatsumi/xcjobs)
4
+ [![Build Status](https://travis-ci.org/kishikawakatsumi/xcjobs.svg?branch=master)](https://travis-ci.org/kishikawakatsumi/xcjobs)
5
+ [![Coverage Status](https://img.shields.io/coveralls/kishikawakatsumi/xcjobs.svg)](https://coveralls.io/r/kishikawakatsumi/xcjobs?branch=master)
6
+ [![Code Climate](https://codeclimate.com/github/kishikawakatsumi/xcjobs/badges/gpa.svg)](https://codeclimate.com/github/kishikawakatsumi/xcjobs)
7
+ [![Dependency Status](https://gemnasium.com/kishikawakatsumi/xcjobs.svg)](https://gemnasium.com/kishikawakatsumi/xcjobs)
3
8
 
4
9
  Support the automation of release process of iOS/OSX apps with CI
5
10
 
data/circle.yml ADDED
@@ -0,0 +1,6 @@
1
+ dependencies:
2
+ pre:
3
+ - case $CIRCLE_NODE_INDEX in 0) rvm use 1.9.3 --default ;; 1) rvm use 2.0.0 --default ;; 2) rvm use 2.1 --default ;; 3) rvm use 2.2 --default ;; esac
4
+ test:
5
+ override:
6
+ - ruby -v ; bundle exec rspec --format documentation --color spec: {parallel: true}
@@ -8,12 +8,6 @@ require 'digest/md5'
8
8
  module XCJobs
9
9
  module Coverage
10
10
 
11
- def self.run_gcov(configuration_temp_dir)
12
- Dir.glob("#{configuration_temp_dir}/**/*.gcda").each do |file|
13
- system %[(cd "#{File.dirname(file)}" && gcov -l "#{file}")]
14
- end
15
- end
16
-
17
11
  class Coveralls < Rake::TaskLib
18
12
  include Rake::DSL if defined?(Rake::DSL)
19
13
 
@@ -109,9 +103,9 @@ module XCJobs
109
103
  end
110
104
  else
111
105
  coverage[number.to_i - 1] = case count.strip
112
- when "-"
106
+ when '-'
113
107
  nil
114
- when "#####"
108
+ when '#####'
115
109
  if text.strip == '}'
116
110
  nil
117
111
  else
@@ -1,3 +1,3 @@
1
1
  module XCJobs
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -43,17 +43,6 @@ module XCJobs
43
43
  end
44
44
  end
45
45
 
46
- def coverage=(coverage)
47
- @coverage = coverage
48
- if coverage
49
- add_build_setting('GCC_INSTRUMENT_PROGRAM_FLOW_ARCS', 'YES')
50
- add_build_setting('GCC_GENERATE_TEST_COVERAGE_FILES', 'YES')
51
- else
52
- @build_settings.delete('GCC_INSTRUMENT_PROGRAM_FLOW_ARCS')
53
- @build_settings.delete('GCC_GENERATE_TEST_COVERAGE_FILES')
54
- end
55
- end
56
-
57
46
  def coverage_enabled
58
47
  @coverage
59
48
  end
@@ -84,11 +73,6 @@ module XCJobs
84
73
  def run(cmd)
85
74
  @before_action.call if @before_action
86
75
 
87
- if coverage_enabled
88
- out, status = Open3.capture2(*(cmd + ['-showBuildSettings']))
89
- configuration_temp_dir = out.lines.grep(/\bCONFIGURATION_TEMP_DIR\b/).first.split('=').last.strip
90
- end
91
-
92
76
  if @formatter
93
77
  puts (cmd + ['|', @formatter]).join(" ")
94
78
  else
@@ -105,10 +89,6 @@ module XCJobs
105
89
 
106
90
  status = wait_thrs.first.value
107
91
  if status.success?
108
- if coverage_enabled
109
- XCJobs::Coverage.run_gcov(configuration_temp_dir)
110
- end
111
-
112
92
  @after_action.call(output, status) if @after_action
113
93
  else
114
94
  fail "xcodebuild failed (exited with status: #{status.exitstatus})"
@@ -124,10 +104,6 @@ module XCJobs
124
104
 
125
105
  status = wait_thr.value
126
106
  if status.success?
127
- if coverage_enabled
128
- XCJobs::Coverage.run_gcov(configuration_temp_dir)
129
- end
130
-
131
107
  @after_action.call(output, status) if @after_action
132
108
  else
133
109
  fail "xcodebuild failed (exited with status: #{status.exitstatus})"
@@ -144,6 +120,7 @@ module XCJobs
144
120
  opts.concat(['-scheme', scheme]) if scheme
145
121
  opts.concat(['-sdk', sdk]) if sdk
146
122
  opts.concat(['-configuration', configuration]) if configuration
123
+ opts.concat(['-enableCodeCoverage', 'YES']) if coverage_enabled
147
124
  opts.concat(['-derivedDataPath', build_dir]) if build_dir
148
125
 
149
126
  @destinations.each do |destination|
@@ -180,10 +157,78 @@ module XCJobs
180
157
  add_build_setting('CODE_SIGN_IDENTITY', '""')
181
158
  add_build_setting('CODE_SIGNING_REQUIRED', 'NO')
182
159
  end
183
-
160
+ if sdk == 'macosx'
161
+ add_build_setting('CONFIGURATION_BUILD_DIR', File.expand_path(build_dir)) if build_dir
162
+ end
163
+ add_build_setting('CONFIGURATION_TEMP_DIR', File.join(build_dir, 'temp')) if build_dir
184
164
  add_build_setting('GCC_SYMBOLS_PRIVATE_EXTERN', 'NO')
185
165
 
186
166
  run(['xcodebuild', 'test'] + options)
167
+
168
+ if coverage_enabled
169
+ out, status = Open3.capture2(*(['xcodebuild', 'test'] + options + ['-showBuildSettings']))
170
+
171
+ configuration_build_dir = out.lines.grep(/\bCONFIGURATION_BUILD_DIR\b/).first.split('=').last.strip
172
+ project_temp_root = out.lines.grep(/\bPROJECT_TEMP_ROOT\b/).first.split('=').last.strip
173
+ object_file_dir_normal = out.lines.grep(/\bOBJECT_FILE_DIR_normal\b/).first.split('=').last.strip
174
+ current_arch = out.lines.grep(/\bCURRENT_ARCH\b/).first.split('=').last.strip
175
+ executable_name = out.lines.grep(/\bEXECUTABLE_NAME\b/).first.split('=').last.strip
176
+ executable_path = out.lines.grep(/\bEXECUTABLE_PATH\b/).first.split('=').last.strip
177
+
178
+ if sdk.start_with 'iphone'
179
+ target_path = File.join(File.join(object_file_dir_normal, current_arch), executable_name)
180
+ elsif sdk == 'macosx'
181
+ target_path = File.join(configuration_build_dir, executable_path)
182
+ end
183
+
184
+ code_coverage_dir = File.join(project_temp_root, 'CodeCoverage')
185
+ profdata_dir = File.join(code_coverage_dir, scheme)
186
+ profdata_path = File.join(profdata_dir, 'Coverage.profdata')
187
+
188
+ gcov_file = {}
189
+ source_path = ''
190
+
191
+ cmd = ['xcrun', 'llvm-cov', 'report']
192
+ opts = ['-instr-profile', profdata_path, target_path, '-use-color=0']
193
+ puts (cmd + opts).join(" ")
194
+ out, status = Open3.capture2(*(cmd + opts))
195
+ out.lines.each do |line|
196
+ puts line
197
+ end
198
+
199
+ cmd = ['xcrun', 'llvm-cov', 'show']
200
+ puts (cmd + opts).join(" ")
201
+ out, status = Open3.capture2(*(cmd + opts))
202
+ out.lines.each do |line|
203
+ match = /^(['"]?(?:\/[^\/]+)*['"]?):$/.match(line)
204
+ if match.to_a.count > 0
205
+ source_path = match.to_a[1]
206
+ gcov_file[source_path] = []
207
+ next
208
+ end
209
+
210
+ match = /^[ ]*([0-9]+|[ ]+)\|[ ]*([0-9]+)\|(.*)$/.match(line)
211
+ next unless match.to_a.count == 4
212
+ count, number, text = match.to_a[1..3]
213
+
214
+ execution_count = case count.strip
215
+ when ''
216
+ '-'.rjust(5)
217
+ when '0'
218
+ '#####'
219
+ else count
220
+ end
221
+ gcov_file[source_path] << "#{execution_count.rjust(5)}:#{number.rjust(5)}:#{text}"
222
+ end
223
+
224
+ gcov_file.each do |key, value|
225
+ gcon_path = File.join(File.dirname(target_path), "#{File.basename(target_path)}.gcov")
226
+ file = File::open(gcon_path, "w")
227
+ file.puts("#{'-'.rjust(5)}:#{'0'.rjust(5)}:Source:#{key}")
228
+ file.puts(value)
229
+ file.flush
230
+ end
231
+ end
187
232
  end
188
233
  end
189
234
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcjobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kishikawa katsumi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2015-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,7 @@ files:
80
80
  - LICENSE
81
81
  - README.md
82
82
  - Rakefile
83
+ - circle.yml
83
84
  - lib/xcjobs.rb
84
85
  - lib/xcjobs/certificate.rb
85
86
  - lib/xcjobs/coverage.rb
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
120
  version: '0'
120
121
  requirements: []
121
122
  rubyforge_project:
122
- rubygems_version: 2.4.5
123
+ rubygems_version: 2.4.5.1
123
124
  signing_key:
124
125
  specification_version: 4
125
126
  summary: Support the automation of release process of iOS/OSX apps with CI