forked from parse-community/Parse-SDK-iOS-OSX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
733 lines (631 loc) · 24.2 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
#
# Copyright (c) 2015-present, Parse, LLC.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
require_relative 'Vendor/xctoolchain/Scripts/xctask/build_task'
require_relative 'Vendor/xctoolchain/Scripts/xctask/build_framework_task'
script_folder = File.expand_path(File.dirname(__FILE__))
build_folder = File.join(script_folder, 'build')
release_folder = File.join(build_folder, 'release')
bolts_build_folder = File.join(script_folder, 'Carthage', 'Build')
bolts_folder = File.join(script_folder, 'Carthage', 'Checkouts', 'Bolts-ObjC')
ios_simulator = 'platform="iOS Simulator",name="iPhone 11"'
tvos_simulator = 'platform="tvOS Simulator",name="Apple TV 4K"'
module Constants
require 'plist'
script_folder = File.expand_path(File.dirname(__FILE__))
PARSE_CONSTANTS_HEADER = File.join(script_folder, 'Parse', 'Parse', 'PFConstants.h')
PARSE_PODSPEC = File.join(script_folder, 'Parse.podspec')
PLISTS = [
File.join(script_folder, 'Parse','Parse', 'Resources', 'Parse-iOS.Info.plist'),
File.join(script_folder, 'Parse','Parse', 'Resources', 'Parse-OSX.Info.plist'),
File.join(script_folder, 'Parse','Parse', 'Resources', 'Parse-watchOS.Info.plist'),
File.join(script_folder, 'Parse','Parse', 'Resources', 'Parse-tvOS.Info.plist'),
File.join(script_folder, 'ParseFacebookUtils', 'Resources', 'Info-iOS.plist'),
File.join(script_folder, 'ParseFacebookUtils', 'Resources', 'Info-tvOS.plist'),
File.join(script_folder, 'ParseTwitterUtils', 'Resources', 'Info.plist'),
File.join(script_folder, 'ParseUI', 'Resources', 'Info.plist'),
File.join(script_folder, 'ParseStarterProject', 'iOS', 'ParseStarterProject', 'Resources', 'Info.plist'),
File.join(script_folder, 'ParseStarterProject', 'iOS', 'ParseStarterProject-Swift', 'Resources', 'Info.plist'),
File.join(script_folder, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject', 'Resources', 'Info.plist'),
File.join(script_folder, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject-Swift', 'Resources', 'Info.plist'),
File.join(script_folder, 'ParseStarterProject', 'tvOS', 'ParseStarterProject-Swift', 'ParseStarter', 'Info.plist'),
File.join(script_folder, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift', 'ParseStarter', 'Info.plist'),
File.join(script_folder, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift', 'ParseStarter Extension', 'Info.plist'),
File.join(script_folder, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift', 'Resources', 'Info.plist'),
]
def self.current_version
constants_file = File.open(PARSE_CONSTANTS_HEADER, 'r').read
matches = constants_file.match(/(.*PARSE_VERSION\s*@")(.*)(")/)
matches[2] # Return the second match, which is the version itself
end
def self.update_version(version)
constants_file = File.open(PARSE_CONSTANTS_HEADER, 'r+')
constants = constants_file.read
constants.gsub!(/(.*PARSE_VERSION\s*@")(.*)(")/, "\\1#{version}\\3")
constants_file.seek(0)
constants_file.write(constants)
PLISTS.each do |plist|
update_info_plist_version(plist, version)
end
podspec_file = File.open(PARSE_PODSPEC, 'r+')
podspec = podspec_file.read
podspec.gsub!(/(.*s.version\s*=\s*')(.*)(')/, "\\1#{version}\\3")
podspec_file.seek(0)
podspec_file.write(podspec)
end
def self.update_info_plist_version(plist_path, version)
info_plist = Plist.parse_xml(plist_path)
info_plist['CFBundleShortVersionString'] = version
info_plist['CFBundleVersion'] = version
File.open(plist_path, 'w') { |f| f.write(info_plist.to_plist) }
end
end
namespace :build do
desc 'Build iOS framework.'
task :ios do
task = XCTask::BuildFrameworkTask.new do |t|
t.directory = script_folder
t.build_directory = build_folder
t.framework_type = XCTask::FrameworkType::IOS
t.framework_name = 'Parse.framework'
t.workspace = 'Parse.xcworkspace'
t.scheme = 'Parse-iOS'
t.configuration = 'Release'
end
result = task.execute
unless result
puts 'Failed to build iOS Framework.'
exit(1)
end
end
desc 'Build watchOS framework.'
task :watchos do
task = XCTask::BuildFrameworkTask.new do |t|
t.directory = script_folder
t.build_directory = build_folder
t.framework_type = XCTask::FrameworkType::WATCHOS
t.framework_name = 'Parse.framework'
t.workspace = 'Parse.xcworkspace'
t.scheme = 'Parse-watchOS'
t.configuration = 'Release'
end
result = task.execute
unless result
puts 'Failed to build watchOS Framework.'
exit(1)
end
end
desc 'Build macOS framework.'
task :macos do
task = XCTask::BuildFrameworkTask.new do |t|
t.directory = script_folder
t.build_directory = build_folder
t.framework_type = XCTask::FrameworkType::OSX
t.framework_name = 'Parse.framework'
t.workspace = 'Parse.xcworkspace'
t.scheme = 'Parse-macOS'
t.configuration = 'Release'
end
result = task.execute
unless result
puts 'Failed to build macOS Framework.'
exit(1)
end
end
desc 'Build tvOS framework.'
task :tvos do
task = XCTask::BuildFrameworkTask.new do |t|
t.directory = script_folder
t.build_directory = build_folder
t.framework_type = XCTask::FrameworkType::TVOS
t.framework_name = 'Parse.framework'
t.workspace = 'Parse.xcworkspace'
t.scheme = 'Parse-tvOS'
t.configuration = 'Release'
end
result = task.execute
unless result
puts 'Failed to build tvOS Framework.'
exit(1)
end
end
namespace :facebook_utils do
desc 'Build iOS FacebookUtils framework.'
task :ios do
task = XCTask::BuildFrameworkTask.new do |t|
t.directory = script_folder
t.build_directory = File.join(build_folder, 'iOS')
t.framework_type = XCTask::FrameworkType::IOS
t.framework_name = 'ParseFacebookUtilsV4.framework'
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseFacebookUtilsV4-iOS'
t.configuration = 'Release'
end
result = task.execute
unless result
puts 'Failed to build iOS FacebookUtils Framework.'
exit(1)
end
end
desc 'Build tvOS FacebookUtils framework.'
task :tvos do
task = XCTask::BuildFrameworkTask.new do |t|
t.directory = script_folder
t.build_directory = File.join(build_folder, 'tvOS')
t.framework_type = XCTask::FrameworkType::TVOS
t.framework_name = 'ParseFacebookUtilsV4.framework'
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseFacebookUtilsV4-tvOS'
t.configuration = 'Release'
end
result = task.execute
unless result
puts 'Failed to build tvOS FacebookUtils Framework.'
exit(1)
end
end
end
namespace :twitter_utils do
desc 'Build iOS TwitterUtils framework.'
task :ios do
task = XCTask::BuildFrameworkTask.new do |t|
t.directory = script_folder
t.build_directory = File.join(build_folder, 'iOS')
t.framework_type = XCTask::FrameworkType::IOS
t.framework_name = 'ParseTwitterUtils.framework'
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseTwitterUtils-iOS'
t.configuration = 'Release'
end
result = task.execute
unless result
puts 'Failed to build iOS TwitterUtils Framework.'
exit(1)
end
end
end
namespace :parseui do
task :framework do
task = XCTask::BuildFrameworkTask.new do |t|
t.directory = script_folder
t.build_directory = File.join(build_folder, 'iOS')
t.framework_type = XCTask::FrameworkType::IOS
t.framework_name = 'ParseUI.framework'
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseUI'
t.configuration = 'Release'
end
result = task.execute
unless result
puts 'Failed to build ParseUI'
exit(1)
end
end
task :demo_objc do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseUIDemo'
t.sdk = 'iphonesimulator'
t.destinations = [ios_simulator]
t.configuration = 'Debug'
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
t.actions = [XCTask::BuildAction::CLEAN, XCTask::BuildAction::BUILD]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
result = task.execute
unless result
puts 'Failed to build ParseUI Demo.'
exit(1)
end
end
task :demo_swift do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseUIDemo-Swift'
t.sdk = 'iphonesimulator'
t.destinations = [ios_simulator]
t.configuration = 'Debug'
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
t.actions = [XCTask::BuildAction::CLEAN, XCTask::BuildAction::BUILD]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
result = task.execute
unless result
puts 'Failed to build iOS ParseUI Swift Demo.'
exit(1)
end
end
end
end
namespace :package do
package_ios_name = 'Parse-iOS.zip'
package_macos_name = 'Parse-macOS.zip'
package_tvos_name = 'Parse-tvOS.zip'
package_watchos_name = 'Parse-watchOS.zip'
package_starter_ios_name = 'ParseStarterProject-iOS.zip'
package_starter_osx_name = 'ParseStarterProject-OSX.zip'
package_starter_tvos_name = 'ParseStarterProject-tvOS.zip'
package_starter_watchos_name = 'ParseStarterProject-watchOS.zip'
package_parseui_name = 'ParseUI.zip'
task :prepare do
`rm -rf #{build_folder} && mkdir -p #{build_folder}`
`rm -rf #{bolts_build_folder} && mkdir -p #{bolts_build_folder}`
`#{bolts_folder}/scripts/build_framework.sh -n -c Release --with-watchos --with-tvos`
end
task :set_version, [:version] do |_, args|
version = args[:version] || Constants.current_version
Constants.update_version(version)
end
desc 'Build all frameworks and starters'
task :release do |_|
Rake::Task['package:frameworks'].invoke
Rake::Task['package:starters'].invoke
end
desc 'Build and package all frameworks for the release'
task :frameworks, [:version] => :prepare do |_, args|
version = args[:version] || Constants.current_version
Constants.update_version(version)
## Build macOS Framework
Rake::Task['build:macos'].invoke
bolts_path = File.join(bolts_build_folder, 'osx', 'Bolts.framework')
osx_framework_path = File.join(build_folder, 'Parse.framework')
make_package(release_folder,
[osx_framework_path, bolts_path],
package_macos_name)
## Build iOS Framework
Rake::Task['build:ios'].invoke
bolts_path = File.join(bolts_build_folder, 'ios', 'Bolts.framework')
ios_framework_path = File.join(build_folder, 'Parse.framework')
make_package(release_folder,
[ios_framework_path, bolts_path],
package_ios_name)
## Build tvOS Framework
Rake::Task['build:tvos'].invoke
bolts_path = File.join(bolts_build_folder, 'tvOS', 'Bolts.framework')
tvos_framework_path = File.join(build_folder, 'Parse.framework')
make_package(release_folder,
[tvos_framework_path, bolts_path],
package_tvos_name)
## Build watchOS Framework
Rake::Task['build:watchos'].invoke
bolts_path = File.join(bolts_build_folder, 'watchOS', 'Bolts.framework')
watchos_framework_path = File.join(build_folder, 'Parse.framework')
make_package(release_folder,
[watchos_framework_path, bolts_path],
package_watchos_name)
Rake::Task['build:facebook_utils:ios'].invoke
ios_fb_utils_framework_path = File.join(build_folder, 'iOS', 'ParseFacebookUtilsV4.framework')
make_package(release_folder, [ios_fb_utils_framework_path], 'ParseFacebookUtils-iOS.zip')
Rake::Task['build:twitter_utils:ios'].invoke
ios_tw_utils_framework_path = File.join(build_folder, 'iOS', 'ParseTwitterUtils.framework')
make_package(release_folder, [ios_tw_utils_framework_path], 'ParseTwitterUtils-iOS.zip')
Rake::Task['build:facebook_utils:tvos'].invoke
tvos_fb_utils_framework_path = File.join(build_folder, 'tvOS', 'ParseFacebookUtilsV4.framework')
make_package(release_folder, [tvos_fb_utils_framework_path], 'ParseFacebookUtils-tvOS.zip')
Rake::Task['build:parseui:framework'].invoke
parseui_framework_path = File.join(build_folder, 'iOS', 'ParseUI.framework')
make_package(release_folder,
[parseui_framework_path],
package_parseui_name)
end
desc 'Build and package all starter projects for the release'
task :starters, [:version] => :frameworks do |_, _args|
require 'xcodeproj'
ios_starters = [
File.join(script_folder, 'ParseStarterProject', 'iOS', 'ParseStarterProject'),
File.join(script_folder, 'ParseStarterProject', 'iOS', 'ParseStarterProject-Swift')
]
ios_framework_archive = File.join(release_folder, package_ios_name)
make_starter_package(release_folder, ios_starters, ios_framework_archive, package_starter_ios_name)
osx_starters = [
File.join(script_folder, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject'),
File.join(script_folder, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject-Swift')
]
osx_framework_archive = File.join(release_folder, package_macos_name)
make_starter_package(release_folder, osx_starters, osx_framework_archive, package_starter_osx_name)
tvos_starters = [
File.join(script_folder, 'ParseStarterProject', 'tvOS', 'ParseStarterProject-Swift')
]
tvos_framework_archive = File.join(release_folder, package_tvos_name)
make_starter_package(release_folder, tvos_starters, tvos_framework_archive, package_starter_tvos_name)
watchos_starters = [
File.join(script_folder, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift')
]
watchos_framework_archive = File.join(release_folder, package_watchos_name)
watchos_starters.each do |project_path|
`git clean -xfd #{project_path}`
`mkdir -p #{project_path}/Frameworks/iOS && mkdir -p #{project_path}/Frameworks/watchOS`
`cd #{project_path}/Frameworks/iOS && unzip -o #{ios_framework_archive}`
`cd #{project_path}/Frameworks/watchOS && unzip -o #{watchos_framework_archive}`
xcodeproj_path = Dir.glob(File.join(project_path, '*.xcodeproj'))[0]
prepare_xcodeproj(xcodeproj_path)
end
make_package(release_folder, watchos_starters, package_starter_watchos_name)
watchos_starters.each do |project_path|
`git clean -xfd #{project_path}`
`git checkout #{project_path}`
end
end
def make_package(target_path, items, archive_name)
temp_folder = File.join(target_path, 'tmp')
`mkdir -p #{temp_folder}`
item_list = ''
items.each do |item|
`cp -R #{item} #{temp_folder}`
file_name = File.basename(item)
item_list << " #{file_name}"
end
archive_path = File.join(target_path, archive_name)
`cd #{temp_folder}; zip -r --symlinks #{archive_path} #{item_list}`
`rm -rf #{temp_folder}`
puts "Release archive created: #{File.join(target_path, archive_name)}"
end
def make_starter_package(target_path, starter_projects, framework_archive, archive_name)
starter_projects.each do |project_path|
`git clean -xfd #{project_path}`
`cd #{project_path} && unzip -o #{framework_archive}`
xcodeproj_path = Dir.glob(File.join(project_path, '*.xcodeproj'))[0]
prepare_xcodeproj(xcodeproj_path)
end
make_package(target_path, starter_projects, archive_name)
starter_projects.each do |project_path|
`git clean -xfd #{project_path}`
`git checkout #{project_path}`
end
end
def prepare_xcodeproj(path)
project = Xcodeproj::Project.open(path)
project.targets.each do |target|
if target.name == 'Bootstrap'
target.remove_from_project
else
target.dependencies.each do |dependency|
dependency.remove_from_project if dependency.display_name == 'Bootstrap'
end
end
end
project.save
`rm -rf #{File.join(path, 'xcshareddata', 'xcschemes', '*')}`
end
end
namespace :test do
desc 'Run iOS Tests'
task :ios do |_, args|
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = 'Parse-iOS'
t.sdk = 'iphonesimulator'
t.destinations = [ios_simulator]
t.configuration = 'Debug'
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
t.actions = [XCTask::BuildAction::TEST]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
unless task.execute
puts 'iOS Tests Failed!'
exit(1)
end
end
desc 'Run macOS Tests'
task :macos do |_, args|
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = 'Parse-macOS'
t.sdk = 'macosx'
t.configuration = 'Debug'
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
t.actions = [XCTask::BuildAction::TEST]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
unless task.execute
puts 'macOS Tests Failed!'
exit(1)
end
end
namespace :facebook_utils do
desc 'Test iOS FacebookUtils framework.'
task :ios do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseFacebookUtilsV4-iOS'
t.sdk = 'iphonesimulator'
t.destinations = [ios_simulator]
t.configuration = 'Debug'
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
t.actions = [XCTask::BuildAction::TEST]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
result = task.execute
unless result
puts 'Failed to build iOS FacebookUtils Framework.'
exit(1)
end
end
end
namespace :twitter_utils do
desc 'Test iOS TwitterUtils framework.'
task :ios do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseTwitterUtils-iOS'
t.sdk = 'iphonesimulator'
t.destinations = [ios_simulator]
t.configuration = 'Debug'
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
t.actions = [XCTask::BuildAction::TEST]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
result = task.execute
unless result
puts 'Failed to build iOS TwitterUtils Framework.'
exit(1)
end
end
end
namespace :parseui do
task :all do
Rake::Task['test:parseui:framework'].invoke
Rake::Task['test:parseui:demo_objc'].invoke
end
task :framework do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseUI'
t.sdk = 'iphonesimulator'
t.destinations = [ios_simulator]
t.configuration = 'Debug'
t.actions = [XCTask::BuildAction::TEST]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
result = task.execute
unless result
puts 'Failed to build ParseUI'
exit(1)
end
end
task :demo_objc do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseUIDemo'
t.sdk = 'iphonesimulator'
t.destinations = [ios_simulator]
t.configuration = 'Debug'
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
t.actions = [XCTask::BuildAction::CLEAN, XCTask::BuildAction::BUILD]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
result = task.execute
unless result
puts 'Failed to build ParseUI Demo.'
exit(1)
end
end
task :demo_swift do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseUIDemo-Swift'
t.sdk = 'iphonesimulator'
t.destinations = [ios_simulator]
t.configuration = 'Debug'
t.additional_options = { "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS" => "YES",
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
t.actions = [XCTask::BuildAction::CLEAN, XCTask::BuildAction::BUILD]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
result = task.execute
unless result
puts 'Failed to build iOS ParseUI Swift Demo.'
exit(1)
end
end
end
desc 'Run Starter Project Tests'
task :starters do |_|
results = []
ios_schemes = ['ParseStarterProject',
'ParseStarterProject-Swift']
osx_schemes = ['ParseOSXStarterProject',
'ParseOSXStarterProject-Swift']
tvos_schemes = ['ParseStarter-tvOS']
watchos_schemes = ['ParseWatchStarter-watchOS']
ios_schemes.each do |scheme|
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = scheme
t.configuration = 'Debug'
t.sdk = 'iphonesimulator'
t.destinations = [ios_simulator]
t.actions = [XCTask::BuildAction::CLEAN, XCTask::BuildAction::BUILD]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
results << task.execute
end
osx_schemes.each do |scheme|
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = scheme
t.configuration = 'Debug'
t.sdk = 'macosx'
t.actions = [XCTask::BuildAction::CLEAN, XCTask::BuildAction::BUILD]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
results << task.execute
end
watchos_schemes.each do |scheme|
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = scheme
t.configuration = 'Debug'
t.destinations = [ios_simulator]
t.actions = [XCTask::BuildAction::CLEAN, XCTask::BuildAction::BUILD]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
results << task.execute
end
tvos_schemes.each do |scheme|
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.workspace = 'Parse.xcworkspace'
t.scheme = scheme
t.configuration = 'Debug'
t.destinations = [tvos_simulator]
t.actions = [XCTask::BuildAction::CLEAN, XCTask::BuildAction::BUILD]
t.formatter = XCTask::BuildFormatter::XCPRETTY
end
results << task.execute
end
results.each do |result|
unless result
puts 'Starter Project Tests Failed!'
exit(1)
end
end
end
desc 'Run Podspec Lint'
task :cocoapods do |_|
podspecs = ['Parse.podspec']
results = []
system("pod repo update --silent")
podspecs.each do |podspec|
results << system("pod lib lint #{podspec} --allow-warnings")
results << system("pod lib lint #{podspec} --allow-warnings --use-libraries --use-modular-headers")
end
results.each do |result|
unless result
puts 'Podspec Tests Failed!'
exit(1)
end
end
end
desc 'Run Carthage Build'
task :carthage do |_|
if !system('carthage build --no-skip-current')
puts 'Carthage Tests Failed!'
exit(1)
end
end
end