@@ -585,6 +585,9 @@ class PluginInvocationTests: XCTestCase {
585
585
}
586
586
587
587
func testPrebuildPluginShouldNotUseExecTarget( ) throws {
588
+ // Only run the test if the environment in which we're running actually supports Swift concurrency (which the plugin APIs require).
589
+ try XCTSkipIf ( !UserToolchain. default. supportsSwiftConcurrency ( ) , " skipping because test environment doesn't support concurrency " )
590
+
588
591
try testWithTemporaryDirectory { tmpPath in
589
592
// Create a sample package with a library target and a plugin.
590
593
let packageDir = tmpPath. appending ( components: " mypkg " )
@@ -720,69 +723,4 @@ class PluginInvocationTests: XCTestCase {
720
723
}
721
724
}
722
725
}
723
-
724
- func testShouldNotRequireNonPluginTarget( ) throws {
725
- try testWithTemporaryDirectory { tmpPath in
726
- // Create a sample package with a library target and a plugin.
727
- let packageDir = tmpPath. appending ( components: " MyPackage " )
728
- try localFileSystem. createDirectory ( packageDir, recursive: true )
729
- try localFileSystem. writeFileContents ( packageDir. appending ( component: " Package.swift " ) , string: """
730
- // swift-tools-version: 5.7
731
- import PackageDescription
732
- let package = Package(
733
- name: " MyPackage " ,
734
- products: [
735
- .plugin(name: " Foo " , targets: [ " Foo " ])
736
- ],
737
- dependencies: [
738
- ],
739
- targets: [
740
- .plugin(
741
- name: " Foo " ,
742
- capability: .command(
743
- intent: .custom(verb: " Foo " , description: " Plugin example " ),
744
- permissions: []
745
- )
746
- )
747
- ]
748
- )
749
- """ )
750
-
751
- let myPluginTargetDir = packageDir. appending ( components: " Plugins " , " Foo " )
752
- try localFileSystem. createDirectory ( myPluginTargetDir, recursive: true )
753
- try localFileSystem. writeFileContents ( myPluginTargetDir. appending ( component: " plugin.swift " ) , string: """
754
- import PackagePlugin
755
- @main struct FooPlugin: BuildToolPlugin {
756
- func createBuildCommands(
757
- context: PluginContext,
758
- target: Target
759
- ) throws -> [Command] { }
760
- }
761
- """ )
762
-
763
- // Load a workspace from the package.
764
- let observability = ObservabilitySystem . makeForTesting ( )
765
- let workspace = try Workspace (
766
- fileSystem: localFileSystem,
767
- forRootPackage: packageDir,
768
- customManifestLoader: ManifestLoader ( toolchain: UserToolchain . default) ,
769
- delegate: MockWorkspaceDelegate ( )
770
- )
771
-
772
- // Load the root manifest.
773
- let rootInput = PackageGraphRootInput ( packages: [ packageDir] , dependencies: [ ] )
774
- let rootManifests = try tsc_await {
775
- workspace. loadRootManifests (
776
- packages: rootInput. packages,
777
- observabilityScope: observability. topScope,
778
- completion: $0
779
- )
780
- }
781
- XCTAssert ( rootManifests. count == 1 , " \( rootManifests) " )
782
-
783
- // Load the package graph.
784
- let _ = try workspace. loadPackageGraph ( rootInput: rootInput, observabilityScope: observability. topScope)
785
- XCTAssertNoDiagnostics ( observability. diagnostics)
786
- }
787
- }
788
726
}
0 commit comments