This repository has been archived by the owner on May 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev/updated platform definition (#129)
* Migrated uwp build pipeline scripts * Converted build into to scriptable object * updated proper versioning and bundle identifiers * bumped version and updated dependencies for new build pipeline * updated package dependencies for preview * updated bundle version
- Loading branch information
1 parent
ba46380
commit 4b35b81
Showing
10 changed files
with
705 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
using System; | ||
using System.IO; | ||
using UnityEngine; | ||
using XRTK.Editor.Utilities; | ||
using XRTK.Utilities.WindowsDevicePortal.DataStructures; | ||
|
||
namespace XRTK.Editor.BuildPipeline | ||
{ | ||
public static class UwpBuildDeployPreferences | ||
{ | ||
public static Version MIN_SDK_VERSION = new Version("10.0.17763.0"); | ||
private const string EDITOR_PREF_BUILD_CONFIG = "BuildDeployWindow_BuildConfig"; | ||
private const string EDITOR_PREF_FORCE_REBUILD = "BuildDeployWindow_ForceRebuild"; | ||
private const string EDITOR_PREF_CONNECT_INFOS = "BuildDeployWindow_DeviceConnections"; | ||
private const string EDITOR_PREF_FULL_REINSTALL = "BuildDeployWindow_FullReinstall"; | ||
private const string EDITOR_PREF_USE_SSL = "BuildDeployWindow_UseSSL"; | ||
private const string EDITOR_PREF_PROCESS_ALL = "BuildDeployWindow_ProcessAll"; | ||
private const string EDITOR_PREF_APP_ICON_SETTINGS_PATH = "ProjectSettings/Xrtk_MixedRealityIconPath.json"; | ||
|
||
/// <summary> | ||
/// The current Build Configuration. (Debug, Release, or Master) | ||
/// </summary> | ||
public static string BuildConfig | ||
{ | ||
get => EditorPreferences.Get(EDITOR_PREF_BUILD_CONFIG, "master"); | ||
set => EditorPreferences.Set(EDITOR_PREF_BUILD_CONFIG, value.ToLower()); | ||
} | ||
|
||
/// <summary> | ||
/// Current setting to force rebuilding the appx. | ||
/// </summary> | ||
public static bool ForceRebuild | ||
{ | ||
get => EditorPreferences.Get(EDITOR_PREF_FORCE_REBUILD, false); | ||
set => EditorPreferences.Set(EDITOR_PREF_FORCE_REBUILD, value); | ||
} | ||
|
||
/// <summary> | ||
/// Current setting to fully uninstall and reinstall the appx. | ||
/// </summary> | ||
public static bool FullReinstall | ||
{ | ||
get => EditorPreferences.Get(EDITOR_PREF_FULL_REINSTALL, true); | ||
set => EditorPreferences.Set(EDITOR_PREF_FULL_REINSTALL, value); | ||
} | ||
|
||
private static string appIconPath; | ||
|
||
/// <summary> | ||
/// The path to the 3d app icon .glb asset. | ||
/// </summary> | ||
public static string MixedRealityAppIconPath | ||
{ | ||
get | ||
{ | ||
if (!string.IsNullOrEmpty(appIconPath)) | ||
{ | ||
return appIconPath; | ||
} | ||
|
||
var projectSettingsPath = Path.GetFullPath(EDITOR_PREF_APP_ICON_SETTINGS_PATH); | ||
|
||
if (!File.Exists(projectSettingsPath)) | ||
{ | ||
var appIconAsset = new MixedRealityAppIcon { MixedRealityAppIconPath = string.Empty }; | ||
JsonUtility.ToJson(appIconAsset); | ||
return appIconAsset.MixedRealityAppIconPath; | ||
} | ||
|
||
var data = File.ReadAllText(projectSettingsPath); | ||
return JsonUtility.FromJson<MixedRealityAppIcon>(data).MixedRealityAppIconPath; | ||
} | ||
set | ||
{ | ||
var projectSettingsPath = Path.GetFullPath(EDITOR_PREF_APP_ICON_SETTINGS_PATH); | ||
|
||
if (!string.IsNullOrWhiteSpace(value)) | ||
{ | ||
Debug.Assert(value.EndsWith(".glb"), "3d App Icon must be a .glb asset"); | ||
} | ||
|
||
appIconPath = value; | ||
File.WriteAllText(projectSettingsPath, JsonUtility.ToJson(new MixedRealityAppIcon { MixedRealityAppIconPath = value })); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// The current device portal connections. | ||
/// </summary> | ||
public static string DevicePortalConnections | ||
{ | ||
get => EditorPreferences.Get( | ||
EDITOR_PREF_CONNECT_INFOS, | ||
JsonUtility.ToJson( | ||
new DevicePortalConnections( | ||
new DeviceInfo("127.0.0.1", string.Empty, string.Empty, "Local Machine")))); | ||
set => EditorPreferences.Set(EDITOR_PREF_CONNECT_INFOS, value); | ||
} | ||
|
||
/// <summary> | ||
/// Current setting to use Single Socket Layer connections to the device portal. | ||
/// </summary> | ||
public static bool UseSSL | ||
{ | ||
get => EditorPreferences.Get(EDITOR_PREF_USE_SSL, true); | ||
set => EditorPreferences.Set(EDITOR_PREF_USE_SSL, value); | ||
} | ||
|
||
/// <summary> | ||
/// Current setting to target all the devices registered to the build window. | ||
/// </summary> | ||
public static bool TargetAllConnections | ||
{ | ||
get => EditorPreferences.Get(EDITOR_PREF_PROCESS_ALL, false); | ||
set => EditorPreferences.Set(EDITOR_PREF_PROCESS_ALL, value); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System; | ||
using System.Linq; | ||
using UnityEditor; | ||
using UnityEditor.Build.Reporting; | ||
using UnityEngine; | ||
using XRTK.Attributes; | ||
using XRTK.Definitions.Platforms; | ||
using XRTK.Services; | ||
|
||
namespace XRTK.Editor.BuildPipeline | ||
{ | ||
[RuntimePlatform(typeof(UniversalWindowsPlatform))] | ||
public class UwpBuildInfo : BuildInfo | ||
{ | ||
protected override void Awake() | ||
{ | ||
base.Awake(); | ||
Version = PlayerSettings.WSA.packageVersion; | ||
SolutionName = $"{PlayerSettings.productName}\\{PlayerSettings.productName}.sln"; | ||
BuildTargetFamilies = GetFamilies(); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override BuildTarget BuildTarget => BuildTarget.WSAPlayer; | ||
|
||
/// <inheritdoc /> | ||
public override Version Version { get; set; } | ||
|
||
/// <summary> | ||
/// The name of the Visual Studio .sln file generated. | ||
/// </summary> | ||
public string SolutionName { get; private set; } | ||
|
||
/// <summary> | ||
/// Build the appx bundle after building Unity Player? | ||
/// </summary> | ||
public bool BuildAppx { get; set; } | ||
|
||
/// <summary> | ||
/// Force rebuilding the appx bundle? | ||
/// </summary> | ||
public bool RebuildAppx { get; set; } | ||
|
||
public string UwpSdk => EditorUserBuildSettings.wsaUWPSDK; | ||
|
||
public string MinSdk => EditorUserBuildSettings.wsaMinUWPSDK; | ||
|
||
public PlayerSettings.WSATargetFamily[] BuildTargetFamilies { get; private set; } | ||
|
||
private static PlayerSettings.WSATargetFamily[] GetFamilies() | ||
{ | ||
var values = (PlayerSettings.WSATargetFamily[])Enum.GetValues(typeof(PlayerSettings.WSATargetFamily)); | ||
return values.Where(PlayerSettings.WSA.GetTargetDeviceFamily).ToArray(); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override void OnPostProcessBuild(BuildReport buildReport) | ||
{ | ||
if (!MixedRealityToolkit.ActivePlatforms.Contains(BuildPlatform) || | ||
EditorUserBuildSettings.activeBuildTarget != BuildTarget) | ||
{ | ||
return; | ||
} | ||
|
||
if (buildReport.summary.result == BuildResult.Failed) | ||
{ | ||
if (!Application.isBatchMode) | ||
{ | ||
EditorUtility.DisplayDialog($"{PlayerSettings.productName} Build {buildReport.summary.result}!", "See console for details", "OK"); | ||
} | ||
} | ||
else | ||
{ | ||
if (BuildAppx || | ||
!Application.isBatchMode && | ||
!EditorUtility.DisplayDialog(PlayerSettings.productName, "Build Complete", "OK", "Build AppX")) | ||
{ | ||
UwpAppxBuildTools.BuildAppx(this); | ||
} | ||
} | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override void ParseCommandLineArgs() | ||
{ | ||
base.ParseCommandLineArgs(); | ||
|
||
string[] arguments = Environment.GetCommandLineArgs(); | ||
|
||
for (int i = 0; i < arguments.Length; ++i) | ||
{ | ||
switch (arguments[i]) | ||
{ | ||
case "-buildAppx": | ||
BuildAppx = true; | ||
break; | ||
case "-rebuildAppx": | ||
RebuildAppx = true; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
Editor/BuildPipeline/XRTK.WindowsMixedReality.Editor.BuildPipeline.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "XRTK.WindowsMixedReality.Editor.BuildPipeline", | ||
"references": [ | ||
"GUID:f3241d040533491e8a1e2714b27c3111", | ||
"GUID:e67d30660ec243e4836aac191d3f36fb", | ||
"GUID:258402e6b12e10c43925784eabc239e5" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
7 changes: 7 additions & 0 deletions
7
Editor/BuildPipeline/XRTK.WindowsMixedReality.Editor.BuildPipeline.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters