Skip to content

Commit

Permalink
Make Carthage action support dependencies for build command (fastlane…
Browse files Browse the repository at this point in the history
  • Loading branch information
joihelgi authored and ohayon committed Oct 24, 2017
1 parent a0954ff commit f7758f3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fastlane/lib/fastlane/actions/carthage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def self.run(params)

if command_name == "archive" && params[:frameworks].count > 0
cmd.concat params[:frameworks]
elsif command_name == "update" && params[:dependencies].count > 0
elsif (command_name == "update" || command_name == "build") && params[:dependencies].count > 0
cmd.concat params[:dependencies]
end

Expand Down Expand Up @@ -65,7 +65,7 @@ def self.available_options
UI.user_error!("Please pass a valid command. Use one of the following: #{available_commands.join(', ')}") unless available_commands.include? value
end),
FastlaneCore::ConfigItem.new(key: :dependencies,
description: "Carthage dependencies to update",
description: "Carthage dependencies to update or build",
default_value: [],
is_string: false,
type: Array),
Expand Down Expand Up @@ -174,7 +174,7 @@ def self.example_code
frameworks: ["MyFramework1", "MyFramework2"], # Specify which frameworks to archive (only for the archive command)
output: "MyFrameworkBundle.framework.zip", # Specify the output archive name (only for the archive command)
command: "bootstrap", # One of: build, bootstrap, update, archive. (default: bootstrap)
dependencies: ["Alamofire", "Notice"], # Specify which dependencies to update (only for the update command)
dependencies: ["Alamofire", "Notice"], # Specify which dependencies to update or build (only for update and build commands)
use_ssh: false, # Use SSH for downloading GitHub repositories.
use_submodules: false, # Add dependencies as Git submodules.
use_binaries: true, # Check out dependency repositories even when prebuilt frameworks exist
Expand Down
24 changes: 24 additions & 0 deletions fastlane/spec/actions_specs/carthage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,30 @@
eq("carthage update TestDependency1 TestDependency2")
end

it "builds with a single dependency" do
result = Fastlane::FastFile.new.parse("lane :test do
carthage(
command: 'build',
dependencies: ['TestDependency']
)
end").runner.execute(:test)

expect(result).to \
eq("carthage build TestDependency")
end

it "builds with multiple dependencies" do
result = Fastlane::FastFile.new.parse("lane :test do
carthage(
command: 'build',
dependencies: ['TestDependency1', 'TestDependency2']
)
end").runner.execute(:test)

expect(result).to \
eq("carthage build TestDependency1 TestDependency2")
end

it "works with no parameters" do
expect do
Fastlane::FastFile.new.parse("lane :test do
Expand Down

0 comments on commit f7758f3

Please sign in to comment.