Skip to content

Commit bafa2ed

Browse files
committed
Merge pull request #370 from ParsePlatform/nlutsenko.watch.deployment
Add Parse watchOS deployment testing to Travis.
2 parents 780945d + 32af66a commit bafa2ed

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

Rakefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@ namespace :build do
7777
end
7878
end
7979

80+
desc 'Build watchOS framework.'
81+
task :watchos do
82+
task = XCTask::BuildFrameworkTask.new do |t|
83+
t.directory = script_folder
84+
t.build_directory = build_folder
85+
t.framework_type = XCTask::FrameworkType::WATCHOS
86+
t.framework_name = 'Parse.framework'
87+
88+
t.workspace = 'Parse.xcworkspace'
89+
t.scheme = 'Parse-watchOS'
90+
t.configuration = 'Release'
91+
end
92+
result = task.execute
93+
unless result
94+
puts 'Failed to build watchOS Framework.'
95+
exit(1)
96+
end
97+
end
98+
8099
desc 'Build OS X framework.'
81100
task :osx do
82101
task = XCTask::BuildFrameworkTask.new do |t|
@@ -246,6 +265,7 @@ namespace :test do
246265

247266
desc 'Run Deployment Tests'
248267
task :deployment do |_|
268+
Rake::Task['build:watchos'].invoke
249269
Rake::Task['package:frameworks'].invoke
250270
Rake::Task['package:starters'].invoke
251271
end

Scripts/xctask/build_framework_task.rb

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ module XCTask
1616
class FrameworkType
1717
IOS = 'ios'
1818
OSX = 'osx'
19+
WATCHOS = 'watchos'
1920

2021
def self.verify(type)
21-
if type.nil? || (type != IOS && type != OSX)
22-
fail "Unknown framework type. Available types: 'ios', 'osx'."
22+
if type.nil? || (type != IOS && type != OSX && type != WATCHOS)
23+
fail "Unknown framework type. Available types: 'ios', 'osx', 'watchos'."
2324
end
2425
end
2526
end
@@ -64,6 +65,8 @@ def build
6465
build_ios_framework
6566
when FrameworkType::OSX
6667
build_osx_framework
68+
when FrameworkType::WATCHOS
69+
build_watchos_framework
6770
end
6871
end
6972

@@ -92,6 +95,31 @@ def build_ios_framework
9295
result
9396
end
9497

98+
def build_watchos_framework
99+
framework_paths = []
100+
framework_paths << build_framework('watchos')
101+
framework_paths << build_framework('watchsimulator')
102+
final_path = final_framework_path
103+
104+
system("rm -rf #{final_path} && cp -R #{framework_paths[0]} #{final_path}")
105+
106+
binary_name = File.basename(@framework_name, '.framework')
107+
system("rm -rf #{final_path}/#{binary_name}")
108+
109+
lipo_command = 'lipo -create'
110+
framework_paths.each do |path|
111+
lipo_command += " #{path}/#{binary_name}"
112+
end
113+
lipo_command += " -o #{final_path}/#{binary_name}"
114+
115+
result = system(lipo_command)
116+
unless result
117+
puts 'Failed to lipo watchOS framework.'
118+
exit(1)
119+
end
120+
result
121+
end
122+
95123
def build_osx_framework
96124
build_path = build_framework('macosx')
97125
final_path = final_framework_path

0 commit comments

Comments
 (0)