Skip to content

Commit c80d245

Browse files
committed
Build regex parser by default.
Currently, SwiftCompilerSources' inclusion of the regex parser depends on CMake flag `SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING`. However, in some scenarios we want to build the regex parser as part of the compiler _without_ building the runtime modules. This patch makes building the regex parser the default regardless of `SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING`. Only when the build environment is missing the string processing repo, we skip building the regex parser by setting `SWIFT_BUILD_REGEX_PARSER_IN_COMPILER` to false.
1 parent d0691e3 commit c80d245

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ option(SWIFT_BUILD_PERF_TESTSUITE
137137
"Create in-tree targets for building swift performance benchmarks."
138138
FALSE)
139139

140+
option(SWIFT_BUILD_REGEX_PARSER_IN_COMPILER
141+
"Build the Swift regex parser as part of the compiler."
142+
TRUE)
143+
140144
option(SWIFT_INCLUDE_TESTS "Create targets for building/running tests." TRUE)
141145

142146
option(SWIFT_INCLUDE_TEST_BINARIES

SwiftCompilerSources/Sources/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
add_subdirectory(Basic)
1212
add_subdirectory(AST)
13-
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
13+
if(SWIFT_BUILD_REGEX_PARSER_IN_COMPILER)
1414
add_subdirectory(_RegexParser)
1515
endif()
1616
add_subdirectory(SIL)

SwiftCompilerSources/Sources/Optimizer/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
set(dependencies)
1010
list(APPEND dependencies Basic SIL)
11-
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
11+
if(SWIFT_BUILD_REGEX_PARSER_IN_COMPILER)
1212
list(APPEND dependencies _CompilerRegexParser)
1313
endif()
1414

utils/build-script-impl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,14 +2200,23 @@ for host in "${ALL_HOSTS[@]}"; do
22002200
)
22012201
fi
22022202

2203-
if [[ $(true_false "${SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING}") == "TRUE" && \
2204-
-d "${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}" && \
2203+
if [[ -d "${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}" && \
22052204
-n "$(ls -A "${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}")" ]] ; then
22062205
cmake_options=(
22072206
"${cmake_options[@]}"
2208-
-DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING:BOOL=TRUE
22092207
-DEXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR="${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}"
22102208
)
2209+
if [[ $(true_false "${SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING}") == "TRUE" ]] ; then
2210+
cmake_options=(
2211+
"${cmake_options[@]}"
2212+
-DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING:BOOL=TRUE
2213+
)
2214+
fi
2215+
else
2216+
cmake_options=(
2217+
"${cmake_options[@]}"
2218+
-DSWIFT_BUILD_REGEX_PARSER_IN_COMPILER:BOOL=FALSE
2219+
)
22112220
fi
22122221

22132222
if [[ "${SWIFT_STDLIB_CONCURRENCY_TRACING}" ]] ; then

0 commit comments

Comments
 (0)