Skip to content

Commit ebe5e1b

Browse files
Merge branch 'main'
Conflicts: Sources/SwiftParser/Expressions.swift Sources/SwiftParser/Statements.swift Sources/SwiftParser/StringLiterals.swift
2 parents 47e57d8 + 1672a3e commit ebe5e1b

File tree

364 files changed

+10951
-2899
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

364 files changed

+10951
-2899
lines changed

.bazelrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,12 @@ common --lockfile_mode=off
55
build --features=swift.use_explicit_swift_module_map
66
build --host_features=swift.use_explicit_swift_module_map
77

8+
# Improved build performance
9+
build --host_swiftcopt=-whole-module-optimization
10+
build --swiftcopt=-whole-module-optimization
11+
12+
# Keep in sync with Package.swift
13+
build --host_macos_minimum_os=10.15
14+
build --macos_minimum_os=10.15
15+
816
test --test_output=errors

.swift-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": 1,
3-
"lineLength": 160,
3+
"lineLength": 120,
44
"indentation": {
55
"spaces": 2
66
},

BUILD.bazel

Lines changed: 201 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,21 @@
1-
load("//utils/bazel:swift_syntax_library.bzl", "swift_syntax_library")
1+
load("@build_bazel_rules_apple//apple/testing/default_runner:ios_xctestrun_runner.bzl", "ios_xctestrun_runner")
2+
load("//utils/bazel:swift_syntax_library.bzl", "swift_syntax_library", "swift_syntax_test")
23

34
package(default_visibility = ["//visibility:public"])
45

5-
cc_library(
6-
name = "_AtomicBool",
7-
srcs = glob(["Sources/_AtomicBool/src/*.c"]),
8-
hdrs = glob(["Sources/_AtomicBool/include/*.h"]),
9-
includes = ["Sources/_AtomicBool/include"],
10-
tags = ["swift_module=_AtomicBool"],
11-
)
12-
136
swift_syntax_library(
14-
name = "SwiftIDEUtils",
7+
name = "SwiftBasicFormat",
158
deps = [
16-
":SwiftParser",
179
":SwiftSyntax",
1810
],
1911
)
2012

21-
swift_syntax_library(
22-
name = "SwiftSyntax",
13+
swift_syntax_test(
14+
name = "SwiftBasicFormatTest",
2315
deps = [
24-
":_AtomicBool",
25-
],
26-
)
27-
28-
swift_syntax_library(
29-
name = "SwiftBasicFormat",
30-
deps = [
31-
":SwiftSyntax",
16+
":SwiftBasicFormat",
17+
":SwiftSyntaxBuilder",
18+
":_SwiftSyntaxTestSupport",
3219
],
3320
)
3421

@@ -46,42 +33,76 @@ swift_syntax_library(
4633
":SwiftDiagnostics",
4734
":SwiftOperators",
4835
":SwiftParser",
36+
":SwiftSyntax",
4937
":SwiftSyntaxMacroExpansion",
5038
":SwiftSyntaxMacros",
5139
],
5240
)
5341

42+
swift_syntax_test(
43+
name = "SwiftCompilerPluginTest",
44+
deps = [
45+
":SwiftCompilerPlugin",
46+
],
47+
)
48+
5449
swift_syntax_library(
55-
name = "SwiftSyntaxMacroExpansion",
50+
name = "SwiftDiagnostics",
5651
deps = [
57-
":SwiftOperators",
5852
":SwiftSyntax",
59-
":SwiftSyntaxMacros",
53+
],
54+
)
55+
56+
swift_syntax_test(
57+
name = "SwiftDiagnosticsTest",
58+
deps = [
59+
":SwiftDiagnostics",
60+
":SwiftParser",
61+
":SwiftParserDiagnostics",
62+
":_SwiftSyntaxTestSupport",
6063
],
6164
)
6265

6366
swift_syntax_library(
64-
name = "SwiftDiagnostics",
67+
name = "SwiftIDEUtils",
68+
deps = [
69+
":SwiftDiagnostics",
70+
":SwiftParser",
71+
":SwiftSyntax",
72+
],
73+
)
74+
75+
swift_syntax_test(
76+
name = "SwiftIDEUtilsTest",
6577
deps = [
78+
":SwiftIDEUtils",
79+
":SwiftParser",
6680
":SwiftSyntax",
81+
":_SwiftSyntaxTestSupport",
6782
],
6883
)
6984

7085
swift_syntax_library(
71-
name = "SwiftSyntaxMacros",
86+
name = "SwiftOperators",
7287
deps = [
7388
":SwiftDiagnostics",
7489
":SwiftParser",
7590
":SwiftSyntax",
76-
":SwiftSyntaxBuilder",
91+
],
92+
)
93+
94+
swift_syntax_test(
95+
name = "SwiftOperatorsTest",
96+
deps = [
97+
":SwiftOperators",
98+
":SwiftParser",
99+
":_SwiftSyntaxTestSupport",
77100
],
78101
)
79102

