Skip to content

Commit c7bdcea

Browse files
authored
Add missing products from the swift-syntax prebuilts. (#8458)
We were focused on including things for macros but missed a number of products, including new ones for 601. With this change we now just include all the products and make sure all the targets they depend on end up in the library.
1 parent b72d47d commit c7bdcea

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

Sources/swift-build-prebuilts/BuildPrebuilts.swift

+48-3
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,42 @@ var prebuiltRepos: IdentifiableSet<PrebuiltRepos> = [
5858
"SwiftParserDiagnostics",
5959
"SwiftRefactor",
6060
"SwiftSyntax",
61+
"SwiftSyntaxBuilder",
6162
"SwiftSyntaxMacros",
6263
"SwiftSyntaxMacroExpansion",
6364
"SwiftSyntaxMacrosTestSupport",
6465
"SwiftSyntaxMacrosGenericTestSupport",
66+
"_SwiftCompilerPluginMessageHandling",
67+
"_SwiftLibraryPluginProvider",
6568
],
6669
cModules: [
6770
"_SwiftSyntaxCShims",
6871
]
6972
),
70-
7173
]),
7274
cModulePaths: [
7375
"_SwiftSyntaxCShims": ["Sources", "_SwiftSyntaxCShims"]
7476
],
7577
addProduct: { library, repoDir in
76-
try await shell("swift package add-product \(library.name) --type static-library --targets \(library.products.joined(separator: " "))", cwd: repoDir)
78+
let targets = [
79+
"SwiftBasicFormat",
80+
"SwiftCompilerPlugin",
81+
"SwiftDiagnostics",
82+
"SwiftIDEUtils",
83+
"SwiftOperators",
84+
"SwiftParser",
85+
"SwiftParserDiagnostics",
86+
"SwiftRefactor",
87+
"SwiftSyntax",
88+
"SwiftSyntaxBuilder",
89+
"SwiftSyntaxMacros",
90+
"SwiftSyntaxMacroExpansion",
91+
"SwiftSyntaxMacrosTestSupport",
92+
"SwiftSyntaxMacrosGenericTestSupport",
93+
"SwiftCompilerPluginMessageHandling",
94+
"SwiftLibraryPluginProvider",
95+
]
96+
try await shell("swift package add-product \(library.name) --type static-library --targets \(targets.joined(separator: " "))", cwd: repoDir)
7797
}
7898
),
7999
.init(
@@ -86,15 +106,20 @@ var prebuiltRepos: IdentifiableSet<PrebuiltRepos> = [
86106
"SwiftCompilerPlugin",
87107
"SwiftDiagnostics",
88108
"SwiftIDEUtils",
109+
"SwiftIfConfig",
110+
"SwiftLexicalLookup",
89111
"SwiftOperators",
90112
"SwiftParser",
91113
"SwiftParserDiagnostics",
92114
"SwiftRefactor",
93115
"SwiftSyntax",
116+
"SwiftSyntaxBuilder",
94117
"SwiftSyntaxMacros",
95118
"SwiftSyntaxMacroExpansion",
96119
"SwiftSyntaxMacrosTestSupport",
97120
"SwiftSyntaxMacrosGenericTestSupport",
121+
"_SwiftCompilerPluginMessageHandling",
122+
"_SwiftLibraryPluginProvider",
98123
],
99124
cModules: [
100125
"_SwiftSyntaxCShims",
@@ -106,13 +131,33 @@ var prebuiltRepos: IdentifiableSet<PrebuiltRepos> = [
106131
"_SwiftSyntaxCShims": ["Sources", "_SwiftSyntaxCShims"]
107132
],
108133
addProduct: { library, repoDir in
134+
let targets = [
135+
"SwiftBasicFormat",
136+
"SwiftCompilerPlugin",
137+
"SwiftDiagnostics",
138+
"SwiftIDEUtils",
139+
"SwiftIfConfig",
140+
"SwiftLexicalLookup",
141+
"SwiftOperators",
142+
"SwiftParser",
143+
"SwiftParserDiagnostics",
144+
"SwiftRefactor",
145+
"SwiftSyntax",
146+
"SwiftSyntaxBuilder",
147+
"SwiftSyntaxMacros",
148+
"SwiftSyntaxMacroExpansion",
149+
"SwiftSyntaxMacrosTestSupport",
150+
"SwiftSyntaxMacrosGenericTestSupport",
151+
"SwiftCompilerPluginMessageHandling",
152+
"SwiftLibraryPluginProvider",
153+
]
109154
// swift package add-product doesn't work here since it's now computed
110155
let packageFile = repoDir.appending(component: "Package.swift")
111156
var package = try String(contentsOf: packageFile.asURL)
112157
package.replace("products: products,", with: """
113158
products: products + [
114159
.library(name: "\(library.name)", type: .static, targets: [
115-
\(library.products.map({ "\"\($0)\"" }).joined(separator: ","))
160+
\(targets.map({ "\"\($0)\"" }).joined(separator: ","))
116161
])
117162
],
118163
""")

0 commit comments

Comments
 (0)