Class: Fastlane::Actions::GodotExportAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::GodotExportAction
- Defined in:
- lib/fastlane/plugin/godot/actions/godot_export_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
70 71 72 |
# File 'lib/fastlane/plugin/godot/actions/godot_export_action.rb', line 70 def self. ['Mad Science Software'] end |
.available_options ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/fastlane/plugin/godot/actions/godot_export_action.rb', line 78 def self. [ FastlaneCore::ConfigItem.new(key: :preset, env_name: 'FL_GODOT_PRESET', description: 'Name of the export preset in export_presets.cfg', type: String), FastlaneCore::ConfigItem.new(key: :project_path, env_name: 'FL_GODOT_PROJECT_PATH', description: 'Directory containing project.godot', type: String, default_value: '.'), FastlaneCore::ConfigItem.new(key: :godot_binary, env_name: 'FL_GODOT_BINARY', description: 'Path to the Godot binary', type: String, default_value: 'godot'), FastlaneCore::ConfigItem.new(key: :output_path, env_name: 'FL_GODOT_OUTPUT_PATH', description: 'Where to write the exported artifact (defaults to the preset export_path), relative to the project', type: String, optional: true), FastlaneCore::ConfigItem.new(key: :debug, env_name: 'FL_GODOT_DEBUG', description: 'Export a debug build instead of a release build', type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :import_first, env_name: 'FL_GODOT_IMPORT_FIRST', description: 'Run a headless --import before exporting (a stale import cache aborts exports)', type: Boolean, default_value: true), FastlaneCore::ConfigItem.new(key: :verbose, env_name: 'FL_GODOT_VERBOSE', description: 'Pass --verbose to Godot', type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :install_android_build_template, env_name: 'FL_GODOT_INSTALL_ANDROID_BUILD_TEMPLATE', description: "Install the project's Android Gradle build template during export (needed for Android App Bundle presets)", type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :skip_version_check, env_name: 'FL_GODOT_SKIP_VERSION_CHECK', description: "Skip verifying the binary's version against the project's declared engine version", type: Boolean, default_value: false) ] end |
.description ⇒ Object
62 63 64 |
# File 'lib/fastlane/plugin/godot/actions/godot_export_action.rb', line 62 def self.description 'Export a Godot project headlessly using an export preset' end |
.is_supported?(platform) ⇒ Boolean
127 128 129 |
# File 'lib/fastlane/plugin/godot/actions/godot_export_action.rb', line 127 def self.is_supported?(platform) true end |
.output ⇒ Object
74 75 76 |
# File 'lib/fastlane/plugin/godot/actions/godot_export_action.rb', line 74 def self.output [['GODOT_EXPORT_OUTPUT', 'Absolute path to the exported artifact']] end |
.return_value ⇒ Object
66 67 68 |
# File 'lib/fastlane/plugin/godot/actions/godot_export_action.rb', line 66 def self.return_value 'Absolute path to the exported artifact (for iOS, the generated Xcode project)' end |
.run(params) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 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 |
# File 'lib/fastlane/plugin/godot/actions/godot_export_action.rb', line 8 def self.run(params) project_path = File.(params[:project_path]) preset_name = params[:preset] UI.user_error!("No project.godot in #{project_path}") unless File.exist?(File.join(project_path, 'project.godot')) godot = Helper::GodotHelper.discover_godot_binary(params[:godot_binary]) version = Helper::GodotHelper.godot_version(godot) UI.("Godot #{version}") Helper::GodotHelper.verify_binary_matches_project!(version, project_path) unless params[:skip_version_check] cfg_path = File.join(project_path, 'export_presets.cfg') preset = Helper::GodotHelper.find_preset(cfg_path, preset_name) Helper::GodotHelper.verify_templates!(version, preset[:platform]) output_path = params[:output_path] || preset[:export_path] UI.user_error!("Preset '#{preset_name}' has no export_path and no output_path was given") if output_path.nil? || output_path.empty? absolute_output = File.(output_path, project_path) FileUtils.mkdir_p(File.dirname(absolute_output)) if params[:import_first] UI.('Importing project resources (stale import caches abort exports)…') # The import step streams hundreds of per-file progress lines; keep # them out of the lane output unless asked (failures still raise # with full output attached). Actions.sh("#{godot.shellescape} --headless --path #{project_path.shellescape} --import", log: params[:verbose]) UI.('Import done') end export_flag = params[:debug] ? '--export-debug' : '--export-release' command = [ godot.shellescape, '--headless', '--path', project_path.shellescape ] # Gradle-based Android exports (AABs) need the build template installed # into the project; Godot only installs it during an export invocation. command << '--install-android-build-template' if params[:install_android_build_template] command += [export_flag, preset_name.shellescape, absolute_output.shellescape] command << '--verbose' if params[:verbose] UI.("Exporting preset '#{preset_name}' (#{preset[:platform]}) -> #{absolute_output}") # Per-file savepack progress stays hidden unless verbose; failures # still raise with the full output attached. Actions.sh(command.join(' '), log: params[:verbose]) # Godot has historically exited 0 on some export failures; trust the artifact, not the exit code. UI.user_error!("Export claimed success but produced nothing at #{absolute_output}") unless File.exist?(absolute_output) UI.success("Exported #{preset[:platform]} build: #{absolute_output}") Actions.lane_context[SharedValues::GODOT_EXPORT_OUTPUT] = absolute_output absolute_output end |