Skip to content

Commit

Permalink
Merge pull request #607 from calabash/release/2.3.1
Browse files Browse the repository at this point in the history
Release/2.3.1
  • Loading branch information
jmoody authored Mar 7, 2017
2 parents 42f3191 + 682817a commit 79ca591
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 73 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## Change Log

### 2.3.1

This release does not contain a new DeviceAgent stack.

* Xcode#version returns 0.0.0 on XTC and on RuntimeErrors #606
* CoreSim: quit simulator before resetting app sandbox #605
* DeviceAgent::Client: skip ensure software keyboard check #604
* Prepare for Xcode 8.3 support #603
* Directory: rescue errors during skip check and File.size #598
* Directory: rescue ENOENT errors during skip check #597

### 2.3.0

This release contains a significant change - Simulators will not be
Expand Down
26 changes: 26 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,30 @@ target = #{target}
end
end

def create_calabash_keychain
require "run_loop/environment"
path = File.join(RunLoop::Environment.user_home_directory,
".calabash", "calabash-codesign")
if File.exist?(path)
Dir.chdir(path) do
args = ["apple/create-keychain.sh"]
hash = RunLoop::Shell.run_shell_command(args)
if hash[:exit_status] != 0
raise %Q[
Failed to create the codesigning keychain:
#{hash[:out]}
]
else
log_info("Created the Calabash.keychain")
end
end
else
log_info("Cannot create the Calabash.keychain")
end
end

task :build do
banner("Building")

Expand All @@ -233,6 +257,8 @@ target = #{target}

ensure_valid_core_simulator_service

create_calabash_keychain

env = {"DEVICEAGENT_PATH" => device_agent}

Dir.chdir(ios_device_manager) do
Expand Down
4 changes: 3 additions & 1 deletion lib/run_loop/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ def self.include_calabash_script?(options)
# version.
def self.default_simulator(xcode=RunLoop::Xcode.new)

if xcode.version_gte_82?
if xcode.version_gte_83?
"iPhone 7 (10.3)"
elsif xcode.version_gte_82?
"iPhone 7 (10.2)"
elsif xcode.version_gte_81?
"iPhone 7 (10.1)"
Expand Down
1 change: 1 addition & 0 deletions lib/run_loop/core_simulator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ def app_is_installed?
def reset_app_sandbox
return true if !app_is_installed?

RunLoop::CoreSimulator.quit_simulator
RunLoop::CoreSimulator.wait_for_simulator_state(device, "Shutdown")

reset_app_sandbox_internal
Expand Down
1 change: 0 additions & 1 deletion lib/run_loop/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,6 @@ def simulator_process_running?(process_name)
waiter = RunLoop::ProcessWaiter.new(process_name)
waiter.pids.any? do |pid|
process_parent_is_launchd_sim?(pid)
#process_parent_is_current_xcode?(pid)
end
end

Expand Down
1 change: 0 additions & 1 deletion lib/run_loop/device_agent/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def self.run(options={})
core_sim.reset_app_sandbox
end

simctl.ensure_software_keyboard(device)
core_sim.install
end

Expand Down
66 changes: 38 additions & 28 deletions lib/run_loop/directory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ def self.directory_digest(path, options={})
#{e}
while trying to find the SHA of this file:
while trying to find the SHA of this file:
#{file}
This is not a fatal error; it can be ignored.
This is not a fatal error; it can be ignored.
}
RunLoop.log_debug(message)
when :raising
Expand Down Expand Up @@ -135,32 +135,37 @@ def self.size(path, format)

