Class: Fastlane::Actions::Unity3dAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::Unity3dAction
- Defined in:
- lib/fastlane/plugin/unity3d/actions/unity3d_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
87 88 89 |
# File 'lib/fastlane/plugin/unity3d/actions/unity3d_action.rb', line 87 def self. ["fuzhongqing"] end |
.available_options ⇒ Object
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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/fastlane/plugin/unity3d/actions/unity3d_action.rb', line 100 def self. [ FastlaneCore::ConfigItem.new(key: :executable, env_name: "FL_UNITY_EXECUTABLE", description: "Path for Unity executable", optional: true, default_value: Helper::Unity3dHelper.default_exe_path), FastlaneCore::ConfigItem.new(key: :project_path, env_name: "FL_UNITY_PROJECT_PATH", description: "Path for Unity project", optional: true, default_value: "#{Dir.pwd}"), FastlaneCore::ConfigItem.new(key: :execute_method, env_name: "FL_UNITY_EXECUTE_METHOD", description: "Method to execute", optional: true, default_value: nil), FastlaneCore::ConfigItem.new(key: :build_type, env_name: "FL_UNITY_BUILD_TYPE", description: "`Debug` or `Release`", optional: true, default_value: "Release"), FastlaneCore::ConfigItem.new(key: :nographics, env_name: "FL_UNITY_NOGRAPHICS", description: "Initialize graphics device or not", optional: true, is_string: false, default_value: true), FastlaneCore::ConfigItem.new(key: :logfile, env_name: "FL_UNITY_LOGFILE", description: "log file", optional: true, is_string: true, default_value: ""), FastlaneCore::ConfigItem.new(key: :skip_building, env_name: "FL_UNITY_SKIP_BUILDING", description: "Need skip building", optional: true, is_string: false, default_value: false), ] end |
.category ⇒ Object
157 158 159 |
# File 'lib/fastlane/plugin/unity3d/actions/unity3d_action.rb', line 157 def self.category :building end |
.description ⇒ Object
83 84 85 |
# File 'lib/fastlane/plugin/unity3d/actions/unity3d_action.rb', line 83 def self.description "fastlane plugin for unity3d engine" end |
.details ⇒ Object
95 96 97 98 |
# File 'lib/fastlane/plugin/unity3d/actions/unity3d_action.rb', line 95 def self.details # Optional: "fastlane for unity3d engine" end |
.is_supported?(platform) ⇒ Boolean
149 150 151 152 153 154 155 |
# File 'lib/fastlane/plugin/unity3d/actions/unity3d_action.rb', line 149 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # # [:ios, :mac, :android].include?(platform) true end |
.return_value ⇒ Object
91 92 93 |
# File 'lib/fastlane/plugin/unity3d/actions/unity3d_action.rb', line 91 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
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 76 77 |
# File 'lib/fastlane/plugin/unity3d/actions/unity3d_action.rb', line 20 def self.run(params) build_cmd = "#{params[:executable]}" build_cmd << " -projectPath #{params[:project_path]}" build_cmd << " -batchmode" build_cmd << " -quit" build_cmd << " -logfile #{params[:logfile]}" build_cmd << " -nographics" if params[:nographics] build_cmd << " -executeMethod #{params[:execute_method]}" if params[:execute_method] UI. "\n#{ Terminal::Table.new( title: "Unity".green, headings: ["Option", "Value"], rows: params.values )}\n" UI. "Start running" sh build_cmd unless params[:skip_building] if File.exist?('.build_summary.json') then summary = Helper::BuildSummary.new(JSON.parse(File.read('.build_summary.json'))) UI. "\n#{ Terminal::Table.new( title: "build summary".green, headings: ["Key", "Value"], rows: summary.kv )}\n" UI.error "build faild, check logfile" unless summary.success? Actions.lane_context[SharedValues::UNITY3D_BUILD_STARTED_AT] = summary.kv['buildStartedAt'] Actions.lane_context[SharedValues::UNITY3D_PLATFORM] = summary.kv['platform'] Actions.lane_context[SharedValues::UNITY3D_OPTIONS] = summary.kv['options'] Actions.lane_context[SharedValues::UNITY3D_OUTPUT_PATH] = summary.kv['outputPath'] Actions.lane_context[SharedValues::UNITY3D_TOTAL_SIZE] = summary.kv['totalSize'] Actions.lane_context[SharedValues::UNITY3D_TOTAL_TIME] = summary.kv['totalTime'] Actions.lane_context[SharedValues::UNITY3D_BUILD_ENDED_AT] = summary.kv['buildEndedAt'] Actions.lane_context[SharedValues::UNITY3D_TOTAL_ERRORS] = summary.kv['totalErrors'] Actions.lane_context[SharedValues::UNITY3D_TOTAL_TOTAL_WARNINGS] = summary.kv['totalWarnings'] if summary.is_android? then build_script_file = Dir[File.join(summary.build_path, '*', 'build.gradle')].find { |path| File.exist?(path) } if build_script_file then # if export mode sh "gradle -p \'#{File.dirname(build_script_file)}\' wrapper" ENV["FL_GRADLE_PROJECT_DIR"] = File.dirname(build_script_file) end end else UI. "file `build_summary.json` not found" end end |