Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit dd61c08

Browse files
author
Sean Parker
authored
Prevent worker builds with compiler errors in Unity Editor (#1425)
* Add CHANGELOG entry * Disable MenuBuild with editor compile errors * Fix codegen for Unity worker menu build * Generate one validation function for menu build
1 parent e935704 commit dd61c08

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
- Added support for multiple annotations in Code Writer API. [#1427](https://github.com/spatialos/gdk-for-unity/pull/1427)
8+
- Prevent building workers with Unity Editor compile errors. [#1425](https://github.com/spatialos/gdk-for-unity/pull/1425)
89

910
## `0.3.8` - 2020-07-20
1011

workers/unity/Packages/io.improbable.gdk.buildsystem/.codegen/Source/Generators/BuildSystem/UnityWorkerMenuGenerator.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public static CodeWriter Generate(List<string> workerTypes)
3434
return workerTypes.Select(workerType => $@"""{workerType}""");
3535
});
3636
37+
var allMenuOptionValidators = buildWorkerMenu.Annotate($@"MenuItem(EditorConfig.ParentMenu + ""/"" + LocalMenu + ""/All workers"", true, EditorConfig.MenuOffset + {workerTypes.Count})")
38+
.Annotate($@"MenuItem(EditorConfig.ParentMenu + ""/"" + CloudMenu + ""/All workers"", true, EditorConfig.MenuOffset + {workerTypes.Count})");
39+
3740
for (var i = 0; i < workerTypes.Count; i++)
3841
{
3942
var workerType = workerTypes[i];
@@ -50,8 +53,16 @@ public static CodeWriter Generate(List<string> workerTypes)
5053
{
5154
$@"MenuBuildCloud(new[] {{ {workerTypeString} }});"
5255
});
56+
57+
allMenuOptionValidators.Annotate($@"MenuItem(EditorConfig.ParentMenu + ""/"" + LocalMenu + ""/{workerType}"", true, EditorConfig.MenuOffset + {i})")
58+
.Annotate($@"MenuItem(EditorConfig.ParentMenu + ""/"" + CloudMenu + ""/{workerType}"", true, EditorConfig.MenuOffset + {i})");
5359
}
5460

61+
allMenuOptionValidators.Method("public static bool ValidateEditorCompile()", () => new[]
62+
{
63+
"return !EditorUtility.scriptCompilationFailed;"
64+
});
65+
5566
buildWorkerMenu.Annotate($@"MenuItem(EditorConfig.ParentMenu + ""/"" + LocalMenu + ""/All workers"", false, EditorConfig.MenuOffset + {workerTypes.Count})")
5667
.Method("public static void BuildLocalAll()", () => new[]
5768
{

workers/unity/Packages/io.improbable.gdk.buildsystem/WorkerBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4-
using System.Linq;
54
using Improbable.Gdk.BuildSystem.Configuration;
65
using Improbable.Gdk.Core;
76
using Improbable.Gdk.Tools;

0 commit comments

Comments
 (0)