def self.skip_file?(file, task, debug)
skip = false
if File.directory?(file)
# Skip directories
skip = true
elsif !Pathname.new(file).exist?
# Skip broken symlinks
skip = true
elsif !File.exist?(file)
# Skip files that don't exist
skip = true
else
case File.ftype(file)
when 'fifo'
RunLoop.log_warn("#{task} IS SKIPPING FIFO #{file}") if debug
skip = true
when 'socket'
RunLoop.log_warn("#{task} IS SKIPPING SOCKET #{file}") if debug
skip = true
when 'characterSpecial'
RunLoop.log_warn("#{task} IS SKIPPING CHAR SPECIAL #{file}") if debug
skip = true
when 'blockSpecial'
skip = true
RunLoop.log_warn("#{task} SKIPPING BLOCK SPECIAL #{file}") if debug
else

begin
if File.directory?(file)
# Skip directories
skip = true
elsif !Pathname.new(file).exist?
# Skip broken symlinks
skip = true
elsif !File.exist?(file)
# Skip files that don't exist
skip = true
else
case File.ftype(file)
when 'fifo'
RunLoop.log_warn("#{task} IS SKIPPING FIFO #{file}") if debug
skip = true
when 'socket'
RunLoop.log_warn("#{task} IS SKIPPING SOCKET #{file}") if debug
skip = true
when 'characterSpecial'
RunLoop.log_warn("#{task} IS SKIPPING CHAR SPECIAL #{file}") if debug
skip = true
when 'blockSpecial'
skip = true
RunLoop.log_warn("#{task} SKIPPING BLOCK SPECIAL #{file}") if debug
else
end
end
rescue => e
skip = true
RunLoop.log_debug("Directory.skip_file? rescued an ignorable error.")
RunLoop.log_debug("#{e.class}: #{e.message}")
end
skip
end
Expand All @@ -170,7 +175,12 @@ def self.iterate_for_size(entries)
size = 0
entries.each do |file|
unless self.skip_file?(file, "SIZE", debug)
size = size + File.size(file)
begin
size = size + File.size(file)
rescue => e
RunLoop.log_debug("Directory.iterate_for_size? rescued an ignorable error.")
RunLoop.log_debug("#{e.class}: #{e.message}")
end
end
end
size
Expand Down
2 changes: 1 addition & 1 deletion lib/run_loop/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module RunLoop
VERSION = "2.3.0"
VERSION = "2.3.1"

# A model of a software release version that can be used to compare two versions.
#
Expand Down
56 changes: 43 additions & 13 deletions lib/run_loop/xcode.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'open3'

module RunLoop

# A model of the active Xcode version.
Expand All @@ -12,7 +10,11 @@ module RunLoop
# `xcode-select` or overridden using the `DEVELOPER_DIR`.
class Xcode

require "run_loop/regex"
require "run_loop/shell"

include RunLoop::Regex
include RunLoop::Shell

# Returns a String representation.
def to_s
Expand All @@ -24,6 +26,14 @@ def inspect
to_s
end

# Returns a version instance for Xcode 8.3 ; used to check for the
# availability of features and paths to various items on the filesystem
#
# @return [RunLoop::Version] 8.3
def v83
fetch_version(:v83)
end

# Returns a version instance for Xcode 8.2 ; used to check for the
# availability of features and paths to various items on the filesystem
#
Expand Down Expand Up @@ -136,6 +146,13 @@ def v50
fetch_version(:v50)
end

# Is the active Xcode version 8.3 or above?
#
# @return [Boolean] `true` if the current Xcode version is >= 8.3
def version_gte_83?
version >= v83
end

# Is the active Xcode version 8.2 or above?
#
# @return [Boolean] `true` if the current Xcode version is >= 8.2
Expand Down Expand Up @@ -234,12 +251,31 @@ def version_gte_51?
# @return [RunLoop::Version] The current version of Xcode as reported by
# `xcrun xcodebuild -version`.
def version
@xcode_version ||= lambda do
execute_command(['-version']) do |stdout, _, _|
version_string = stdout.read.chomp[VERSION_REGEX, 0]
RunLoop::Version.new(version_string)
@xcode_version ||= begin
if RunLoop::Environment.xtc?
RunLoop::Version.new("0.0.0")
else
version = RunLoop::Version.new("0.0.0")
begin
args = ["xcrun", "xcodebuild", "-version"]
hash = run_shell_command(args)
if hash[:exit_status] != 0
RunLoop.log_error("xcrun xcodebuild -version exited non-zero")
else
out = hash[:out]
version_string = out.chomp[VERSION_REGEX, 0]
version = RunLoop::Version.new(version_string)
end
rescue RuntimeError => e
RunLoop.log_error(%Q[
Could not find Xcode version:
#{e.class}: #{e.message}
])
end
version
end
end.call
end
end

