Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
language: objective-c
osx_image: xcode7.2

env:
matrix:
- CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="7.0.3" TASK="rake ci"
- CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="7.1" TASK="rake ci"
- CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="8.1" TASK="rake ci"
matrix:
include:
- env: CEDAR_SDK_VERSION="9.2" CEDAR_SDK_RUNTIME_VERSION="8.4" TASK="rake ci"
- env: CEDAR_SDK_VERSION="9.2" CEDAR_SDK_RUNTIME_VERSION="9.2" TASK="rake ci"

# Analyze takes too long -- vary on runtime SDK
- CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="8.1" TASK="rake suites:specs:analyze"
- CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="8.1" TASK="rake suites:uispecs:analyze"
- CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="8.1" TASK="rake suites:focused_specs:analyze"
# Analyze takes too long to vary on runtime SDK. Latest is fine.
- env: CEDAR_SDK_VERSION="9.2" TASK="rake suites:specs:analyze"
- env: CEDAR_SDK_VERSION="9.2" TASK="rake suites:uispecs:analyze"
- env: CEDAR_SDK_VERSION="9.2" TASK="rake suites:focused_specs:analyze"

- TASK="./install.sh"
- TASK="./installCodeSnippetsAndTemplates"
- env: TASK="./install.sh"
- env: TASK="./installCodeSnippetsAndTemplates"

before_install: brew update
install:
- bundle install
- brew install ios-sim
- ios-sim showsdks
- ios-sim showdevicetypes

script:
# run a printer task to keep travis from terminating static analysis
Expand Down
3 changes: 3 additions & 0 deletions scripts/rake/helpers/shell.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
class Shell

def self.run(cmd, logfile = nil)
cmd.gsub!(/\s{2,}/, " ")

puts "#{green}==>#{clear} #{cmd}"
original_cmd = cmd

if logfile
logfile = output_file(logfile)
cmd = "export > #{logfile}; (#{cmd}) 2>&1 >> #{logfile}; test ${PIPESTATUS[0]} -eq 0"
Expand Down
1 change: 1 addition & 0 deletions scripts/rake/helpers/simulator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ def self.kill
system %Q[killall -m -KILL "gdb" > /dev/null 2>&1]
system %Q[killall -m -KILL "otest" > /dev/null 2>&1]
system %Q[killall -m -KILL "iPhone Simulator" > /dev/null 2>&1]
system %Q[killall -m -KILL "Simulator" > /dev/null 2>&1]
end
end
35 changes: 30 additions & 5 deletions scripts/rake/helpers/xcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def self.developer_dir
`xcode-select -print-path`.strip
end

def self.build_dir(effective_platform_name = "")
File.join(BUILD_DIR, CONFIGURATION + effective_platform_name)
def self.build_dir(effective_platform_name = "", configuration = CONFIGURATION)
File.join(BUILD_DIR, configuration + effective_platform_name)
end

def self.sdk_dir_for_version(version)
Expand All @@ -19,8 +19,12 @@ def self.sdk_dir_for_version(version)
path
end

def self.iPhone_simulator_name
'iPhone 5s'
end

def self.destination_for_ios_sdk(version)
"name=iPhone 5s,OS=#{version}"
"name=#{iPhone_simulator_name},OS=#{version}"
end

def self.swift_build_settings
Expand All @@ -41,9 +45,10 @@ def self.build(options = nil)
args += " -target #{options[:target].inspect}" if options[:target]
args += " -sdk #{options[:sdk].inspect}" if options[:sdk]
args += " -scheme #{options[:scheme].inspect}" if options[:scheme]
args += " -configuration #{options[:configuration] || CONFIGURATION}"

