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

Add configuration and project parameters for ionic #51

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ Which will produce:
| **browserify** | Specifies whether to browserify build or not | CORDOVA_BROWSERIFY | *false* |
| **cordova_prepare** | Specifies whether to run `ionic cordova prepare` before building | CORDOVA_PREPARE | *true* |
| **min_sdk_version** | Overrides the value of minSdkVersion set in `AndroidManifest.xml` | CORDOVA_ANDROID_MIN_SDK_VERSION | '' |
| **cordova_no_fetch** | Specifies whether to run `ionic cordova platform add` with `--nofetch` parameter | CORDOVA_NO_FETCH | *false* |
| **cordova_no_fetch** | Specifies whether to run `ionic cordova platform add` with `--nofetch` parameter | CORDOVA_NO_FETCH | *false* |
| **build_flag** | An array of Xcode buildFlag. Will be appended on compile command. | CORDOVA_IOS_BUILD_FLAG | [] |
| **project** | Call `ionic cordova compile` with `--project=<Project>` to specify project in multi-projects monorepo, the project is looked up by key in the projects object *(Since Ionic CLI 4.3.0+)* | CORDOVA_PROJECT | |
| **configuration** | Call `ionic cordova compile` with `--configuration=<Configuration>` to specify the configuration to use (for instance to manage environment in angular) *(Since Ionic CLI 4.10.2+)* | CORDOVA_CONFIGURATION | |
| **cordova_build_config_file** | Call `ionic cordova compile` with `--buildConfig=<ConfigFile>` to specify build config file path | CORDOVA_BUILD_CONFIG_FILE | |


Expand Down
34 changes: 31 additions & 3 deletions lib/fastlane/plugin/ionic/actions/ionic_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,17 @@ def self.get_ios_args(params)
def self.check_platform(params)
platform = params[:platform]
if platform && !File.directory?("./platforms/#{platform}")
cmd = "ionic cordova platform add #{platform} --no-interactive"

if params[:cordova_no_fetch]
sh "ionic cordova platform add #{platform} --no-interactive --nofetch"
else
sh "ionic cordova platform add #{platform} --no-interactive"
cmd << " --nofetch"
end

if !params[:project].to_s.empty?
cmd << " --project #{params[:project]}"
end

sh cmd
end
end

Expand All @@ -105,6 +111,14 @@ def self.build(params)
args << "--buildConfig=#{Shellwords.escape(params[:cordova_build_config_file])}"
end

if !params[:project].to_s.empty?
args << "--project #{params[:project]}"
end

if !params[:configuration].to_s.empty?
args << "--configuration=#{params[:configuration]}"
end

android_args = self.get_android_args(params) if params[:platform].to_s == 'android'
ios_args = self.get_ios_args(params) if params[:platform].to_s == 'ios'

Expand Down Expand Up @@ -270,6 +284,20 @@ def self.available_options
default_value: false,
is_string: false
),
FastlaneCore::ConfigItem.new(
key: :project,
env_name: "CORDOVA_PROJECT",
description: "Specifies project in multi-projects monorepo, the project is looked up by key in the projects object",
default_value: '',
is_string: true
),
FastlaneCore::ConfigItem.new(
key: :configuration,
env_name: "CORDOVA_CONFIGURATION",
description: "Specifies the configuration to use (for instance to manage environment in angular)",
default_value: '',
is_string: true
),
FastlaneCore::ConfigItem.new(
key: :cordova_prepare,
env_name: "CORDOVA_PREPARE",
Expand Down
2 changes: 1 addition & 1 deletion lib/fastlane/plugin/ionic/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Fastlane
module Ionic
VERSION = "0.1.0"
VERSION = "0.1.1"
end
end