Skip to content

Commit 0977765

Browse files
committed
Add a version number indicating swift-driver's source version
1 parent d7cca36 commit 0977765

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Sources/SwiftDriver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ add_library(SwiftDriver
2323
Driver/ModuleOutputInfo.swift
2424
Driver/OutputFileMap.swift
2525
Driver/ToolExecutionDelegate.swift
26+
Driver/DriverVersion.swift
2627

2728
Execution/ArgsResolver.swift
2829
Execution/DriverExecutor.swift

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,12 @@ extension Driver {
830830
buildRecordInfo == nil) {
831831
assert(jobs.count == 1, "Cannot execute in place for multi-job build plans")
832832
var job = jobs[0]
833+
// Print the driver source version first before we print the compiler
834+
// versions.
835+
if job.kind == .versionRequest && !Driver.driverSourceVersion.isEmpty {
836+
stderrStream <<< "swift-driver version: " <<< Driver.driverSourceVersion <<< "\n"
837+
stderrStream.flush()
838+
}
833839
// Require in-place execution for all single job plans.
834840
job.requiresInPlaceExecution = true
835841
try executor.execute(job: job,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//===------ DriverVersion.swift - Swift Driver Source Version--------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
extension Driver {
13+
#if SWIFT_DRIVER_VERSION_DEFINED
14+
static let driverSourceVersion: String = SWIFT_DRIVER_VERSION
15+
#else
16+
static let driverSourceVersion: String = ""
17+
#endif
18+
}

0 commit comments

Comments
 (0)