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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96e50a14af9081a9995f926e20603a15aeeebbdb167c3a7488488e074f9095b4
4
- data.tar.gz: 3f894f28a17b8addad168696daf246e408ed00ba6e2164f4a9c742a97b114ec2
3
+ metadata.gz: 7bff3d2d963ce751f8770a2e461b1765637ef1a4d7a274ff48b9de6be392f0e3
4
+ data.tar.gz: d57e0104dd2d54504d384681ad84d6f39a811c7e5e321e2eecad2421e9718a1f
5
5
  SHA512:
6
- metadata.gz: 69f08ae45b2538b88c47fe4c2b01bf78312b2fc952414a21e5a733c1da4d41e459f3b3a0db9e184c4b1c56217ff44d917864c2ff9a4d78586b1488c80926fdf8
7
- data.tar.gz: 1629f955e2b634eceff64074e821d3c93336e92d79b3d14ddc6681fdb4ea51ce08b7961a388122174b00ff8a8a63249588e960c7b0ab66032e32cc745964aedb
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' and 'new_version_code' and 'export_path'
97
- unity_export(build_target: "...", new_version: "2.3.4", new_version_code: "0", export_path: "path/Builds")
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.unity_project_path_relative_to_fastfile}ProjectSettings/ProjectSettings.asset' >> #{log_file} 2>&1")
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.unity_project_path_relative_to_fastfile}"
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
- def self.unity_project_path_relative_to_fastfile
12
- # project path relative if following hierarchy is given: "root/{unity-project}/fastlane-build-exporter/{platform}-export/."
13
- # p File.expand_path("../../")
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
- unity_project_path_relative_to_fastfile
65
+ unity_project_path
61
66
  end
62
67
 
63
68
  package_manifest_path = "#{relative_path}/Packages/manifest.json"
64
- package_manifest_json = File.read(package_manifest_path)
65
- return package_manifest_json
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
- unity_project_path_relative_to_fastfile
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)) == true
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
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module UnityExporter
3
- VERSION = "1.0.4"
3
+ VERSION = "1.1.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.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ar:met