Skip to content

Commit b4cf5dc

Browse files
committed
added --pull support
1 parent ca894ff commit b4cf5dc

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Sources/swift-build/main.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ do {
8181

8282
do {
8383
let dependencies = try get(manifest.package.dependencies, prefix: depsdir)
84+
85+
if opts.pull == false {
86+
try build(dependencies)
87+
try build(try get(manifest.package.testDependencies, prefix: depsdir))
8488

85-
try build(dependencies)
86-
try build(try get(manifest.package.testDependencies, prefix: depsdir))
87-
88-
// build the current directory
89-
try llbuild(srcroot: rootd, targets: targets, dependencies: dependencies, prefix: builddir, tmpdir: Path.join(builddir, "\(pkgname).o"), configuration: configuration)
89+
// build the current directory
90+
try llbuild(srcroot: rootd, targets: targets, dependencies: dependencies, prefix: builddir, tmpdir: Path.join(builddir, "\(pkgname).o"), configuration: configuration)
91+
}
9092
} catch POSIX.Error.ExitStatus(let foo) {
9193
#if os(Linux)
9294
// it is a common error on Linux for clang++ to not be installed, but

Sources/swift-build/usage.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func usage(print: (String) -> Void = { print($0) }) {
2929
print(" -v[v] Increase verbosity of informational output")
3030
print(" -Xcc <flag> Pass flag through to all compiler instantiations")
3131
print(" -Xlinker <flag> Pass flag through to all linker instantiations")
32+
print(" --pull Only pull down dependencies without building binaries")
3233
}
3334

3435
enum CleanMode: String {
@@ -55,6 +56,7 @@ struct Options {
5556
var verbosity: Int = 0
5657
var Xcc: [String] = []
5758
var Xlinker: [String] = []
59+
var pull = false
5860
}
5961

6062
func parse(commandLineArguments args: [String]) throws -> (Mode, Options) {
@@ -156,6 +158,8 @@ func parse(commandLineArguments args: [String]) throws -> (Mode, Options) {
156158

157159
case .Switch(.Xlinker):
158160
opts.Xlinker.append(try cruncher.rawPop())
161+
case .Switch(.Pull):
162+
opts.pull = true
159163
}
160164
}
161165

@@ -208,6 +212,7 @@ private struct Cruncher {
208212
case Verbose = "--verbose"
209213
case Xcc = "-Xcc"
210214
case Xlinker = "-Xlinker"
215+
case Pull = "--pull"
211216

212217
init?(rawValue: String) {
213218
switch rawValue {
@@ -219,6 +224,8 @@ private struct Cruncher {
219224
self = .Xcc
220225
case Xlinker.rawValue:
221226
self = .Xlinker
227+
case Pull.rawValue:
228+
self = .Pull
222229
default:
223230
return nil
224231
}

0 commit comments

Comments
 (0)