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

Commit 6d72714

Browse files
author
Jamie Brynes
authored
UTY-2061: Exclude schema directory when cleaning workers (#969)
1 parent 114fd68 commit 6d72714

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- Moved Dev Auth Token to the Player Preferences.
2626
- Added a setting in `GdkToolsConfiguration` to let users configure whether a `DevAuthToken.txt` should be generated or not.
2727
- When launching Android cloud clients from the Editor, the DevAuthToken is now passed in as a command line argument.
28+
- The schema descriptor is no longer deleted when you select `SpatialOS > Clean all workers` from the Unity Editor.
2829

2930
### Fixed
3031

workers/unity/Packages/com.improbable.gdk.buildsystem/Util/EditorPaths.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ namespace Improbable.Gdk.BuildSystem
1111
/// </remarks>
1212
public static class EditorPaths
1313
{
14+
/// <summary>
15+
/// The path to the Unity project build directory that worker build artifacts are placed into.
16+
/// </summary>
1417
public static readonly string BuildScratchDirectory =
1518
Path.GetFullPath(Path.Combine(Application.dataPath, "..", "build", "worker"));
1619

17-
public static readonly string AssetDatabaseDirectory =
20+
/// <summary>
21+
/// The path to the SpatialOS assembly directory where SpatialOS assembly artifacts are placed.
22+
/// </summary>
23+
public static readonly string SpatialAssemblyDirectory =
1824
Path.Combine(Application.dataPath, "..", "..", "..", "build", "assembly");
1925
}
2026
}

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ namespace Improbable.Gdk.BuildSystem
1515
public static class WorkerBuilder
1616
{
1717
private static readonly string PlayerBuildDirectory =
18-
Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), EditorPaths.AssetDatabaseDirectory,
18+
Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), EditorPaths.SpatialAssemblyDirectory,
1919
"worker"));
2020

21-
private static readonly string AssetDatabaseDirectory =
22-
Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), EditorPaths.AssetDatabaseDirectory));
21+
private static readonly string SpatialAssemblyDirectory =
22+
Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), EditorPaths.SpatialAssemblyDirectory));
2323

2424
private const string BuildWorkerTypes = "buildWorkerTypes";
2525

@@ -217,9 +217,18 @@ private static bool BuildWorkerForEnvironment(string workerType, BuildEnvironmen
217217

218218
public static void Clean()
219219
{
220-
if (Directory.Exists(AssetDatabaseDirectory))
220+
// Delete all but the schema directory where the schema descriptor is placed.
221+
if (Directory.Exists(SpatialAssemblyDirectory))
221222
{
222-
Directory.Delete(AssetDatabaseDirectory, true);
223+
var children = new DirectoryInfo(SpatialAssemblyDirectory).GetDirectories();
224+
225+
foreach (var child in children)
226+
{
227+
if (child.Name != "schema")
228+
{
229+
Directory.Delete(child.FullName, true);
230+
}
231+
}
223232
}
224233

225234
if (Directory.Exists(EditorPaths.BuildScratchDirectory))

0 commit comments

Comments
 (0)