Skip to content

Commit adfca8f

Browse files
committed
[Layering] Remove direct imports of libc.
- At least, from the layers above POSIX/Utility.
1 parent 15d4e6c commit adfca8f

File tree

7 files changed

+25
-9
lines changed

7 files changed

+25
-9
lines changed

Sources/Commands/Error.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
import Basic
1212
import PackageModel
13-
import libc
1413

1514
import enum Utility.ColorWrap
1615
import enum Utility.Stream
16+
import func POSIX.exit
1717
import func Utility.isTTY
1818
import var Utility.stderr
1919

Sources/Commands/Options.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11-
import func libc.exit
11+
import POSIX
1212
import PackageModel
1313
import Utility
14-
import POSIX
1514

1615
public class Options {
1716
public var chdir: String?

Sources/Commands/SwiftTestTool.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Basic
1414
import Utility
1515

1616
import func POSIX.chdir
17-
import func libc.exit
17+
import func POSIX.exit
1818

1919
private enum TestError: ErrorProtocol {
2020
case testsExecutableNotFound

Sources/Commands/build().swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11-
import func POSIX.getenv
1211
import PackageModel
1312
import Utility
14-
import func libc.exit
13+
14+
import func POSIX.getenv
15+
import func POSIX.exit
1516

1617
// Builds the default target in the llbuild manifest unless specified.
1718
public func build(YAMLPath: String, target: String? = nil) throws {

Sources/Get/RawClone.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11-
import struct PackageDescription.Version
1211
import PackageModel
1312
import Utility
14-
import libc
13+
14+
import struct PackageDescription.Version
1515

1616
/**
1717
Initially we clone into a non-final form because we may need to

Sources/POSIX/exit.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright 2016 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See http://swift.org/LICENSE.txt for license information
8+
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
*/
10+
11+
import libc
12+
13+
@noreturn public func exit(_ status: Int32) {
14+
libc.exit(status)
15+
}

Sources/PackageLoading/transmute.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
import PackageModel
1212
import Utility
13-
import func libc.exit
13+
14+
import func POSIX.exit
1415

1516
/// Load packages into a complete set of modules and products.
1617
public func transmute(_ rootPackage: Package, externalPackages: [Package]) throws -> (modules: [Module], externalModules: [Module], products: [Product]) {

0 commit comments

Comments
 (0)