Shell.fold "build.#{options[:scheme] || options[:target]}" do
Shell.run(%Q(xcodebuild -project #{PROJECT_NAME}.xcodeproj -configuration #{CONFIGURATION} SYMROOT=#{BUILD_DIR.inspect} clean build #{args}), logfile)
Shell.run(%Q(xcodebuild -project #{PROJECT_NAME}.xcodeproj SYMROOT=#{BUILD_DIR.inspect} clean build #{args}), logfile)
end
end

Expand All @@ -57,8 +62,28 @@ def self.test(options = nil)
args += " -sdk #{options[:sdk].inspect}" if options[:sdk]
args += " -scheme #{options[:scheme].inspect}" if options[:scheme]

# launch Simulator.app with the uuid matching our device and sdk version
Shell.run(%Q(open -b com.apple.iphonesimulator \
--args -CurrentDeviceUDID `xcrun instruments -s | \
grep -o "#{iPhone_simulator_name} (#{SDK_VERSION}) \[.*\]" | \
grep -o "\[.*\]" | \
sed "s/^\[\(.*\)\]$/\1/" 2>/dev/null`))
Shell.run("sleep 5", nil) # need to wait for the simulator to be done "launching"

Shell.fold "test.#{options[:scheme] || options[:target]}" do
Shell.run(%Q(xcodebuild -project #{PROJECT_NAME}.xcodeproj -configuration #{CONFIGURATION} -derivedDataPath #{DERIVED_DATA_DIR.inspect} SYMROOT=#{BUILD_DIR.inspect} clean build test #{args}), logfile)
retry_count = 0
begin
Shell.run(%Q(
xcodebuild -project #{PROJECT_NAME}.xcodeproj \
-configuration #{CONFIGURATION} \
-derivedDataPath #{DERIVED_DATA_DIR.inspect} \
SYMROOT=#{BUILD_DIR.inspect} \
clean build test #{args})\
, logfile)
rescue
retry_count += 1
raise if retry_count == 3
end
end
end

Expand Down
12 changes: 8 additions & 4 deletions scripts/rake/tasks/spec_suites.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

desc "Build UI specs"
task :build do
Xcode.build(target: UI_SPECS_TARGET_NAME, sdk: "iphonesimulator#{SDK_VERSION}", args: 'ARCHS=i386', logfile: "uispecs.build.log")
Xcode.build(target: UI_SPECS_TARGET_NAME, sdk: "iphonesimulator#{SDK_VERSION}", args: 'ARCHS=i386', configuration: "Debug", logfile: "uispecs.build.log")
end

desc "Run UI specs"
Expand All @@ -52,7 +52,7 @@
}

Shell.with_env(env_vars) do
Simulator.launch(Xcode.build_dir("-iphonesimulator"), UI_SPECS_TARGET_NAME, Xcode.build_dir("-uispecs.run.log"))
Simulator.launch(Xcode.build_dir("-iphonesimulator", "Debug"), UI_SPECS_TARGET_NAME, Xcode.build_dir("-uispecs.run.log"))
end
end
end
Expand Down Expand Up @@ -123,7 +123,11 @@

desc "Build iOS dynamic framework specs"
task :build do
Xcode.build(target: IOS_DYNAMIC_FRAMEWORK_SPECS_TARGET_NAME, sdk: "iphonesimulator#{SDK_VERSION}", args: 'ARCHS=i386 '+Xcode.swift_build_settings, logfile: "frameworks.ios.dynamic.specs.build.log")
Xcode.build(target: IOS_DYNAMIC_FRAMEWORK_SPECS_TARGET_NAME,
sdk: "iphonesimulator#{SDK_VERSION}",
args: 'ARCHS=i386 '+Xcode.swift_build_settings,
configuration: "Debug",
logfile: "frameworks.ios.dynamic.specs.build.log")
end

desc "Runs iOS dynamic framework specs"
Expand All @@ -134,7 +138,7 @@
}

Shell.with_env(env_vars) do
Simulator.launch(Xcode.build_dir("-iphonesimulator"), IOS_DYNAMIC_FRAMEWORK_SPECS_TARGET_NAME, Xcode.build_dir("-frameworks.ios.dynamic.specs.run.log"))
Simulator.launch(Xcode.build_dir("-iphonesimulator", "Debug"), IOS_DYNAMIC_FRAMEWORK_SPECS_TARGET_NAME, Xcode.build_dir("-frameworks.ios.dynamic.specs.run.log"))
end
end
end
Expand Down