fastlane-plugin-unity_exporter 1.2.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f871c4202b1c52b9d5d719312834f66f9374a6a16319925a6e39d5d3f87f258
4
- data.tar.gz: 6c74a627ee70148c1b27d52421f5bf275d5ce2405c60588db6abeee04dcded2e
3
+ metadata.gz: cad649f6ebbc0102d8e2d8295a76350b09b4fbd9873d2581ac65971b6a156ac5
4
+ data.tar.gz: e043af9dd9db9a8372866e822487bb47d82363937bd9d6d9d263798ca50c090e
5
5
  SHA512:
6
- metadata.gz: e62253ae48ffaa41ee6a62ce09e91b0d10dcc610e05216ddec73414ea2f1d295263c95117289fd9ca33c0622036f98e9e7d44cddb3fedf360e4245378a569aa9
7
- data.tar.gz: 3ce7dc870812337f11e80c9de94910697b47278dc98b31d51dbffe7b5006516bbb7b07342693269ee624d818000a931c4d31c9e4fecb4d4a9e63d6ae8e916482
6
+ metadata.gz: de4f1d457398aa20fd87cb4dabe052cad7819a5c12e54d968f3b7b79c18235f93d2f1bbf5e2e211282867c2fbe38106770bd387d8ac70f2a26c38601e3490880
7
+ data.tar.gz: 2f510f3242214de7440bea574cfc367a6bfbeaec6fd3ebebf0db5c43eee185526517f0e473a67204ece53015e84ef9219f562ac5bf8c00917db1f105fd3c9ba7
data/README.md CHANGED
@@ -115,6 +115,12 @@ unity_export(build_target: "...", new_version: "3.4.5", new_version_code: "0")
115
115
 
116
116
  # after the export is finished, we commit the version bump
117
117
  unity_commit_version_bump
118
+
119
+ # another invocation example that specifies a project path
120
+ # the expected default path is in accordance with the "getting started" section of this readme
121
+ # if a custom path to the Unity project is required, it's specified this way
122
+ # note that the starting point for relative paths is the directory that contains the 'fastlane' folder
123
+ unity_commit_version_bump(project_path: "path/some-example-unity-projects-directory")
118
124
  ```
119
125
 
120
126
  ### Using `unity_get_version_number`
@@ -126,6 +132,12 @@ unity_export(...)
126
132
  # afterwards you can get the version number like so
127
133
  # note that an error code will be returned if something fails
128
134
  version_number = unity_get_version_number
135
+
136
+ # another invocation example that specifies a project path
137
+ # the expected default path is in accordance with the "getting started" section of this readme
138
+ # if a custom path to the Unity project is required, it's specified this way
139
+ # note that the starting point for relative paths is the directory that contains the 'fastlane' folder
140
+ version_number = unity_get_version_number(project_path: "path/some-example-unity-projects-directory")
129
141
  ```
130
142
 
131
143
  ### Using `unity_get_build_number`
@@ -137,6 +149,12 @@ unity_export(...)
137
149
  # afterwards you can get the build number like so
138
150
  # note that an error code will be returned if something fails
139
151
  build_number = unity_get_build_number
152
+
153
+ # another invocation example that specifies a project path
154
+ # the expected default path is in accordance with the "getting started" section of this readme
155
+ # if a custom path to the Unity project is required, it's specified this way
156
+ # note that the starting point for relative paths is the directory that contains the 'fastlane' folder
157
+ build_number = unity_get_build_number(project_path: "path/some-example-unity-projects-directory")
140
158
  ```
141
159
 
142
160
 
@@ -1,4 +1,5 @@
1
1
  require 'fastlane/action'
2
+ require 'fastlane_core/configuration/config_item'
2
3
  require_relative '../helper/unity_editor_helper'
3
4
  require_relative '../helper/generic_helper'
4
5
 
@@ -6,6 +7,10 @@ module Fastlane
6
7
  module Actions
7
8
  class UnityCommitVersionBumpAction < Action
8
9
  def self.run(params)
10
+ if params[:project_path]
11
+ Helper::UnityEditorHelper.instance_variable_set(:@project_path, params[:project_path])
12
+ end
13
+
9
14
  # TODO: improve the commit command: currently it simply commits the ProjectSettings file
10
15
  # what if there are other changes in the file and you don't want these changes to be part of the commit
11
16
 
@@ -34,6 +39,14 @@ module Fastlane
34
39
  end
35
40
 
36
41
  def self.available_options
42
+ [
43
+ FastlaneCore::ConfigItem.new(key: :project_path,
44
+ env_name: "FL_UNITY_PROJECT_PATH",
45
+ description: "The path to the Unity project. The starting point for relative paths is the directory that contains the 'fastlane' folder",
46
+ optional: true,
47
+ type: String,
48
+ conflicting_options: [:arguments])
49
+ ]
37
50
  end
38
51
 
39
52
  def self.is_supported?(platform)
@@ -26,7 +26,7 @@ module Fastlane
26
26
  headless_args << " -batchmode -nographics -quit" # some arguments that are required when running Unity in headless-mode
27
27
  headless_args << " -accept-apiupdate -releaseCodeOptimization"
28
28
  headless_args << " -projectPath #{Helper::UnityEditorHelper.unity_project_path}"
29
- headless_args << " -logFile unity-export-logs/#{DateTime.now.strftime('%Y-%m-%d_%H-%M-%S-%L')}_#{params[:build_target]}_build.log" # logging; not specifying a path will print the log to the console
29
+ headless_args << " -logFile #{Helper::UnityEditorHelper.unity_project_path}/BuildExporter/#{DateTime.now.strftime('%Y-%m-%d_%H-%M-%S-%L')}_#{params[:build_target]}_build.log" # logging; not specifying a path will print the log to the console
30
30
 
31
31
  # following are custom arguments defined in 'UnityExporter.BuildUtility'
32
32
  # this script is part of the 'fastlane-plugin-unity-exporter-package'
@@ -1,12 +1,17 @@
1
1
  require 'fastlane/action'
2
+ require 'fastlane_core/configuration/config_item'
2
3
  require_relative '../helper/unity_editor_helper'
3
- require_relative '../helper/generic_helper'
4
+ require_relative '../helper/build_exporter_helper'
4
5
 
5
6
  module Fastlane
6
7
  module Actions
7
8
  class UnityGetBuildNumberAction < Action
8
9
  def self.run(params)
9
- build_number = Helper::GenericHelper.build_exporter_build_number
10
+ if params[:project_path]
11
+ Helper::UnityEditorHelper.instance_variable_set(:@project_path, params[:project_path])
12
+ end
13
+
14
+ build_number = Helper::BuildExporterHelper.build_number
10
15
  if build_number == ""
11
16
  return "unity_exporter_error_occurred"
12
17
  end
@@ -31,6 +36,14 @@ module Fastlane
31
36
  end
32
37
 
33
38
  def self.available_options
39
+ [
40
+ FastlaneCore::ConfigItem.new(key: :project_path,
41
+ env_name: "FL_UNITY_PROJECT_PATH",
42
+ description: "The path to the Unity project. The starting point for relative paths is the directory that contains the 'fastlane' folder",
43
+ optional: true,
44
+ type: String,
45
+ conflicting_options: [:arguments])
46
+ ]
34
47
  end
35
48
 
36
49
  def self.is_supported?(platform)
@@ -1,12 +1,17 @@
1
1
  require 'fastlane/action'
2
+ require 'fastlane_core/configuration/config_item'
2
3
  require_relative '../helper/unity_editor_helper'
3
- require_relative '../helper/generic_helper'
4
+ require_relative '../helper/build_exporter_helper'
4
5
 
5
6
  module Fastlane
6
7
  module Actions
7
8
  class UnityGetVersionNumberAction < Action
8
9
  def self.run(params)
9
- version_number = Helper::GenericHelper.build_exporter_version_number
10
+ if params[:project_path]
11
+ Helper::UnityEditorHelper.instance_variable_set(:@project_path, params[:project_path])
12
+ end
13
+
14
+ version_number = Helper::BuildExporterHelper.version_number
10
15
  if version_number == ""
11
16
  return "unity_exporter_error_occurred"
12
17
  end
@@ -31,6 +36,14 @@ module Fastlane
31
36
  end
32
37
 
33
38
  def self.available_options
39
+ [
40
+ FastlaneCore::ConfigItem.new(key: :project_path,
41
+ env_name: "FL_UNITY_PROJECT_PATH",
42
+ description: "The path to the Unity project. The starting point for relative paths is the directory that contains the 'fastlane' folder",
43
+ optional: true,
44
+ type: String,
45
+ conflicting_options: [:arguments])
46
+ ]
34
47
  end
35
48
 
36
49
  def self.is_supported?(platform)
@@ -0,0 +1,44 @@
1
+ require 'fastlane_core/ui/ui'
2
+ require 'shellwords'
3
+ require_relative './unity_editor_helper'
4
+
5
+ module Fastlane
6
+ UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
7
+
8
+ module Helper
9
+ # a helper class specific to the Unity-Build-Exporter package: https://github.com/ar-met/unity-build-exporter
10
+ class BuildExporterHelper
11
+ def self.versions_file_content
12
+ # this is created and updated whenever you create a build via the build exporter
13
+ build_exporter_versions_file = "#{Helper::UnityEditorHelper.unity_project_path}/BuildExporter/latest-build-version.txt"
14
+
15
+ if File.file?(build_exporter_versions_file)
16
+ return File.readlines(build_exporter_versions_file, chomp: true)
17
+ else
18
+ UI.user_error!("Versions file does not exist yet. You must execute the Unity export action beforehand.")
19
+ return []
20
+ end
21
+ end
22
+
23
+ def self.version_number
24
+ versions = versions_file_content
25
+
26
+ if versions.count > 0
27
+ return versions[0]
28
+ else
29
+ return ""
30
+ end
31
+ end
32
+
33
+ def self.build_number
34
+ versions = versions_file_content
35
+
36
+ if versions.count > 0
37
+ return versions[1]
38
+ else
39
+ return ""
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,46 +1,13 @@
1
1
  require 'fastlane_core/ui/ui'
2
2
  require 'shellwords'
3
- require_relative './unity_editor_helper'
4
3
 
5
4
  module Fastlane
6
- UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+ UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
7
6
 
8
7
  module Helper
9
8
  class GenericHelper
10
9
  @git_log_path = "fastlane-unity-exporter/logs/#{DateTime.now.strftime('%Y-%m-%d_%H-%M-%S-%L')}_git.log"
11
10
 
12
- def self.build_exporter_versions
13
- # this is created and updated whenever you create a build via the build exporter
14
- build_exporter_versions_file = "#{Helper::UnityEditorHelper.unity_project_path}/BuildExporter/latest-build-version.txt"
15
-
16
- if File.file?(build_exporter_versions_file)
17
- return File.readlines(build_exporter_versions_file, chomp: true)
18
- else
19
- UI.user_error!("Versions file does not exist yet. You must execute the Unity export action beforehand.")
20
- return []
21
- end
22
- end
23
-
24
- def self.build_exporter_version_number
25
- versions = build_exporter_versions
26
-
27
- if versions.count > 0
28
- return versions[0]
29
- else
30
- return ""
31
- end
32
- end
33
-
34
- def self.build_exporter_build_number
35
- versions = build_exporter_versions
36
-
37
- if versions.count > 0
38
- return versions[1]
39
- else
40
- return ""
41
- end
42
- end
43
-
44
11
  def self.shellify(path)
45
12
  if FastlaneCore::Helper.is_mac?
46
13
  return Shellwords.escape(path)
@@ -4,19 +4,25 @@ require_relative './unity_hub_helper'
4
4
  require_relative './generic_helper'
5
5
 
6
6
  module Fastlane
7
- UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
7
+ UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
8
8
 
9
9
  module Helper
10
10
  class UnityEditorHelper
11
11
  # project path relative if following hierarchy is given: "root/{unity-project}/fastlane-build-exporter/{platform}-export/."
12
- # p File.expand_path("../../")
13
- @project_path_default = "../../"
12
+ # p File.expand_path("../..")
13
+ @project_path_default = "../.."
14
14
  @project_path = ""
15
15
 
16
16
  def self.unity_project_path
17
- return @project_path if @project_path != ""
17
+ project_path = @project_path == "" ? @project_path_default : @project_path
18
18
 
19
- return "../../"
19
+ # we verify the path to the Unity project by looking for the 'manifest.json' file
20
+ package_manifest_path = "#{project_path}/Packages/manifest.json"
21
+ unless File.file?(package_manifest_path)
22
+ UI.user_error!("Cannot find 'manifest.json' at '#{package_manifest_path}'. Make sure that the Unity project path is properly set.")
23
+ end
24
+
25
+ return project_path
20
26
  end
21
27
 
22
28
  def self.unity_editor_path
@@ -67,14 +73,7 @@ module Fastlane
67
73
  end
68
74
 
69
75
  package_manifest_path = "#{relative_path}/Packages/manifest.json"
70
-
71
- # we verify the path to the Unity project by looking for the 'manifest.json' file
72
- if File.file?(package_manifest_path)
73
- return File.read(package_manifest_path)
74
- else
75
- UI.user_error!("Cannot find 'manifest.json' at '#{package_manifest_path}'. Make sure that the Unity project path is properly set.")
76
- return ""
77
- end
76
+ return File.read(package_manifest_path)
78
77
  end
79
78
 
80
79
  def self.load_unity_project_version
@@ -2,7 +2,7 @@ require 'fastlane_core/ui/ui'
2
2
  require_relative './generic_helper'
3
3
 
4
4
  module Fastlane
5
- UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+ UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
6
6
 
7
7
  module Helper
8
8
  class UnityHubHelper
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module UnityExporter
3
- VERSION = "1.2.0"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-unity_exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ar:met
@@ -163,6 +163,7 @@ files:
163
163
  - lib/fastlane/plugin/unity_exporter/actions/unity_export.rb
164
164
  - lib/fastlane/plugin/unity_exporter/actions/unity_get_build_number.rb
165
165
  - lib/fastlane/plugin/unity_exporter/actions/unity_get_version_number.rb
166
+ - lib/fastlane/plugin/unity_exporter/helper/build_exporter_helper.rb
166
167
  - lib/fastlane/plugin/unity_exporter/helper/generic_helper.rb
167
168
  - lib/fastlane/plugin/unity_exporter/helper/unity_editor_helper.rb
168
169
  - lib/fastlane/plugin/unity_exporter/helper/unity_hub_helper.rb