# Is this a beta version of Xcode?
Expand Down Expand Up @@ -333,12 +369,6 @@ def ensure_valid_version_key(key)
end
end

def execute_command(args)
Open3.popen3('xcrun', 'xcodebuild', *args) do |_, stdout, stderr, wait_thr|
yield stdout, stderr, wait_thr
end
end

def xcode_select_path
Open3.popen3('xcode-select', '--print-path') do |_, stdout, _, _|
stdout.read.chomp
Expand Down
18 changes: 9 additions & 9 deletions scripts/lib/on_alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ function dutchLocalizations() {
}

function dutch_BE_Localizations() {
return [
["Sta toe", /toegang tot je locatie toestaan terwijl je de app gebruikt/],
["Sta toe", /toegang tot je locatie toestaan, zelfs als je de app niet gebruikt/],
["OK", /wil toegang tot je contacten/],
["OK", /wil toegang tot je agenda/],
["OK", /wil toegang tot je herinneringen/],
["OK", /wil toegang tot je foto's/],
["OK", /wil toegang tot je bewegings- en fitnessactiviteit/]
];
return [
["Sta toe", /toegang tot je locatie toestaan terwijl je de app gebruikt/],
["Sta toe", /toegang tot je locatie toestaan, zelfs als je de app niet gebruikt/],
["OK", /wil toegang tot je contacten/],
["OK", /wil toegang tot je agenda/],
["OK", /wil toegang tot je herinneringen/],
["OK", /wil toegang tot je foto's/],
["OK", /wil toegang tot je bewegings- en fitnessactiviteit/]
];
}

function swedishLocalizations() {
Expand Down
16 changes: 0 additions & 16 deletions spec/integration/xcode_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@

let(:xcode) { RunLoop::Xcode.new }

it '#version' do
stdout = %q(
Xcode 7.0.1
Build version 7A192o
)
yielded = [StringIO.new(stdout), StringIO.new(''), nil]
expect(xcode).to receive(:execute_command).with(['-version']).and_yield(*yielded)

expected = RunLoop::Version.new('7.0.1')
expect(xcode.version).to be == expected
expect(xcode.instance_variable_get(:@xcode_version)).to be == expected

#Testing memoization
expect(xcode.version).to be == expected
end

it '#xcode_select_path' do
path = xcode.send(:xcode_select_path)
expect(Dir.exist?(path)).to be_truthy
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/core_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@
expect(xcode).to receive(:version).at_least(:once).and_return xcode.v82
expect(RunLoop::Core.default_simulator(xcode)).to be == expected
end

it 'Xcode >= 8.3' do
expected = 'iPhone 7 (10.3)'
expect(xcode).to receive(:version).at_least(:once).and_return xcode.v83
expect(RunLoop::Core.default_simulator(xcode)).to be == expected
end
end

describe '.above_or_eql_version?' do
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/run_loop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
context "not XTC" do

before do
expect(RunLoop::Environment).to receive(:xtc?).and_return(false)
expect(RunLoop::Environment).to receive(:xtc?).at_least(:once).and_return(false)
end

context "Xcode >= 8" do
Expand Down Expand Up @@ -101,7 +101,7 @@
context "not XTC" do

before do
expect(RunLoop::Environment).to receive(:xtc?).and_return(false)
expect(RunLoop::Environment).to receive(:xtc?).at_least(:once).and_return(false)
end

context ":automator defined" do
Expand Down
Loading

0 comments on commit 79ca591

Please sign in to comment.