@@ -27,6 +27,8 @@ public static void UnityBuild(this ICakeContext context, DirectoryPath projectPa
27
27
tool . Run ( context , projectPath , platform ) ;
28
28
}
29
29
30
+
31
+
30
32
/// <summary>
31
33
/// Executes Unity Editor via command-line interface.
32
34
/// </summary>
@@ -35,21 +37,183 @@ public static void UnityBuild(this ICakeContext context, DirectoryPath projectPa
35
37
/// <example>
36
38
/// <code>
37
39
/// var unityEditor = FindUnityEditor(2018, 3) ?? throw new Exception("Cannot find Unity Editor 2018.3.");
40
+ ///
38
41
/// UnityEditor(unityEditor.Path, new UnityEditorArguments
39
42
/// {
40
- /// BatchMode = true,
41
43
/// ProjectPath = "A:/UnityProject",
42
44
/// BuildWindowsPlayer = "A:/Build/game.exe",
43
45
/// LogFile = "A:/Build/unity.log",
44
- /// Quit = true,
45
46
/// });
46
47
/// </code>
47
48
/// </example>
48
49
[ CakeMethodAlias ]
49
50
[ CakeAliasCategory ( "Build" ) ]
50
- public static void UnityEditor ( this ICakeContext context , FilePath unityEditorPath , UnityEditorArguments arguments ) =>
51
+ public static void UnityEditor ( this ICakeContext context ,
52
+ FilePath unityEditorPath , UnityEditorArguments arguments ) =>
53
+ UnityEditor ( context , unityEditorPath , arguments , new UnityEditorSettings ( ) ) ;
54
+
55
+ /// <summary>
56
+ /// Executes Unity Editor via command-line interface.
57
+ /// </summary>
58
+ /// <param name="unityEditorPath">Path to Unity Editor executable.</param>
59
+ /// <param name="arguments">Unity Editor command-line arguments.</param>
60
+ /// <param name="settings">Settings which affect how Unity Editor should be executed.</param>
61
+ /// <example>
62
+ /// <code>
63
+ /// var unityEditor = FindUnityEditor(2018, 3) ?? throw new Exception("Cannot find Unity Editor 2018.3.");
64
+ ///
65
+ /// UnityEditor(
66
+ /// unityEditor.Path,
67
+ /// new UnityEditorArguments
68
+ /// {
69
+ /// ProjectPath = "A:/UnityProject",
70
+ /// BuildWindowsPlayer = "A:/Build/game.exe",
71
+ /// LogFile = "A:/Build/unity.log",
72
+ /// },
73
+ /// new UnityEditorSettings
74
+ /// {
75
+ /// RealTimeLog = true,
76
+ /// });
77
+ /// </code>
78
+ /// </example>
79
+ [ CakeMethodAlias ]
80
+ [ CakeAliasCategory ( "Build" ) ]
81
+ public static void UnityEditor ( this ICakeContext context ,
82
+ FilePath unityEditorPath , UnityEditorArguments arguments , UnityEditorSettings settings ) =>
83
+ new UnityEditor ( context . FileSystem , context . Environment , context . ProcessRunner , context . Tools , context . Log )
84
+ . Run ( unityEditorPath , arguments , settings ) ;
85
+
86
+ /// <summary>
87
+ /// Executes Unity Editor via command-line interface.
88
+ /// </summary>
89
+ /// <param name="unityEditor">Unity Editor descriptor provided by a FindUnityEditor method.</param>
90
+ /// <param name="arguments">Unity Editor command-line arguments.</param>
91
+ /// <param name="settings">Optional settings which affect how Unity Editor should be executed.</param>
92
+ /// <example>
93
+ /// <code>
94
+ /// UnityEditor(
95
+ /// FindUnityEditor(2018, 3) ?? throw new Exception("Cannot find Unity Editor 2018.3."),
96
+ /// new UnityEditorArguments
97
+ /// {
98
+ /// ProjectPath = "A:/UnityProject",
99
+ /// BuildWindowsPlayer = "A:/Build/game.exe",
100
+ /// LogFile = "A:/Build/unity.log",
101
+ /// },
102
+ /// new UnityEditorSettings
103
+ /// {
104
+ /// RealTimeLog = true,
105
+ /// });
106
+ /// </code>
107
+ /// </example>
108
+ [ CakeMethodAlias ]
109
+ [ CakeAliasCategory ( "Build" ) ]
110
+ public static void UnityEditor ( this ICakeContext context ,
111
+ UnityEditorDescriptor unityEditor , UnityEditorArguments arguments , UnityEditorSettings settings = null ) =>
112
+ new UnityEditor ( context . FileSystem , context . Environment , context . ProcessRunner , context . Tools , context . Log )
113
+ . Run ( unityEditor , arguments , settings ?? new UnityEditorSettings ( ) ) ;
114
+
115
+ /// <summary>
116
+ /// <para>Executes Unity Editor via command-line interface.</para>
117
+ /// <para>Determines Unity Editor location automatically by specified version.</para>
118
+ /// </summary>
119
+ /// <param name="versionYear">Year part of Unity version aka major version.</param>
120
+ /// <param name="versionStream">Stream part of Unity version aka minor version.</param>
121
+ /// <param name="arguments">Unity Editor command-line arguments.</param>
122
+ /// <param name="settings">Optional settings which affect how Unity Editor should be executed.</param>
123
+ /// <example>
124
+ /// <code>
125
+ /// UnityEditor(
126
+ /// 2018, 3,
127
+ /// new UnityEditorArguments
128
+ /// {
129
+ /// ProjectPath = "A:/UnityProject",
130
+ /// BuildWindowsPlayer = "A:/Build/game.exe",
131
+ /// LogFile = "A:/Build/unity.log",
132
+ /// },
133
+ /// new UnityEditorSettings
134
+ /// {
135
+ /// RealTimeLog = true,
136
+ /// });
137
+ /// </code>
138
+ /// </example>
139
+ [ CakeMethodAlias ]
140
+ [ CakeAliasCategory ( "Build" ) ]
141
+ public static void UnityEditor ( this ICakeContext context ,
142
+ int versionYear , int versionStream , UnityEditorArguments arguments , UnityEditorSettings settings = null ) =>
51
143
new UnityEditor ( context . FileSystem , context . Environment , context . ProcessRunner , context . Tools , context . Log )
52
- . Run ( unityEditorPath , arguments ) ;
144
+ . Run (
145
+ context . FindUnityEditor ( versionYear , versionStream )
146
+ ?? throw new Exception ( $ "Failed to locate Unity Editor { versionYear } .{ versionStream } . Try to specify it's path explicitly.") ,
147
+ arguments ,
148
+ settings ?? new UnityEditorSettings ( ) ) ;
149
+
150
+ /// <summary>
151
+ /// <para>Executes Unity Editor via command-line interface.</para>
152
+ /// <para>Determines Unity Editor location automatically by specified version.</para>
153
+ /// </summary>
154
+ /// <param name="versionYear">Year part of Unity version aka major version.</param>
155
+ /// <param name="arguments">Unity Editor command-line arguments.</param>
156
+ /// <param name="settings">Optional settings which affect how Unity Editor should be executed.</param>
157
+ /// <example>
158
+ /// <code>
159
+ /// UnityEditor(
160
+ /// 2018,
161
+ /// new UnityEditorArguments
162
+ /// {
163
+ /// ProjectPath = "A:/UnityProject",
164
+ /// BuildWindowsPlayer = "A:/Build/game.exe",
165
+ /// LogFile = "A:/Build/unity.log",
166
+ /// },
167
+ /// new UnityEditorSettings
168
+ /// {
169
+ /// RealTimeLog = true,
170
+ /// });
171
+ /// </code>
172
+ /// </example>
173
+ [ CakeMethodAlias ]
174
+ [ CakeAliasCategory ( "Build" ) ]
175
+ public static void UnityEditor ( this ICakeContext context ,
176
+ int versionYear , UnityEditorArguments arguments , UnityEditorSettings settings = null ) =>
177
+ new UnityEditor ( context . FileSystem , context . Environment , context . ProcessRunner , context . Tools , context . Log )
178
+ . Run (
179
+ context . FindUnityEditor ( versionYear )
180
+ ?? throw new Exception ( $ "Failed to locate Unity Editor { versionYear } . Try to specify it's path explicitly.") ,
181
+ arguments ,
182
+ settings ?? new UnityEditorSettings ( ) ) ;
183
+
184
+ /// <summary>
185
+ /// <para>Executes Unity Editor via command-line interface.</para>
186
+ /// <para>Determines location of latest available Unity Editor automatically.</para>
187
+ /// </summary>
188
+ /// <param name="arguments">Unity Editor command-line arguments.</param>
189
+ /// <param name="settings">Optional settings which affect how Unity Editor should be executed.</param>
190
+ /// <example>
191
+ /// <code>
192
+ /// UnityEditor(
193
+ /// new UnityEditorArguments
194
+ /// {
195
+ /// ProjectPath = "A:/UnityProject",
196
+ /// BuildWindowsPlayer = "A:/Build/game.exe",
197
+ /// LogFile = "A:/Build/unity.log",
198
+ /// },
199
+ /// new UnityEditorSettings
200
+ /// {
201
+ /// RealTimeLog = true,
202
+ /// });
203
+ /// </code>
204
+ /// </example>
205
+ [ CakeMethodAlias ]
206
+ [ CakeAliasCategory ( "Build" ) ]
207
+ public static void UnityEditor ( this ICakeContext context ,
208
+ UnityEditorArguments arguments , UnityEditorSettings settings = null ) =>
209
+ new UnityEditor ( context . FileSystem , context . Environment , context . ProcessRunner , context . Tools , context . Log )
210
+ . Run (
211
+ context . FindUnityEditor ( )
212
+ ?? throw new Exception ( "Failed to locate Unity Editor. Try to specify it's path explicitly." ) ,
213
+ arguments ,
214
+ settings ?? new UnityEditorSettings ( ) ) ;
215
+
216
+
53
217
54
218
/// <summary>
55
219
/// Locates installed Unity Editor with latest version.
0 commit comments