diff --git a/Documentation~/README.md b/Documentation~/README.md index 9b9a5d4..36e737a 100644 --- a/Documentation~/README.md +++ b/Documentation~/README.md @@ -185,3 +185,14 @@ Works for any Apple Platform Target: MacOS, iOS, tvOS, and visionOS. | Argument | Description | | -------- | ----------- | | `-arch` | Sets the build architecture. Can be: `x64`, `arm64`, or `x64arm64`. | + +##### Windows Universal Platform Command Line Arguments + +| Argument | Description | +| -------- | ----------- | +| `-arch` | Sets the build architecture. Can be: `x64`, `x86`, `ARM`, or `ARM64`. | +| `-wsaUWPBuildType` | Sets the output build type when building to Universal Windows Platform. Can be: `XAML`, `D3D`, or `ExecutableOnly`. | +| `-wsaSetDeviceFamily` | Sets the device family. Can be: `Desktop`, `Mobile`, `Xbox`, `Holographic`, `Team`, `IOT`, or `IoTHeadless`. | +| `-wsaUWPSDK` | Sets the UWP SDK Version to build for. | +| `-wsaMinUWPSDK` | Sets the min UWP SDK to build for. | +| `-wsaCertificate` | Sets the signing certificate. Must pass the path and password together. `-wsaCertificate "path/to/cert.pfx" myP@55w0rd` | diff --git a/Editor/Platforms/WSAPlayerBuildInfo.cs b/Editor/Platforms/WSAPlayerBuildInfo.cs new file mode 100644 index 0000000..93f4b19 --- /dev/null +++ b/Editor/Platforms/WSAPlayerBuildInfo.cs @@ -0,0 +1,103 @@ +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; +using UnityEditor; +using UnityEngine; + +namespace Utilities.Editor.BuildPipeline +{ + public class WSAPlayerBuildInfo : BuildInfo + { + /// + public override BuildTarget BuildTarget => BuildTarget.WSAPlayer; + + /// + public override BuildTargetGroup BuildTargetGroup => BuildTargetGroup.WSA; + + /// + public override string FullOutputPath => OutputDirectory; + + /// + public override void ParseCommandLineArgs() + { + base.ParseCommandLineArgs(); + var arguments = Environment.GetCommandLineArgs(); + + for (int i = 0; i < arguments.Length; ++i) + { + switch (arguments[i]) + { + case "-arch": + var arch = arguments[++i]; + + if (!string.IsNullOrWhiteSpace(arch)) + { + EditorUserBuildSettings.wsaArchitecture = arch; + } + else + { + Debug.LogError($"Failed to parse -arch \"{arguments[i]}\""); + } + break; +#if !UNITY_2021_1_OR_NEWER + case "-wsaSubtarget": + if (Enum.TryParse(arguments[++i], out var subTarget)) + { + EditorUserBuildSettings.wsaSubtarget = subTarget; + } + else + { + Debug.LogError($"Failed to parse -wsaSubtarget \"{arguments[i]}\""); + } + break; +#endif + case "-wsaUWPBuildType": + if (Enum.TryParse(arguments[++i], out var buildType)) + { + EditorUserBuildSettings.wsaUWPBuildType = buildType; + } + else + { + Debug.LogError($"Failed to parse -wsaUWPBuildType \"{arguments[i]}\""); + } + break; + case "-wsaSetDeviceFamily": + if (Enum.TryParse(arguments[++i], out var family)) + { + PlayerSettings.WSA.SetTargetDeviceFamily(family, true); + } + else + { + Debug.LogError($"Failed to parse -wsaSetDeviceFamily \"{arguments[i]}\""); + } + break; + case "-wsaUWPSDK": + EditorUserBuildSettings.wsaUWPSDK = arguments[++i]; + break; + case "-wsaMinUWPSDK": + EditorUserBuildSettings.wsaMinUWPSDK = arguments[++i]; + break; + case "-wsaCertificate": + var path = arguments[++i]; + + if (string.IsNullOrWhiteSpace(path)) + { + Debug.LogError("Failed to parse -wsaCertificate. Missing path!"); + break; + } + + var password = arguments[++i]; + + if (string.IsNullOrWhiteSpace(password)) + { + Debug.LogError("Failed to parse -wsaCertificate. Missing password!"); + break; + } + + PlayerSettings.WSA.SetCertificate(path, password); + break; + } + } + } + } +} diff --git a/Editor/Platforms/WSAPlayerBuildInfo.cs.meta b/Editor/Platforms/WSAPlayerBuildInfo.cs.meta new file mode 100644 index 0000000..4fa24d1 --- /dev/null +++ b/Editor/Platforms/WSAPlayerBuildInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c8082d56f90faa43b4f88aaf8fbbd51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/UnityPlayerBuildTools.cs b/Editor/UnityPlayerBuildTools.cs index 6620fce..42a51cc 100644 --- a/Editor/UnityPlayerBuildTools.cs +++ b/Editor/UnityPlayerBuildTools.cs @@ -52,34 +52,10 @@ public static IBuildInfo BuildInfo case BuildTarget.iOS: buildInfoInstance = new IOSBuildInfo(); break; + case BuildTarget.WSAPlayer: + buildInfoInstance = new WSAPlayerBuildInfo(); + break; // TODO: Add additional platform specific build info classes as needed - //case BuildTarget.StandaloneWindows: - //case BuildTarget.StandaloneWindows64: - // break; - //case BuildTarget.WebGL: - // break; - //case BuildTarget.WSAPlayer: - // break; - //case BuildTarget.StandaloneLinux64: - // break; - //case BuildTarget.PS4: - // break; - //case BuildTarget.XboxOne: - // break; - //case BuildTarget.tvOS: - // break; - //case BuildTarget.Switch: - // break; - //case BuildTarget.Lumin: - // break; - //case BuildTarget.Stadia: - // break; - //case BuildTarget.GameCoreXboxOne: - // break; - //case BuildTarget.PS5: - // break; - //case BuildTarget.EmbeddedLinux: - // break; default: buildInfoInstance = new BuildInfo(); break; diff --git a/package.json b/package.json index 533f4bb..6228aae 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Utilities.BuildPipeline", "description": "The Build Pipeline Utilities aims to give developers more tools and options when making builds with the command line or with continuous integration.", "keywords": [], - "version": "1.4.7", + "version": "1.5.0", "unity": "2019.4", "documentationUrl": "https://github.com/RageAgainstThePixel/com.utilities.buildpipeine#documentation", "changelogUrl": "https://github.com/RageAgainstThePixel/com.utilities.buildpipeine/releases",