80103
swift_syntax_library(
81104
name = "SwiftParser",
82105
deps = [
83-
":SwiftBasicFormat",
84-
":SwiftDiagnostics",
85106
":SwiftSyntax",
86107
],
87108
)
@@ -96,28 +117,124 @@ swift_syntax_library(
96117
],
97118
)
98119

120+
swift_syntax_test(
121+
name = "SwiftParserDiagnosticsTest",
122+
deps = [
123+
":SwiftDiagnostics",
124+
":SwiftParserDiagnostics",
125+
],
126+
)
127+
128+
swift_syntax_test(
129+
name = "SwiftParserTest",
130+
deps = [
131+
":SwiftDiagnostics",
132+
":SwiftIDEUtils",
133+
":SwiftOperators",
134+
":SwiftParser",
135+
":SwiftSyntaxBuilder",
136+
":_SwiftSyntaxTestSupport",
137+
],
138+
)
139+
140+
swift_syntax_library(
141+
name = "SwiftRefactor",
142+
deps = [
143+
":SwiftBasicFormat",
144+
":SwiftParser",
145+
":SwiftSyntax",
146+
":SwiftSyntaxBuilder",
147+
],
148+
)
149+
150+
swift_syntax_test(
151+
name = "SwiftRefactorTest",
152+
deps = [
153+
":SwiftRefactor",
154+
":_SwiftSyntaxTestSupport",
155+
],
156+
)
157+
158+
swift_syntax_library(
159+
name = "SwiftSyntax",
160+
deps = [
161+
":SwiftSyntax509",
162+
":SwiftSyntax510",
163+
":SwiftSyntax600",
164+
":_AtomicBool",
165+
],
166+
)
167+
168+
swift_syntax_library(
169+
name = "SwiftSyntax509",
170+
srcs = glob(["Sources/VersionMarkerModules/SwiftSyntax509/**/*.swift"]),
171+
deps = [
172+
],
173+
)
174+
175+
swift_syntax_library(
176+
name = "SwiftSyntax510",
177+
srcs = glob(["Sources/VersionMarkerModules/SwiftSyntax510/**/*.swift"]),
178+
deps = [
179+
],
180+
)
181+
182+
swift_syntax_library(
183+
name = "SwiftSyntax600",
184+
srcs = glob(["Sources/VersionMarkerModules/SwiftSyntax600/**/*.swift"]),
185+
deps = [
186+
],
187+
)
188+
99189
swift_syntax_library(
100190
name = "SwiftSyntaxBuilder",
101191
deps = [
102192
":SwiftBasicFormat",
193+
":SwiftDiagnostics",
103194
":SwiftParser",
104195
":SwiftParserDiagnostics",
105196
":SwiftSyntax",
106197
],
107198
)
108199

200+
swift_syntax_test(
201+
name = "SwiftSyntaxBuilderTest",
202+
deps = [
203+
":SwiftSyntaxBuilder",
204+
":_SwiftSyntaxTestSupport",
205+
],
206+
)
207+
109208
swift_syntax_library(
110-
name = "SwiftOperators",
209+
name = "SwiftSyntaxMacroExpansion",
111210
deps = [
112211
":SwiftDiagnostics",
212+
":SwiftOperators",
213+
":SwiftSyntax",
214+
":SwiftSyntaxBuilder",
215+
":SwiftSyntaxMacros",
216+
],
217+
)
218+
219+
swift_syntax_test(
220+
name = "SwiftSyntaxMacroExpansionTest",
221+
deps = [
222+
":SwiftDiagnostics",
223+
":SwiftOperators",
113224
":SwiftParser",
114225
":SwiftSyntax",
226+
":SwiftSyntaxBuilder",
227+
":SwiftSyntaxMacroExpansion",
228+
":SwiftSyntaxMacros",
229+
":SwiftSyntaxMacrosTestSupport",
230+
":_SwiftSyntaxTestSupport",
115231
],
116232
)
117233

118234
swift_syntax_library(
119-
name = "SwiftRefactor",
235+
name = "SwiftSyntaxMacros",
120236
deps = [
237+
":SwiftDiagnostics",
121238
":SwiftParser",
122239
":SwiftSyntax",
123240
":SwiftSyntaxBuilder",
@@ -129,13 +246,59 @@ swift_syntax_library(
129246
testonly = True,
130247
deps = [
131248
":SwiftDiagnostics",
249+
":SwiftIDEUtils",
132250
":SwiftParser",
133251
":SwiftSyntaxMacroExpansion",
134252
":SwiftSyntaxMacros",
135253
":_SwiftSyntaxTestSupport",
136254
],
137255
)
138256

257+
swift_syntax_test(
258+
name = "SwiftSyntaxMacrosTestSupportTests",
259+
deps = [
260+
":SwiftDiagnostics",
261+
":SwiftSyntax",
262+
":SwiftSyntaxMacros",
263+
":SwiftSyntaxMacrosTestSupport",
264+
],
265+
)
266+
267+
swift_syntax_test(
268+
name = "SwiftSyntaxTest",
269+
deps = [
270+
":SwiftSyntax",
271+
":SwiftSyntaxBuilder",
272+
":_SwiftSyntaxTestSupport",
273+
],
274+
)
275+
276+
swift_syntax_test(
277+
name = "SwiftSyntaxTestSupportTest",
278+
deps = [
279+
":SwiftParser",
280+
":_SwiftSyntaxTestSupport",
281+
],
282+
)
283+
284+
cc_library(
285+
name = "_AtomicBool",
286+
srcs = glob(["Sources/_AtomicBool/src/*.c"]),
287+
hdrs = glob(["Sources/_AtomicBool/include/*.h"]),
288+
includes = ["Sources/_AtomicBool/include"],
289+
tags = ["swift_module=_AtomicBool"],
290+
visibility = ["//visibility:private"],
291+
)
292+
293+
cc_library(
294+
name = "_InstructionCounter",
295+
srcs = glob(["Sources/_InstructionCounter/src/*.c"]),
296+
hdrs = glob(["Sources/_InstructionCounter/include/*.h"]),
297+
includes = ["Sources/_InstructionCounter/include"],
298+
tags = ["swift_module=_InstructionCounter"],
299+
visibility = ["//visibility:private"],
300+
)
301+
139302
swift_syntax_library(
140303
name = "_SwiftSyntaxTestSupport",
141304
testonly = True,
@@ -146,3 +309,10 @@ swift_syntax_library(
146309
":SwiftSyntaxMacroExpansion",
147310
],
148311
)
312+
313+
ios_xctestrun_runner(
314+
name = "ios_test_runner",
315+
random = False,
316+
reuse_simulator = True,
317+
visibility = ["//visibility:private"],
318+
)

CMakeLists.txt

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,12 @@ endif()
6363

6464
# Determine the module triple.
6565
if("${SWIFT_HOST_MODULE_TRIPLE}" STREQUAL "")
66-
# FIXME: This is a hack. It's all a hack. Windows isn't setting
67-
# CMAKE_Swift_COMPILER_TARGET.
66+
set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info)
6867
if(CMAKE_Swift_COMPILER_TARGET)
69-
string(REGEX REPLACE "macosx[0-9]+([.][0-9]+)?" "macos" SWIFT_HOST_MODULE_TRIPLE
70-
${CMAKE_Swift_COMPILER_TARGET})
71-
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
72-
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
73-
set(SWIFT_HOST_MODULE_TRIPLE "x86_64-unknown-windows-msvc")
74-
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64")
75-
set(SWIFT_HOST_MODULE_TRIPLE "aarch64-unknown-windows-msvc")
76-
else()
77-
message(FATAL_ERROR "Unrecognized architecture for Windows host")
78-
endif()
79-
else()
80-
execute_process(COMMAND ${CMAKE_Swift_COMPILER} -print-target-info OUTPUT_VARIABLE target_info)
81-
string(JSON SWIFT_HOST_MODULE_TRIPLE GET ${target_info} target moduleTriple)
68+
list(APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET})
8269
endif()
70+
execute_process(COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json)
71+
string(JSON SWIFT_HOST_MODULE_TRIPLE GET "${target_info_json}" "target" "moduleTriple")
8372
endif()
8473
message(STATUS "Module triple: ${SWIFT_HOST_MODULE_TRIPLE}")
8574

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ We prefer to not squash commits when merging a PR because, especially for larger
7171
- During review, the commits can be reviewed individually, making each review chunk smaller
7272
- In case this PR introduced a bug that is identified later, it is possible to check if it resulted from the refactoring or the actual change, thereby making it easier find the lines that introduce the issue.
7373

74+
## Opening a PR
75+
76+
To submit a PR you don't need permissions on this repo, instead you can fork the repo and create a PR through your forked version.
77+
78+
For more information and instructions, read the GitHub docs on [forking a repo](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo).
79+
80+
Once you've pushed your branch, you should see an option on this repository's page to create a PR from a branch in your fork.
81+
7482
## Review and CI Testing
7583

7684
After you opened your PR, a maintainer will review it and test your changes in CI (*Continuous Integration*) by adding a `@swift-ci Please test` comment on the pull request. Once your PR is approved and CI has passed, the maintainer will merge your pull request.

CodeGeneration/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let package = Package(
1212
.executable(name: "generate-swift-syntax", targets: ["generate-swift-syntax"])
1313
],
1414
dependencies: [
15-
.package(url: "https://github.com/apple/swift-syntax", from: "509.0.0"),
15+
.package(url: "https://github.com/apple/swift-syntax", from: "510.0.0"),
1616
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.2"),
1717
],
1818
targets: [

0 commit comments

Comments
 (0)