fastlane-plugin-unity_exporter 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/lib/fastlane/plugin/unity_exporter/actions/unity_commit_version_bump.rb +1 -1
- data/lib/fastlane/plugin/unity_exporter/actions/unity_export.rb +13 -2
- data/lib/fastlane/plugin/unity_exporter/helper/unity_editor_helper.rb +18 -7
- data/lib/fastlane/plugin/unity_exporter/helper/unity_hub_helper.rb +1 -1
- data/lib/fastlane/plugin/unity_exporter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bff3d2d963ce751f8770a2e461b1765637ef1a4d7a274ff48b9de6be392f0e3
|
4
|
+
data.tar.gz: d57e0104dd2d54504d384681ad84d6f39a811c7e5e321e2eecad2421e9718a1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f02ef24f177fd4885bf28b2d6c1470ced2ec9ef45c00c9105001a1962053f3a67403991a9e029e85d53064dba5ae5e091e7731098945bd14a008b3c8f3e0300
|
7
|
+
data.tar.gz: 31b2a74cf72c8c38a4c9272984ac9104600b063982eebaf66b40a409ab46a8c257560f6176d19b7b9fae97eea76a2dfa74bb9c7cf016fcd1e7af6533cc5adea3
|
data/README.md
CHANGED
@@ -88,13 +88,21 @@ unity_export(build_target: "...", new_version_code: "42")
|
|
88
88
|
# increments the existing version code (Android) and build number (iOS)
|
89
89
|
unity_export(build_target: "...", new_version_code: "increment")
|
90
90
|
|
91
|
+
# the expected default path is in accordance with the "getting started" section of this readme
|
92
|
+
# if a custom path to the Unity project is required, it's specified this way
|
93
|
+
# note that the starting point for relative paths is the directory that contains the 'fastlane' folder
|
94
|
+
unity_export(build_target: "...", project_path: "path/some-example-unity-projects-directory")
|
95
|
+
|
91
96
|
# exports the Unity project to the specified path
|
92
97
|
# if no export path is specified, a default path will be used
|
93
98
|
# note that the starting point for relative paths is the root of the Unity project
|
94
99
|
unity_export(build_target: "...", export_path: "path/some-example-builds-directory")
|
95
100
|
|
96
|
-
# combined usage of 'new_version'
|
97
|
-
unity_export(
|
101
|
+
# combined usage of 'new_version', 'new_version_code', 'project_path' and 'export_path'
|
102
|
+
unity_export(
|
103
|
+
build_target: "...",
|
104
|
+
new_version: "2.3.4", new_version_code: "0",
|
105
|
+
project_path: "path/Unity-project", export_path: "path/Builds")
|
98
106
|
```
|
99
107
|
|
100
108
|
### Using `unity_commit_version_bump`
|
@@ -12,7 +12,7 @@ module Fastlane
|
|
12
12
|
|
13
13
|
# Thank you: https://linuxize.com/post/bash-redirect-stderr-stdout/#redirecting-stderr-to-stdout
|
14
14
|
sh("echo 'UnityCommitVersionBumpAction: created file' > #{log_file} 2>&1")
|
15
|
-
sh("git add '#{Helper::UnityEditorHelper.
|
15
|
+
sh("git add '#{Helper::UnityEditorHelper.unity_project_path}ProjectSettings/ProjectSettings.asset' >> #{log_file} 2>&1")
|
16
16
|
sh("git commit -m 'Version Bump' >> #{log_file} 2>&1")
|
17
17
|
end
|
18
18
|
|
@@ -17,11 +17,15 @@ module Fastlane
|
|
17
17
|
end
|
18
18
|
|
19
19
|
elsif params[:build_target]
|
20
|
+
if params[:project_path]
|
21
|
+
Helper::UnityEditorHelper.class_variable_set(:@@projectPath, params[:project_path])
|
22
|
+
end
|
23
|
+
|
20
24
|
# following are arguments as defined in the docs: https://docs.unity3d.com/Manual/CommandLineArguments.html
|
21
25
|
headless_args = "-buildTarget #{params[:build_target]}"
|
22
26
|
headless_args << " -batchmode -nographics -quit" # some arguments that are required when running Unity in headless-mode
|
23
27
|
headless_args << " -accept-apiupdate -releaseCodeOptimization"
|
24
|
-
headless_args << " -projectPath #{Helper::UnityEditorHelper.
|
28
|
+
headless_args << " -projectPath #{Helper::UnityEditorHelper.unity_project_path}"
|
25
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
|
26
30
|
|
27
31
|
# following are custom arguments defined in 'UnityExporter.BuildUtility'
|
@@ -67,7 +71,7 @@ module Fastlane
|
|
67
71
|
return
|
68
72
|
end
|
69
73
|
|
70
|
-
UI.message("Open 'logFile', if you want to know whats going on with your build.")
|
74
|
+
UI.message("Open 'logFile', if you want to know whats going on with your build. Look for its path in the invocation of the next line.")
|
71
75
|
invocation = unity_path.to_s
|
72
76
|
invocation << " #{params[:arguments]}"
|
73
77
|
sh(invocation) # 'sh' will print what's passed to it
|
@@ -166,6 +170,13 @@ module Fastlane
|
|
166
170
|
end
|
167
171
|
end),
|
168
172
|
|
173
|
+
FastlaneCore::ConfigItem.new(key: :project_path,
|
174
|
+
env_name: "FL_UNITY_PROJECT_PATH",
|
175
|
+
description: "The path to the Unity project. The starting point for relative paths is the directory that contains the 'fastlane' folder",
|
176
|
+
optional: true,
|
177
|
+
type: String,
|
178
|
+
conflicting_options: [:arguments]),
|
179
|
+
|
169
180
|
FastlaneCore::ConfigItem.new(key: :export_path,
|
170
181
|
env_name: "FL_UNITY_EXPORT_PATH",
|
171
182
|
description: "The path to the exported Unity project. The starting point for relative paths is the root of the Unity project",
|
@@ -8,9 +8,13 @@ module Fastlane
|
|
8
8
|
|
9
9
|
module Helper
|
10
10
|
class UnityEditorHelper
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
# project path relative if following hierarchy is given: "root/{unity-project}/fastlane-build-exporter/{platform}-export/."
|
12
|
+
# p File.expand_path("../../")
|
13
|
+
@@projectPathDefault = "../../"
|
14
|
+
@@projectPath = ""
|
15
|
+
|
16
|
+
def self.unity_project_path
|
17
|
+
return @@projectPath if @@projectPath != ""
|
14
18
|
return "../../"
|
15
19
|
end
|
16
20
|
|
@@ -46,6 +50,7 @@ module Fastlane
|
|
46
50
|
# TODO Unity currently does not support commandline arguments for the Package Manager
|
47
51
|
exporter_package_namespace = "io.armet.unity.buildexporter"
|
48
52
|
included = load_unity_project_package_manifest.include?(exporter_package_namespace)
|
53
|
+
# UI.message("exporter package part of Unity project: '#{included}'")
|
49
54
|
unless included
|
50
55
|
UI.user_error!("Package 'io.armet.unity.exporter' must be added to the Unity project.")
|
51
56
|
end
|
@@ -57,19 +62,25 @@ module Fastlane
|
|
57
62
|
relative_path = if FastlaneCore::Helper.is_test?
|
58
63
|
"/tmp/fastlane/tests/fixtures/unity_project"
|
59
64
|
else
|
60
|
-
|
65
|
+
unity_project_path
|
61
66
|
end
|
62
67
|
|
63
68
|
package_manifest_path = "#{relative_path}/Packages/manifest.json"
|
64
|
-
|
65
|
-
|
69
|
+
|
70
|
+
# we verify the path to the Unity project by looking for the 'manifest.json' file
|
71
|
+
if File.file?(package_manifest_path)
|
72
|
+
return File.read(package_manifest_path)
|
73
|
+
else
|
74
|
+
UI.user_error!("Cannot find 'manifest.json' at '#{package_manifest_path}'. Make sure that the Unity project path is properly set.")
|
75
|
+
return ""
|
76
|
+
end
|
66
77
|
end
|
67
78
|
|
68
79
|
def self.load_unity_project_version
|
69
80
|
relative_path = if FastlaneCore::Helper.is_test?
|
70
81
|
"/tmp/fastlane/tests/fixtures/unity_project"
|
71
82
|
else
|
72
|
-
|
83
|
+
unity_project_path
|
73
84
|
end
|
74
85
|
|
75
86
|
project_version_txt_path = "#{relative_path}/ProjectSettings/ProjectVersion.txt"
|
@@ -28,7 +28,7 @@ module Fastlane
|
|
28
28
|
|
29
29
|
def self.verify_default_path
|
30
30
|
# verifies that the Unity Hub exists at the default path
|
31
|
-
exists = File.file?(Helper::UnityHubHelper.unity_hub_path(false))
|
31
|
+
exists = File.file?(Helper::UnityHubHelper.unity_hub_path(false))
|
32
32
|
unless exists
|
33
33
|
UI.error("Unity Hub does not exist at path '#{Helper::UnityHubHelper.unity_hub_path(false)}'")
|
34
34
|
end
|