From c32f0e835ea8bdf8a1dcf1721d275226e58cc1c0 Mon Sep 17 00:00:00 2001 From: Sean Stolberg Date: Mon, 6 May 2019 15:35:07 -0700 Subject: [PATCH] update test based on ad-hoc CR in slack from team. (#78) * update test based on ad-hoc CR in slack from team. * Only use UnityTest when we need to skip frames, remove HoloLens binaries as these are no longer going to be used from this test project. --- .../Assets/Editor/Build/Build.cs | 8 - .../Assets/Editor/Build/HoloLensBuild.meta | 3 - .../Build/HoloLensBuild/ActionExtensions.cs | 54 - .../HoloLensBuild/ActionExtensions.cs.meta | 11 - .../Build/HoloLensBuild/BuildDeployPortal.cs | 741 -------- .../HoloLensBuild/BuildDeployPortal.cs.meta | 12 - .../Build/HoloLensBuild/BuildDeployPrefs.cs | 129 -- .../HoloLensBuild/BuildDeployPrefs.cs.meta | 12 - .../Build/HoloLensBuild/BuildDeployTools.cs | 390 ----- .../HoloLensBuild/BuildDeployTools.cs.meta | 12 - .../Build/HoloLensBuild/BuildDeployWindow.cs | 1501 ----------------- .../HoloLensBuild/BuildDeployWindow.cs.meta | 12 - .../Editor/Build/HoloLensBuild/BuildInfo.cs | 98 -- .../Build/HoloLensBuild/BuildInfo.cs.meta | 3 - .../Build/HoloLensBuild/BuildSLNUtilities.cs | 448 ----- .../HoloLensBuild/BuildSLNUtilities.cs.meta | 12 - .../Build/HoloLensBuild/DataStructures.meta | 10 - .../DataStructures/AdapterInfo.cs | 20 - .../DataStructures/AdapterInfo.cs.meta | 13 - .../DataStructures/AppDetails.cs | 18 - .../DataStructures/AppDetails.cs.meta | 3 - .../HoloLensBuild/DataStructures/AppList.cs | 13 - .../DataStructures/AppList.cs.meta | 3 - .../DataStructures/ConnectInfo.cs | 24 - .../DataStructures/ConnectInfo.cs.meta | 3 - .../DataStructures/CopyDirectoryInfo.cs | 21 - .../DataStructures/CopyDirectoryInfo.cs.meta | 3 - .../HoloLensBuild/DataStructures/DHCPInfo.cs | 15 - .../DataStructures/DHCPInfo.cs.meta | 13 - .../DataStructures/DevicePortalConnections.cs | 19 - .../DevicePortalConnections.cs.meta | 13 - .../DataStructures/InstallStatus.cs | 16 - .../DataStructures/InstallStatus.cs.meta | 3 - .../DataStructures/IpAddressInfo.cs | 14 - .../DataStructures/IpAddressInfo.cs.meta | 13 - .../DataStructures/MachineName.cs | 13 - .../DataStructures/MachineName.cs.meta | 13 - .../DataStructures/NetworkInfo.cs | 13 - .../DataStructures/NetworkInfo.cs.meta | 13 - .../DataStructures/ProcessDesc.cs | 21 - .../DataStructures/ProcessDesc.cs.meta | 3 - .../DataStructures/ProcessList.cs | 13 - .../DataStructures/ProcessList.cs.meta | 3 - .../HoloLensBuild/DataStructures/Response.cs | 13 - .../DataStructures/Response.cs.meta | 3 - .../Build/HoloLensBuild/EditorPrefsUtility.cs | 75 - .../HoloLensBuild/EditorPrefsUtility.cs.meta | 11 - .../HoloLensBuild/HoloToolkitCommands.cs | 56 - .../HoloLensBuild/HoloToolkitCommands.cs.meta | 12 - .../Editor/Build/HoloLensBuild/USB.meta | 10 - .../Build/HoloLensBuild/USB/USBDeviceInfo.cs | 31 - .../HoloLensBuild/USB/USBDeviceInfo.cs.meta | 3 - .../HoloLensBuild/USB/USBDeviceListener.cs | 45 - .../USB/USBDeviceListener.cs.meta | 3 - .../HoloLensBuild/UwpProjectPostProcess.cs | 133 -- .../UwpProjectPostProcess.cs.meta | 13 - .../Build/HoloLensBuild/XdeGuestLocator.cs | 164 -- .../HoloLensBuild/XdeGuestLocator.cs.meta | 12 - .../Assets/Tests/AudioSourceTests.cs | 18 +- .../CrossPlatform/Assets/Tests/CameraTests.cs | 30 +- .../Assets/Tests/DllNativePluginTests.cs | 8 +- .../Assets/Tests/EyeCameraTests.cs | 2 +- .../Assets/Tests/PhysicsTests.cs | 6 +- .../Assets/Tests/RenderingChecks.cs | 4 +- .../Assets/Tests/SimplePerformanceTests.cs | 8 +- .../Assets/Tests/TrackingSpaceTests.cs | 4 +- .../CrossPlatform/Assets/Tests/XrApiTests.cs | 104 +- .../Assets/Tests/XrFunctionalTestBase.cs | 2 +- .../Assets/Tests/XrNodesTests.cs | 4 +- .../Assets/Tests/XrSmokeXrFunctionalTest.cs | 60 - .../Tests/XrSmokeXrFunctionalTest.cs.meta | 11 - .../VR/CrossPlatform/Packages/manifest.json | 2 +- 72 files changed, 110 insertions(+), 4512 deletions(-) delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/ActionExtensions.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/ActionExtensions.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPortal.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPortal.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPrefs.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPrefs.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployTools.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployTools.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployWindow.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployWindow.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildInfo.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildInfo.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildSLNUtilities.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildSLNUtilities.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AdapterInfo.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AdapterInfo.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppDetails.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppDetails.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppList.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppList.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ConnectInfo.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ConnectInfo.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/CopyDirectoryInfo.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/CopyDirectoryInfo.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DHCPInfo.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DHCPInfo.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DevicePortalConnections.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DevicePortalConnections.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/InstallStatus.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/InstallStatus.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/IpAddressInfo.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/IpAddressInfo.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/MachineName.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/MachineName.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/NetworkInfo.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/NetworkInfo.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessDesc.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessDesc.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessList.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessList.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/Response.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/Response.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/EditorPrefsUtility.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/EditorPrefsUtility.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/HoloToolkitCommands.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/HoloToolkitCommands.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceInfo.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceInfo.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceListener.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceListener.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/UwpProjectPostProcess.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/UwpProjectPostProcess.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/XdeGuestLocator.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/XdeGuestLocator.cs.meta delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Tests/XrSmokeXrFunctionalTest.cs delete mode 100644 FunctionalTests/VR/CrossPlatform/Assets/Tests/XrSmokeXrFunctionalTest.cs.meta diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/Build.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/Build.cs index be8b145b..3a878825 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/Build.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/Build.cs @@ -44,16 +44,8 @@ public class Build case BuildTarget.PS4: break; } - - if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.WSAPlayer) - { - HoloToolkit.Unity.HoloToolkitCommands.BuildSLNAndAPPX(path + $"{Name}"); - } - else - { // Build player. BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, path + $"{Name}" + $"{extension}", EditorUserBuildSettings.activeBuildTarget, BuildOptions.None); - } } diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild.meta deleted file mode 100644 index fa6e3957..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: ee45a3e1088b44e6b97ce1887eff0510 -timeCreated: 1551729795 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/ActionExtensions.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/ActionExtensions.cs deleted file mode 100644 index 7d4dd8d3..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/ActionExtensions.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - /// - /// Extensions for the action class. - /// These methods encapsulate the null check before raising an event for an Action. - /// - public static class ActionExtensions - { - public static void RaiseEvent(this Action action) - { - if (action != null) - { - action(); - } - } - - public static void RaiseEvent(this Action action, T arg) - { - if (action != null) - { - action(arg); - } - } - - public static void RaiseEvent(this Action action, T1 arg1, T2 arg2) - { - if (action != null) - { - action(arg1, arg2); - } - } - - public static void RaiseEvent(this Action action, T1 arg1, T2 arg2, T3 arg3) - { - if (action != null) - { - action(arg1, arg2, arg3); - } - } - - public static void RaiseEvent(this Action action, T1 arg1, T2 arg2, T3 arg3, T4 arg4) - { - if (action != null) - { - action(arg1, arg2, arg3, arg4); - } - } - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/ActionExtensions.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/ActionExtensions.cs.meta deleted file mode 100644 index 32deeb88..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/ActionExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0cc56044ef18aa942b078349f887608f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPortal.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPortal.cs deleted file mode 100644 index a0725fdb..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPortal.cs +++ /dev/null @@ -1,741 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using UnityEditor; -using UnityEngine; -using UnityEngine.Networking; -using Debug = UnityEngine.Debug; - -namespace HoloToolkit.Unity -{ - /// - /// Function used to communicate with the device through the REST API - /// - public static class BuildDeployPortal - { - private enum AppInstallStatus - { - Invalid, - Installing, - InstallSuccess, - InstallFail - } - - private const float TimeOut = 10.0f; - private const float MaxWaitTime = 20.0f; - - // Device Portal API Resources - // https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/device-portal-api-hololens#holographic-os - // https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/device-portal-api-core - private static readonly string API_GetMachineNameQuery = @"{0}/api/os/machinename"; - private static readonly string API_ProcessQuery = @"{0}/api/resourcemanager/processes"; - private static readonly string API_PackagesQuery = @"{0}/api/appx/packagemanager/packages"; - private static readonly string API_InstallQuery = @"{0}/api/app/packagemanager/package"; - private static readonly string API_InstallStatusQuery = @"{0}/api/app/packagemanager/state"; - private static readonly string API_AppQuery = @"{0}/api/taskmanager/app"; - private static readonly string API_FileQuery = @"{0}/api/filesystem/apps/file?knownfolderid=LocalAppData&filename=UnityPlayer.log&packagefullname={1}&path=%5C%5CTempState"; - private static readonly string API_IpConfigQuery = @"{0}/api/networking/ipconfig"; - - /// - /// Gets the Basic auth header. - /// If you're using SSL and making HTTPS requests you must also specify if the request is of GET type or not, - /// so we know if we should append the "auto-" prefix to bypass CSRF. - /// - /// target device connection info. - /// If the request you're attempting to make is a GET type - /// - private static string GetBasicAuthHeader(ConnectInfo connectionInfo, bool isGetRequest = false) - { - var auth = string.Format("{0}{1}:{2}", BuildDeployPrefs.UseSSL && !isGetRequest ? "auto-" : "", connectionInfo.User, connectionInfo.Password); - auth = Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(auth)); - return string.Format("Basic {0}", auth); - } - - /// - /// Send a Unity Web Request to GET. - /// - /// Full Query to GET - /// Authorization header - /// Show the progress dialog. - /// Response string. - private static string WebRequestGet(string query, string auth, bool showProgressDialog = true) - { - try - { - using (var webRequest = UnityWebRequest.Get(query)) - { - webRequest.SetRequestHeader("Authorization", auth); -#if UNITY_2017_1_OR_NEWER - webRequest.timeout = (int)TimeOut; -#endif - -#if UNITY_2017_2_OR_NEWER - webRequest.SendWebRequest(); -#else - webRequest.Send(); -#endif - - while (!webRequest.isDone) - { - if (webRequest.downloadProgress > -1 && showProgressDialog) - { - EditorUtility.DisplayProgressBar("Connecting to Device Portal", - "Progress...", webRequest.downloadProgress); - } - } - - if (showProgressDialog) - { - EditorUtility.ClearProgressBar(); - } - - if ( -#if UNITY_2017_2_OR_NEWER - webRequest.isNetworkError || webRequest.isHttpError && -#else - webRequest.isError && -#endif - webRequest.responseCode != 401) - { - string response = string.Empty; - var responseHeaders = webRequest.GetResponseHeaders(); - if (responseHeaders != null) - { - response = responseHeaders.Aggregate(string.Empty, (current, header) => string.Format("{0}{1}: {2}\n", current, header.Key, header.Value)); - } - - Debug.LogErrorFormat("Network Error: {0}\n{1}", webRequest.error, response); - return string.Empty; - } - - switch (webRequest.responseCode) - { - case 200: - case 204: - return webRequest.downloadHandler.text; - case 401: - Debug.LogError("Unauthorized: Access is denied due to invalid credentials."); - break; - default: - Debug.LogError(webRequest.responseCode); - break; - } - } - } - catch (Exception e) - { - Debug.LogException(e); - } - - return string.Empty; - } - - /// - /// Send a Unity Web Request to POST. - /// - /// Full Query to GET - /// Post Data - /// Authorization Header - /// Show the progress dialog. - /// Response string. - private static string WebRequestPost(string query, WWWForm postData, string auth, bool showDialog = true) - { - try - { - using (var webRequest = UnityWebRequest.Post(query, postData)) - { - webRequest.SetRequestHeader("Authorization", auth); -#if UNITY_2017_1_OR_NEWER - webRequest.timeout = (int)TimeOut; -#endif - - // HACK: Workaround for extra quotes around boundary. - string contentType = webRequest.GetRequestHeader("Content-Type"); - if (contentType != null) - { - contentType = contentType.Replace("\"", ""); - webRequest.SetRequestHeader("Content-Type", contentType); - } - -#if UNITY_2017_2_OR_NEWER - webRequest.SendWebRequest(); -#else - webRequest.Send(); -#endif - - while (!webRequest.isDone) - { - if (webRequest.uploadProgress > -1 && showDialog) - { - EditorUtility.DisplayProgressBar("Connecting to Device Portal", - "Uploading...", webRequest.uploadProgress); - } - else if (webRequest.downloadProgress > -1 && showDialog) - { - EditorUtility.DisplayProgressBar("Connecting to Device Portal", - "Progress...", webRequest.downloadProgress); - } - } - - EditorUtility.ClearProgressBar(); - - if ( -#if UNITY_2017_2_OR_NEWER - webRequest.isNetworkError || webRequest.isHttpError && -#else - webRequest.isError && -#endif - webRequest.responseCode != 401) - { - string response = string.Empty; - var responseHeaders = webRequest.GetResponseHeaders(); - if (responseHeaders != null) - { - response = responseHeaders.Aggregate(string.Empty, (current, header) => string.Format("{0}{1}: {2}\n", current, header.Key, header.Value)); - } - - Debug.LogErrorFormat("Network Error: {0}\n{1}", webRequest.error, response); - return string.Empty; - } - - switch (webRequest.responseCode) - { - case 200: - case 202: - return webRequest.downloadHandler.text; - case 401: - Debug.LogError("Unauthorized: Access is denied due to invalid credentials."); - break; - default: - Debug.LogError(webRequest.responseCode); - break; - } - } - } - catch (Exception e) - { - Debug.LogException(e); - } - - return string.Empty; - } - - /// - /// Send a Unity Web Request to DELETE - /// - /// Full Query. - /// Authorization Header - /// Show to progress dialog - /// Successful or not. - private static bool WebRequestDelete(string query, string auth, bool showDialog = true) - { - try - { - using (var webRequest = UnityWebRequest.Delete(query)) - { - webRequest.SetRequestHeader("Authorization", auth); -#if UNITY_2017_1_OR_NEWER - webRequest.timeout = (int)TimeOut; -#endif - -#if UNITY_2017_2_OR_NEWER - webRequest.SendWebRequest(); -#else - webRequest.Send(); -#endif - - while (!webRequest.isDone) - { - if (showDialog && webRequest.downloadProgress > -1) - { - EditorUtility.DisplayProgressBar("Connecting to Device Portal", - "Progress...", webRequest.downloadProgress); - } - } - - EditorUtility.ClearProgressBar(); - - if ( -#if UNITY_2017_2_OR_NEWER - webRequest.isNetworkError || webRequest.isHttpError && -#else - webRequest.isError && -#endif - webRequest.responseCode != 401) - { - string response = string.Empty; - var responseHeaders = webRequest.GetResponseHeaders(); - if (responseHeaders != null) - { - response = responseHeaders.Aggregate(string.Empty, (current, header) => string.Format("{0}{1}: {2}\n", current, header.Key, header.Value)); - } - - Debug.LogErrorFormat("Network Error: {0}\n{1}", webRequest.error, response); - return false; - } - - switch (webRequest.responseCode) - { - case 200: - return true; - case 401: - Debug.LogError("Unauthorized: Access is denied due to invalid credentials."); - break; - default: - Debug.LogError(webRequest.responseCode); - break; - } - } - } - catch (Exception e) - { - Debug.LogException(e); - } - - return false; - } - - /// - /// Opens the Device Portal for the target device. - /// - /// - public static void OpenWebPortal(ConnectInfo targetDevice) - { - //TODO: Figure out how to pass username and password to browser? - Process.Start(FinalizeUrl(targetDevice.IP)); - } - - /// - /// Gets the of the target device. - /// - /// - /// - public static MachineName GetMachineName(ConnectInfo targetDevice) - { - MachineName machineName = null; - string query = string.Format(API_GetMachineNameQuery, FinalizeUrl(targetDevice.IP)); - string response = WebRequestGet(query, GetBasicAuthHeader(targetDevice, true), false); - - if (!string.IsNullOrEmpty(response)) - { - machineName = JsonUtility.FromJson(response); - } - - return machineName; - } - - [Obsolete("Use IsAppInstalled(string packageFamilyName, ConnectInfo targetDevice)")] - public static bool IsAppInstalled(string packageFamilyName, string targetIp) - { - return QueryAppDetails(packageFamilyName, new ConnectInfo(targetIp, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword)) != null; - } - - /// - /// Determines if the target application is currently running on the target device. - /// - /// - /// - /// True, if application is currently installed on device. - public static bool IsAppInstalled(string packageFamilyName, ConnectInfo targetDevice) - { - return QueryAppDetails(packageFamilyName, targetDevice) != null; - } - - [Obsolete("IsAppRunning(string appName, ConnectInfo targetDevice)")] - public static bool IsAppRunning(string appName, string targetDevice) - { - return IsAppRunning(appName, new ConnectInfo(targetDevice, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword)); - } - - /// - /// Determines if the target application is running on the target device. - /// - /// - /// - /// True, if the application is running. - public static bool IsAppRunning(string appName, ConnectInfo targetDevice) - { - string response = WebRequestGet(string.Format(API_ProcessQuery, FinalizeUrl(targetDevice.IP)), GetBasicAuthHeader(targetDevice, true), false); - - if (!string.IsNullOrEmpty(response)) - { - var processList = JsonUtility.FromJson(response); - for (int i = 0; i < processList.Processes.Length; ++i) - { - string processName = processList.Processes[i].ImageName; - - if (processName.Contains(appName)) - { - return true; - } - } - } - - return false; - } - - /// - /// Returns the of the target application from the target device. - /// - /// - /// - /// null if application is not currently installed on the target device. - private static AppDetails QueryAppDetails(string packageFamilyName, ConnectInfo targetDevice) - { - string response = WebRequestGet(string.Format(API_PackagesQuery, FinalizeUrl(targetDevice.IP)), GetBasicAuthHeader(targetDevice, true), false); - - if (!string.IsNullOrEmpty(response)) - { - var appList = JsonUtility.FromJson(response); - for (int i = 0; i < appList.InstalledPackages.Length; ++i) - { - string thisAppName = appList.InstalledPackages[i].PackageFamilyName; - if (thisAppName.Equals(packageFamilyName, StringComparison.OrdinalIgnoreCase)) - { - return appList.InstalledPackages[i]; - } - } - } - - return null; - } - - /// - /// Installs the target application on the target device. - /// - /// - /// - /// Should the thread wait until installation is complete? - /// True, if Installation was a success. - public static bool InstallApp(string appFullPath, ConnectInfo targetDevice, bool waitForDone = true) - { - bool success = false; - - try - { - // Calculate the cert and dependency paths - string fileName = Path.GetFileName(appFullPath); - string certFullPath = Path.ChangeExtension(appFullPath, ".cer"); - string certName = Path.GetFileName(certFullPath); - string depPath = Path.GetDirectoryName(appFullPath) + @"\Dependencies\x86\"; - - // Post it using the REST API - var form = new WWWForm(); - - // APPX file - Debug.Assert(appFullPath != null); - using (var stream = new FileStream(appFullPath, FileMode.Open, FileAccess.Read, FileShare.Read)) - { - using (var reader = new BinaryReader(stream)) - { - form.AddBinaryData(fileName, reader.ReadBytes((int)reader.BaseStream.Length), fileName); - } - } - - // CERT file - Debug.Assert(certFullPath != null); - using (var stream = new FileStream(certFullPath, FileMode.Open, FileAccess.Read, FileShare.Read)) - { - using (var reader = new BinaryReader(stream)) - { - form.AddBinaryData(certName, reader.ReadBytes((int)reader.BaseStream.Length), certName); - } - } - - // Dependencies - FileInfo[] depFiles = new DirectoryInfo(depPath).GetFiles(); - foreach (FileInfo dep in depFiles) - { - using (var stream = new FileStream(dep.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)) - { - using (var reader = new BinaryReader(stream)) - { - string depFilename = Path.GetFileName(dep.FullName); - form.AddBinaryData(depFilename, reader.ReadBytes((int)reader.BaseStream.Length), depFilename); - } - } - } - - // Query - string query = string.Format(API_InstallQuery, FinalizeUrl(targetDevice.IP)); - query += "?package=" + WWW.EscapeURL(fileName); - - var response = WebRequestPost(query, form, GetBasicAuthHeader(targetDevice)); - - if (string.IsNullOrEmpty(response)) - { - Debug.LogErrorFormat("Failed to install {0} on {1}.\n", fileName, targetDevice.MachineName); - return false; - } - - // Wait for done (if requested) - DateTime waitStartTime = DateTime.Now; - while (waitForDone && (DateTime.Now - waitStartTime).TotalSeconds < MaxWaitTime) - { - EditorUtility.DisplayProgressBar("Connecting to Device Portal", "Installing...", (float)((DateTime.Now - waitStartTime).TotalSeconds / MaxWaitTime)); - AppInstallStatus status = GetInstallStatus(targetDevice); - - if (status == AppInstallStatus.InstallSuccess) - { - Debug.LogFormat("Successfully installed {0} on {1}.", fileName, targetDevice.MachineName); - success = true; - break; - } - - if (status == AppInstallStatus.InstallFail) - { - Debug.LogErrorFormat("Failed to install {0} on {1}.\n", fileName, targetDevice.MachineName); - break; - } - - // Wait a bit and we'll ask again - Thread.Sleep(1000); - } - - EditorUtility.ClearProgressBar(); - } - catch (Exception e) - { - Debug.LogException(e); - success = false; - } - - return success; - } - - private static AppInstallStatus GetInstallStatus(ConnectInfo targetDevice) - { - string response = WebRequestGet(string.Format(API_InstallStatusQuery, FinalizeUrl(targetDevice.IP)), GetBasicAuthHeader(targetDevice, true), false); - - if (!string.IsNullOrEmpty(response)) - { - var status = JsonUtility.FromJson(response); - - if (status == null) - { - return AppInstallStatus.Installing; - } - - if (status.Success) - { - return AppInstallStatus.InstallSuccess; - } - - Debug.LogError(status.Reason + "(" + status.CodeText + ")"); - } - else - { - return AppInstallStatus.Installing; - } - - return AppInstallStatus.InstallFail; - } - - [Obsolete("Use UninstallApp(string packageFamilyName, ConnectInfo targetDevice)")] - public static bool UninstallApp(string packageFamilyName, string targetIp) - { - return UninstallApp(packageFamilyName, new ConnectInfo(targetIp, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword)); - } - - /// - /// Uninstalls the target application on the target device. - /// - /// - /// - /// - /// True, if uninstall was a success. - public static bool UninstallApp(string packageFamilyName, ConnectInfo targetDevice, bool showDialog = true) - { - AppDetails appDetails = QueryAppDetails(packageFamilyName, targetDevice); - if (appDetails == null) - { - Debug.Log(string.Format("Application '{0}' not found", packageFamilyName)); - return false; - } - - string query = string.Format("{0}?package={1}", - string.Format(API_InstallQuery, FinalizeUrl(targetDevice.IP)), - WWW.EscapeURL(appDetails.PackageFullName)); - - bool success = WebRequestDelete(query, GetBasicAuthHeader(targetDevice), showDialog); - MachineName targetMachine = GetMachineName(targetDevice); - - if (success) - { - Debug.LogFormat("Successfully uninstalled {0} on {1}.", packageFamilyName, targetMachine.ComputerName); - } - else - { - Debug.LogErrorFormat("Failed to uninstall {0} on {1}", packageFamilyName, targetMachine.ComputerName); - } - - return success; - } - - /// - /// Launches the target application on the target device. - /// - /// - /// - /// - /// True, if application was successfully launched and is currently running on the target device. - public static bool LaunchApp(string packageFamilyName, ConnectInfo targetDevice, bool showDialog = true) - { - // Find the app description - AppDetails appDetails = QueryAppDetails(packageFamilyName, targetDevice); - - if (appDetails == null) - { - Debug.LogWarning("Application not found"); - return false; - } - - string query = string.Format(API_AppQuery, FinalizeUrl(targetDevice.IP)) + - string.Format("?appid={0}&package={1}", - WWW.EscapeURL(EncodeTo64(appDetails.PackageRelativeId)), - WWW.EscapeURL(appDetails.PackageFullName)); - WebRequestPost(query, null, GetBasicAuthHeader(targetDevice), false); - - return IsAppRunning(PlayerSettings.productName, targetDevice); - } - - [Obsolete("KillApp(string packageFamilyName, ConnectInfo targetDevice)")] - public static bool KillApp(string packageFamilyName, string targetIp) - { - return KillApp(packageFamilyName, new ConnectInfo(targetIp, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword)); - } - - /// - /// Kills the target application on the target device. - /// - /// - /// - /// - /// true, if application was successfully stopped. - public static bool KillApp(string packageFamilyName, ConnectInfo targetDevice, bool showDialog = true) - { - AppDetails appDetails = QueryAppDetails(packageFamilyName, targetDevice); - if (appDetails == null) - { - Debug.LogError("Application not found"); - return false; - } - - string query = string.Format("{0}?package={1}", - string.Format(API_AppQuery, FinalizeUrl(targetDevice.IP)), - WWW.EscapeURL(EncodeTo64(appDetails.PackageFullName))); - - bool success = WebRequestDelete(query, GetBasicAuthHeader(targetDevice), showDialog); - MachineName targetMachine = GetMachineName(targetDevice); - - if (success) - { - Debug.LogFormat("Successfully stopped {0} on {1}.", packageFamilyName, targetMachine.ComputerName); - } - - return success; - } - - [Obsolete("DeviceLogFile_View(string packageFamilyName, ConnectInfo targetDevice)")] - public static bool DeviceLogFile_View(string packageFamilyName, string targetIp) - { - return DeviceLogFile_View(packageFamilyName, new ConnectInfo(targetIp, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword)); - } - - /// - /// Downloads and launches the Log file for the target application on the target device. - /// - /// - /// - /// True, if download success. - public static bool DeviceLogFile_View(string packageFamilyName, ConnectInfo targetDevice) - { - EditorUtility.DisplayProgressBar("Download Log", "Downloading Log File for " + packageFamilyName, 0.25f); - - AppDetails appDetails = QueryAppDetails(packageFamilyName, targetDevice); - if (appDetails == null) - { - Debug.LogWarningFormat("{0} not installed on target device", packageFamilyName); - EditorUtility.ClearProgressBar(); - return false; - } - - string logFile = string.Format("{0}/{1}_{2}{3}{4}{5}{6}{7}_deviceLog.txt", - Application.temporaryCachePath, - targetDevice.MachineName, - DateTime.Now.Year, - DateTime.Now.Month, - DateTime.Now.Day, - DateTime.Now.Hour, - DateTime.Now.Minute, - DateTime.Now.Second); - - string response = WebRequestGet(string.Format(API_FileQuery, FinalizeUrl(targetDevice.IP), appDetails.PackageFullName), GetBasicAuthHeader(targetDevice, true)); - bool success = !string.IsNullOrEmpty(response); - - if (success) - { - File.WriteAllText(logFile, response); - Process.Start(logFile); - } - - EditorUtility.ClearProgressBar(); - - return success; - } - - /// - /// Returns the for the target device. - /// - /// - /// - public static NetworkInfo GetNetworkInfo(ConnectInfo targetDevice) - { - string response = WebRequestGet(string.Format(API_IpConfigQuery, FinalizeUrl(targetDevice.IP)), GetBasicAuthHeader(targetDevice, true), false); - if (!string.IsNullOrEmpty(response)) - { - return JsonUtility.FromJson(response); - } - - return null; - } - - /// - /// This Utility method finalizes the URL and formats the HTTPS string if needed. - /// Local Machine will be changed to 127.0.1:10080 for HoloLens connections. - /// - /// - /// - private static string FinalizeUrl(string targetUrl) - { - string ssl = BuildDeployPrefs.UseSSL ? "s" : string.Empty; - - if (targetUrl.Contains("Local Machine")) - { - targetUrl = "127.0.0.1:10080"; - ssl = string.Empty; - } - return string.Format(@"http{0}://{1}", ssl, targetUrl); - } - - private static string EncodeTo64(string toEncode) - { - byte[] toEncodeAsBytes = Encoding.ASCII.GetBytes(toEncode); - string returnValue = Convert.ToBase64String(toEncodeAsBytes); - return returnValue; - } - - private static string DecodeFrom64(string encodedData) - { - byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData); - string returnValue = Encoding.ASCII.GetString(encodedDataAsBytes); - return returnValue; - } - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPortal.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPortal.cs.meta deleted file mode 100644 index 99ba73be..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPortal.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 09ea77b2be8b62b4a9c86c123cd5ddbe -timeCreated: 1466615025 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPrefs.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPrefs.cs deleted file mode 100644 index 7b90f45a..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPrefs.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.IO; -using UnityEngine; - -namespace HoloToolkit.Unity -{ - public static class BuildDeployPrefs - { - // Constants - private const string EditorPrefs_BuildDir = "_BuildDeployWindow_BuildDir"; - private const string EditorPrefs_BuildConfig = "_BuildDeployWindow_BuildConfig"; - private const string EditorPrefs_BuildPlatform = "_BuildDeployWindow_BuildPlatform"; - private const string EditorPrefs_ForceRebuild = "_BuildDeployWindow_ForceBuild"; - private const string EditorPrefs_IncrementBuildVersion = "_BuildDeployWindow_IncrementBuildVersion"; - private const string EditorPrefs_MSBuildVer = "_BuildDeployWindow_MSBuildVer"; - private const string EditorPrefs_TargetIPs = "_BuildDeployWindow_DestIPs"; - private const string EditorPrefs_ConnectInfos = "_BuildDeployWindow_ConnectInfos"; - private const string EditorPrefs_DeviceUser = "_BuildDeployWindow_DeviceUser"; - private const string EditorPrefs_DevicePwd = "_BuildDeployWindow_DevicePwd"; - private const string EditorPrefs_FullReinstall = "_BuildDeployWindow_FullReinstall"; - private const string EditorPrefs_UseSSL = "_BuildDeployWindow_UseSSL"; - private const string EditorPrefs_ProcessAll = "_BuildDeployWindow_ProcessAll"; - - public static string BuildDirectory - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_BuildDir, "UWP"); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_BuildDir, value); } - } - - public static string AbsoluteBuildDirectory - { - get - { - string rootBuildDirectory = BuildDirectory; - int dirCharIndex = rootBuildDirectory.IndexOf("/", StringComparison.Ordinal); - if (dirCharIndex != -1) - { - rootBuildDirectory = rootBuildDirectory.Substring(0, dirCharIndex); - } - return Path.GetFullPath(Path.Combine(Path.Combine(Application.dataPath, ".."), rootBuildDirectory)); - } - } - - public static string MsBuildVersion - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_MSBuildVer, BuildDeployTools.DefaultMSBuildVersion); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_MSBuildVer, value); } - } - - public static string BuildConfig - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_BuildConfig, "Debug"); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_BuildConfig, value); } - } - - public static string BuildPlatform - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_BuildPlatform, "x86"); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_BuildPlatform, value); } - } - - public static bool ForceRebuild - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_ForceRebuild, false); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_ForceRebuild, value); } - } - - public static bool IncrementBuildVersion - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_IncrementBuildVersion, true); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_IncrementBuildVersion, value); } - } - - public static bool FullReinstall - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_FullReinstall, true); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_FullReinstall, value); } - } - - public static string DevicePortalConnections - { - get - { - return EditorPrefsUtility.GetEditorPref( - EditorPrefs_ConnectInfos, - JsonUtility.ToJson( - new DevicePortalConnections( - new ConnectInfo("127.0.0.1", string.Empty, string.Empty, "Local Machine")))); - } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_ConnectInfos, value); } - } - - [Obsolete("Use DevicePortalConnections")] - public static string DeviceUser - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_DeviceUser, string.Empty); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_DeviceUser, value); } - } - - [Obsolete("Use DevicePortalConnections")] - public static string DevicePassword - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_DevicePwd, string.Empty); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_DevicePwd, value); } - } - - [Obsolete("Use DevicePortalConnections")] - public static string TargetIPs - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_TargetIPs, "127.0.0.1"); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_TargetIPs, value); } - } - - public static bool UseSSL - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_UseSSL, true); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_UseSSL, value); } - } - - public static bool TargetAllConnections - { - get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_ProcessAll, false); } - set { EditorPrefsUtility.SetEditorPref(EditorPrefs_ProcessAll, value); } - } - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPrefs.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPrefs.cs.meta deleted file mode 100644 index 69935eb5..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployPrefs.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6762008b7153ae94ab1f370faf6bbca0 -timeCreated: 1468891604 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployTools.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployTools.cs deleted file mode 100644 index 3c7739d1..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployTools.cs +++ /dev/null @@ -1,390 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Xml.Linq; -using Microsoft.Win32; -using UnityEditor; -using UnityEngine; -using Debug = UnityEngine.Debug; - -namespace HoloToolkit.Unity -{ - /// - /// Contains utility functions for building for the device - /// - public class BuildDeployTools - { - public const string DefaultMSBuildVersion = "15.0"; - - public static bool CanBuild() - { - if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.IL2CPP && - IsIl2CppAvailable()) - { - return true; - } - - return PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.WinRTDotNET && - IsDotNetAvailable(); - } - - public static bool IsDotNetAvailable() - { - return Directory.Exists(EditorApplication.applicationContentsPath + - "\\PlaybackEngines\\MetroSupport\\Managed\\UAP"); - } - - public static bool IsIl2CppAvailable() - { - return Directory.Exists(EditorApplication.applicationContentsPath + - "\\PlaybackEngines\\MetroSupport\\Managed\\il2cpp"); - } - - /// - /// Displays a dialog if no scenes are present in the build and returns true if build can proceed. - /// - /// - public static bool CheckBuildScenes() - { - if (EditorBuildSettings.scenes.Length == 0) - { - return EditorUtility.DisplayDialog("Attention!", - "No scenes are present in the build settings!\n\n Do you want to cancel and add one?", - "Continue Anyway", "Cancel Build"); - } - - return true; - } - - /// - /// Do a build configured for Mixed Reality Applications, returns the error from BuildPipeline.BuildPlayer - /// - public static bool BuildSLN() - { - return BuildSLN(BuildDeployPrefs.BuildDirectory, false); - } - - public static bool BuildSLN(string buildDirectory, bool showDialog = true) - { - // Use BuildSLNUtilities to create the SLN - bool buildSuccess = false; - - if (CheckBuildScenes() == false) - { - return false; - } - - var buildInfo = new BuildInfo - { - // These properties should all match what the Standalone.proj file specifies - OutputDirectory = buildDirectory, - Scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path), - BuildTarget = BuildTarget.WSAPlayer, - WSASdk = WSASDK.UWP, - WSAUWPBuildType = EditorUserBuildSettings.wsaUWPBuildType, - WSAUwpSdk = EditorUserBuildSettings.wsaUWPSDK, - - // Configure a post build action that will compile the generated solution - PostBuildAction = (innerBuildInfo, buildError) => - { - if (!string.IsNullOrEmpty(buildError)) - { - //EditorUtility.DisplayDialog(PlayerSettings.productName + " WindowsStoreApp Build Failed!", buildError, "OK"); - } - else - { - if (showDialog) - { - if (!EditorUtility.DisplayDialog(PlayerSettings.productName, "Build Complete", "OK", - "Build AppX")) - { - BuildAppxFromSLN( - PlayerSettings.productName, - BuildDeployPrefs.MsBuildVersion, - BuildDeployPrefs.ForceRebuild, - BuildDeployPrefs.BuildConfig, - BuildDeployPrefs.BuildPlatform, - BuildDeployPrefs.BuildDirectory, - BuildDeployPrefs.IncrementBuildVersion); - } - } - - buildSuccess = true; - } - } - }; - - BuildSLNUtilities.RaiseOverrideBuildDefaults(ref buildInfo); - - BuildSLNUtilities.PerformBuild(buildInfo); - - return buildSuccess; - } - - public static string CalcMSBuildPath(string msBuildVersion) - { -#if UNITY_WINDOWS - if (msBuildVersion.Equals("14.0")) - { - using (RegistryKey key = - Registry.LocalMachine.OpenSubKey( - string.Format(@"Software\Microsoft\MSBuild\ToolsVersions\{0}", msBuildVersion))) - { - if (key != null) - { - var msBuildBinFolder = (string)key.GetValue("MSBuildToolsPath"); - return Path.Combine(msBuildBinFolder, "msbuild.exe"); - } - } - } - #endif - - // If we got this far then we don't have VS 2015 installed and need to use msBuild 15 - msBuildVersion = "15.0"; - - // For MSBuild 15+ we should to use vswhere to give us the correct instance - string output = @"/C vswhere -version " + msBuildVersion + - " -products * -requires Microsoft.Component.MSBuild -property installationPath"; - - // get the right program files path based on whether the PC is x86 or x64 - string programFiles = @"C:\Program Files (x86)\Microsoft Visual Studio\Installer"; - - var vswherePInfo = new ProcessStartInfo - { - FileName = "cmd.exe", - CreateNoWindow = true, - UseShellExecute = false, - RedirectStandardOutput = true, - RedirectStandardError = false, - Arguments = output, - WorkingDirectory = programFiles - }; - - using (var vswhereP = new Process()) - { - vswhereP.StartInfo = vswherePInfo; - vswhereP.Start(); - output = vswhereP.StandardOutput.ReadToEnd(); - vswhereP.WaitForExit(); - } - - string[] paths = output.Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); - - if (paths.Length > 0) - { - // if there are multiple 2017 installs, - // prefer enterprise, then pro, then community - string bestPath = paths.OrderBy(p => p.ToLower().Contains("enterprise")) - .ThenBy(p => p.ToLower().Contains("professional")) - .ThenBy(p => p.ToLower().Contains("community")).First(); - - return bestPath + @"\MSBuild\" + msBuildVersion + @"\Bin\MSBuild.exe"; - } - - Debug.LogError("Unable to find a valid path to Visual Studio Instance!"); - return string.Empty; - } - - public static bool RestoreNugetPackages(string nugetPath, string storePath) - { - Debug.Assert(File.Exists(nugetPath)); - Debug.Assert(Directory.Exists(storePath)); - - var nugetPInfo = new ProcessStartInfo - { - FileName = nugetPath, - CreateNoWindow = true, - UseShellExecute = false, - Arguments = "restore \"" + storePath + "/project.json\"" - }; - - using (var nugetP = new Process()) - { - nugetP.StartInfo = nugetPInfo; - nugetP.Start(); - nugetP.WaitForExit(); - nugetP.Close(); - nugetP.Dispose(); - } - - return File.Exists(storePath + "\\project.lock.json"); - } - - public static bool BuildAppxFromSLN(string productName, string msBuildVersion, bool forceRebuildAppx, - string buildConfig, string buildPlatform, string buildDirectory, bool incrementVersion, - bool showDialog = true) - { - EditorUtility.DisplayProgressBar("Build AppX", "Building AppX Package...", 0); - string slnFilename = Path.Combine(buildDirectory, PlayerSettings.productName + ".sln"); - - if (!File.Exists(slnFilename)) - { - Debug.LogError("Unable to find Solution to build from!"); - EditorUtility.ClearProgressBar(); - return false; - } - - // Get and validate the msBuild path... - var msBuildPath = CalcMSBuildPath(msBuildVersion); - - if (!File.Exists(msBuildPath)) - { - Debug.LogErrorFormat("MSBuild.exe is missing or invalid (path={0}).", msBuildPath); - EditorUtility.ClearProgressBar(); - return false; - } - - // Get the path to the NuGet tool - string unity = Path.GetDirectoryName(EditorApplication.applicationPath); - System.Diagnostics.Debug.Assert(unity != null, "unity != null"); - string storePath = Path.GetFullPath(Path.Combine(Path.Combine(Application.dataPath, ".."), buildDirectory)); - string solutionProjectPath = Path.GetFullPath(Path.Combine(storePath, productName + @".sln")); - - // Bug in Unity editor that doesn't copy project.json and project.lock.json files correctly if solutionProjectPath is not in a folder named UWP. - if (!File.Exists(storePath + "\\project.json")) - { - File.Copy(unity + @"\Data\PlaybackEngines\MetroSupport\Tools\project.json", - storePath + "\\project.json"); - } - - string nugetPath = Path.Combine(unity, @"Data\PlaybackEngines\MetroSupport\Tools\NuGet.exe"); - string assemblyCSharp = storePath + "/GeneratedProjects/UWP/Assembly-CSharp"; - string assemblyCSharpFirstPass = storePath + "/GeneratedProjects/UWP/Assembly-CSharp-firstpass"; - bool restoreFirstPass = Directory.Exists(assemblyCSharpFirstPass); - - // Before building, need to run a nuget restore to generate a json.lock file. Failing to do - // this breaks the build in VS RTM - if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.WinRTDotNET && - (!RestoreNugetPackages(nugetPath, storePath) || - !RestoreNugetPackages(nugetPath, storePath + "\\" + productName) || - !RestoreNugetPackages(nugetPath, assemblyCSharp) || - restoreFirstPass && - !RestoreNugetPackages(nugetPath, assemblyCSharpFirstPass))) - { - Debug.LogError("Failed to restore nuget packages"); - EditorUtility.ClearProgressBar(); - return false; - } - - EditorUtility.DisplayProgressBar("Build AppX", "Building AppX Package...", 25); - - // Ensure that the generated .appx version increments by modifying - // Package.appxmanifest - if (incrementVersion) - { - IncrementPackageVersion(); - } - - // Now do the actual build - var pInfo = new ProcessStartInfo - { - FileName = msBuildPath, - CreateNoWindow = false, - Arguments = string.Format("\"{0}\" /t:{1} /p:Configuration={2} /p:Platform={3} /verbosity:m", - solutionProjectPath, - forceRebuildAppx ? "Rebuild" : "Build", - buildConfig, - buildPlatform) - }; - - // Uncomment out to debug by copying into command window - //Debug.Log("\"" + vs + "\"" + " " + pInfo.Arguments); - - var process = new Process {StartInfo = pInfo}; - - try - { - if (!process.Start()) - { - Debug.LogError("Failed to start Cmd process!"); - EditorUtility.ClearProgressBar(); - return false; - } - - process.WaitForExit(); - - EditorUtility.ClearProgressBar(); - - if (process.ExitCode == 0 && - showDialog && - !EditorUtility.DisplayDialog("Build AppX", "AppX Build Successful!", "OK", "Open AppX Folder")) - { - Process.Start("explorer.exe", - "/f /open," + Path.GetFullPath(BuildDeployPrefs.BuildDirectory + "/" + - PlayerSettings.productName + "/AppPackages")); - } - - if (process.ExitCode != 0) - { - Debug.LogError("MSBuild error (code = " + process.ExitCode + ")"); - EditorUtility.DisplayDialog(PlayerSettings.productName + " build Failed!", - "Failed to build appx from solution. Error code: " + process.ExitCode, "OK"); - return false; - } - - process.Close(); - process.Dispose(); - } - catch (Exception e) - { - Debug.LogError("Cmd Process EXCEPTION: " + e); - EditorUtility.ClearProgressBar(); - return false; - } - - return true; - } - - private static void IncrementPackageVersion() - { - // Find the manifest, assume the one we want is the first one - string[] manifests = Directory.GetFiles(BuildDeployPrefs.AbsoluteBuildDirectory, "Package.appxmanifest", - SearchOption.AllDirectories); - - if (manifests.Length == 0) - { - Debug.LogError("Unable to find Package.appxmanifest file for build (in path - " + - BuildDeployPrefs.AbsoluteBuildDirectory + ")"); - return; - } - - string manifest = manifests[0]; - var rootNode = XElement.Load(manifest); - var identityNode = rootNode.Element(rootNode.GetDefaultNamespace() + "Identity"); - - if (identityNode == null) - { - Debug.LogError("Package.appxmanifest for build (in path - " + BuildDeployPrefs.AbsoluteBuildDirectory + - ") is missing an node"); - return; - } - - // We use XName.Get instead of string -> XName implicit conversion because - // when we pass in the string "Version", the program doesn't find the attribute. - // Best guess as to why this happens is that implicit string conversion doesn't set the namespace to empty - var versionAttr = identityNode.Attribute(XName.Get("Version")); - - if (versionAttr == null) - { - Debug.LogError("Package.appxmanifest for build (in path - " + BuildDeployPrefs.AbsoluteBuildDirectory + - ") is missing a version attribute in the node."); - return; - } - - // Assume package version always has a '.' between each number. - // According to https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx - // Package versions are always of the form Major.Minor.Build.Revision. - // Note: Revision number reserved for Windows Store, and a value other than 0 will fail WACK. - var version = PlayerSettings.WSA.packageVersion; - var newVersion = new Version(version.Major, version.Minor, version.Build + 1, version.Revision); - - PlayerSettings.WSA.packageVersion = newVersion; - versionAttr.Value = newVersion.ToString(); - rootNode.Save(manifest); - } - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployTools.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployTools.cs.meta deleted file mode 100644 index 25928f31..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployTools.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bc185db46b00c9840b977f9e46183160 -timeCreated: 1466615028 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployWindow.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployWindow.cs deleted file mode 100644 index de794a88..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployWindow.cs +++ /dev/null @@ -1,1501 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Copyright (c) Rafael Rivera. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Xml; -using UnityEditor; -using UnityEngine; -using Debug = UnityEngine.Debug; - -namespace HoloToolkit.Unity -{ - /// - /// Build window - supports SLN creation, APPX from SLN, Deploy on device, and misc helper utilities associated with the build/deploy/test iteration loop - /// Requires the device to be set in developer mode and to have secure connections disabled (in the security tab in the device portal) - /// - public class BuildDeployWindow : EditorWindow - { - private const float UpdateBuildsPeriod = 1.0f; - - private const string SdkVersion = -#if UNITY_2017_2_OR_NEWER - "10.0.16299.0"; -#else - "10.0.15063.0"; -#endif - - private readonly string[] tabNames = { "Unity Build Options", "Appx Build Options", "Deploy Options" }; - - private readonly string[] scriptingBackendNames = { "IL2CPP", ".NET" }; - - private readonly int[] scriptingBackendEnum = { (int)ScriptingImplementation.IL2CPP, (int)ScriptingImplementation.WinRTDotNET }; - - private readonly string[] deviceNames = { "Any Device", "PC", "Mobile", "HoloLens" }; - - private readonly List builds = new List(0); - - private static readonly List appPackageDirectories = new List(0); - - #region Labels - - private readonly GUIContent buildAllThenInstallLabel = new GUIContent("Build all, then Install", "Builds the Unity Project, the APPX, then installs to the target device."); - - private readonly GUIContent buildAllLabel = new GUIContent("Build all", "Builds the Unity Project and APPX"); - - private readonly GUIContent buildDirectoryLabel = new GUIContent("Build Directory", "It's recommended to use 'UWP'"); - - private readonly GUIContent useCSharpProjectsLabel = new GUIContent("Unity C# Projects", "Generate C# Project References for debugging"); - - private readonly GUIContent autoIncrementLabel = new GUIContent("Auto Increment", "Increases Version Build Number"); - - private readonly GUIContent versionNumberLabel = new GUIContent("Version Number", "Major.Minor.Build.Revision\nNote: Revision should always be zero because it's reserved by Windows Store."); - - private readonly GUIContent pairHoloLensUsbLabel = new GUIContent("Pair HoloLens", "Pairs the USB connected HoloLens with the Build Window so you can deploy via USB"); - - private readonly GUIContent useSSLLabel = new GUIContent("Use SSL?", "Use SLL to communicate with Device Portal"); - - private readonly GUIContent addConnectionLabel = new GUIContent("+", "Add a remote connection"); - - private readonly GUIContent removeConnectionLabel = new GUIContent("-", "Remove a remote connection"); - - private readonly GUIContent ipAddressLabel = new GUIContent("IpAddress", "Note: Local Machine will install on any HoloLens connected to USB as well."); - - private readonly GUIContent doAllLabel = new GUIContent(" Do actions on all devices", "Should the build options perform actions on all the connected devices?"); - - private readonly GUIContent uninstallLabel = new GUIContent("Uninstall First", "Uninstall application before installing"); - - #endregion - - private enum BuildDeployTab - { - UnityBuildOptions, - AppxBuildOptions, - DeployOptions - } - - private enum BuildPlatformEnum - { - x86 = 1, - x64 = 2 - } - - private enum BuildConfigEnum - { - Debug = 0, - Release = 1, - Master = 2 - } - - #region Properties - - public static bool AppxInstallSucces = false; - - private static bool ShouldOpenSLNBeEnabled - { - get { return !string.IsNullOrEmpty(BuildDeployPrefs.BuildDirectory); } - } - - private static bool ShouldBuildSLNBeEnabled - { - get { return !string.IsNullOrEmpty(BuildDeployPrefs.BuildDirectory); } - } - - private static bool ShouldBuildAppxBeEnabled - { - get - { - return ShouldBuildSLNBeEnabled && - !string.IsNullOrEmpty(BuildDeployPrefs.BuildDirectory) && - !string.IsNullOrEmpty(BuildDeployPrefs.MsBuildVersion) && - !string.IsNullOrEmpty(BuildDeployPrefs.BuildConfig); - } - } - - private static bool DevicePortalConnectionEnabled - { - get { return (portalConnections.Connections.Count > 1 || IsHoloLensConnectedUsb) && !string.IsNullOrEmpty(BuildDeployPrefs.BuildDirectory); } - } - - private static bool CanInstall - { - get - { - return Directory.Exists(BuildDeployPrefs.AbsoluteBuildDirectory) && !string.IsNullOrEmpty(familyPackageName); - } - } - - private static string familyPackageName; - - private static bool IsHoloLensConnectedUsb - { - get - { - bool isConnected = false; - - if (USBDeviceListener.USBDevices != null) - { - if (USBDeviceListener.USBDevices.Any(device => device.Name.Equals("Microsoft HoloLens"))) - { - isConnected = true; - } - - SessionState.SetBool("HoloLensUsbConnected", isConnected); - } - else - { - isConnected = SessionState.GetBool("HoloLensUsbConnected", false); - } - - return isConnected; - } - } - - #endregion // Properties - - #region Fields - - private int halfWidth; - private int quarterWidth; - - private float timeLastUpdatedBuilds; - - private string[] targetIps; - private string[] windowsSdkPaths; - - private Vector2 scrollPosition; - - private BuildDeployTab currentTab = BuildDeployTab.UnityBuildOptions; - - private static bool isAppRunning; - private static int currentConnectionInfoIndex; - private static DevicePortalConnections portalConnections; - - #endregion // Fields - - #region Methods - - [MenuItem("Mixed Reality Toolkit/Build Window", false, 0)] - public static void OpenWindow() - { - // Dock it next to the Scene View. - var window = GetWindow(typeof(SceneView)); - window.titleContent = new GUIContent("Build Window"); - window.Show(); - } - - private void OnEnable() - { - Setup(); - } - - private void Setup() - { - titleContent = new GUIContent("Build Window"); - minSize = new Vector2(512, 256); - - windowsSdkPaths = Directory.GetDirectories(@"C:\Program Files (x86)\Windows Kits\10\Lib"); - - for (int i = 0; i < windowsSdkPaths.Length; i++) - { - windowsSdkPaths[i] = windowsSdkPaths[i].Substring(windowsSdkPaths[i].LastIndexOf(@"\", StringComparison.Ordinal) + 1); - } - - UpdateBuilds(); - - portalConnections = JsonUtility.FromJson(BuildDeployPrefs.DevicePortalConnections); - UpdatePortalConnections(); - } - - private void OnGUI() - { - quarterWidth = Screen.width / 4; - halfWidth = Screen.width / 2; - - #region Quick Options - - if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.WSAPlayer) - { - EditorGUILayout.HelpBox("Build window only available for UWP build target.", MessageType.Warning); - GUILayout.BeginVertical(); - GUILayout.Space(5); - EditorGUILayout.BeginHorizontal(); - - // Build directory (and save setting, if it's changed) - string curBuildDirectory = BuildDeployPrefs.BuildDirectory; - EditorGUILayout.LabelField(buildDirectoryLabel, GUILayout.Width(96)); - string newBuildDirectory = EditorGUILayout.TextField( - curBuildDirectory, - GUILayout.Width(64), GUILayout.ExpandWidth(true)); - - if (newBuildDirectory != curBuildDirectory) - { - BuildDeployPrefs.BuildDirectory = newBuildDirectory; - } - - GUI.enabled = Directory.Exists(BuildDeployPrefs.AbsoluteBuildDirectory); - - if (GUILayout.Button("Open Build Directory", GUILayout.Width(quarterWidth))) - { - EditorApplication.delayCall += () => Process.Start(BuildDeployPrefs.AbsoluteBuildDirectory); - } - - GUI.enabled = true; - - if (GUILayout.Button("Open Player Settings", GUILayout.Width(quarterWidth))) - { - EditorApplication.ExecuteMenuItem("Edit/Project Settings/Player"); - } - - EditorGUILayout.EndHorizontal(); - GUILayout.EndVertical(); - return; - } - - GUILayout.BeginVertical(); - GUILayout.Space(5); - GUILayout.Label("Quick Options"); - EditorGUILayout.BeginHorizontal(); - - EditorUserBuildSettings.wsaSubtarget = (WSASubtarget)EditorGUILayout.Popup((int)EditorUserBuildSettings.wsaSubtarget, deviceNames); - - GUI.enabled = ShouldBuildSLNBeEnabled; - bool canInstall = CanInstall; - - // Build & Run button... - if (GUILayout.Button(CanInstall - ? buildAllThenInstallLabel - : buildAllLabel, - GUILayout.Width(halfWidth - 20))) - { - EditorApplication.delayCall += () => { BuildAll(canInstall); }; - } - - GUI.enabled = true; - - if (GUILayout.Button("Open Player Settings", GUILayout.Width(quarterWidth))) - { - EditorApplication.ExecuteMenuItem("Edit/Project Settings/Player"); - } - - // If Xbox Controller support is enabled and we're targeting the HoloLens device, - // Enable the HID capability. - if (EditorUserBuildSettings.wsaSubtarget == WSASubtarget.HoloLens) - { - PlayerSettings.WSA.SetCapability( - PlayerSettings.WSACapability.HumanInterfaceDevice, - EditorPrefsUtility.GetEditorPref("Enable Xbox Controller Support", false)); - - BuildDeployPrefs.BuildPlatform = BuildPlatformEnum.x86.ToString(); - } - else - { - PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.HumanInterfaceDevice, false); - } - - EditorGUILayout.EndHorizontal(); - GUILayout.EndVertical(); - GUILayout.Space(10); - - #endregion - - currentTab = (BuildDeployTab)GUILayout.Toolbar(SessionState.GetInt("_MRTK_BuildWindow_Tab", (int)currentTab), tabNames); - SessionState.SetInt("_MRTK_BuildWindow_Tab", (int)currentTab); - - GUILayout.Space(10); - - switch (currentTab) - { - case BuildDeployTab.UnityBuildOptions: - UnityBuildGUI(); - break; - case BuildDeployTab.AppxBuildOptions: - AppxBuildGUI(); - break; - case BuildDeployTab.DeployOptions: - DeployGUI(); - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - - private void Update() - { - if (Time.realtimeSinceStartup - timeLastUpdatedBuilds > UpdateBuildsPeriod) - { - UpdateBuilds(); - } - } - - private void UnityBuildGUI() - { - GUILayout.BeginVertical(); - EditorGUILayout.BeginHorizontal(); - - // Build directory (and save setting, if it's changed) - string curBuildDirectory = BuildDeployPrefs.BuildDirectory; - EditorGUILayout.LabelField(buildDirectoryLabel, GUILayout.Width(96)); - string newBuildDirectory = EditorGUILayout.TextField( - curBuildDirectory, - GUILayout.Width(64), GUILayout.ExpandWidth(true)); - - if (newBuildDirectory != curBuildDirectory) - { - BuildDeployPrefs.BuildDirectory = newBuildDirectory; - } - - GUI.enabled = Directory.Exists(BuildDeployPrefs.AbsoluteBuildDirectory); - - if (GUILayout.Button("Open Build Directory", GUILayout.Width(halfWidth))) - { - EditorApplication.delayCall += () => Process.Start(BuildDeployPrefs.AbsoluteBuildDirectory); - } - - GUI.enabled = true; - - EditorGUILayout.EndHorizontal(); - EditorGUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - GUI.enabled = ShouldOpenSLNBeEnabled; - - if (GUILayout.Button("Open in Visual Studio", GUILayout.Width(halfWidth))) - { - // Open SLN - string slnFilename = Path.Combine(BuildDeployPrefs.BuildDirectory, PlayerSettings.productName + ".sln"); - - if (File.Exists(slnFilename)) - { - EditorApplication.delayCall += () => Process.Start(new FileInfo(slnFilename).FullName); - } - else if (EditorUtility.DisplayDialog( - "Solution Not Found", - "We couldn't find the Project's Solution. Would you like to Build the project now?", - "Yes, Build", "No")) - { - EditorApplication.delayCall += () => BuildDeployTools.BuildSLN(BuildDeployPrefs.BuildDirectory); - } - } - - - EditorGUILayout.EndHorizontal(); - EditorGUILayout.BeginHorizontal(); - - // Generate C# Project References for debugging - GUILayout.FlexibleSpace(); - var previousLabelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 105; - - EditorGUIUtility.labelWidth = previousLabelWidth; - - // Build Unity Player - GUI.enabled = ShouldBuildSLNBeEnabled; - - if (GUILayout.Button("Build Unity Project", GUILayout.Width(halfWidth))) - { - EditorApplication.delayCall += () => BuildDeployTools.BuildSLN(BuildDeployPrefs.BuildDirectory); - } - - GUI.enabled = true; - - EditorGUILayout.EndHorizontal(); - EditorGUILayout.EndVertical(); - } - - private void AppxBuildGUI() - { - GUILayout.BeginVertical(); - GUILayout.BeginHorizontal(); - - // SDK and MS Build Version(and save setting, if it's changed) - string currentSDKVersion = EditorUserBuildSettings.wsaUWPSDK; - - int currentSDKVersionIndex = -1; - - for (var i = 0; i < windowsSdkPaths.Length; i++) - { - if (string.IsNullOrEmpty(currentSDKVersion)) - { - currentSDKVersionIndex = windowsSdkPaths.Length - 1; - } - else - { - if (windowsSdkPaths[i].Equals(SdkVersion)) - { - currentSDKVersionIndex = i; - } - } - } - - EditorGUILayout.LabelField("Required SDK Version: " + SdkVersion); - - // Throw exception if user has no Windows 10 SDK installed - if (currentSDKVersionIndex < 0) - { - Debug.LogErrorFormat("Unable to find the required Windows 10 SDK Target!\n" + - "Please be sure to install the {0} SDK from Visual Studio Installer.", SdkVersion); - GUILayout.EndHorizontal(); - - EditorGUILayout.HelpBox(string.Format("Unable to find the required Windows 10 SDK Target!\n" + - "Please be sure to install the {0} SDK from Visual Studio Installer.", SdkVersion), MessageType.Error); - - GUILayout.BeginHorizontal(); - } - - var curScriptingBackend = PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA); - var newScriptingBackend = (ScriptingImplementation)EditorGUILayout.IntPopup( - "Scripting Backend", - (int)curScriptingBackend, - scriptingBackendNames, - scriptingBackendEnum, - GUILayout.Width(halfWidth)); - - if (newScriptingBackend != curScriptingBackend) - { - bool canUpdate = !Directory.Exists(BuildDeployPrefs.AbsoluteBuildDirectory); - - if (!canUpdate && - EditorUtility.DisplayDialog("Attention!", - string.Format("Build path contains project built with {0} scripting backend, while current project is using {1} scripting backend.\n\n" + - "Switching to a new scripting backend requires us to delete all the data currently in your build folder and rebuild the Unity Player!", - newScriptingBackend.ToString(), - curScriptingBackend.ToString()), - "Okay", "Cancel")) - { - Directory.Delete(BuildDeployPrefs.AbsoluteBuildDirectory, true); - } - - if (canUpdate) - { - PlayerSettings.SetScriptingBackend(BuildTargetGroup.WSA, newScriptingBackend); - } - } - - string newSDKVersion = windowsSdkPaths[currentSDKVersionIndex]; - - if (!newSDKVersion.Equals(currentSDKVersion)) - { - EditorUserBuildSettings.wsaUWPSDK = newSDKVersion; - } - - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - // Build config (and save setting, if it's changed) - string curBuildConfigString = BuildDeployPrefs.BuildConfig; - - BuildConfigEnum buildConfigOption; - if (curBuildConfigString.ToLower().Equals("master")) - { - buildConfigOption = BuildConfigEnum.Master; - } - else if (curBuildConfigString.ToLower().Equals("release")) - { - buildConfigOption = BuildConfigEnum.Release; - } - else - { - buildConfigOption = BuildConfigEnum.Debug; - } - - buildConfigOption = (BuildConfigEnum)EditorGUILayout.EnumPopup("Build Configuration", buildConfigOption, GUILayout.Width(halfWidth)); - - string buildConfigString = buildConfigOption.ToString(); - - if (buildConfigString != curBuildConfigString) - { - BuildDeployPrefs.BuildConfig = buildConfigString; - } - - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - // Build Platform (and save setting, if it's changed) - string curBuildPlatformString = BuildDeployPrefs.BuildPlatform; - var buildPlatformOption = BuildPlatformEnum.x86; - - if (curBuildPlatformString.ToLower().Equals("x86")) - { - buildPlatformOption = BuildPlatformEnum.x86; - } - else if (curBuildPlatformString.ToLower().Equals("x64")) - { - buildPlatformOption = BuildPlatformEnum.x64; - } - - buildPlatformOption = (BuildPlatformEnum)EditorGUILayout.EnumPopup("Build Platform", buildPlatformOption, GUILayout.Width(halfWidth)); - - string newBuildPlatformString; - - switch (buildPlatformOption) - { - case BuildPlatformEnum.x86: - case BuildPlatformEnum.x64: - newBuildPlatformString = buildPlatformOption.ToString(); - break; - default: - throw new ArgumentOutOfRangeException(); - } - - if (newBuildPlatformString != curBuildPlatformString) - { - BuildDeployPrefs.BuildPlatform = newBuildPlatformString; - } - - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - var previousLabelWidth = EditorGUIUtility.labelWidth; - - // Auto Increment version - EditorGUIUtility.labelWidth = 96; - bool curIncrementVersion = BuildDeployPrefs.IncrementBuildVersion; - bool newIncrementVersion = EditorGUILayout.Toggle(autoIncrementLabel, curIncrementVersion); - - // Restore previous label width - EditorGUIUtility.labelWidth = previousLabelWidth; - - if (newIncrementVersion != curIncrementVersion) - { - BuildDeployPrefs.IncrementBuildVersion = newIncrementVersion; - } - - EditorGUILayout.LabelField(versionNumberLabel, GUILayout.Width(96)); - Vector3 newVersion = Vector3.zero; - - EditorGUI.BeginChangeCheck(); - - newVersion.x = EditorGUILayout.IntField(PlayerSettings.WSA.packageVersion.Major, GUILayout.Width(quarterWidth / 2 - 3)); - newVersion.y = EditorGUILayout.IntField(PlayerSettings.WSA.packageVersion.Minor, GUILayout.Width(quarterWidth / 2 - 3)); - newVersion.z = EditorGUILayout.IntField(PlayerSettings.WSA.packageVersion.Build, GUILayout.Width(quarterWidth / 2 - 3)); - - if (EditorGUI.EndChangeCheck()) - { - PlayerSettings.WSA.packageVersion = new Version((int)newVersion.x, (int)newVersion.y, (int)newVersion.z, 0); - } - - GUI.enabled = false; - EditorGUILayout.IntField(PlayerSettings.WSA.packageVersion.Revision, GUILayout.Width(quarterWidth / 2 - 3)); - GUI.enabled = true; - - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - // Force rebuild - previousLabelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 50; - bool curForceRebuildAppx = BuildDeployPrefs.ForceRebuild; - bool newForceRebuildAppx = EditorGUILayout.Toggle("Rebuild", curForceRebuildAppx); - - if (newForceRebuildAppx != curForceRebuildAppx) - { - BuildDeployPrefs.ForceRebuild = newForceRebuildAppx; - } - - // Restore previous label width - EditorGUIUtility.labelWidth = previousLabelWidth; - - // Build APPX - GUI.enabled = ShouldBuildAppxBeEnabled; - - if (GUILayout.Button("Build APPX", GUILayout.Width(halfWidth))) - { - // Check if SLN exists - string slnFilename = Path.Combine(BuildDeployPrefs.BuildDirectory, PlayerSettings.productName + ".sln"); - - if (File.Exists(slnFilename)) - { - // Build APPX - EditorApplication.delayCall += () => - { - BuildDeployTools.BuildAppxFromSLN( - PlayerSettings.productName, - BuildDeployTools.DefaultMSBuildVersion, - BuildDeployPrefs.ForceRebuild, - BuildDeployPrefs.BuildConfig, - BuildDeployPrefs.BuildPlatform, - BuildDeployPrefs.BuildDirectory, - BuildDeployPrefs.IncrementBuildVersion); - }; - } - else if (EditorUtility.DisplayDialog("Solution Not Found", "We couldn't find the solution. Would you like to Build it?", "Yes, Build", "No")) - { - // Build SLN then APPX - EditorApplication.delayCall += () => BuildAll(install: false); - } - - GUI.enabled = true; - } - - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - // Open AppX packages location - string appxBuildPath = Path.GetFullPath(BuildDeployPrefs.BuildDirectory + "/" + PlayerSettings.productName + "/AppPackages"); - GUI.enabled = builds.Count > 0 && !string.IsNullOrEmpty(appxBuildPath); - - if (GUILayout.Button("Open APPX Packages Location", GUILayout.Width(halfWidth))) - { - EditorApplication.delayCall += () => Process.Start("explorer.exe", "/f /open," + appxBuildPath); - } - - GUI.enabled = true; - - GUILayout.EndHorizontal(); - GUILayout.EndVertical(); - } - - private void DeployGUI() - { - Debug.Assert(portalConnections.Connections.Count != 0); - Debug.Assert(currentConnectionInfoIndex >= 0); - - GUILayout.BeginVertical(); - EditorGUI.BeginChangeCheck(); - GUILayout.BeginHorizontal(); - - // Launch app... - GUI.enabled = IsHoloLensConnectedUsb; - - if (GUILayout.Button(pairHoloLensUsbLabel, GUILayout.Width(quarterWidth))) - { - EditorApplication.delayCall += () => - { - var newConnection = default(ConnectInfo); - - foreach (var targetDevice in portalConnections.Connections) - { - if (!IsLocalConnection(targetDevice)) - { - continue; - } - - var machineName = BuildDeployPortal.GetMachineName(targetDevice); - var networkInfo = BuildDeployPortal.GetNetworkInfo(targetDevice); - - if (networkInfo != null) - { - var newIps = new List(); - foreach (var adapter in networkInfo.Adapters) - { - newIps.AddRange(from address in adapter.IpAddresses where !address.IpAddress.Contains("0.0.0.0") select address.IpAddress); - } - - if (newIps.Count == 0) - { - Debug.LogWarning("This HoloLens is not connected to any networks and cannot be paired."); - } - - foreach (var ip in newIps) - { - if (portalConnections.Connections.Any(connection => connection.IP == ip)) - { - Debug.LogFormat("Already paired"); - continue; - } - - newConnection.IP = ip; - newConnection.User = targetDevice.User; - newConnection.Password = targetDevice.Password; - - if (machineName != null) - { - newConnection.MachineName = machineName.ComputerName; - } - } - } - } - - if (IsValidIpAddress(newConnection.IP)) - { - portalConnections.Connections.Add(newConnection); - for (var i = 0; i < portalConnections.Connections.Count; i++) - { - if (portalConnections.Connections[i].IP == newConnection.IP) - { - currentConnectionInfoIndex = i; - SessionState.SetInt("_MRTK_BuildWindow_CurrentDeviceIndex", currentConnectionInfoIndex); - break; - } - } - - UpdatePortalConnections(); - } - }; - } - - GUI.enabled = true; - - GUILayout.FlexibleSpace(); - - var previousLabelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 64; - bool useSSL = EditorGUILayout.Toggle(useSSLLabel, BuildDeployPrefs.UseSSL); - EditorGUIUtility.labelWidth = previousLabelWidth; - - currentConnectionInfoIndex = EditorGUILayout.Popup( - SessionState.GetInt("_MRTK_BuildWindow_CurrentDeviceIndex", 0), targetIps, GUILayout.Width(halfWidth - 48)); - - var currentConnection = portalConnections.Connections[currentConnectionInfoIndex]; - - bool currentConnectionIsLocal = IsLocalConnection(currentConnection); - - if (currentConnectionIsLocal) - { - currentConnection.MachineName = "Local Machine"; - } - - GUI.enabled = IsValidIpAddress(currentConnection.IP); - - if (GUILayout.Button(addConnectionLabel, GUILayout.Width(20))) - { - portalConnections.Connections.Add(new ConnectInfo("0.0.0.0", currentConnection.User, currentConnection.Password)); - currentConnectionInfoIndex++; - currentConnection = portalConnections.Connections[currentConnectionInfoIndex]; - UpdatePortalConnections(); - } - - GUI.enabled = portalConnections.Connections.Count > 1 && currentConnectionInfoIndex != 0; - - if (GUILayout.Button(removeConnectionLabel, GUILayout.Width(20))) - { - portalConnections.Connections.RemoveAt(currentConnectionInfoIndex); - currentConnectionInfoIndex--; - currentConnection = portalConnections.Connections[currentConnectionInfoIndex]; - UpdatePortalConnections(); - } - - GUI.enabled = true; - - GUILayout.EndHorizontal(); - GUILayout.Space(5); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - GUILayout.Label(currentConnection.MachineName, GUILayout.Width(halfWidth)); - - GUILayout.EndHorizontal(); - - previousLabelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 64; - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - GUI.enabled = !currentConnectionIsLocal; - currentConnection.IP = EditorGUILayout.TextField( - ipAddressLabel, - currentConnection.IP, - GUILayout.Width(halfWidth)); - GUI.enabled = true; - - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - currentConnection.User = EditorGUILayout.TextField("Username", currentConnection.User, GUILayout.Width(halfWidth)); - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - currentConnection.Password = EditorGUILayout.PasswordField("Password", currentConnection.Password, GUILayout.Width(halfWidth)); - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - - EditorGUIUtility.labelWidth = 152; - - bool processAll = EditorGUILayout.Toggle( - doAllLabel, - BuildDeployPrefs.TargetAllConnections, - GUILayout.Width(176)); - - EditorGUIUtility.labelWidth = 86; - - bool fullReinstall = EditorGUILayout.Toggle( - uninstallLabel, - BuildDeployPrefs.FullReinstall, - GUILayout.ExpandWidth(false)); - EditorGUIUtility.labelWidth = previousLabelWidth; - - if (EditorGUI.EndChangeCheck()) - { - SessionState.SetInt("_MRTK_BuildWindow_CurrentDeviceIndex", currentConnectionInfoIndex); - BuildDeployPrefs.TargetAllConnections = processAll; - BuildDeployPrefs.FullReinstall = fullReinstall; - BuildDeployPrefs.UseSSL = useSSL; - - // Format our local connection - if (currentConnection.IP.Contains("127.0.0.1")) - { - currentConnection.IP = "Local Machine"; - } - - portalConnections.Connections[currentConnectionInfoIndex] = currentConnection; - UpdatePortalConnections(); - Repaint(); - } - - GUILayout.FlexibleSpace(); - - // Connect - if (!IsLocalConnection(currentConnection)) - { - GUI.enabled = IsValidIpAddress(currentConnection.IP) && IsCredentialsValid(currentConnection); - - if (GUILayout.Button("Connect", GUILayout.Width(quarterWidth))) - { - EditorApplication.delayCall += () => - { - var machineName = BuildDeployPortal.GetMachineName(currentConnection); - - if (machineName != null) - { - currentConnection.MachineName = machineName.ComputerName; - } - - portalConnections.Connections[currentConnectionInfoIndex] = currentConnection; - UpdatePortalConnections(); - Repaint(); - }; - } - - GUI.enabled = true; - } - - GUI.enabled = DevicePortalConnectionEnabled && CanInstall; - - // Open web portal - if (GUILayout.Button("Open Device Portal", GUILayout.Width(quarterWidth))) - { - EditorApplication.delayCall += () => OpenDevicePortal(portalConnections); - } - - GUI.enabled = true; - - GUILayout.EndHorizontal(); - - // Build list - if (builds.Count == 0) - { - GUILayout.Label("*** No builds found in build directory", EditorStyles.boldLabel); - } - else - { - EditorGUILayout.Separator(); - GUILayout.BeginVertical(GUILayout.ExpandHeight(true)); - scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); - - foreach (var fullBuildLocation in builds) - { - int lastBackslashIndex = fullBuildLocation.LastIndexOf("\\", StringComparison.Ordinal); - - var directoryDate = Directory.GetLastWriteTime(fullBuildLocation).ToString("yyyy/MM/dd HH:mm:ss"); - string packageName = fullBuildLocation.Substring(lastBackslashIndex + 1); - - GUILayout.Space(2); - EditorGUILayout.BeginHorizontal(); - GUILayout.Space(12); - - GUI.enabled = CanInstall; - if (GUILayout.Button("Install", GUILayout.Width(96))) - { - EditorApplication.delayCall += () => - { - if (processAll) - { - InstallAppOnDevicesList(fullBuildLocation, portalConnections); - } - else - { - InstallOnTargetDevice(fullBuildLocation, currentConnection); - } - }; - } - - GUI.enabled = true; - - // Uninstall... - GUI.enabled = CanInstall; - - if (GUILayout.Button("Uninstall", GUILayout.Width(96))) - { - EditorApplication.delayCall += () => - { - if (processAll) - { - UninstallAppOnDevicesList(portalConnections); - } - else - { - UninstallAppOnTargetDevice(familyPackageName, currentConnection); - } - }; - } - - GUI.enabled = true; - - bool canLaunchLocal = currentConnectionInfoIndex == 0 && IsHoloLensConnectedUsb; - bool canLaunchRemote = DevicePortalConnectionEnabled && CanInstall && currentConnectionInfoIndex != 0; - - // Launch app... - GUI.enabled = canLaunchLocal || canLaunchRemote; - - if (GUILayout.Button(new GUIContent(isAppRunning ? "Kill App" : "Launch App", "These are remote commands only"), GUILayout.Width(96))) - { - EditorApplication.delayCall += () => - { - if (isAppRunning) - { - if (processAll) - { - KillAppOnDeviceList(portalConnections); - isAppRunning = false; - } - else - { - isAppRunning = !KillAppOnTargetDevice(currentConnection); - } - } - else - { - if (processAll) - { - LaunchAppOnDeviceList(portalConnections); - isAppRunning = true; - } - else - { - isAppRunning = LaunchAppOnTargetDevice(currentConnection); - } - } - }; - } - - GUI.enabled = true; - - // Log file - string localLogPath = string.Format("%USERPROFILE%\\AppData\\Local\\Packages\\{0}\\TempState\\UnityPlayer.log", PlayerSettings.productName); - bool localLogExists = File.Exists(localLogPath); - - GUI.enabled = localLogExists || canLaunchRemote || canLaunchLocal; - - if (GUILayout.Button("View Log", GUILayout.Width(96))) - { - EditorApplication.delayCall += () => - { - if (processAll) - { - OpenLogFilesOnDeviceList(portalConnections, localLogPath); - } - else - { - OpenLogFileForTargetDevice(currentConnection, localLogPath); - } - }; - } - - GUI.enabled = true; - - GUILayout.Space(8); - GUILayout.Label(new GUIContent(packageName + " (" + directoryDate + ")")); - EditorGUILayout.EndHorizontal(); - } - - GUILayout.EndScrollView(); - GUILayout.EndVertical(); - } - - GUILayout.EndVertical(); - } - - #endregion // Methods - - #region Utilities - - private void BuildAll(bool install = true) - { - // First build SLN - if (!BuildDeployTools.BuildSLN(BuildDeployPrefs.BuildDirectory, false)) - { - return; - } - - // Next, APPX - if (!BuildDeployTools.BuildAppxFromSLN( - PlayerSettings.productName, - BuildDeployPrefs.MsBuildVersion, - BuildDeployPrefs.ForceRebuild, - BuildDeployPrefs.BuildConfig, - BuildDeployPrefs.BuildPlatform, - BuildDeployPrefs.BuildDirectory, - BuildDeployPrefs.IncrementBuildVersion, - showDialog: !install)) - { - return; - } - - // Next, Install - if (install) - { - string fullBuildLocation = CalcMostRecentBuild(); - - if (BuildDeployPrefs.TargetAllConnections) - { - InstallAppOnDevicesList(fullBuildLocation, portalConnections); - } - else - { - InstallOnTargetDevice(fullBuildLocation, portalConnections.Connections[currentConnectionInfoIndex]); - } - } - } - - private void UpdateBuilds() - { - builds.Clear(); - - try - { - appPackageDirectories.Clear(); - string[] buildList = Directory.GetDirectories(BuildDeployPrefs.AbsoluteBuildDirectory, "*", SearchOption.AllDirectories); - foreach (string appBuild in buildList) - { - if (appBuild.Contains("AppPackages") && !appBuild.Contains("AppPackages\\")) - { - appPackageDirectories.AddRange(Directory.GetDirectories(appBuild)); - } - } - - IEnumerable selectedDirectories = - from string directory in appPackageDirectories - orderby Directory.GetLastWriteTime(directory) descending - select Path.GetFullPath(directory); - builds.AddRange(selectedDirectories); - } - catch (DirectoryNotFoundException) - { - // unused - } - - familyPackageName = CalcPackageFamilyName(); - - timeLastUpdatedBuilds = Time.realtimeSinceStartup; - } - - private string CalcMostRecentBuild() - { - UpdateBuilds(); - DateTime mostRecent = DateTime.MinValue; - string mostRecentBuild = string.Empty; - - foreach (var fullBuildLocation in builds) - { - DateTime directoryDate = Directory.GetLastWriteTime(fullBuildLocation); - - if (directoryDate > mostRecent) - { - mostRecentBuild = fullBuildLocation; - mostRecent = directoryDate; - } - } - - return mostRecentBuild; - } - - 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++) - { - targetIps[i] = portalConnections.Connections[i].MachineName; - } - - BuildDeployPrefs.DevicePortalConnections = JsonUtility.ToJson(portalConnections); - Repaint(); - } - - private static bool IsLocalConnection(ConnectInfo connection) - { - return connection.IP.Contains("Local Machine") || connection.IP.Contains("127.0.0.1"); - } - - private static bool IsCredentialsValid(ConnectInfo connection) - { - return !string.IsNullOrEmpty(connection.User) && !string.IsNullOrEmpty(connection.IP); - } - - private static bool IsValidIpAddress(string ip) - { - if (string.IsNullOrEmpty(ip)) - { - return false; - } - - if (ip.Contains("Local Machine")) - { - return true; - } - - if (ip.Contains("0.0.0.0")) - { - return false; - } - - var subAddresses = ip.Split('.'); - return subAddresses.Length > 3; - } - - private static string CalcPackageFamilyName() - { - if (appPackageDirectories.Count == 0) - { - return string.Empty; - } - - // Find the manifest - string[] manifests = Directory.GetFiles(BuildDeployPrefs.AbsoluteBuildDirectory, "Package.appxmanifest", SearchOption.AllDirectories); - - if (manifests.Length == 0) - { - Debug.LogError("Unable to find manifest file for build (in path - " + BuildDeployPrefs.AbsoluteBuildDirectory + ")"); - return string.Empty; - } - - string manifest = manifests[0]; - - // Parse it - using (var reader = new XmlTextReader(manifest)) - { - while (reader.Read()) - { - switch (reader.NodeType) - { - case XmlNodeType.Element: - if (reader.Name.Equals("identity", StringComparison.OrdinalIgnoreCase)) - { - while (reader.MoveToNextAttribute()) - { - if (reader.Name.Equals("name", StringComparison.OrdinalIgnoreCase)) - { - return reader.Value; - } - } - } - - break; - } - } - } - - Debug.LogError("Unable to find PackageFamilyName in manifest file (" + manifest + ")"); - return string.Empty; - } - - #endregion - - #region Device Portal Commands - - private static void OpenDevicePortal(DevicePortalConnections targetDevices) - { - MachineName usbMachine = null; - - if (IsHoloLensConnectedUsb) - { - usbMachine = BuildDeployPortal.GetMachineName(targetDevices.Connections.FirstOrDefault(targetDevice => targetDevice.IP.Contains("Local Machine"))); - } - - for (int i = 0; i < targetDevices.Connections.Count; i++) - { - bool isLocalMachine = IsLocalConnection(targetDevices.Connections[i]); - - if (isLocalMachine && !IsHoloLensConnectedUsb) - { - continue; - } - - if (IsHoloLensConnectedUsb) - { - if (isLocalMachine || usbMachine != null && usbMachine.ComputerName != targetDevices.Connections[i].MachineName) - { - BuildDeployPortal.OpenWebPortal(targetDevices.Connections[i]); - } - } - else - { - if (!isLocalMachine) - { - BuildDeployPortal.OpenWebPortal(targetDevices.Connections[i]); - } - } - } - } - - public static void InstallOnTargetDevice(string buildPath, ConnectInfo targetDevice) - { - isAppRunning = false; - - string packageFamilyName = CalcPackageFamilyName(); - - if (string.IsNullOrEmpty(packageFamilyName)) - { - return; - } - - if (IsLocalConnection(targetDevice) && !IsHoloLensConnectedUsb || buildPath.Contains("x64")) - { - FileInfo[] installerFiles = new DirectoryInfo(buildPath).GetFiles("*.ps1"); - if (installerFiles.Length == 1) - { - var pInfo = new ProcessStartInfo - { - FileName = "powershell.exe", - CreateNoWindow = false, - Arguments = string.Format("-executionpolicy bypass -File \"{0}\"", installerFiles[0].FullName) - }; - - var process = new Process { StartInfo = pInfo }; - - process.Start(); - } - - return; - } - - if (buildPath.Contains("x64")) - { - return; - } - - // Get the appx path - FileInfo[] files = new DirectoryInfo(buildPath).GetFiles("*.appx"); - files = files.Length == 0 ? new DirectoryInfo(buildPath).GetFiles("*.appxbundle") : files; - - if (files.Length == 0) - { - Debug.LogErrorFormat("No APPX found in folder build folder ({0})", buildPath); - return; - } - - BuildDeployPortal.IsAppInstalled(packageFamilyName, targetDevice); - - // Kick off the install - if (BuildDeployPortal.InstallApp(files[0].FullName, targetDevice)) - { - AppxInstallSucces = true; - } - } - - private static void InstallAppOnDevicesList(string buildPath, DevicePortalConnections targetList) - { - string packageFamilyName = CalcPackageFamilyName(); - - if (string.IsNullOrEmpty(packageFamilyName)) - { - return; - } - - if (BuildDeployPrefs.FullReinstall) - { - UninstallAppOnDevicesList(targetList); - } - - try - { - for (int i = 0; i < targetList.Connections.Count; i++) - { - EditorUtility.DisplayProgressBar("Installing on devices", - string.Format("Installing on {0}", targetList.Connections[i].MachineName), - i / (float)targetList.Connections.Count); - - InstallOnTargetDevice(buildPath, targetList.Connections[i]); - } - } - catch (Exception e) - { - Debug.LogError(e.Message); - } - - EditorUtility.ClearProgressBar(); - } - - private static void UninstallAppOnTargetDevice(string packageFamilyName, ConnectInfo currentConnection, bool showDialog = true) - { - isAppRunning = false; - - if (IsLocalConnection(currentConnection) && !IsHoloLensConnectedUsb) - { - var pInfo = new ProcessStartInfo - { - FileName = "powershell.exe", - CreateNoWindow = true, - Arguments = string.Format("-windowstyle hidden -nologo Get-AppxPackage *{0}* | Remove-AppxPackage", packageFamilyName) - }; - - var process = new Process { StartInfo = pInfo }; - process.Start(); - } - else - { - if (BuildDeployPortal.IsAppInstalled(packageFamilyName, currentConnection)) - { - BuildDeployPortal.UninstallApp(packageFamilyName, currentConnection, showDialog); - } - } - } - - private static void UninstallAppOnDevicesList(DevicePortalConnections targetList) - { - string packageFamilyName = CalcPackageFamilyName(); - - if (string.IsNullOrEmpty(packageFamilyName)) - { - return; - } - - try - { - for (int i = 0; i < targetList.Connections.Count; i++) - { - EditorUtility.DisplayProgressBar("Uninstalling on devices", string.Format("Uninstalling ({0})", targetList.Connections[i].IP), i / (float)targetList.Connections.Count); - UninstallAppOnTargetDevice(packageFamilyName, targetList.Connections[i], false); - } - } - catch (Exception e) - { - Debug.LogError(e.ToString()); - } - - EditorUtility.ClearProgressBar(); - } - - private static bool LaunchAppOnTargetDevice(ConnectInfo targetDevice, bool showDialog = true) - { - string packageFamilyName = CalcPackageFamilyName(); - - if (string.IsNullOrEmpty(packageFamilyName)) - { - return false; - } - - if (IsLocalConnection(targetDevice) && !IsHoloLensConnectedUsb) - { - return false; - } - - if (showDialog) - { - EditorUtility.DisplayProgressBar("Launching Application", string.Format("Launching {0} on {1}", packageFamilyName, targetDevice.MachineName), 0.25f); - } - - bool success = !BuildDeployPortal.IsAppRunning(PlayerSettings.productName, targetDevice) && - BuildDeployPortal.LaunchApp(packageFamilyName, targetDevice, false); - - if (showDialog) - { - EditorUtility.ClearProgressBar(); - } - - return success; - } - - private static void LaunchAppOnDeviceList(DevicePortalConnections targetDevices) - { - for (int i = 0; i < targetDevices.Connections.Count; i++) - { - EditorUtility.DisplayProgressBar("Launching App on devices", - string.Format("Launching on {0}", targetDevices.Connections[i].IP), - i / (float)targetDevices.Connections.Count); - - LaunchAppOnTargetDevice(targetDevices.Connections[i], false); - } - } - - private static bool KillAppOnTargetDevice(ConnectInfo targetDevice, bool showDialog = true) - { - string packageFamilyName = CalcPackageFamilyName(); - - if (string.IsNullOrEmpty(packageFamilyName)) - { - return false; - } - - if (IsLocalConnection(targetDevice) && !IsHoloLensConnectedUsb) - { - return false; - } - - if (showDialog) - { - EditorUtility.DisplayProgressBar("Stopping Application", string.Format("Stopping {0} on {1}", packageFamilyName, targetDevice.MachineName), 0.5f); - } - - bool success = BuildDeployPortal.IsAppRunning(PlayerSettings.productName, targetDevice) && - BuildDeployPortal.KillApp(packageFamilyName, targetDevice, false); - - if (showDialog) - { - EditorUtility.ClearProgressBar(); - } - - return success; - } - - private static void KillAppOnDeviceList(DevicePortalConnections targetDevices) - { - for (int i = 0; i < targetDevices.Connections.Count; i++) - { - EditorUtility.DisplayProgressBar("Stopping Application on devices", - string.Format("Stopping on {0}", targetDevices.Connections[i].MachineName), - i / (float)targetDevices.Connections.Count); - KillAppOnTargetDevice(targetDevices.Connections[i], false); - } - } - - private static void OpenLogFileForTargetDevice(ConnectInfo targetDevice, string localLogPath) - { - string packageFamilyName = CalcPackageFamilyName(); - - if (string.IsNullOrEmpty(packageFamilyName)) - { - return; - } - - if (IsLocalConnection(targetDevice) && File.Exists(localLogPath)) - { - Process.Start(localLogPath); - return; - } - - if (!IsLocalConnection(targetDevice) || IsHoloLensConnectedUsb) - { - BuildDeployPortal.DeviceLogFile_View(packageFamilyName, targetDevice); - return; - } - - Debug.Log("No Log Found"); - } - - private static void OpenLogFilesOnDeviceList(DevicePortalConnections targetDevices, string localLogPath) - { - for (int i = 0; i < targetDevices.Connections.Count; i++) - { - OpenLogFileForTargetDevice(targetDevices.Connections[i], localLogPath); - } - } - - #endregion - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployWindow.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployWindow.cs.meta deleted file mode 100644 index 07864ba7..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildDeployWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6d8b4a3eedcdf774bbc71cc2a08da79f -timeCreated: 1466615027 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildInfo.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildInfo.cs deleted file mode 100644 index e3660c90..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildInfo.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; - -namespace HoloToolkit.Unity -{ - public class BuildInfo - { - public string OutputDirectory { get; set; } - - public IEnumerable Scenes { get; set; } - - public IEnumerable CopyDirectories { get; set; } - - public Action PreBuildAction { get; set; } - - public Action PostBuildAction { get; set; } - - public BuildOptions BuildOptions { get; set; } - - public BuildTarget BuildTarget { get; set; } - - public WSASDK? WSASdk { get; set; } - - public string WSAUwpSdk { get; set; } - - public WSAUWPBuildType? WSAUWPBuildType { get; set; } - - public bool? WSAGenerateReferenceProjects { get; set; } - - public ColorSpace? ColorSpace { get; set; } - - public bool IsCommandLine { get; set; } - - public string BuildSymbols { get; private set; } - - public BuildInfo() - { - BuildSymbols = string.Empty; - } - - public void AppendSymbols(params string[] symbol) - { - AppendSymbols((IEnumerable)symbol); - } - - public void AppendSymbols(IEnumerable symbols) - { - string[] toAdd = symbols.Except(BuildSymbols.Split(';')) - .Where(sym => !string.IsNullOrEmpty(sym)).ToArray(); - - if (!toAdd.Any()) - { - return; - } - - if (!string.IsNullOrEmpty(BuildSymbols)) - { - BuildSymbols += ";"; - } - - BuildSymbols += string.Join(";", toAdd); - } - - public bool HasAnySymbols(params string[] symbols) - { - return BuildSymbols.Split(';').Intersect(symbols).Any(); - } - - public bool HasConfigurationSymbol() - { - return HasAnySymbols( - BuildSLNUtilities.BuildSymbolDebug, - BuildSLNUtilities.BuildSymbolRelease, - BuildSLNUtilities.BuildSymbolMaster); - } - - public static IEnumerable RemoveConfigurationSymbols(string symbols) - { - return symbols.Split(';').Except(new[] - { - BuildSLNUtilities.BuildSymbolDebug, - BuildSLNUtilities.BuildSymbolRelease, - BuildSLNUtilities.BuildSymbolMaster - }); - } - - public bool HasAnySymbols(IEnumerable symbols) - { - return BuildSymbols.Split(';').Intersect(symbols).Any(); - } - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildInfo.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildInfo.cs.meta deleted file mode 100644 index c0b97f26..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildInfo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 8641cc4d0d7648aca3b48f7d2302a094 -timeCreated: 1497140920 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildSLNUtilities.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildSLNUtilities.cs deleted file mode 100644 index f8bf80ca..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildSLNUtilities.cs +++ /dev/null @@ -1,448 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Xml; -using UnityEditor; -using UnityEngine; - -namespace HoloToolkit.Unity -{ - /// - /// Class containing various utility methods to build a WSA solution from a Unity project. - /// - public static class BuildSLNUtilities - { - /// - /// A method capable of configuring settings. - /// - /// The settings to configure. - public delegate void BuildInfoConfigurationMethod(ref BuildInfo toConfigure); - - /// - /// Add a handler to this event to override defaults before a build. - /// - /// - public static event BuildInfoConfigurationMethod OverrideBuildDefaults; - - /// - /// Call this method to give other code an opportunity to override defaults. - /// - /// >The settings to configure. - /// - public static void RaiseOverrideBuildDefaults(ref BuildInfo toConfigure) - { - if (OverrideBuildDefaults != null) - { - OverrideBuildDefaults(ref toConfigure); - } - } - - // Build configurations. Exactly one of these should be defined for any given build. - public const string BuildSymbolDebug = "DEBUG"; - public const string BuildSymbolRelease = "RELEASE"; - public const string BuildSymbolMaster = "MASTER"; - - /// - /// Event triggered when a build starts. - /// - public static event Action BuildStarted; - - /// - /// Event triggered when a build completes. - /// - public static event Action BuildCompleted; - - public static void PerformBuild(BuildInfo buildInfo) - { - BuildTargetGroup buildTargetGroup = GetGroup(buildInfo.BuildTarget); - string oldBuildSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup); - if (!string.IsNullOrEmpty(oldBuildSymbols)) - { - if (buildInfo.HasConfigurationSymbol()) - { - buildInfo.AppendSymbols(BuildInfo.RemoveConfigurationSymbols(oldBuildSymbols)); - } - else - { - buildInfo.AppendSymbols(oldBuildSymbols.Split(';')); - } - } - - if ((buildInfo.BuildOptions & BuildOptions.Development) == BuildOptions.Development) - { - if (!buildInfo.HasConfigurationSymbol()) - { - buildInfo.AppendSymbols(BuildSymbolDebug); - } - } - - if (buildInfo.HasAnySymbols(BuildSymbolDebug)) - { - buildInfo.BuildOptions |= BuildOptions.Development | BuildOptions.AllowDebugging; - } - - if (buildInfo.HasAnySymbols(BuildSymbolRelease)) - { - //Unity automatically adds the DEBUG symbol if the BuildOptions.Development flag is - //specified. In order to have debug symbols and the RELEASE symbols we have to - //inject the symbol Unity relies on to enable the /debug+ flag of csc.exe which is "DEVELOPMENT_BUILD" - buildInfo.AppendSymbols("DEVELOPMENT_BUILD"); - } - - BuildTarget oldBuildTarget = EditorUserBuildSettings.activeBuildTarget; - BuildTargetGroup oldBuildTargetGroup = GetGroup(oldBuildTarget); - - EditorUserBuildSettings.SwitchActiveBuildTarget(buildTargetGroup, buildInfo.BuildTarget); - - WSAUWPBuildType? oldWSAUWPBuildType = EditorUserBuildSettings.wsaUWPBuildType; - - if (buildInfo.WSAUWPBuildType.HasValue) - { - EditorUserBuildSettings.wsaUWPBuildType = buildInfo.WSAUWPBuildType.Value; - } - - var oldColorSpace = PlayerSettings.colorSpace; - - if (buildInfo.ColorSpace.HasValue) - { - PlayerSettings.colorSpace = buildInfo.ColorSpace.Value; - } - - if (buildInfo.BuildSymbols != null) - { - PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, buildInfo.BuildSymbols); - } - - string buildError = "Error"; - try - { - // For the WSA player, Unity builds into a target directory. - // For other players, the OutputPath parameter indicates the - // path to the target executable to build. - if (buildInfo.BuildTarget == BuildTarget.WSAPlayer) - { - Directory.CreateDirectory(buildInfo.OutputDirectory); - } - - OnPreProcessBuild(buildInfo); - buildError = BuildPipeline.BuildPlayer( - buildInfo.Scenes.ToArray(), - buildInfo.OutputDirectory, - buildInfo.BuildTarget, - buildInfo.BuildOptions).ToString(); - - if (buildError.StartsWith("Error")) - { - throw new Exception(buildError); - } - } - finally - { - OnPostProcessBuild(buildInfo, buildError); - - if (BuildTarget.WSAPlayer == buildInfo.BuildTarget) - { - UwpProjectPostProcess.Execute(buildInfo.OutputDirectory); - } - - PlayerSettings.colorSpace = oldColorSpace; - PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, oldBuildSymbols); - - if (oldWSAUWPBuildType.HasValue) - { - EditorUserBuildSettings.wsaUWPBuildType = oldWSAUWPBuildType.Value; - } - - EditorUserBuildSettings.SwitchActiveBuildTarget(oldBuildTargetGroup, oldBuildTarget); - } - } - - public static void ParseBuildCommandLine(ref BuildInfo buildInfo) - { - string[] arguments = Environment.GetCommandLineArgs(); - - buildInfo.IsCommandLine = true; - - for (int i = 0; i < arguments.Length; ++i) - { - // Can't use -buildTarget which is something Unity already takes as an argument for something. - if (string.Equals(arguments[i], "-duskBuildTarget", StringComparison.InvariantCultureIgnoreCase)) - { - buildInfo.BuildTarget = (BuildTarget)Enum.Parse(typeof(BuildTarget), arguments[++i]); - } - else if (string.Equals(arguments[i], "-wsaSDK", StringComparison.InvariantCultureIgnoreCase)) - { - string wsaSdkArg = arguments[++i]; - - buildInfo.WSASdk = (WSASDK)Enum.Parse(typeof(WSASDK), wsaSdkArg); - } - else if (string.Equals(arguments[i], "-wsaUwpSdk", StringComparison.InvariantCultureIgnoreCase)) - { - buildInfo.WSAUwpSdk = arguments[++i]; - } - else if (string.Equals(arguments[i], "-wsaUWPBuildType", StringComparison.InvariantCultureIgnoreCase)) - { - buildInfo.WSAUWPBuildType = (WSAUWPBuildType)Enum.Parse(typeof(WSAUWPBuildType), arguments[++i]); - } - else if (string.Equals(arguments[i], "-wsaGenerateReferenceProjects", StringComparison.InvariantCultureIgnoreCase)) - { - buildInfo.WSAGenerateReferenceProjects = bool.Parse(arguments[++i]); - } - else if (string.Equals(arguments[i], "-buildOutput", StringComparison.InvariantCultureIgnoreCase)) - { - buildInfo.OutputDirectory = arguments[++i]; - } - else if (string.Equals(arguments[i], "-buildDesc", StringComparison.InvariantCultureIgnoreCase)) - { - ParseBuildDescriptionFile(arguments[++i], ref buildInfo); - } - else if (string.Equals(arguments[i], "-unityBuildSymbols", StringComparison.InvariantCultureIgnoreCase)) - { - string newBuildSymbols = arguments[++i]; - buildInfo.AppendSymbols(newBuildSymbols.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); - } - } - } - - public static void PerformBuild_CommandLine() - { - var buildInfo = new BuildInfo - { - // Use scenes from the editor build settings. - Scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path), - - // Configure a post build action to throw appropriate error code. - PostBuildAction = (innerBuildInfo, buildError) => - { - if (!string.IsNullOrEmpty(buildError)) - { - EditorApplication.Exit(1); - } - } - }; - - RaiseOverrideBuildDefaults(ref buildInfo); - - ParseBuildCommandLine(ref buildInfo); - - PerformBuild(buildInfo); - } - - public static void ParseBuildDescriptionFile(string filename, ref BuildInfo buildInfo) - { - Debug.Log(string.Format(CultureInfo.InvariantCulture, "Build: Using \"{0}\" as build description", filename)); - - // Parse the XML file - var reader = new XmlTextReader(filename); - - while (reader.Read()) - { - switch (reader.NodeType) - { - case XmlNodeType.Element: - if (string.Equals(reader.Name, "SceneList", StringComparison.InvariantCultureIgnoreCase)) - { - // Set the scenes we want to build - buildInfo.Scenes = ReadSceneList(reader); - } - else if (string.Equals(reader.Name, "CopyList", StringComparison.InvariantCultureIgnoreCase)) - { - // Set the directories we want to copy - buildInfo.CopyDirectories = ReadCopyList(reader); - } - break; - } - } - } - - private static BuildTargetGroup GetGroup(BuildTarget buildTarget) - { - switch (buildTarget) - { - case BuildTarget.WSAPlayer: - return BuildTargetGroup.WSA; - case BuildTarget.StandaloneWindows: - case BuildTarget.StandaloneWindows64: - return BuildTargetGroup.Standalone; - default: - return BuildTargetGroup.Unknown; - } - } - - private static IEnumerable ReadSceneList(XmlTextReader reader) - { - var result = new List(); - while (reader.Read()) - { - switch (reader.NodeType) - { - case XmlNodeType.Element: - if (string.Equals(reader.Name, "Scene", StringComparison.InvariantCultureIgnoreCase)) - { - while (reader.MoveToNextAttribute()) - { - if (string.Equals(reader.Name, "Name", StringComparison.InvariantCultureIgnoreCase)) - { - result.Add(reader.Value); - Debug.Log(string.Format(CultureInfo.InvariantCulture, "Build: Adding scene \"{0}\"", reader.Value)); - } - } - } - break; - - case XmlNodeType.EndElement: - if (string.Equals(reader.Name, "SceneList", StringComparison.InvariantCultureIgnoreCase)) - { - return result; - } - break; - } - } - - return result; - } - - private static IEnumerable ReadCopyList(XmlTextReader reader) - { - var result = new List(); - while (reader.Read()) - { - switch (reader.NodeType) - { - case XmlNodeType.Element: - if (string.Equals(reader.Name, "Copy", StringComparison.InvariantCultureIgnoreCase)) - { - string source = null; - string dest = null; - string filter = null; - bool recursive = false; - - while (reader.MoveToNextAttribute()) - { - if (string.Equals(reader.Name, "Source", StringComparison.InvariantCultureIgnoreCase)) - { - source = reader.Value; - } - else if (string.Equals(reader.Name, "Destination", StringComparison.InvariantCultureIgnoreCase)) - { - dest = reader.Value; - } - else if (string.Equals(reader.Name, "Recursive", StringComparison.InvariantCultureIgnoreCase)) - { - recursive = Convert.ToBoolean(reader.Value); - } - else if (string.Equals(reader.Name, "Filter", StringComparison.InvariantCultureIgnoreCase)) - { - filter = reader.Value; - } - } - - if (source != null) - { - // Either the file specifies the Destination as well, or else CopyDirectory will use Source for Destination - var info = new CopyDirectoryInfo { Source = source }; - - if (dest != null) - { - info.Destination = dest; - } - - if (filter != null) - { - info.Filter = filter; - } - - info.Recursive = recursive; - - Debug.Log(string.Format(CultureInfo.InvariantCulture, @"Build: Adding {0}copy ""{1}\{2}"" => ""{3}""", info.Recursive ? "Recursive " : "", info.Source, info.Filter, info.Destination ?? info.Source)); - - result.Add(info); - } - } - break; - - case XmlNodeType.EndElement: - if (string.Equals(reader.Name, "CopyList", StringComparison.InvariantCultureIgnoreCase)) - return result; - break; - } - } - - return result; - } - - public static void CopyDirectory(string sourceDirectoryPath, string destinationDirectoryPath, CopyDirectoryInfo directoryInfo) - { - sourceDirectoryPath = Path.Combine(sourceDirectoryPath, directoryInfo.Source); - destinationDirectoryPath = Path.Combine(destinationDirectoryPath, directoryInfo.Destination ?? directoryInfo.Source); - - Debug.Log(string.Format(CultureInfo.InvariantCulture, @"{0} ""{1}\{2}"" to ""{3}""", directoryInfo.Recursive ? "Recursively copying" : "Copying", sourceDirectoryPath, directoryInfo.Filter, destinationDirectoryPath)); - - foreach (string sourceFilePath in Directory.GetFiles(sourceDirectoryPath, directoryInfo.Filter, directoryInfo.Recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)) - { - string destinationFilePath = sourceFilePath.Replace(sourceDirectoryPath, destinationDirectoryPath); - try - { - Directory.CreateDirectory(Path.GetDirectoryName(destinationFilePath)); - if (File.Exists(destinationFilePath)) - { - File.SetAttributes(destinationFilePath, FileAttributes.Normal); - } - File.Copy(sourceFilePath, destinationFilePath, true); - File.SetAttributes(destinationFilePath, FileAttributes.Normal); - } - catch (Exception exception) - { - Debug.LogError(string.Format(CultureInfo.InvariantCulture, "Failed to copy \"{0}\" to \"{1}\" with \"{2}\"", sourceFilePath, destinationFilePath, exception)); - } - } - } - - private static void OnPreProcessBuild(BuildInfo buildInfo) - { - // Raise the global event for listeners - BuildStarted.RaiseEvent(buildInfo); - - // Call the pre-build action, if any - if (buildInfo.PreBuildAction != null) - { - buildInfo.PreBuildAction(buildInfo); - } - } - - private static void OnPostProcessBuild(BuildInfo buildInfo, string buildError) - { - if (string.IsNullOrEmpty(buildError)) - { - if (buildInfo.CopyDirectories != null) - { - string inputProjectDirectoryPath = GetProjectPath(); - string outputProjectDirectoryPath = Path.Combine(GetProjectPath(), buildInfo.OutputDirectory); - foreach (var directory in buildInfo.CopyDirectories) - { - CopyDirectory(inputProjectDirectoryPath, outputProjectDirectoryPath, directory); - } - } - } - - // Raise the global event for listeners - BuildCompleted.RaiseEvent(buildInfo, buildError); - - // Call the post-build action, if any - if (buildInfo.PostBuildAction != null) - { - buildInfo.PostBuildAction(buildInfo, buildError); - } - } - - public static string GetProjectPath() - { - return Path.GetDirectoryName(Path.GetFullPath(Application.dataPath)); - } - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildSLNUtilities.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildSLNUtilities.cs.meta deleted file mode 100644 index d8ccbe5b..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/BuildSLNUtilities.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b404a9703a0c1784b9c8f2de897cae3b -timeCreated: 1466615028 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures.meta deleted file mode 100644 index a7916d61..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 183ec72b0e46f5d4a974ffbe5d11fe95 -folderAsset: yes -timeCreated: 1511727687 -licenseType: Pro -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AdapterInfo.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AdapterInfo.cs deleted file mode 100644 index 84267269..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AdapterInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class AdapterInfo - { - public string Description; - public string HardwareAddress; - public int Index; - public string Name; - public string Type; - public DHCPInfo DHCP; - public IpAddressInfo[] Gateways; - public IpAddressInfo[] IpAddresses; - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AdapterInfo.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AdapterInfo.cs.meta deleted file mode 100644 index a4ac0a72..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AdapterInfo.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: e9e582b5e23c1ce4db5af4795de2ea11 -timeCreated: 1511921435 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppDetails.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppDetails.cs deleted file mode 100644 index 1768efe2..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppDetails.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class AppDetails - { - public string Name; - public string PackageFamilyName; - public string PackageFullName; - public int PackageOrigin; - public string PackageRelativeId; - public string Publisher; - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppDetails.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppDetails.cs.meta deleted file mode 100644 index 79ebe4e5..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppDetails.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 78d89e4089fc412fbd92cf88db9abb54 -timeCreated: 1505630361 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppList.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppList.cs deleted file mode 100644 index 4b634401..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppList.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class AppList - { - public AppDetails[] InstalledPackages; - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppList.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppList.cs.meta deleted file mode 100644 index 34646f03..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/AppList.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 1b08d6ba78f3428e9ea3dbfd1dec00f3 -timeCreated: 1505630361 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ConnectInfo.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ConnectInfo.cs deleted file mode 100644 index 28a0272f..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ConnectInfo.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public struct ConnectInfo - { - public ConnectInfo(string ip, string user, string password, string machineName = "") - { - IP = ip; - User = user; - Password = password; - MachineName = string.IsNullOrEmpty(machineName) ? ip : machineName; - } - - public string IP; - public string User; - public string Password; - public string MachineName; - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ConnectInfo.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ConnectInfo.cs.meta deleted file mode 100644 index bc9ef4c7..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ConnectInfo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e2f1a5e5a63040eb99e1c07b389abef6 -timeCreated: 1505630244 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/CopyDirectoryInfo.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/CopyDirectoryInfo.cs deleted file mode 100644 index 16321889..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/CopyDirectoryInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace HoloToolkit.Unity -{ - public class CopyDirectoryInfo - { - public string Source { get; set; } - public string Destination { get; set; } - public string Filter { get; set; } - public bool Recursive { get; set; } - - public CopyDirectoryInfo() - { - Source = null; - Destination = null; - Filter = "*"; - Recursive = false; - } - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/CopyDirectoryInfo.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/CopyDirectoryInfo.cs.meta deleted file mode 100644 index 5d2d18c1..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/CopyDirectoryInfo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 23511800bce94604830cfd49251a3746 -timeCreated: 1497140939 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DHCPInfo.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DHCPInfo.cs deleted file mode 100644 index 2f5ab4f9..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DHCPInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class DHCPInfo - { - public int LeaseExpires; - public int LeaseObtained; - public IpAddressInfo Address; - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DHCPInfo.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DHCPInfo.cs.meta deleted file mode 100644 index dba104c9..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DHCPInfo.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: b9f4adcf165401e44b8dd0fdc1f01406 -timeCreated: 1511921662 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DevicePortalConnections.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DevicePortalConnections.cs deleted file mode 100644 index bf2e2a34..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DevicePortalConnections.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.Collections.Generic; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class DevicePortalConnections - { - public List Connections = new List(0); - - public DevicePortalConnections(ConnectInfo connectInfo) - { - Connections.Add(connectInfo); - } - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DevicePortalConnections.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DevicePortalConnections.cs.meta deleted file mode 100644 index 813beaed..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/DevicePortalConnections.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: d9fa39adff61e294d9fac017583d4dfa -timeCreated: 1511774995 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/InstallStatus.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/InstallStatus.cs deleted file mode 100644 index c2b27b51..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/InstallStatus.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class InstallStatus - { - public int Code; - public string CodeText; - public string Reason; - public bool Success; - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/InstallStatus.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/InstallStatus.cs.meta deleted file mode 100644 index f589c428..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/InstallStatus.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 3bac05516c6546fc9692f8e3575e5bc4 -timeCreated: 1505630361 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/IpAddressInfo.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/IpAddressInfo.cs deleted file mode 100644 index 8b3a2a34..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/IpAddressInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class IpAddressInfo - { - public string IpAddress; - public string Mask; - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/IpAddressInfo.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/IpAddressInfo.cs.meta deleted file mode 100644 index edad3af9..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/IpAddressInfo.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 89cbcc9bf958da744ac19dfb03b05f36 -timeCreated: 1511923796 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/MachineName.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/MachineName.cs deleted file mode 100644 index 53d5d96e..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/MachineName.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class MachineName - { - public string ComputerName; - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/MachineName.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/MachineName.cs.meta deleted file mode 100644 index 1b2a7b8b..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/MachineName.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 6b38e86f792363c45afa2e3aba61e715 -timeCreated: 1511828513 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/NetworkInfo.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/NetworkInfo.cs deleted file mode 100644 index 626c9303..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/NetworkInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class NetworkInfo - { - public AdapterInfo[] Adapters; - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/NetworkInfo.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/NetworkInfo.cs.meta deleted file mode 100644 index 07ea98d2..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/NetworkInfo.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 34cde40c31747a94e901220591f0a238 -timeCreated: 1511921270 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessDesc.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessDesc.cs deleted file mode 100644 index 3e788436..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessDesc.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class ProcessDesc - { - public float CPUUsage; - public string ImageName; - public float PageFileUsage; - public int PrivateWorkingSet; - public int ProcessId; - public int SessionId; - public string UserName; - public int VirtualSize; - public int WorkingSetSize; - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessDesc.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessDesc.cs.meta deleted file mode 100644 index bff0442e..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessDesc.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 444b49b99f6c486a9f94123fefa890c8 -timeCreated: 1505630361 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessList.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessList.cs deleted file mode 100644 index ded54163..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessList.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class ProcessList - { - public ProcessDesc[] Processes; - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessList.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessList.cs.meta deleted file mode 100644 index 4591f3b5..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/ProcessList.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: bb334efdb39a4bf4902fa71524072b4a -timeCreated: 1505630361 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/Response.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/Response.cs deleted file mode 100644 index fc73fc8a..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/Response.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class Response - { - public string Reason; - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/Response.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/Response.cs.meta deleted file mode 100644 index abacf262..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/DataStructures/Response.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 3ba58874bb124faa8037fb6733e6475f -timeCreated: 1505630361 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/EditorPrefsUtility.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/EditorPrefsUtility.cs deleted file mode 100644 index 13adf8b0..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/EditorPrefsUtility.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using UnityEditor; -using UnityEngine; - -namespace HoloToolkit.Unity -{ - public static class EditorPrefsUtility - { - public static void SetEditorPref(string key, string value) - { - EditorPrefs.SetString(Application.productName + key, value); - } - - public static void SetEditorPref(string key, bool value) - { - EditorPrefs.SetBool(Application.productName + key, value); - } - - public static void SetEditorPref(string key, float value) - { - EditorPrefs.SetFloat(Application.productName + key, value); - } - - public static void SetEditorPref(string key, int value) - { - EditorPrefs.SetInt(Application.productName + key, value); - } - - public static string GetEditorPref(string key, string defaultValue) - { - if (EditorPrefs.HasKey(Application.productName + key)) - { - return EditorPrefs.GetString(Application.productName + key); - } - - EditorPrefs.SetString(Application.productName + key, defaultValue); - return defaultValue; - } - - public static bool GetEditorPref(string key, bool defaultValue) - { - if (EditorPrefs.HasKey(Application.productName + key)) - { - return EditorPrefs.GetBool(Application.productName + key); - } - - EditorPrefs.SetBool(Application.productName + key, defaultValue); - return defaultValue; - } - - public static float GetEditorPref(string key, float defaultValue) - { - if (EditorPrefs.HasKey(Application.productName + key)) - { - return EditorPrefs.GetFloat(Application.productName + key); - } - - EditorPrefs.SetFloat(Application.productName + key, defaultValue); - return defaultValue; - } - - public static int GetEditorPref(string key, int defaultValue) - { - if (EditorPrefs.HasKey(Application.productName + key)) - { - return EditorPrefs.GetInt(Application.productName + key); - } - - EditorPrefs.SetInt(Application.productName + key, defaultValue); - return defaultValue; - } - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/EditorPrefsUtility.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/EditorPrefsUtility.cs.meta deleted file mode 100644 index e01df3a3..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/EditorPrefsUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eb5e6e8f269f74d439c58d77b1aea33b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/HoloToolkitCommands.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/HoloToolkitCommands.cs deleted file mode 100644 index 61c2c2da..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/HoloToolkitCommands.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using UnityEditor; - -namespace HoloToolkit.Unity -{ - /// - /// Implements functionality for building HoloLens applications - /// - public static class HoloToolkitCommands - { - /// - /// Do a build configured for the HoloLens, returns the error from BuildPipeline.BuildPlayer - /// - [Obsolete("Use BuildDeployTools.BuildSLN")] - public static bool BuildSLN() - { - return BuildDeployTools.BuildSLN(BuildDeployPrefs.BuildDirectory, false); - } - - public static bool BuildAPPX(string buildDirectory = "") - { - if(buildDirectory == string.Empty) - { - buildDirectory = BuildDeployPrefs.BuildDirectory; - } - - return BuildDeployTools.BuildAppxFromSLN( - PlayerSettings.productName, - BuildDeployTools.DefaultMSBuildVersion, - BuildDeployPrefs.ForceRebuild, - BuildDeployPrefs.BuildConfig, - BuildDeployPrefs.BuildPlatform, - buildDirectory, - BuildDeployPrefs.IncrementBuildVersion); - } - - public static void BuildSLNAndAPPX(string path) - { - var slnResult = BuildDeployTools.BuildSLN(path, false); - - var appxResult = BuildAPPX(path); - } - - public static bool InstallAPPX() - { - ConnectInfo connectInfo = new ConnectInfo("10.1.18.9", "1234", "12341234", "HoloLens"); - - BuildDeployWindow.InstallOnTargetDevice(BuildDeployPrefs.BuildDirectory, connectInfo); - - return BuildDeployWindow.AppxInstallSucces; - } - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/HoloToolkitCommands.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/HoloToolkitCommands.cs.meta deleted file mode 100644 index d407d7dd..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/HoloToolkitCommands.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 85636330e25a7ac4c81b19530c5b8282 -timeCreated: 1464366824 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB.meta deleted file mode 100644 index d9006a1a..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 080001477ab9a6248b3cd5c3c4bfbff4 -folderAsset: yes -timeCreated: 1512167852 -licenseType: Pro -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceInfo.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceInfo.cs deleted file mode 100644 index 438aafd2..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using UnityEngine; - -namespace HoloToolkit.Unity -{ - [Serializable] - public class USBDeviceInfo - { - public USBDeviceInfo(int vendorId, string udid, int productId, string name, int revision) - { - VendorId = vendorId; - Udid = udid; - ProductId = productId; - Name = name; - Revision = revision; - } - - public int VendorId { get; private set; } - - public string Udid { get; private set; } - - public int ProductId { get; private set; } - - public string Name { get; private set; } - - public int Revision { get; private set; } - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceInfo.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceInfo.cs.meta deleted file mode 100644 index 4d266be5..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceInfo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c5e55757366a403cb092abaff6b6a15d -timeCreated: 1497305870 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceListener.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceListener.cs deleted file mode 100644 index 400d1a14..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceListener.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System.Collections.Generic; -using UnityEditor; -using UnityEditor.Hardware; -using UnityEngine; - -namespace HoloToolkit.Unity -{ - [InitializeOnLoad] - public class USBDeviceListener - { - [SerializeField] - public static USBDeviceInfo[] USBDevices; - - public delegate void OnUsbDevicesChanged(UsbDevice[] usbDevices); - - public static event OnUsbDevicesChanged UsbDevicesChanged; - - private static List usbDevicesList = new List(0); - - static USBDeviceListener() - { - Usb.DevicesChanged += NotifyUsbDevicesChanged; - } - - private static void NotifyUsbDevicesChanged(UsbDevice[] devices) - { - if (UsbDevicesChanged != null) - { - UsbDevicesChanged.Invoke(devices); - } - - usbDevicesList.Clear(); - - foreach (UsbDevice device in devices) - { - usbDevicesList.Add(new USBDeviceInfo(device.vendorId, device.udid, device.productId, device.name, device.revision)); - } - - USBDevices = usbDevicesList.ToArray(); - } - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceListener.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceListener.cs.meta deleted file mode 100644 index 688eb36d..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/USB/USBDeviceListener.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: fc26d07c1945497f97ae60db9eb11a91 -timeCreated: 1497297319 \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/UwpProjectPostProcess.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/UwpProjectPostProcess.cs deleted file mode 100644 index 348d5dab..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/UwpProjectPostProcess.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.RegularExpressions; -using System.Xml; - -namespace HoloToolkit.Unity -{ - /// - /// This class is designed to post process the UWP Assembly-CSharp projects to ensure that the defaults and defines are set correctly. - /// - public static class UwpProjectPostProcess - { - private static readonly Regex PlatformRegex = new Regex(@"'\$\(Configuration\)\|\$\(Platform\)' == '(?.*)\|(?.*)'"); - - /// - /// Executes the Post Processes on the C# Projects generated as part of the UWP build. - /// - /// The root path of the UWP build output. - public static void Execute(string buildRootPath) - { - UpdateProjectFile(Path.Combine(buildRootPath, @"GeneratedProjects\UWP\Assembly-CSharp\Assembly-CSharp.csproj")); - UpdateProjectFile(Path.Combine(buildRootPath, @"GeneratedProjects\UWP\Assembly-CSharp-firstpass\Assembly-CSharp-firstpass.csproj")); - } - - /// - /// Updates the project file to ensure that certain requirements are met. - /// - /// The filename of the project to update. - /// This is manually parsing the Unity generated MSBuild projects, which means it will be fragile to changes. - private static void UpdateProjectFile(string filename) - { - if (!File.Exists(filename)) - { - UnityEngine.Debug.LogWarningFormat("Unable to find file \"{0}\", double check that the build succeeded and that the C# Projects are set to be generated.", filename); - return; - } - - var projectDocument = new XmlDocument(); - projectDocument.Load(filename); - - if (projectDocument.DocumentElement == null) - { - UnityEngine.Debug.LogWarningFormat("Unable to load file \"{0}\", double check that the build succeeded and that the C# Projects are set to be generated.", filename); - return; - } - - if (projectDocument.DocumentElement.Name != "Project") - { - UnityEngine.Debug.LogWarningFormat("The loaded project \"{0}\", does not appear to be a MSBuild Project file.", filename); - return; - } - - foreach (XmlNode node in projectDocument.DocumentElement.ChildNodes) - { - // Everything we are looking for is inside a PropertyGroup... - if (node.Name != "PropertyGroup" || node.Attributes == null) - { - continue; - } - - if (node.Attributes.Count == 0 && node["Configuration"] != null && node["Platform"] != null) - { - // Update the defaults to Release and x86 so that we can run NuGet restore. - node["Configuration"].InnerText = "Release"; - node["Platform"].InnerText = "x86"; - } - else if (node.Attributes["Condition"] != null) - { - // Update the DefineConstants to include the configuration allowing us to conditionally compile code based on the configuration. - Match match = PlatformRegex.Match(node.Attributes["Condition"].InnerText); - - if (match.Success) - { - UpdateDefineConstants(node["DefineConstants"], match.Groups["Configuration"].Value, match.Groups["Platform"].Value); - } - } - } - - WriteXmlDocumentToFile(projectDocument, filename); - } - - private static void UpdateDefineConstants(XmlNode defineConstants, string configuration, string platform) - { - if (defineConstants == null) - { - return; - } - - IEnumerable symbols = defineConstants.InnerText.Split(';').Except(new[] - { - string.Empty, - BuildSLNUtilities.BuildSymbolDebug, - BuildSLNUtilities.BuildSymbolRelease, - BuildSLNUtilities.BuildSymbolMaster - }).Union(new[] { configuration.ToUpperInvariant() }); - - defineConstants.InnerText = string.Join(";", symbols.ToArray()); - //UnityEngine.Debug.LogFormat("Updating defines for Configuration|Platform: {0}|{1} => {2}", configuration, platform, defineConstants.InnerText); - } - - private static void WriteXmlDocumentToFile(XmlNode document, string fullPath) - { - FileStream fileStream = null; - try - { - fileStream = File.Open(fullPath, FileMode.Create); - - var settings = new XmlWriterSettings - { - Indent = true, - CloseOutput = true - }; - - using (XmlWriter writer = XmlWriter.Create(fileStream, settings)) - { - fileStream = null; - document.WriteTo(writer); - } - } - finally - { - if (fileStream != null) - { - fileStream.Dispose(); - } - } - } - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/UwpProjectPostProcess.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/UwpProjectPostProcess.cs.meta deleted file mode 100644 index a6306a74..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/UwpProjectPostProcess.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 740afdacd94cd8d49a0fbdf8bfed2c1f -timeCreated: 1484171169 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: - \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/XdeGuestLocator.cs b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/XdeGuestLocator.cs deleted file mode 100644 index 713e1bc5..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/XdeGuestLocator.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Copyright (c) Rafael Rivera. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.Linq; -using System.Net; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using System.Runtime.InteropServices; -using System.Threading; - -namespace HoloToolkit.Unity -{ - /// - /// Emulator Utility Class - /// - public static class XdeGuestLocator - { - [StructLayout(LayoutKind.Sequential, Pack = 4)] - struct XdePeerHostIdentifier - { - public Guid GuestDiscoveryGUID; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] GuestMACAddress; - public int PeerDiscoveryPort; - } - - [StructLayout(LayoutKind.Sequential, Pack = 4)] - struct XdePeerGuestIdentifier - { - public Guid GuestDiscoveryGUID; - public int GuestTcpPort; - public int GuestSvcVersion; - } - - public static bool IsSearching { get; private set; } - public static bool HasData { get; private set; } - public static IPAddress GuestIpAddress { get; private set; } - - static XdeGuestLocator() - { - HasData = false; - IsSearching = false; - } - - public static void FindGuestAddressAsync() - { - if (IsSearching) - { - return; - } - - ThreadPool.QueueUserWorkItem(FindGuestAddress); - } - - private static void FindGuestAddress(object state) - { - IsSearching = true; - HasData = false; - GuestIpAddress = IPAddress.None; - - UnicastIPAddressInformation internalSwitchAddressInfo = null; - try - { - internalSwitchAddressInfo = GetInternalSwitchAddressInfo(); - } - catch (Exception) - { - UnityEngine.Debug.LogError("Failed to locate internal switch adapter"); - } - - if (internalSwitchAddressInfo != null) - { - using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) - { - try - { - // Bind to next available UDP port for a listen operation - socket.Blocking = true; - socket.ReceiveTimeout = (int)TimeSpan.FromSeconds(5).TotalMilliseconds; - - socket.Bind(new IPEndPoint(internalSwitchAddressInfo.Address, 0)); - var localPort = (socket.LocalEndPoint as IPEndPoint).Port; - - // Send out a probe to 'devices' connected to the internal switch - // listening on port 3553 (Microsoft Device Emulator specific) - var broadcastAddress = GetBroadcastAddressForAddress(internalSwitchAddressInfo.Address, internalSwitchAddressInfo.IPv4Mask); - var broadcastTarget = new IPEndPoint(broadcastAddress, 3553); - - // - // WORKAROUND: We don't have easy access to WMI to go querying - // for virtual machine information so we just cover finding - // the first 255 potential candidates xx 00 - xx FF. - // - // It sounds like a lot but we're talking super tiny - // payloads on an internal interface. It's very fast. - // - for (int i = 0; i <= 0xFF; i++) - { - var probe = GenerateProbe(localPort, i); - socket.SendTo(probe, broadcastTarget); - } - - // Return the endpoint information for the first 'device' that replies - // (we don't necessarily care about the returned identifier info) - var responseBytes = new byte[Marshal.SizeOf(typeof(XdePeerGuestIdentifier))]; - - EndPoint guestEndpoint = new IPEndPoint(broadcastAddress, 0); - - socket.ReceiveFrom(responseBytes, ref guestEndpoint); - GuestIpAddress = (guestEndpoint as IPEndPoint).Address; - HasData = true; - } - catch (SocketException) - { - // Do nothing, our probe went unanswered or failed - } - } - } - - IsSearching = false; - } - - private static UnicastIPAddressInformation GetInternalSwitchAddressInfo() - { - var internalSwitch = GetInternalNetworkSwitchInterface(); - return internalSwitch.GetIPProperties().UnicastAddresses.Where(a => a.Address.AddressFamily == AddressFamily.InterNetwork).FirstOrDefault(); - } - - private static NetworkInterface GetInternalNetworkSwitchInterface() - { - return NetworkInterface.GetAllNetworkInterfaces().Where(i => i.Name.Contains("Windows Phone Emulator")).FirstOrDefault(); - } - - private static IPAddress GetBroadcastAddressForAddress(IPAddress address, IPAddress mask) - { - var addressInt = BitConverter.ToInt32(address.GetAddressBytes(), 0); - var maskInt = BitConverter.ToInt32(mask.GetAddressBytes(), 0); - return new IPAddress(BitConverter.GetBytes((addressInt | ~maskInt))); - } - - private static byte[] GenerateProbe(int port, int machineIndex) - { - var identifier = new XdePeerHostIdentifier(); - identifier.PeerDiscoveryPort = port; - identifier.GuestDiscoveryGUID = new Guid("{963ef858-2efe-4eb4-8d2d-fed5408e6441}"); - identifier.GuestMACAddress = new byte[] { 0x02, 0xDE, 0xDE, 0xDE, 0xDE, (byte)machineIndex }; - - return GetStructureBytes(identifier); - } - - private static byte[] GetStructureBytes(object obj) - { - var bytes = new byte[Marshal.SizeOf(obj)]; - - var handle = GCHandle.Alloc(bytes, GCHandleType.Pinned); - Marshal.StructureToPtr(obj, handle.AddrOfPinnedObject(), false); - handle.Free(); - - return bytes; - } - } -} diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/XdeGuestLocator.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/XdeGuestLocator.cs.meta deleted file mode 100644 index ccb6283d..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Editor/Build/HoloLensBuild/XdeGuestLocator.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 05d1324a6d6a0d248848b4042ad6d6bf -timeCreated: 1471035499 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/AudioSourceTests.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/AudioSourceTests.cs index 61deb802..a7449c02 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/AudioSourceTests.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/AudioSourceTests.cs @@ -8,7 +8,7 @@ public class AudioSourceTests : XrFunctionalTestBase { private AudioSource audioSource; - private readonly int audioPlaySkipFrameCountWait = 2 * OneSecOfFramesWaitTime; + private readonly int audioPlaySkipFrameCountWait = 2; private readonly float audioTolerance = .01f; [SetUp] @@ -34,7 +34,7 @@ public class AudioSourceTests : XrFunctionalTestBase public IEnumerator VerifyAudioSource_Play() { // Act - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); audioSource.Play(); yield return SkipFrame(audioPlaySkipFrameCountWait); @@ -47,7 +47,7 @@ public class AudioSourceTests : XrFunctionalTestBase public IEnumerator VerifyAudioSource_Pause() { // Arrange - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); audioSource.Play(); yield return SkipFrame(audioPlaySkipFrameCountWait); @@ -64,7 +64,7 @@ public class AudioSourceTests : XrFunctionalTestBase public IEnumerator VerifyAudioSource_UnPause() { // Arrange - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); audioSource.Play(); yield return SkipFrame(audioPlaySkipFrameCountWait); @@ -84,14 +84,14 @@ public class AudioSourceTests : XrFunctionalTestBase public IEnumerator VerifyAudioSource_Stop() { // Arrange - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); audioSource.Play(); yield return SkipFrame(audioPlaySkipFrameCountWait); // Act audioSource.Stop(); - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); // Assert Assert.AreEqual(audioSource.isPlaying, false, "Audio failed to stop"); @@ -101,7 +101,7 @@ public class AudioSourceTests : XrFunctionalTestBase public IEnumerator VerifyAudioSource_Adjust_SpatialBlend() { // Arrange - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); audioSource.spatialize = true; Debug.Log("Enabling Spatialized Audio"); @@ -129,7 +129,7 @@ public class AudioSourceTests : XrFunctionalTestBase public IEnumerator VerifyAudioSource_Adjust_Volume() { // Arrange - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); audioSource.Play(); Debug.Log("Starting Audio"); @@ -137,7 +137,7 @@ public class AudioSourceTests : XrFunctionalTestBase audioSource.volume = 0f; Assert.AreEqual(0f, audioSource.volume, "Volume was not set to 0;"); - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); var volumeAmount = 0f; diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/CameraTests.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/CameraTests.cs index 8895af44..2da57cf7 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/CameraTests.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/CameraTests.cs @@ -41,7 +41,7 @@ public class CameraTests : XrFunctionalTestBase [UnityTest] public IEnumerator CameraCheckForMultiPass() { - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); XrFunctionalTestHelpers.TestStageSetup(TestStageConfig.MultiPass); Assert.AreEqual(XRSettings.stereoRenderingMode, UnityEditor.PlayerSettings.stereoRenderingPath, "Expected StereoRenderingPath to be Multi pass"); @@ -52,7 +52,7 @@ public class CameraTests : XrFunctionalTestBase [UnityTest] public IEnumerator CameraCheckForInstancing() { - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); XrFunctionalTestHelpers.TestStageSetup(TestStageConfig.Instancing); Assert.AreEqual(XRSettings.stereoRenderingMode, UnityEditor.PlayerSettings.stereoRenderingPath, "Expected StereoRenderingPath to be Instancing"); @@ -62,7 +62,7 @@ public class CameraTests : XrFunctionalTestBase [UnityTest] public IEnumerator VerifyRefreshRate() { - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); var refreshRate = XRDevice.refreshRate; if (IsMobilePlatform()) @@ -77,7 +77,7 @@ public class CameraTests : XrFunctionalTestBase [UnityTest] public IEnumerator VerifyAdjustRenderViewportScale() { - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); XRSettings.renderViewportScale = 1f; Assert.AreEqual(1f, XRSettings.renderViewportScale, "Render viewport scale is not being respected"); @@ -93,29 +93,31 @@ public class CameraTests : XrFunctionalTestBase [UnityTest] public IEnumerator VerifyAdjustEyeTextureResolutionScale() { - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); var scale = 0.1f; - var scaleCount = 0.1f; + var scaleIncrement = 0.1f; + var scaleLimit = 2f; - for (var i = 0.1f; i < 2; i++) + do { - scale = scale + 0.1f; - scaleCount = scaleCount + 0.1f; + + scale = scale + scaleIncrement; XRSettings.eyeTextureResolutionScale = scale; - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); Debug.Log("VerifyAdjustEyeTextureResolutionScale = " + scale); - Assert.AreEqual(scaleCount, XRSettings.eyeTextureResolutionScale, "Eye texture resolution scale is not being respected"); + Assert.AreEqual(scale, XRSettings.eyeTextureResolutionScale, "Eye texture resolution scale is not being respected"); } + while (scale < scaleLimit) ; } [UnityTest] public IEnumerator VerifyAdjustDeviceZoom() { - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); var zoomAmount = 0f; var zoomCount = 0f; @@ -127,7 +129,7 @@ public class CameraTests : XrFunctionalTestBase XRDevice.fovZoomFactor = zoomAmount; - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); Debug.Log("fovZoomFactor = " + zoomAmount); Assert.AreEqual(zoomCount, XRDevice.fovZoomFactor, "Zoom Factor is not being respected"); @@ -137,7 +139,7 @@ public class CameraTests : XrFunctionalTestBase [UnityTest] public IEnumerator TakeScreenShot() { - yield return SkipFrame(2 * OneSecOfFramesWaitTime); + yield return SkipFrame(2); try { diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/DllNativePluginTests.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/DllNativePluginTests.cs index dd442fb0..ef23c7e1 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/DllNativePluginTests.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/DllNativePluginTests.cs @@ -64,11 +64,10 @@ public class DllNativePluginTests : XrFunctionalTestBase sceneObjectsLoaded = true; } - [UnityTest] - public IEnumerator VerifySceneObjectsLoaded() + [Test] + public void VerifySceneObjectsLoaded() { Assert.IsTrue(sceneObjectsLoaded, "Scene Objects was not created"); - yield return null; } [UnityTest] @@ -82,7 +81,7 @@ public class DllNativePluginTests : XrFunctionalTestBase [UnityTest] public IEnumerator VerifyRenderingFps() { - yield return SkipFrame(2 * OneSecOfFramesWaitTime); + yield return SkipFrame(2); Assert.AreEqual(0, nonPerformantFrameCount, "Failed to keep every frame inside the target frame time for the tested window"); } @@ -96,6 +95,7 @@ public class DllNativePluginTests : XrFunctionalTestBase filter = true; } + // TODO pull these magic numbers (256) into readonly vars with description if(renderPlane.GetComponent().material.mainTexture.height == 256 && renderPlane.GetComponent().material.mainTexture.width == 256) { textsize = true; diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/EyeCameraTests.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/EyeCameraTests.cs index 379b224f..b0211b42 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/EyeCameraTests.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/EyeCameraTests.cs @@ -10,7 +10,7 @@ public class EyeCameraTests : XrFunctionalTestBase [UnityTest] public IEnumerator VerifyEyesParallelWithHead() { - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); Assert.IsTrue(EyesParallelWithHead(), "Eyes are not parallel with the head"); } diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/PhysicsTests.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/PhysicsTests.cs index b46a6c0d..8244e146 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/PhysicsTests.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/PhysicsTests.cs @@ -45,10 +45,10 @@ public class PhysicsTests : XrFunctionalTestBase [UnityTest] public IEnumerator GazeCheck() { - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); InputTracking.GetNodeStates(xrNodeList); - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); if (xrNodeList.Count != 0) { @@ -64,7 +64,7 @@ public class PhysicsTests : XrFunctionalTestBase Ray ray = new Ray(xrCenterNodePos, XrFunctionalTestHelpers.Camera.GetComponent().transform.forward); Physics.Raycast(ray, 10f); - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); if (ray.origin == xrCenterNodePos) { diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/RenderingChecks.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/RenderingChecks.cs index 653e2dc1..83ac1207 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/RenderingChecks.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/RenderingChecks.cs @@ -56,7 +56,7 @@ public class RenderingChecks : XrFunctionalTestBase // 100 frames ~= 1 or 2 seconds for (int i = 0; i < 100; i++) - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); } // TODO We need to refactor this so that we have a clear arrange/act/assert @@ -66,7 +66,7 @@ public class RenderingChecks : XrFunctionalTestBase while (!stopTest) { DoTest(); - yield return SkipFrame(2 * OneSecOfFramesWaitTime); + yield return SkipFrame(2); } } diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/SimplePerformanceTests.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/SimplePerformanceTests.cs index e0d26be5..e9323262 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/SimplePerformanceTests.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/SimplePerformanceTests.cs @@ -23,7 +23,7 @@ public class SimplePerformanceTests : XrFunctionalTestBase public IEnumerator SimpleFpsTest() { XrFunctionalTestHelpers.TestCubeSetup(TestCubesConfig.TestCube); - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); Assert.AreEqual(0, nonPerformantFrameCount, "Failed to keep every frame inside the target frame time for the tested window"); } @@ -32,7 +32,7 @@ public class SimplePerformanceTests : XrFunctionalTestBase public IEnumerator SimpleFpsTestWithFocalPoint() { XrFunctionalTestHelpers.TestCubeSetup(TestCubesConfig.TestCube); - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); Assert.AreEqual(0, nonPerformantFrameCount, "Failed to keep every frame inside the target frame time for the tested window"); } @@ -42,7 +42,7 @@ public class SimplePerformanceTests : XrFunctionalTestBase { XrFunctionalTestHelpers.TestCubeSetup(TestCubesConfig.PerformanceMassObjects); - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); Assert.AreEqual(0, nonPerformantFrameCount, "Failed to keep every frame inside the target frame time for the tested window"); } @@ -52,7 +52,7 @@ public class SimplePerformanceTests : XrFunctionalTestBase { XrFunctionalTestHelpers.TestCubeSetup(TestCubesConfig.PerformanceMassFloorObjects); - yield return null; + yield return SkipFrame(DefaultFrameSkipCount); Assert.AreEqual(0, nonPerformantFrameCount, "Failed to keep every frame inside the target frame time for the tested window"); } diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/TrackingSpaceTests.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/TrackingSpaceTests.cs index c9780452..f10c2c12 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/TrackingSpaceTests.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/TrackingSpaceTests.cs @@ -1,6 +1,4 @@ using System.Collections; -using UnityEngine.Experimental.XR; -using UnityEngine; using UnityEngine.XR; using NUnit.Framework; using UnityEngine.TestTools; @@ -10,7 +8,7 @@ public class TrackingSpaceTests : XrFunctionalTestBase [UnityTest] public IEnumerator VerifyXRDevice_GetCurrentTrackingSpace() { - yield return SkipFrame(2 * OneSecOfFramesWaitTime); + yield return SkipFrame(2); var trackingSpace = XRDevice.GetTrackingSpaceType(); Assert.IsNotNull(trackingSpace, "Tracking space is not reading correctly"); diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrApiTests.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrApiTests.cs index 6ddebac6..66613ea9 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrApiTests.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrApiTests.cs @@ -6,79 +6,107 @@ using UnityEngine.XR; public class XrApiTests : XrFunctionalTestBase { - [UnityTest] - public IEnumerator VerifyApplication_IsMobilePlatform() + [UnityPlatform(include = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] + [Test] + public void VerifyApplication_IsMobilePlatform() { - if (IsMobilePlatform()) - { - Assert.IsTrue(Application.isMobilePlatform, "SDK returned as a non mobile platform "); - } - else - { - Assert.IsFalse(Application.isMobilePlatform, "SDK returned as a mobile platform"); - } - - yield return null; + Assert.IsTrue(Application.isMobilePlatform, "SDK returned as a non mobile platform "); } - [UnityTest] - public IEnumerator VerifyXrDevice_IsPresent() + [Test] + public void VerifyXrDevice_IsPresent() { Assert.IsTrue(XRDevice.isPresent, "XR Device is not present"); - yield return null; } - [UnityPlatform(exclude = new[] { RuntimePlatform.Android })] - [UnityTest] - public IEnumerator VerifyXRDevice_userPresence_isPresent() + [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] + [Test] + public void VerifyXRDevice_userPresence_isPresent() { if (Settings.EnabledXrTarget != "MockHMD") { var expUserPresenceState = UserPresenceState.Present; Assert.AreEqual(XRDevice.userPresence, expUserPresenceState, string.Format("Not mobile platform. Expected XRDevice.userPresence to be {0}, but is {1}.", expUserPresenceState, XRDevice.userPresence)); } - yield return null; } - [UnityTest] - public IEnumerator VerifyXrSettings_IsDeviceActive() + [Test] + public void VerifyXrSettings_IsDeviceActive() { Assert.IsTrue(XRSettings.isDeviceActive, "XR Device is not active"); - yield return null; } - [UnityTest] - public IEnumerator VerifyXrSettings_LoadedDeviceName() + [Test] + public void VerifyXrSettings_LoadedDeviceName() { - yield return null; Assert.AreEqual( Settings.EnabledXrTarget, XRSettings.loadedDeviceName, string.Format("Expected {0}, but is {1}.", Settings.EnabledXrTarget, XRSettings.loadedDeviceName)); } - [UnityTest] - public IEnumerator VerifyXrModelNotEmpty() + [Test] + public void VerifyXrModelNotEmpty() { - var model = XRDevice.model; - Assert.IsNotEmpty(model, "Model is empty"); - yield return null; + Assert.IsNotEmpty(XRDevice.model, "Model is empty"); } - [UnityTest] - public IEnumerator VerifyXrDevice_NativePtr_IsNotEmpty() + [Test] + public void VerifyXrDevice_NativePtr_IsNotEmpty() { var ptr = XRDevice.GetNativePtr().ToString(); Assert.IsNotEmpty(ptr, "Native Ptr is empty"); - yield return null; } - [UnityTest] - public IEnumerator VerifyRefreshRateGreaterThan0() + [Test] + public void VerifyRefreshRateGreaterThan0() { - var refreshRate = XRDevice.refreshRate; - Assert.AreNotEqual(refreshRate, 0, "Refresh is 0; should be greater than 0."); - yield return null; + Assert.AreNotEqual(XRDevice.refreshRate, 0, "Refresh is 0; should be greater than 0."); + } + + [Test] + public void VerifyXrSettings_EyeTextureHeight_GreaterThan0() + { + Assert.IsTrue(XRSettings.eyeTextureHeight > 0f); + } + + [Test] + public void VerifyXrSettings_EyeTextureWidth_GreaterThan0() + { + Assert.IsTrue(XRSettings.eyeTextureWidth > 0f); + } + + [Test] + public void VerifyXrSettings_EyeTextureResolutionScale_GreaterThan0() + { + Assert.IsTrue(XRSettings.eyeTextureResolutionScale > 0f); + } + + [Test] + public void VerifyXrSettings_RenderViewportScale_GreaterThan0() + { + Assert.IsTrue(XRSettings.renderViewportScale > 0f); + } + + [Test] + public void VerifyXrSettings_UseOcclusionMesh() + { + Assert.IsTrue(XRSettings.useOcclusionMesh); + } +#if !UNITY_EDITOR + [Test] + public void XrApVerifyXrSettings_StereoRenderingMode() + { + + Assert.IsTrue(XRSettings.stereoRenderingMode.ToString().Contains(Settings.StereoRenderingMode.ToString()), $"{XRSettings.stereoRenderingMode} != {Settings.StereoRenderingMode}"); + } +#endif + + [UnityTest] + [Ignore("Inconsistent results for test. For example, this doesn't work on GearVR.")] + public IEnumerator CanDisableAndEnableXr() + { + yield return new MonoBehaviourTest(); } } diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrFunctionalTestBase.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrFunctionalTestBase.cs index d1d073ff..5c583734 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrFunctionalTestBase.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrFunctionalTestBase.cs @@ -20,7 +20,7 @@ public class XrFunctionalTestBase { protected XrFunctionalTestHelpers XrFunctionalTestHelpers; protected CurrentSettings Settings; - protected static int OneSecOfFramesWaitTime = 1; + protected static int DefaultFrameSkipCount = 1; public GameObject Camera; public GameObject Light; diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrNodesTests.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrNodesTests.cs index b7feb361..e5701963 100644 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrNodesTests.cs +++ b/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrNodesTests.cs @@ -36,7 +36,7 @@ internal class XrNodesTests : XrFunctionalTestBase public IEnumerator XrNodesHeadTracking() { InputTracking.GetNodeStates(nodeList); - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); var headNodes = nodeList.Where(n => n.nodeType == XRNode.Head); Assert.True(headNodes.Any(), "Failed to find XRNode.Head node type."); @@ -47,7 +47,7 @@ internal class XrNodesTests : XrFunctionalTestBase public IEnumerator XrNodesEyeTracking() { InputTracking.GetNodeStates(nodeList); - yield return SkipFrame(OneSecOfFramesWaitTime); + yield return SkipFrame(DefaultFrameSkipCount); // Verify left eye node var leftEyeNodes = nodeList.Where(n => n.nodeType == XRNode.LeftEye); diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrSmokeXrFunctionalTest.cs b/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrSmokeXrFunctionalTest.cs deleted file mode 100644 index c961a3f0..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrSmokeXrFunctionalTest.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System.Collections; -using NUnit.Framework; -using UnityEngine.TestTools; -using UnityEngine.XR; -using Assert = UnityEngine.Assertions.Assert; - -internal class XrSmokeXrFunctionalTest : XrFunctionalTestBase -{ - [UnityTest] - public IEnumerator VerifyXrSettings_EyeTextureHeight_GreaterThan0() - { - Assert.IsTrue(XRSettings.eyeTextureHeight > 0f); - yield return null; - } - - [UnityTest] - public IEnumerator VerifyXrSettings_EyeTextureWidth_GreaterThan0() - { - Assert.IsTrue(XRSettings.eyeTextureWidth > 0f); - yield return null; - } - - [UnityTest] - public IEnumerator VerifyXrSettings_EyeTextureResolutionScale_GreaterThan0() - { - Assert.IsTrue(XRSettings.eyeTextureResolutionScale > 0f); - yield return null; - } - - [UnityTest] - public IEnumerator VerifyXrSettings_RenderViewportScale_GreaterThan0() - { - Assert.IsTrue(XRSettings.renderViewportScale > 0f); - yield return null; - } - - [UnityTest] - public IEnumerator VerifyXrSettings_UseOcclusionMesh() - { - Assert.IsTrue(XRSettings.useOcclusionMesh); - yield return null; - } -#if !UNITY_EDITOR - [UnityTest] - public IEnumerator XrApVerifyXrSettings_StereoRenderingMode() - { - - Assert.IsTrue(XRSettings.stereoRenderingMode.ToString().Contains(Settings.StereoRenderingMode.ToString()), $"{XRSettings.stereoRenderingMode} != {Settings.StereoRenderingMode}"); - - yield return null; - } -#endif - - [UnityTest] - [Ignore("Inconsistent results for test. For example, this doesn't work on GearVR.")] - public IEnumerator CanDisableAndEnableXr() - { - yield return new MonoBehaviourTest(); - } -} \ No newline at end of file diff --git a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrSmokeXrFunctionalTest.cs.meta b/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrSmokeXrFunctionalTest.cs.meta deleted file mode 100644 index 9bf713c3..00000000 --- a/FunctionalTests/VR/CrossPlatform/Assets/Tests/XrSmokeXrFunctionalTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1e24ec30759d27c4d8c3379b486701b3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/FunctionalTests/VR/CrossPlatform/Packages/manifest.json b/FunctionalTests/VR/CrossPlatform/Packages/manifest.json index 3fd2e134..e1b343e5 100644 --- a/FunctionalTests/VR/CrossPlatform/Packages/manifest.json +++ b/FunctionalTests/VR/CrossPlatform/Packages/manifest.json @@ -8,7 +8,7 @@ "com.unity.ide.vscode": "1.0.6", "com.unity.package-manager-ui": "2.2.0", "com.unity.purchasing": "2.0.6", - "com.unity.test-framework": "1.0.11", + "com.unity.test-framework": "1.0.12", "com.unity.textmeshpro": "1.3.0", "com.unity.timeline": "1.0.0", "com.unity.xr.legacyinputhelpers": "2.0.2",