Class: Fastlane::Actions::FlutterBuildAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FlutterBuildAction
- Extended by:
- FlutterActionBase
- Defined in:
- lib/fastlane/plugin/flutter/actions/flutter_build_action.rb
Constant Summary collapse
- FASTLANE_PLATFORM_TO_BUILD =
{ ios: 'ios', android: 'apk', }
Class Method Summary collapse
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .process_deprecated_params(params, build_args) ⇒ Object
- .publish_gym_defaults(build_args) ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Methods included from FlutterActionBase
Class Method Details
.available_options ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/fastlane/plugin/flutter/actions/flutter_build_action.rb', line 124 def self. [ FastlaneCore::ConfigItem.new( key: :build, env_name: 'FL_FLUTTER_BUILD', description: 'Type of Flutter build (e.g. apk, appbundle, ios)', optional: true, type: String, ), FastlaneCore::ConfigItem.new( key: :debug, env_name: 'FL_FLUTTER_DEBUG', description: 'Build a Debug version of the app if true', optional: true, type: Boolean, default_value: false, ), FastlaneCore::ConfigItem.new( key: :codesign, env_name: 'FL_FLUTTER_CODESIGN', description: 'Set to false to skip iOS app signing. This may be ' \ 'useful e.g. on CI or when signed later by Fastlane "sigh"', optional: true, type: Boolean, ), FastlaneCore::ConfigItem.new( key: :build_number, env_name: 'FL_FLUTTER_BUILD_NUMBER', description: 'Override build number specified in pubspec.yaml', optional: true, type: Integer, ), FastlaneCore::ConfigItem.new( key: :build_name, env_name: 'FL_FLUTTER_BUILD_NAME', description: "Override build name specified in pubspec.yaml.\nNOTE: for App Store, build name must be in the format of at most 3\nintegeres separated by a dot (\".\").\n", optional: true, ), FastlaneCore::ConfigItem.new( key: :build_args, description: 'An array of extra arguments for "flutter build"', optional: true, type: Array, ), ] end |
.category ⇒ Object
116 117 118 |
# File 'lib/fastlane/plugin/flutter/actions/flutter_build_action.rb', line 116 def self.category :building end |
.description ⇒ Object
112 113 114 |
# File 'lib/fastlane/plugin/flutter/actions/flutter_build_action.rb', line 112 def self.description 'Run "flutter build" to build a Flutter application' end |
.process_deprecated_params(params, build_args) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/fastlane/plugin/flutter/actions/flutter_build_action.rb', line 94 def self.process_deprecated_params(params, build_args) unless params[:codesign].nil? UI.deprecated("flutter_build parameter \"codesign\" is deprecated. Use\n\nflutter_build(\nbuild_args: [\"--\#{params[:codesign] == false ? 'no-' : ''}codesign\"]\n)\n\nform instead.\n") if params[:codesign] == false build_args.push('--no-codesign') end end end |
.publish_gym_defaults(build_args) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/fastlane/plugin/flutter/actions/flutter_build_action.rb', line 77 def self.publish_gym_defaults(build_args) ENV['GYM_WORKSPACE'] ||= 'ios/Runner.xcworkspace' ENV['GYM_BUILD_PATH'] ||= 'build/ios' unless ENV.include?('GYM_SCHEME') # Do some parsing on args. Is there a less ugly way? build_args.each.with_index do |arg, index| if arg.start_with?('--flavor', '-flavor') if arg.include?('=') ENV['GYM_SCHEME'] = arg.split('=', 2).last else ENV['GYM_SCHEME'] = build_args[index + 1] end end end end end |
.return_value ⇒ Object
120 121 122 |
# File 'lib/fastlane/plugin/flutter/actions/flutter_build_action.rb', line 120 def self.return_value 'A path to the built file, if available' end |
.run(params) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fastlane/plugin/flutter/actions/flutter_build_action.rb', line 19 def self.run(params) # "flutter build" args list. build_args = [] if params[:build] build_args.push(params[:build]) else if fastlane_platform = (lane_context[SharedValues::PLATFORM_NAME] || lane_context[SharedValues::DEFAULT_PLATFORM]) build_args.push(FASTLANE_PLATFORM_TO_BUILD[fastlane_platform]) else UI.user_error!('flutter_build action "build" parameter is not ' \ 'specified and cannot be inferred from Fastlane context.') end end process_deprecated_params(params, build_args) if params[:debug] build_args.push('--debug') end if build_number = (params[:build_number] || lane_context[SharedValues::BUILD_NUMBER]) build_args.push('--build-number', build_number.to_s) end if build_name = (params[:build_name] || lane_context[SharedValues::VERSION_NUMBER]) build_args.push('--build-name', build_name.to_s) end build_args += params[:build_args] || [] Helper::FlutterHelper.flutter('build', *build_args) do |status, res| if status.success? if res =~ /^Built (.*?)(:? \([^)]*\))?\.$/ lane_context[SharedValues::FLUTTER_OUTPUT] = File.absolute_path($1) else UI.important('Cannot parse built file path from "flutter build"') end # gym (aka build_ios_app) action call may follow build; let's help # it identify the project, since Flutter project structure is # usually standard. publish_gym_defaults(build_args) else # Print stdout from "flutter build" because it may contain useful # details about failures, and it's normally not very verbose. UI.command_output(res) end # Tell upstream to NOT ignore error. false end lane_context[SharedValues::FLUTTER_OUTPUT] end |