Skip to content

Commit 98032df

Browse files
base compare without build metadata
1 parent 4afe82b commit 98032df

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/android-sdk.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,15 @@ async function getAndroidSdkPath(editor: UnityEditor, androidTargetSdk: number):
138138

139139
// if 2019+ test editor path, else use system android installation
140140
if (editor.version.isGreaterThanOrEqualTo('2019.0.0')) {
141+
logger.info('Using Android SDK bundled with Unity 2019+');
141142
try {
142143
sdkPath = await ResolveGlobToPath([editor.editorPath, '**', 'PlaybackEngines', 'AndroidPlayer', 'SDK', 'platforms', `android-${androidTargetSdk}/`]);
143144
} catch (error) {
144145
logger.debug(`android-${androidTargetSdk} not installed`);
145146
return undefined;
146147
}
147148
} else { // fall back to system android installation
149+
logger.info('Using system Android SDK for Unity versions prior to 2019');
148150
try {
149151
const systemSdkPath = process.env.ANDROID_SDK_ROOT || process.env.ANDROID_HOME;
150152

src/unity-version.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class UnityVersion {
4242
}
4343

4444
static compare(a: UnityVersion, b: UnityVersion): number {
45-
const baseComparison = compare(a.semVer, b.semVer, true);
45+
const baseComparison = UnityVersion.baseCompare(a, b);
4646

4747
if (baseComparison !== 0) {
4848
return baseComparison;
@@ -51,6 +51,10 @@ export class UnityVersion {
5151
return UnityVersion.compareBuildMetadata(a.semVer, b.semVer);
5252
}
5353

54+
static baseCompare(a: UnityVersion, b: UnityVersion): number {
55+
return compare(a.semVer, b.semVer, true);
56+
}
57+
5458
toString(): string {
5559
return this.changeset ? `${this.version} (${this.changeset})` : this.version;
5660
}
@@ -109,22 +113,22 @@ export class UnityVersion {
109113

110114
isGreaterThan(other: string | UnityVersion): boolean {
111115
const otherVersion = other instanceof UnityVersion ? other : new UnityVersion(other);
112-
return UnityVersion.compare(this, otherVersion) > 0;
116+
return UnityVersion.baseCompare(this, otherVersion) > 0;
113117
}
114118

115119
isGreaterThanOrEqualTo(other: string | UnityVersion): boolean {
116120
const otherVersion = other instanceof UnityVersion ? other : new UnityVersion(other);
117-
return UnityVersion.compare(this, otherVersion) >= 0;
121+
return UnityVersion.baseCompare(this, otherVersion) >= 0;
118122
}
119123

120124
isLessThan(other: string | UnityVersion): boolean {
121125
const otherVersion = other instanceof UnityVersion ? other : new UnityVersion(other);
122-
return UnityVersion.compare(this, otherVersion) < 0;
126+
return UnityVersion.baseCompare(this, otherVersion) < 0;
123127
}
124128

125129
isLessThanOrEqualTo(other: string | UnityVersion): boolean {
126130
const otherVersion = other instanceof UnityVersion ? other : new UnityVersion(other);
127-
return UnityVersion.compare(this, otherVersion) <= 0;
131+
return UnityVersion.baseCompare(this, otherVersion) <= 0;
128132
}
129133

130134
equals(other: UnityVersion): boolean {

0 commit comments

Comments
 (0)