Skip to content

SR-1005: Replace POSIX module by Foundation #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
2 changes: 1 addition & 1 deletion Sources/Build/Command.link().swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

import func POSIX.mkdir
import func Utility.mkdir
import PackageType
import Utility
import PkgConfig
Expand Down
1 change: 1 addition & 0 deletions Sources/Build/PackageVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import class Utility.Git
import struct Utility.Path
import func Utility.fopen
import func Utility.fputs
import func Utility.mkdir

public func generateVersionData(_ rootDir: String, rootPackage: Package, externalPackages: [Package]) throws {
let dirPath = Path.join(rootDir, ".build/versionData")
Expand Down
1 change: 0 additions & 1 deletion Sources/Build/describe().swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/

import func POSIX.getenv
import func POSIX.mkdir
import PackageType
import Utility

Expand Down
3 changes: 1 addition & 2 deletions Sources/Build/misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import func POSIX.getenv
import func POSIX.popen
import func POSIX.mkdir
import PackageType
import Utility

Expand Down Expand Up @@ -114,7 +113,7 @@ extension ClangModule {
}

private func createModuleMap(inDir wd: String, type: UmbrellaType) throws {
try POSIX.mkdir(wd)
try Utility.mkdir(wd)
let moduleMapFile = Path.join(wd, self.moduleMap)
let moduleMap = try fopen(moduleMapFile, mode: .Write)
defer { moduleMap.closeFile() }
Expand Down
2 changes: 1 addition & 1 deletion Sources/Get/Git.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

import struct PackageDescription.Version
import func POSIX.realpath
import func Utility.realpath
import func POSIX.getenv
import enum POSIX.Error
import Utility
Expand Down
4 changes: 2 additions & 2 deletions Sources/Get/PackagesDirectory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/

import struct PackageDescription.Version
import func POSIX.mkdir
import func POSIX.rename
import func Utility.mkdir
import func Utility.rename
import PackageType
import Utility

Expand Down
5 changes: 1 addition & 4 deletions Sources/ManifestSerializer/Manifest+parse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

import func POSIX.realpath
import func POSIX.unlink
import PackageDescription
import PackageType
import Utility
import func Utility.fopen

extension Manifest {
public init(path pathComponents: String..., baseURL: String, swiftc: String, libdir: String) throws {
Expand Down Expand Up @@ -75,7 +72,7 @@ private func parse(path manifestPath: String, swiftc: String, libdir: String) th
cmd += ["-fileno", "\(fp.fileDescriptor)"]
try system(cmd)

let toml = try fopen(filePath).reduce("") { $0 + "\n" + $1 }
let toml = try fopen(filePath).enumerate().reduce("") { $0 + "\n" + $1 }
try unlink(filePath) //Delete the temp file after reading it

return toml != "" ? toml : nil
Expand Down
2 changes: 1 addition & 1 deletion Sources/Multitool/Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

import func libc.exit
import PackageType
import func POSIX.getenv
import Utility
import POSIX

public class Options {
public var chdir: String?
Expand Down
54 changes: 0 additions & 54 deletions Sources/POSIX/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,12 @@
public enum SystemError: ErrorProtocol {
case chdir(Int32)
case close(Int32)
case dirfd(Int32, String)
case fgetc(Int32)
case fread(Int32)
case getcwd(Int32)
case mkdir(Int32, String)
case mkdtemp(Int32)
case opendir(Int32, String)
case pipe(Int32)
case popen(Int32, String)
case posix_spawn(Int32, [String])
case read(Int32)
case readdir(Int32, String)
case readlink(Int32, String)
case realpath(Int32, String)
case rename(Int32, old: String, new: String)
case rmdir(Int32, String)
case stat(Int32, String)
case symlinkat(Int32, String)
case unlink(Int32, String)
case waitpid(Int32)
case time(Int32)
case gmtime_r(Int32)
case ctime_r(Int32)
case strftime
}

import func libc.strerror
Expand All @@ -54,20 +36,6 @@ extension SystemError: CustomStringConvertible {
return "chdir error: \(strerror(errno))"
case .close(let errno):
return "close error: \(strerror(errno))"
case .dirfd(let errno, _):
return "dirfd error: \(strerror(errno))"
case .fgetc(let errno):
return "fgetc error: \(strerror(errno))"
case .fread(let errno):
return "fread error: \(strerror(errno))"
case .getcwd(let errno):
return "getcwd error: \(strerror(errno))"
case .mkdir(let errno, let path):
return "mkdir error: \(strerror(errno)): \(path)"
case .mkdtemp(let errno):
return "mkdtemp error: \(strerror(errno))"
case .opendir(let errno, _):
return "opendir error: \(strerror(errno))"
case .pipe(let errno):
return "pipe error: \(strerror(errno))"
case .posix_spawn(let errno, let args):
Expand All @@ -76,32 +44,10 @@ extension SystemError: CustomStringConvertible {
return "popen error: \(strerror(errno))"
case .read(let errno):
return "read error: \(strerror(errno))"
case .readdir(let errno, _):
return "readdir error: \(strerror(errno))"
case .readlink(let errno, let path):
return "readlink error: \(path), \(strerror(errno))"
case .realpath(let errno, let path):
return "realpath error: \(strerror(errno)): \(path)"
case .rename(let errno, let old, let new):
return "rename error: \(strerror(errno)): \(old) -> \(new)"
case .rmdir(let errno, let path):
return "rmdir error: \(strerror(errno)): \(path)"
case .stat(let errno, _):
return "stat error: \(strerror(errno))"
case .symlinkat(let errno, _):
return "symlinkat error: \(strerror(errno))"
case .unlink(let errno, let path):
return "unlink error: \(strerror(errno)): \(path)"
case .waitpid(let errno):
return "waitpid error: \(strerror(errno))"
case .time(let errno):
return "time error: \(strerror(errno))"
case .gmtime_r(let errno):
return "gmtime_r error: \(strerror(errno))"
case .ctime_r(let errno):
return "ctime_r error: \(strerror(errno))"
case .strftime:
return "strftime error."
}
}
}
Expand Down
27 changes: 0 additions & 27 deletions Sources/POSIX/ctime_r.swift

This file was deleted.

11 changes: 0 additions & 11 deletions Sources/POSIX/fileno.swift

This file was deleted.

25 changes: 0 additions & 25 deletions Sources/POSIX/gmtime_r.swift

This file was deleted.

49 changes: 0 additions & 49 deletions Sources/POSIX/mkdir.swift

This file was deleted.

40 changes: 0 additions & 40 deletions Sources/POSIX/mkdtemp.swift

This file was deleted.

22 changes: 0 additions & 22 deletions Sources/POSIX/opendir.swift

This file was deleted.

25 changes: 0 additions & 25 deletions Sources/POSIX/readlink.swift

This file was deleted.

Loading