Skip to content

Put default interface verifier behind an env var #791

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

Merged
merged 1 commit into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sources/SwiftDriver/Jobs/Planning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ extension Driver {
default: false)
else { return }

// FIXME: remove this when we are confident to enable interface verification
// by default.
if env["ENABLE_DEFAULT_INTERFACE_VERIFIER"] == nil &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly a note for the future when we'll turn this var around. We could move this check to the default argument on line 432:

       parsedOptions.hasFlag(positive: .verifyEmittedModuleInterface,
                             negative: .noVerifyEmittedModuleInterface,
                             default: true),

!parsedOptions.hasArgument(.verifyEmittedModuleInterface) {
return
}
func addVerifyJob(forPrivate: Bool) throws {
let isNeeded =
forPrivate
Expand Down
22 changes: 17 additions & 5 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3940,6 +3940,8 @@ final class SwiftDriverTests: XCTestCase {

func testVerifyEmittedInterfaceJob() throws {
// Evolution enabled
var envVars = ProcessEnv.vars
envVars["ENABLE_DEFAULT_INTERFACE_VERIFIER"] = "YES"
do {
var driver = try Driver(args: ["swiftc", "foo.swift", "-emit-module", "-module-name",
"foo", "-emit-module-interface",
Expand All @@ -3965,7 +3967,7 @@ final class SwiftDriverTests: XCTestCase {
// No Evolution
do {
var driver = try Driver(args: ["swiftc", "foo.swift", "-emit-module", "-module-name",
"foo", "-emit-module-interface", "-verify-emitted-module-interface"])
"foo", "-emit-module-interface", "-verify-emitted-module-interface"], env: envVars)
let plannedJobs = try driver.planBuild()
XCTAssertEqual(plannedJobs.count, 2)
}
Expand All @@ -3975,7 +3977,7 @@ final class SwiftDriverTests: XCTestCase {
var driver = try Driver(args: ["swiftc", "foo.swift", "-emit-module", "-module-name",
"foo", "-emit-module-interface",
"-enable-library-evolution",
"-no-verify-emitted-module-interface"])
"-no-verify-emitted-module-interface"], env: envVars)
let plannedJobs = try driver.planBuild()
XCTAssertEqual(plannedJobs.count, 2)
}
Expand All @@ -3985,18 +3987,28 @@ final class SwiftDriverTests: XCTestCase {
var driver = try Driver(args: ["swiftc", "foo.swift", "-emit-module", "-module-name",
"foo", "-emit-module-interface",
"-enable-library-evolution",
"-no-emit-module-separately"])
"-no-emit-module-separately"], env: envVars)
let plannedJobs = try driver.planBuild()
XCTAssertEqual(plannedJobs.count, 2)
}

// Emit-module separately
// Disabled when no "ENABLE_DEFAULT_INTERFACE_VERIFIER" found in the environment
do {
var driver = try Driver(args: ["swiftc", "foo.swift", "-emit-module", "-module-name",
"foo", "-emit-module-interface",
"-enable-library-evolution",
"-experimental-emit-module-separately"])
let plannedJobs = try driver.planBuild()
XCTAssertEqual(plannedJobs.count, 1)
}

// Emit-module separately
do {
var driver = try Driver(args: ["swiftc", "foo.swift", "-emit-module", "-module-name",
"foo", "-emit-module-interface",
"-enable-library-evolution",
"-experimental-emit-module-separately"], env: envVars)
let plannedJobs = try driver.planBuild()
XCTAssertEqual(plannedJobs.count, 2)
let emitJob = plannedJobs[0]
let verifyJob = plannedJobs[1]
Expand All @@ -4015,7 +4027,7 @@ final class SwiftDriverTests: XCTestCase {
var driver = try Driver(args: ["swiftc", "foo.swift", "-emit-module", "-module-name",
"foo", "-emit-module-interface",
"-enable-library-evolution",
"-whole-module-optimization"])
"-whole-module-optimization"], env: envVars)
let plannedJobs = try driver.planBuild()
XCTAssertEqual(plannedJobs.count, 2)
let emitJob = plannedJobs[0]
Expand Down