File tree Expand file tree Collapse file tree
TuistGeneratorTests/Generator
TuistKitTests/ProjectEditor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,13 +70,6 @@ open class TuistAcceptanceTestCase: XCTestCase {
7070 . appending ( component: " fixtures " )
7171
7272 fixturePath = fixtureTemporaryDirectory. path. appending ( component: fixture. path)
73- if fixturePath. components [ 1 ] == " var " {
74- // `resolveSymlinks` doesn't seem to properly resolve /var to /private/var when running the fixture in a temporary
75- // directory.
76- // The project needs to be reference by its full absolute path without symlinks.
77- fixturePath = try AbsolutePath ( validating: " /private " )
78- . appending ( components: Array ( fixturePath. components. dropFirst ( ) ) )
79- }
8073
8174 try FileHandler . shared. copy (
8275 from: fixturesPath. appending ( component: fixture. path) ,
Original file line number Diff line number Diff line change 1+ import FileSystem
12import Foundation
23import Mockable
34import Path
@@ -216,18 +217,24 @@ final class ProjectEditor: ProjectEditing {
216217 plugins: Plugins ,
217218 onlyCurrentDirectory: Bool
218219 ) async throws -> [ EditablePluginManifest ] {
219- let loadedEditablePluginManifests = try plugins. projectDescriptionHelpers
220+ let loadedEditablePluginManifests = plugins. projectDescriptionHelpers
220221 . filter { $0. location == . local }
221- . map { EditablePluginManifest ( name: $0. name, path: try FileHandler . shared. resolveSymlinks ( $0. path. parentDirectory) ) }
222+ . map {
223+ EditablePluginManifest (
224+ name: $0. name,
225+ path: $0. path. parentDirectory
226+ )
227+ }
222228
223229 let localEditablePluginManifests = try await manifestFilesLocator. locatePluginManifests (
224230 at: path,
225231 excluding: excluding,
226232 onlyCurrentDirectory: onlyCurrentDirectory
227- ) . map {
233+ )
234+ . map {
228235 EditablePluginManifest (
229236 name: $0. parentDirectory. basename,
230- path: try FileHandler . shared . resolveSymlinks ( $0. parentDirectory)
237+ path: $0. parentDirectory
231238 )
232239 }
233240
Original file line number Diff line number Diff line change @@ -115,7 +115,12 @@ public final class SwiftPackageManagerGraphLoader: SwiftPackageManagerGraphLoadi
115115 guard let path = dependency. packageRef. path ?? dependency. packageRef. location else {
116116 throw SwiftPackageManagerGraphGeneratorError . missingPathInLocalSwiftPackage ( name)
117117 }
118- packageFolder = try AbsolutePath ( validating: path)
118+ // There's a bug in the `relative` implementation that produces the wrong path when using a symbolic link.
119+ // This leads to nonexisting path in the `ModuleMapMapper` that relies on that method.
120+ // To get around this, we're aligning paths from `workspace-state.json` with the /var temporary directory.
121+ packageFolder = try AbsolutePath (
122+ validating: path. replacingOccurrences ( of: " /private/var " , with: " /var " )
123+ )
119124 case " registry " :
120125 let registryFolder = path. appending ( try RelativePath ( validating: " registry/downloads " ) )
121126 packageFolder = registryFolder. appending ( try RelativePath ( validating: dependency. subpath) )
Original file line number Diff line number Diff line change @@ -870,8 +870,8 @@ extension ProjectDescription.ResourceFileElements {
870870 {
871871 let absolutePathGlob = resourceAbsolutePath. extension != nil ? resourceAbsolutePath : resourceAbsolutePath
872872 . appending ( component: " ** " )
873- if try excludedPaths
874- . contains ( where: { try FileHandler . shared . resolveSymlinks ( absolutePathGlob) . isDescendantOfOrEqual ( to: $0) } )
873+ if excludedPaths
874+ . contains ( where: { absolutePathGlob. isDescendantOfOrEqual ( to: $0) } )
875875 {
876876 return nil
877877 }
@@ -927,7 +927,7 @@ extension ProjectDescription.ResourceFileElements {
927927 }
928928 }
929929 )
930- resourceFileElements += try defaultResourcePaths ( from: path) { candidateURL in
930+ resourceFileElements += try await defaultResourcePaths ( from: path) { candidateURL in
931931 let candidatePath = AbsolutePath ( stringLiteral: candidateURL. path)
932932 let candidateNotInExcludedDirectory = excludedPaths. allSatisfy { !$0. isAncestorOfOrEqual ( to: candidatePath) }
933933 return candidateNotInExcludedDirectory
Original file line number Diff line number Diff line change @@ -86,7 +86,6 @@ public protocol FileHandling: AnyObject {
8686 func urlSafeBase64MD5( path: Path . AbsolutePath ) throws -> String
8787 func fileSize( path: Path . AbsolutePath ) throws -> UInt64
8888 func changeExtension( path: Path . AbsolutePath , to newExtension: String ) throws -> Path . AbsolutePath
89- func resolveSymlinks( _ path: Path . AbsolutePath ) throws -> Path . AbsolutePath
9089 func fileAttributes( at path: Path . AbsolutePath ) throws -> [ FileAttributeKey : Any ]
9190 func filesAndDirectoriesContained( in path: Path . AbsolutePath ) throws -> [ Path . AbsolutePath ] ?
9291 func zipItem( at sourcePath: Path . AbsolutePath , to destinationPath: Path . AbsolutePath ) throws
@@ -353,10 +352,6 @@ public class FileHandler: FileHandling {
353352 try fileManager. createSymbolicLink ( atPath: path. pathString, withDestinationPath: destination. pathString)
354353 }
355354
356- public func resolveSymlinks( _ path: Path . AbsolutePath ) throws -> Path . AbsolutePath {
357- try . init( validating: TSCBasic . resolveSymlinks ( . init( validating: path. pathString) ) . pathString)
358- }
359-
360355 public func fileAttributes( at path: Path . AbsolutePath ) throws -> [ FileAttributeKey : Any ] {
361356 try fileManager. attributesOfItem ( atPath: path. pathString)
362357 }
Original file line number Diff line number Diff line change @@ -405,10 +405,6 @@ final class WorkspaceStructureGeneratorTests: XCTestCase {
405405 [ ]
406406 }
407407
408- func resolveSymlinks( _ path: AbsolutePath ) -> AbsolutePath {
409- path
410- }
411-
412408 func fileAttributes( at _: AbsolutePath ) throws -> [ FileAttributeKey : Any ] {
413409 [ : ]
414410 }
Original file line number Diff line number Diff line change @@ -8,8 +8,6 @@ import XCTest
88final class RunAcceptanceTestCommandLineToolBasic : TuistAcceptanceTestCase {
99 func test_command_line_tool_basic( ) async throws {
1010 try await setUpFixture ( . commandLineToolBasic)
11- fixturePath = try AbsolutePath ( validating: " / " )
12- . appending ( components: Array ( fixturePath. components. dropFirst ( 2 ) ) )
1311 try await run ( InstallCommand . self)
1412 try await run ( RunCommand . self, " CommandLineTool " )
1513 }
Original file line number Diff line number Diff line change @@ -240,6 +240,10 @@ final class ProjectEditorTests: TuistUnitTestCase {
240240 directory. appending ( components: " C " , " Plugin.swift " ) ,
241241 directory. appending ( components: " D " , " Plugin.swift " ) ,
242242 ]
243+ for pluginManifest in pluginManifests {
244+ try await fileSystem. makeDirectory ( at: pluginManifest. parentDirectory)
245+ try await fileSystem. touch ( pluginManifest)
246+ }
243247 let tuistPath = try AbsolutePath ( validating: ProcessInfo . processInfo. arguments. first!)
244248
245249 // When
You can’t perform that action at this time.
0 commit comments