@@ -494,11 +494,6 @@ public class SwiftTool {
494
494
return workspace
495
495
}
496
496
497
- // we do not take an observabilityScope in the workspace initializer as the workspace is designed to be long lived
498
- // instead observabilityScope is passed into the individual workspace methods which are short lived
499
- // however, the workspace initializer may need to emit diagnostics, for which the CLI sets this thread local
500
- Thread . current. threadDictionary [ " observabilityScope " ] = observabilityScope
501
-
502
497
let isXcodeBuildSystemEnabled = self . options. buildSystem == . xcode
503
498
let repositoryProvider = GitRepositoryProvider ( processSet: self . processSet)
504
499
let delegate = ToolWorkspaceDelegate ( self . outputStream, logLevel: self . logLevel, observabilityScope: self . observabilityScope)
@@ -546,72 +541,7 @@ public class SwiftTool {
546
541
return try Workspace . DefaultLocations. resolvedVersionsFile ( forRootPackage: self . getPackageRoot ( ) )
547
542
}
548
543
549
- /*
550
- func getMirrorsConfig(sharedConfigurationDirectory: AbsolutePath? = nil) throws -> Workspace.Configuration.Mirrors {
551
- let sharedConfigurationDirectory = sharedConfigurationDirectory ?? self.sharedConfigurationDirectory
552
- let sharedMirrorFile = sharedConfigurationDirectory.map { Workspace.DefaultLocations.mirrorsConfigurationFile(at: $0) }
553
- return try .init(
554
- localMirrorFile: self.mirrorsConfigFile(),
555
- sharedMirrorFile: sharedMirrorFile,
556
- fileSystem: localFileSystem
557
- )
558
- }
559
-
560
- private func mirrorsConfigFile() throws -> AbsolutePath {
561
- // TODO: does this make sense now that we a global configuration as well? or should we at least rename it?
562
- // Look for the override in the environment.
563
- if let envPath = ProcessEnv.vars["SWIFTPM_MIRROR_CONFIG"] {
564
- return try AbsolutePath(validating: envPath)
565
- }
566
-
567
- // Otherwise, use the default path.
568
- // TODO: replace multiroot-data-file with explicit overrides
569
- if let multiRootPackageDataFile = options.multirootPackageDataFile {
570
- // migrate from legacy location
571
- let legacyPath = multiRootPackageDataFile.appending(components: "xcshareddata", "swiftpm", "config")
572
- let newPath = multiRootPackageDataFile.appending(components: "xcshareddata", "swiftpm", "configuration", "mirrors.json")
573
- if localFileSystem.exists(legacyPath) {
574
- try localFileSystem.createDirectory(newPath.parentDirectory, recursive: true)
575
- try localFileSystem.move(from: legacyPath, to: newPath)
576
- }
577
- return newPath
578
- }
579
-
580
- // migrate from legacy location
581
- let legacyPath = try self.getPackageRoot().appending(components: ".swiftpm", "config")
582
- let newPath = try Workspace.DefaultLocations.mirrorsConfigurationFile(forRootPackage: self.getPackageRoot())
583
- if localFileSystem.exists(legacyPath) {
584
- observabilityScope.emit(warning: "Usage of \(legacyPath) has been deprecated. Please delete it and use the new \(newPath) instead.")
585
- if !localFileSystem.exists(newPath) {
586
- try localFileSystem.createDirectory(newPath.parentDirectory, recursive: true)
587
- try localFileSystem.copy(from: legacyPath, to: newPath)
588
- }
589
- }
590
- return newPath
591
- }
592
-
593
- func getRegistriesConfig(sharedConfigurationDirectory: AbsolutePath? = nil) throws -> Workspace.Configuration.Registries {
594
- let localRegistriesFile = try Workspace.DefaultLocations.registriesConfigurationFile(forRootPackage: self.getPackageRoot())
595
-
596
- let sharedConfigurationDirectory = sharedConfigurationDirectory ?? self.sharedConfigurationDirectory
597
- let sharedRegistriesFile = sharedConfigurationDirectory.map {
598
- Workspace.DefaultLocations.registriesConfigurationFile(at: $0)
599
- }
600
-
601
- return try .init(
602
- localRegistriesFile: localRegistriesFile,
603
- sharedRegistriesFile: sharedRegistriesFile,
604
- fileSystem: localFileSystem
605
- )
606
- }*/
607
-
608
544
internal func getLocalConfigurationDirectory( ) throws -> AbsolutePath {
609
- // TODO: does this make sense now that we a global configuration as well? or should we at least rename it?
610
- // Look for the override in the environment.
611
- //if let envPath = ProcessEnv.vars["SWIFTPM_MIRROR_CONFIG"] {
612
- // return try AbsolutePath(validating: envPath)
613
- //}
614
-
615
545
// Otherwise, use the default path.
616
546
// TODO: replace multiroot-data-file with explicit overrides
617
547
if let multiRootPackageDataFile = options. multirootPackageDataFile {
@@ -1075,11 +1005,8 @@ private func getSharedSecurityDirectory(options: SwiftToolOptions, observability
1075
1005
return explicitSecurityPath
1076
1006
}
1077
1007
1078
- do {
1079
- let sharedSecurityDirectory = try localFileSystem. getOrCreateSwiftPMSecurityDirectory ( )
1080
- // And make sure we can write files (locking the directory writes a lock file)
1081
- try localFileSystem. withLock ( on: sharedSecurityDirectory, type: . exclusive) { }
1082
- return sharedSecurityDirectory
1008
+ do {
1009
+ return try localFileSystem. getOrCreateSwiftPMSecurityDirectory ( )
1083
1010
} catch {
1084
1011
observabilityScope. emit ( warning: " Failed creating default security location, \( error) " )
1085
1012
return . none
@@ -1096,7 +1023,7 @@ private func getSharedConfigurationDirectory(options: SwiftToolOptions, observab
1096
1023
}
1097
1024
1098
1025
do {
1099
- return try localFileSystem. getOrCreateSwiftPMConfigurationDirectory ( observabilityScope : observabilityScope )
1026
+ return try localFileSystem. getOrCreateSwiftPMConfigurationDirectory ( )
1100
1027
} catch {
1101
1028
observabilityScope. emit ( warning: " Failed creating default configuration location, \( error) " )
1102
1029
return . none
0 commit comments