Skip to content

Commit c722506

Browse files
authored
Add #if UNITY_EDITOR to PackageValidator (#1125)
Add #if UNITY_EDITOR
1 parent 4e97724 commit c722506

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

org.mixedrealitytoolkit.core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
77
### Changed
88

99
* Updated code style in `HandsSubsystemDescriptor`, `MRTKSubsystemDescriptor`, `DictationSubsystemDescriptor`, and `XRSubsystemHelpers`. [PR #1109](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1109)
10+
* Updated `PackageValidator` to only be valid if `UNITY_EDITOR` is true. [PR #1125](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1125)
1011

1112
### Fixed
1213

org.mixedrealitytoolkit.core/Tests/TestUtilities/PackageValidator.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Copyright (c) Mixed Reality Toolkit Contributors
22
// Licensed under the BSD 3-Clause
33

4-
// Disable "missing XML comment" warning for tests. While nice to have, this documentation is not required.
5-
#pragma warning disable CS1591
6-
#if HAS_ASSET_STORE_VALIDATION
4+
#if HAS_ASSET_STORE_VALIDATION && UNITY_EDITOR
75

86
using System;
97
using System.Collections.Generic;
@@ -26,12 +24,7 @@ public static class PackageValidator
2624
/// </exception>
2725
public static PackageValidatorResults Validate(string packageName)
2826
{
29-
PackageInfo info = UpmPackageInfo(packageName);
30-
if (info == null)
31-
{
32-
throw new ArgumentException($"No package found with name \"{packageName}\"");
33-
}
34-
27+
PackageInfo info = UpmPackageInfo(packageName) ?? throw new ArgumentException($"No package found with name \"{packageName}\"");
3528
string packageId = $"{info.name}@{info.version}";
3629
ValidationSuite.ValidatePackage(packageId, ValidationType.AssetStore);
3730

@@ -70,5 +63,5 @@ private static PackageInfo[] UpmListOffline(string packageIdOrName = null)
7063
}
7164
}
7265
}
73-
#endif // HAS_ASSET_STORE_VALIDATION
74-
#pragma warning restore CS1591
66+
67+
#endif // HAS_ASSET_STORE_VALIDATION && UNITY_EDITOR

0 commit comments

Comments
 (0)