diff --git a/XRTK-Core/Packages/com.xrtk.core/Runtime/Extensions/ProcessExtensions.cs b/XRTK-Core/Packages/com.xrtk.core/Runtime/Extensions/ProcessExtensions.cs
index 8a65e2bb5..a42dbc78a 100644
--- a/XRTK-Core/Packages/com.xrtk.core/Runtime/Extensions/ProcessExtensions.cs
+++ b/XRTK-Core/Packages/com.xrtk.core/Runtime/Extensions/ProcessExtensions.cs
@@ -23,9 +23,10 @@ public static class ProcessExtensions
/// The passed arguments.
/// The output of the process.
/// The Application to run through the command line. Default application is "cmd.exe"
+ /// Add the platform command switch to the arguments?
/// Output string.
- /// This process will block the main thread of the editor if command takes too long to run. Use for a background process.
- public static bool Run(this Process process, string args, out string output, string application = "")
+ /// This process will block the main thread of the editor if command takes too long to run. Use for a background process.
+ public static bool Run(this Process process, string args, out string output, string application = "", bool usePlatformArgs = true)
{
if (string.IsNullOrEmpty(args))
{
@@ -34,7 +35,10 @@ public static bool Run(this Process process, string args, out string output, str
return false;
}
- SetupPlatformArgs(ref args, ref application);
+ if (usePlatformArgs)
+ {
+ SetupPlatformArgs(ref args, ref application);
+ }
process.StartInfo = new ProcessStartInfo
{
@@ -100,10 +104,14 @@ public static async Task RunAsync(this Process process, string ar
/// The Process arguments.
/// Should output debug code to Editor Console?
///
+ /// Add the command platform switch to the arguments?
///
- public static async Task RunAsync(this Process process, string args, string application = "", bool showDebug = false, CancellationToken cancellationToken = default)
+ public static async Task RunAsync(this Process process, string args, string application = "", bool showDebug = false, CancellationToken cancellationToken = default, bool setPlatformArgs = true)
{
- SetupPlatformArgs(ref args, ref application);
+ if (setPlatformArgs)
+ {
+ SetupPlatformArgs(ref args, ref application);
+ }
return await RunAsync(process, new ProcessStartInfo
{
diff --git a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/BuildDeployWindow.cs b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/BuildDeployWindow.cs
index 36349cdc9..608d80a4f 100644
--- a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/BuildDeployWindow.cs
+++ b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/BuildDeployWindow.cs
@@ -42,6 +42,7 @@ private enum Architecture
x86 = 0,
x64 = 1,
ARM = 2,
+ ARM64 = 3,
}
#endregion Internal Types
@@ -362,7 +363,7 @@ private void UnityBuildGUI()
if (GUILayout.Button("Open in Visual Studio", GUILayout.Width(HALF_WIDTH)))
{
// Open SLN
- string slnFilename = Path.Combine(BuildDeployPreferences.BuildDirectory, $"{PlayerSettings.productName}.sln");
+ string slnFilename = Path.Combine(BuildDeployPreferences.BuildDirectory, $"{PlayerSettings.productName}\\{PlayerSettings.productName}.sln");
if (File.Exists(slnFilename))
{
@@ -506,6 +507,10 @@ private void AppxBuildGUI()
{
buildArchitecture = Architecture.ARM;
}
+ else if (currentArchitectureString.ToLower().Equals("arm64"))
+ {
+ buildArchitecture = Architecture.ARM64;
+ }
buildArchitecture = (Architecture)EditorGUILayout.EnumPopup("Build Platform", buildArchitecture, GUILayout.Width(HALF_WIDTH));
@@ -574,7 +579,7 @@ private void AppxBuildGUI()
GUILayout.FlexibleSpace();
// Open AppX packages location
- string appxDirectory = curScriptingBackend == ScriptingImplementation.IL2CPP ? $"/AppPackages/{PlayerSettings.productName}" : $"/{PlayerSettings.productName}/AppPackages";
+ string appxDirectory = $"\\{PlayerSettings.productName}\\AppPackages";
string appxBuildPath = Path.GetFullPath($"{BuildDeployPreferences.BuildDirectory}{appxDirectory}");
GUI.enabled = Builds.Count > 0 && !string.IsNullOrEmpty(appxBuildPath);
@@ -611,7 +616,7 @@ private void AppxBuildGUI()
if (GUILayout.Button("Build APPX", GUILayout.Width(HALF_WIDTH)))
{
// Check if solution exists
- string slnFilename = Path.Combine(BuildDeployPreferences.BuildDirectory, $"{PlayerSettings.productName}.sln");
+ string slnFilename = Path.Combine(BuildDeployPreferences.BuildDirectory, $"{PlayerSettings.productName}\\{PlayerSettings.productName}.sln");
if (File.Exists(slnFilename))
{
@@ -659,7 +664,6 @@ private void DeployGUI()
}
GUI.enabled = true;
-
GUILayout.FlexibleSpace();
var previousLabelWidth = EditorGUIUtility.labelWidth;
@@ -1123,14 +1127,14 @@ private static void UpdateBuilds()
{
Builds.Clear();
- var curScriptingBackend = PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA);
- string appxDirectory = curScriptingBackend == ScriptingImplementation.IL2CPP ? $"AppPackages\\{PlayerSettings.productName}" : $"{PlayerSettings.productName}\\AppPackages";
+ string appxDirectory = $"{PlayerSettings.productName}\\AppPackages\\{PlayerSettings.productName}";
try
{
AppPackageDirectories.Clear();
- string[] buildList = Directory.GetDirectories(BuildDeployPreferences.AbsoluteBuildDirectory, "*", SearchOption.AllDirectories);
- foreach (string appBuild in buildList)
+ var buildList = Directory.GetDirectories(BuildDeployPreferences.AbsoluteBuildDirectory, "*", SearchOption.AllDirectories);
+
+ foreach (var appBuild in buildList)
{
if (appBuild.Contains(appxDirectory) && !appBuild.Contains($"{appxDirectory}\\"))
{
@@ -1138,10 +1142,9 @@ private static void UpdateBuilds()
}
}
- IEnumerable selectedDirectories =
- from string directory in AppPackageDirectories
- orderby Directory.GetLastWriteTime(directory) descending
- select Path.GetFullPath(directory);
+ var selectedDirectories = from string directory in AppPackageDirectories
+ orderby Directory.GetLastWriteTime(directory) descending
+ select Path.GetFullPath(directory);
Builds.AddRange(selectedDirectories);
}
catch (DirectoryNotFoundException)
@@ -1157,12 +1160,12 @@ orderby Directory.GetLastWriteTime(directory) descending
private static string CalcMostRecentBuild()
{
UpdateBuilds();
- DateTime mostRecent = DateTime.MinValue;
- string mostRecentBuild = string.Empty;
+ var mostRecent = DateTime.MinValue;
+ var mostRecentBuild = string.Empty;
foreach (var fullBuildLocation in Builds)
{
- DateTime directoryDate = Directory.GetLastWriteTime(fullBuildLocation);
+ var directoryDate = Directory.GetLastWriteTime(fullBuildLocation);
if (directoryDate > mostRecent)
{
@@ -1177,12 +1180,14 @@ private static string CalcMostRecentBuild()
private void UpdatePortalConnections()
{
targetIps = new string[portalConnections.Connections.Count];
+
if (currentConnectionInfoIndex > portalConnections.Connections.Count - 1)
{
currentConnectionInfoIndex = portalConnections.Connections.Count - 1;
}
targetIps[0] = LOCAL_MACHINE;
+
for (int i = 1; i < targetIps.Length; i++)
{
if (string.IsNullOrEmpty(portalConnections.Connections[i].MachineName))
@@ -1194,6 +1199,7 @@ private void UpdatePortalConnections()
}
var devicePortalConnections = new DevicePortalConnections();
+
for (var i = 0; i < portalConnections.Connections.Count; i++)
{
devicePortalConnections.Connections.Add(portalConnections.Connections[i]);
diff --git a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/UnityPlayerBuildTools.cs b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/UnityPlayerBuildTools.cs
index cd4dd78a5..be6abbc66 100644
--- a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/UnityPlayerBuildTools.cs
+++ b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/UnityPlayerBuildTools.cs
@@ -268,6 +268,8 @@ public static void ParseBuildCommandLine(ref IBuildInfo buildInfo)
break;
case "-x86":
case "-x64":
+ case "-ARM":
+ case "-ARM64":
buildInfo.BuildPlatform = arguments[i].Substring(1);
break;
case "-debug":
diff --git a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/UwpAppxBuildTools.cs b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/UwpAppxBuildTools.cs
index 4289585f1..4f9173ae8 100644
--- a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/UwpAppxBuildTools.cs
+++ b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/BuildAndDeploy/UwpAppxBuildTools.cs
@@ -57,7 +57,7 @@ public static async Task BuildAppxAsync(UwpBuildInfo buildInfo, Cancellati
Debug.Log("Starting Unity Appx Build...");
IsBuilding = true;
- string slnFilename = Path.Combine(buildInfo.OutputDirectory, $"{PlayerSettings.productName}.sln");
+ string slnFilename = Path.Combine(buildInfo.OutputDirectory, $"{PlayerSettings.productName}\\{PlayerSettings.productName}.sln");
if (!File.Exists(slnFilename))
{
@@ -66,7 +66,7 @@ public static async Task BuildAppxAsync(UwpBuildInfo buildInfo, Cancellati
}
// Get and validate the msBuild path...
- var msBuildPath = await FindMsBuildPathAsync();
+ var msBuildPath = await FindMsBuildPathAsync(cancellationToken);
if (!File.Exists(msBuildPath))
{
@@ -88,15 +88,10 @@ public static async Task BuildAppxAsync(UwpBuildInfo buildInfo, Cancellati
return IsBuilding = false;
}
- string storagePath = Path.GetFullPath(Path.Combine(Path.Combine(Application.dataPath, ".."), buildInfo.OutputDirectory));
- string solutionProjectPath = Path.GetFullPath(Path.Combine(storagePath, $@"{PlayerSettings.productName}.sln"));
-
- // Now do the actual appx build
- var processResult = await new Process().RunAsync(
- $"\"{solutionProjectPath}\" /t:{(buildInfo.RebuildAppx ? "Rebuild" : "Build")} /p:Configuration={buildInfo.Configuration} /p:Platform={buildInfo.BuildPlatform} /verbosity:m",
- msBuildPath,
- !Application.isBatchMode,
- cancellationToken);
+ var storagePath = Path.GetFullPath(Path.Combine(Path.Combine(Application.dataPath, ".."), buildInfo.OutputDirectory));
+ var solutionProjectPath = Path.GetFullPath(Path.Combine(storagePath, $"{PlayerSettings.productName}/{PlayerSettings.productName}.sln"));
+ var appxBuildArgs = $"\"{solutionProjectPath}\" /t:{(buildInfo.RebuildAppx ? "Rebuild" : "Build")} /p:Configuration={buildInfo.Configuration} /p:Platform={buildInfo.BuildPlatform} /verbosity:m";
+ var processResult = await new Process().RunAsync(appxBuildArgs, msBuildPath, !Application.isBatchMode, cancellationToken, false);
switch (processResult.ExitCode)
{
@@ -154,7 +149,7 @@ public static async Task BuildAppxAsync(UwpBuildInfo buildInfo, Cancellati
return processResult.ExitCode == 0;
}
- private static async Task FindMsBuildPathAsync()
+ private static async Task FindMsBuildPathAsync(CancellationToken cancellationToken)
{
var result = await new Process().RunAsync(
new ProcessStartInfo
@@ -164,28 +159,27 @@ private static async Task FindMsBuildPathAsync()
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
- Arguments = $@"/C vswhere -all -products * -requires Microsoft.Component.MSBuild -property installationPath",
- WorkingDirectory = @"C:\Program Files (x86)\Microsoft Visual Studio\Installer"
- });
+ WorkingDirectory = @"C:\Program Files (x86)\Microsoft Visual Studio\Installer",
+ Arguments = "/c vswhere -all -products * -requires Microsoft.Component.MSBuild -property installationPath"
+ }, true, cancellationToken);
foreach (var path in result.Output)
{
- if (!string.IsNullOrEmpty(path))
- {
- string[] paths = path.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
+ if (string.IsNullOrEmpty(path)) { continue; }
- if (paths.Length > 0)
- {
- // if there are multiple visual studio installs,
- // prefer enterprise, then pro, then community
- var bestPath = paths.OrderBy(p => p.ToLower().Contains("enterprise"))
- .ThenBy(p => p.ToLower().Contains("professional"))
- .ThenBy(p => p.ToLower().Contains("community")).First();
-
- return bestPath.Contains("2019")
- ? $@"{bestPath}\MSBuild\Current\Bin\MSBuild.exe"
- : $@"{bestPath}\MSBuild\15.0\Bin\MSBuild.exe";
- }
+ var paths = path.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
+
+ if (paths.Length > 0)
+ {
+ // if there are multiple visual studio installs,
+ // prefer enterprise, then pro, then community
+ var bestPath = paths.OrderBy(p => p.ToLower().Contains("enterprise"))
+ .ThenBy(p => p.ToLower().Contains("professional"))
+ .ThenBy(p => p.ToLower().Contains("community")).First();
+
+ return bestPath.Contains("2019")
+ ? $@"{bestPath}\MSBuild\Current\Bin\MSBuild.exe"
+ : $@"{bestPath}\MSBuild\15.0\Bin\MSBuild.exe";
}
}