Skip to content

Commit 09d75c8

Browse files
committed
WIP: Verify that files generated with SwiftSyntaxBuilder match the checked-in state
Currently, we only verify that the gyb-generated files match the checked in source state. As more and more files are being generated using CodeGeneration, we should also verify them in CI. rdar://103023853
1 parent cdbdcba commit 09d75c8

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CodeGeneration/Package.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let package = Package(
1414
],
1515
dependencies: [
1616
.package(url: "https://github.com/apple/swift-syntax.git", revision: "6e3dfb332553ad1462f0a3d45b4d91e349ce4013"),
17-
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.1.4")),
17+
// swift-argument-parser dependency is added below
1818
],
1919
targets: [
2020
.executableTarget(
@@ -78,3 +78,14 @@ let package = Package(
7878
),
7979
]
8080
)
81+
82+
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
83+
// Building standalone.
84+
package.dependencies += [
85+
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.1.4")),
86+
]
87+
} else {
88+
package.dependencies += [
89+
.package(path: "../swift-argument-parser")
90+
]
91+
}

CodeGeneration/Sources/generate-swiftideutils/SyntaxClassificationFile.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import SwiftSyntaxBuilder
1515
import SyntaxSupport
1616
import Utils
1717

18+
1819
// Collects the list of classifications to use for contextual classification.
1920
var node_child_classifications: [ChildClassification] {
2021
var result = [ChildClassification]()

build-script.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ def run_code_generation(
370370

371371
env = dict(os.environ)
372372
env["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] = "1"
373+
env["SWIFTCI_USE_LOCAL_DEPS"] = "1"
373374
check_call(swiftpm_call, env=env, verbose=verbose)
374375

375376

@@ -741,7 +742,7 @@ def verify_source_code_command(args: argparse.Namespace) -> None:
741742
try:
742743
verify_gyb_generated_files(args.gyb_exec, verbose=args.verbose)
743744

744-
if not args.gyb_only:
745+
if not args.gyb_only or True:
745746
verify_code_generated_files(
746747
toolchain=args.toolchain,
747748
verbose=args.verbose,

0 commit comments

Comments
 (0)