|
12 | 12 | // |
13 | 13 | //===----------------------------------------------------------------------===// |
14 | 14 | import * as fs from "fs/promises"; |
15 | | -import * as os from "os"; |
16 | 15 | import * as path from "path"; |
17 | 16 | import * as vscode from "vscode"; |
18 | 17 |
|
@@ -79,10 +78,6 @@ export class BuildConfigurationFactory { |
79 | 78 |
|
80 | 79 | /** flag for enabling test discovery */ |
81 | 80 | private testDiscoveryFlag(ctx: FolderContext): string[] { |
82 | | - // Test discovery is only available in SwiftPM 5.1 and later. |
83 | | - if (ctx.swiftVersion.isLessThan(new Version(5, 1, 0))) { |
84 | | - return []; |
85 | | - } |
86 | 81 | // Test discovery is always enabled on Darwin. |
87 | 82 | if (process.platform !== "darwin") { |
88 | 83 | const hasLinuxMain = ctx.linuxMain.exists; |
@@ -427,17 +422,6 @@ export class TestingConfigurationFactory { |
427 | 422 | }, |
428 | 423 | }; |
429 | 424 | default: |
430 | | - const swiftVersion = this.ctx.toolchain.swiftVersion; |
431 | | - if ( |
432 | | - swiftVersion.isLessThan(new Version(5, 7, 0)) && |
433 | | - swiftVersion.isGreaterThanOrEqual(new Version(5, 6, 0)) && |
434 | | - process.platform === "darwin" |
435 | | - ) { |
436 | | - // if debugging on macOS with Swift 5.6 we need to create a custom launch |
437 | | - // configuration so we can set the system architecture |
438 | | - return await this.createDarwin56TestConfiguration(); |
439 | | - } |
440 | | - |
441 | 425 | let xcTestArgs = [ |
442 | 426 | "test", |
443 | 427 | ...(this.testKind === TestKind.coverage |
@@ -477,60 +461,6 @@ export class TestingConfigurationFactory { |
477 | 461 | } |
478 | 462 | /* eslint-enable no-case-declarations */ |
479 | 463 |
|
480 | | - /** |
481 | | - * Return custom Darwin test configuration that works with Swift 5.6 |
482 | | - **/ |
483 | | - private async createDarwin56TestConfiguration(): Promise<vscode.DebugConfiguration | null> { |
484 | | - if ((await this.ctx.swiftPackage.getTargets(TargetType.test)).length === 0) { |
485 | | - return null; |
486 | | - } |
487 | | - |
488 | | - let testFilterArg: string; |
489 | | - const testList = this.testList.join(","); |
490 | | - if (testList.length > 0) { |
491 | | - testFilterArg = `-XCTest ${testList}`; |
492 | | - } else { |
493 | | - testFilterArg = ""; |
494 | | - } |
495 | | - |
496 | | - const { folder, nameSuffix } = getFolderAndNameSuffix(this.ctx, true); |
497 | | - // On macOS, find the path to xctest |
498 | | - // and point it at the .xctest bundle from the configured build directory. |
499 | | - const xctestPath = this.ctx.toolchain.xcTestPath; |
500 | | - if (xctestPath === undefined) { |
501 | | - return null; |
502 | | - } |
503 | | - let arch: string; |
504 | | - switch (os.arch()) { |
505 | | - case "x64": |
506 | | - arch = "x86_64"; |
507 | | - break; |
508 | | - case "arm64": |
509 | | - arch = "arm64e"; |
510 | | - break; |
511 | | - default: |
512 | | - return null; |
513 | | - } |
514 | | - const sanitizer = this.ctx.toolchain.sanitizer(configuration.sanitizer); |
515 | | - const envCommands = Object.entries({ |
516 | | - ...swiftRuntimeEnv(), |
517 | | - ...configuration.folder(this.ctx.workspaceFolder).testEnvironmentVariables, |
518 | | - ...sanitizer?.runtimeEnvironment, |
519 | | - }).map(([key, value]) => `settings set target.env-vars ${key}="${value}"`); |
520 | | - |
521 | | - return { |
522 | | - type: SWIFT_LAUNCH_CONFIG_TYPE, |
523 | | - request: "custom", |
524 | | - name: `Test ${await this.ctx.swiftPackage.name}`, |
525 | | - targetCreateCommands: [`file -a ${arch} ${xctestPath}/xctest`], |
526 | | - processCreateCommands: [ |
527 | | - ...envCommands, |
528 | | - `process launch -w ${folder} -- ${testFilterArg} ${this.xcTestOutputPath()}`, |
529 | | - ], |
530 | | - preLaunchTask: `swift: Build All${nameSuffix}`, |
531 | | - }; |
532 | | - } |
533 | | - |
534 | 464 | private addSwiftTestingFlagsArgs(args: string[]): string[] { |
535 | 465 | if (!this.swiftTestingArguments) { |
536 | 466 | throw new Error( |
|
0 commit comments