-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for creating custom build_configurations
This enables creation of custom build configurations by adding `build_configurations` to `.liftoffrc`: ```yaml build_configurations: - name: Debug-CI type: debug - name: Release-CI type: release ``` `type` must be `release` or `debug` (or else it'll error in `add_build_configuration`). As `xcodeproj` itself doesn't explicitly checks for these, I followed the same rule. I also haven't checked if both `name` and `type` were specified as I haven't seen this pattern through the codebase. `create_build_configurations` was called before `configure_base_project_settings` so all further configuration is also applied to the created configurations.
- Loading branch information
1 parent
7d39896
commit ce47d4b
Showing
7 changed files
with
145 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Liftoff | ||
class BuildConfigurationBuilder | ||
def initialize(xcode_project) | ||
@xcode_project = xcode_project | ||
end | ||
|
||
def generate_build_configuration(name, type) | ||
@xcode_project.add_build_configuration(name, type.to_sym) | ||
end | ||
|
||
def generate_build_configurations(build_configurations) | ||
build_configurations ||= [] | ||
build_configurations.each do |configuration| | ||
name = configuration["name"] | ||
type = configuration["type"] | ||
generate_build_configuration(name, type) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require "spec_helper" | ||
|
||
describe Liftoff::BuildConfigurationBuilder do | ||
describe "#generate_build_configuration" do | ||
it "creates a build configuration" do | ||
project = double("xcodeproj") | ||
builder = build_configuration_builder(project) | ||
|
||
allow(project).to receive(:add_build_configuration) | ||
|
||
builder.generate_build_configuration("Release-CI", :release) | ||
|
||
expect(project).to have_received(:add_build_configuration).with("Release-CI", :release) | ||
end | ||
end | ||
|
||
describe "#generate_build_configurations" do | ||
it "creates multiple build configurations" do | ||
project = double("xcodeproj") | ||
builder = build_configuration_builder(project) | ||
|
||
allow(project).to receive(:add_build_configuration) | ||
|
||
builder.generate_build_configurations(build_configurations) | ||
|
||
expect(project).to have_received(:add_build_configuration).with("Release-CI", :release) | ||
expect(project).to have_received(:add_build_configuration).with("Debug-CI", :debug) | ||
end | ||
end | ||
|
||
def build_configurations | ||
[ | ||
{ | ||
"name" => "Release-CI", | ||
"type" => "release", | ||
}, | ||
{ | ||
"name" => "Debug-CI", | ||
"type" => "debug", | ||
}, | ||
] | ||
end | ||
|
||
def build_configuration_builder(project) | ||
Liftoff::BuildConfigurationBuilder.new(project) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters