Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showBuildSettings does not require to call clean #8921

Merged
merged 6 commits into from
Apr 21, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions fastlane_core/lib/fastlane_core/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ def self.keychain_path(name)
keychain_path
end

# @return true if XCode version is higher than 8.3
def self.xcode_atleast?(version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xcode_at_least?

FastlaneCore::UI.user_error!("Unable to locate Xcode. Please make sure to have Xcode installed on your machine") if xcode_version.nil?
v = xcode_version
Gem::Version.new(v) >= Gem::Version.new(version)
end

# @return the full path to the iTMSTransporter executable
def self.itms_path
return ENV["FASTLANE_ITUNES_TRANSPORTER_PATH"] if FastlaneCore::Env.truthy?("FASTLANE_ITUNES_TRANSPORTER_PATH")
Expand Down
10 changes: 5 additions & 5 deletions fastlane_core/lib/fastlane_core/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ def xcodebuild_parameters
#####################################################

def build_xcodebuild_showbuildsettings_command
# We also need to pass the workspace and scheme to this command.
#
# The 'clean' portion of this command is a workaround for an xcodebuild bug with Core Data projects.
# See: https://github.com/fastlane/fastlane/pull/5626
command = "xcodebuild clean -showBuildSettings #{xcodebuild_parameters.join(' ')}"
if FastlaneCore::Helper.xcode_atleast?('8.3')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reference in a command on why this was added, when it was fixed, etc.

command = "xcodebuild -showBuildSettings #{xcodebuild_parameters.join(' ')}"
else
command = "xcodebuild clean -showBuildSettings #{xcodebuild_parameters.join(' ')}"
end
command += " 2> /dev/null" if xcodebuild_suppress_stderr
command
end
Expand Down
15 changes: 13 additions & 2 deletions fastlane_core/spec/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,21 @@ def within_a_temp_dir
end

describe "build_settings() can handle empty lines" do
it "SUPPORTED_PLATFORMS should be iphonesimulator iphoneos" do
it "SUPPORTED_PLATFORMS should be iphonesimulator iphoneos on XCode >= 8.3" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xcode

options = { project: "./fastlane_core/spec/fixtures/projects/Example.xcodeproj" }
@project = FastlaneCore::Project.new(options, xcodebuild_list_silent: true, xcodebuild_suppress_stderr: true)
expect(FastlaneCore::Project).to receive(:run_command).with("xcodebuild clean -showBuildSettings -project ./fastlane_core/spec/fixtures/projects/Example.xcodeproj 2> /dev/null", { timeout: 10, retries: 3, print: false }).and_return(File.read("./fastlane_core/spec/fixtures/projects/build_settings_with_toolchains"))
expect(FastlaneCore::Helper).to receive(:xcode_atleast?).and_return(true)
command = "xcodebuild -showBuildSettings -project ./fastlane_core/spec/fixtures/projects/Example.xcodeproj 2> /dev/null"
expect(FastlaneCore::Project).to receive(:run_command).with(command.to_s, { timeout: 10, retries: 3, print: false }).and_return(File.read("./fastlane_core/spec/fixtures/projects/build_settings_with_toolchains"))
expect(@project.build_settings(key: "SUPPORTED_PLATFORMS")).to eq("iphonesimulator iphoneos")
end

it "SUPPORTED_PLATFORMS should be iphonesimulator iphoneos on XCode < 8.3" do
options = { project: "./fastlane_core/spec/fixtures/projects/Example.xcodeproj" }
@project = FastlaneCore::Project.new(options, xcodebuild_list_silent: true, xcodebuild_suppress_stderr: true)
expect(FastlaneCore::Helper).to receive(:xcode_atleast?).and_return(false)
command = "xcodebuild clean -showBuildSettings -project ./fastlane_core/spec/fixtures/projects/Example.xcodeproj 2> /dev/null"
expect(FastlaneCore::Project).to receive(:run_command).with(command.to_s, { timeout: 10, retries: 3, print: false }).and_return(File.read("./fastlane_core/spec/fixtures/projects/build_settings_with_toolchains"))
expect(@project.build_settings(key: "SUPPORTED_PLATFORMS")).to eq("iphonesimulator iphoneos")
end
end
Expand Down
4 changes: 1 addition & 3 deletions gym/lib/gym/xcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ def pre_7?
end

def legacy_api_deprecated?
UI.user_error!("Unable to locate Xcode. Please make sure to have Xcode installed on your machine") if xcode_version.nil?
v = xcode_version
Gem::Version.new(v) >= Gem::Version.new('8.3.0')
FastlaneCore::Helper.xcode_atleast?('8.3')
end
end
end
Expand Down