Skip to content

Commit b626f46

Browse files
committed
[Build] Determine the early SwiftSyntax build directory in build-script-impl
Cross-compilation of the host depends on iteration over all of the host architectures within build-script-impl itself, so the computation of the build directory must occur in build-script-impl. Sink it down there to fix builds for multiple host architectures.
1 parent 1b71154 commit b626f46

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

utils/build-script-impl

+12
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ KNOWN_SETTINGS=(
230230
swift-disable-dead-stripping "0" "turns off Darwin-specific dead stripping for Swift host tools"
231231
common-swift-flags "" "Flags used for Swift targets other than the stdlib, like the corelibs"
232232
swift-enable-experimental-string-processing "1" "whether to build experimental string processing feature"
233+
swift-earlyswiftsyntax "0" "use the early SwiftSyntax"
233234

234235
## FREESTANDING Stdlib Options
235236
swift-freestanding-flavor "" "when building the FREESTANDING stdlib, which build style to use (options: apple, linux)"
@@ -850,6 +851,16 @@ function set_build_options_for_host() {
850851
swift_cmake_options+=(
851852
-DCOVERAGE_DB="${COVERAGE_DB}"
852853
)
854+
855+
if [[ "$(true_false ${SWIFT_EARLYSWIFTSYNTAX})" == "TRUE" ]]; then
856+
early_swiftsyntax_build_dir="$(build_directory ${host} earlyswiftsyntax)"
857+
swift_cmake_options+=(
858+
-DSWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR:PATH="${early_swiftsyntax_build_dir}"
859+
)
860+
lldb_cmake_options+=(
861+
-DSWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR:PATH="${early_swiftsyntax_build_dir}"
862+
)
863+
fi
853864
}
854865

855866
function configure_default_options() {
@@ -1233,6 +1244,7 @@ LIBDISPATCH_STATIC_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch"
12331244
LIBICU_SOURCE_DIR="${WORKSPACE}/icu"
12341245
LIBCXX_SOURCE_DIR="${WORKSPACE}/llvm-project/runtimes"
12351246
EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR="${WORKSPACE}/swift-experimental-string-processing"
1247+
SWIFTSYNTAX_SOURCE_DIR="${WORKSPACE}/swift-syntax"
12361248
LIBXML2_SOURCE_DIR="${WORKSPACE}/libxml2"
12371249
SWIFT_SYNTAX_SOURCE_DIR="${WORKSPACE}/swift-syntax"
12381250

utils/swift_build_support/swift_build_support/build_script_invocation.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,7 @@ def convert_to_impl_arguments(self):
252252
'-DSWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE:PATH={}'.format(swift_syntax_src))
253253

254254
if args.build_early_swiftsyntax:
255-
early_swiftsyntax_build_dir = os.path.join(
256-
self.workspace.build_root,
257-
'%s-%s' % ('earlyswiftsyntax', self.args.host_target))
258-
args.extra_cmake_options.append(
259-
'-DSWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR:PATH={}'
260-
.format(early_swiftsyntax_build_dir))
255+
impl_args += ["--swift-earlyswiftsyntax"]
261256

262257
# Then add subproject install flags that either skip building them /or/
263258
# if we are going to build them and install_all is set, we also install

utils/swift_build_support/swift_build_support/products/swift.py

-15
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ def __init__(self, args, toolchain, source_dir, build_dir):
5757
# Add experimental distributed flag.
5858
self.cmake_options.extend(self._enable_experimental_distributed)
5959

60-
# Add path for the early SwiftSyntax build.
61-
self.cmake_options.extend(self._early_swiftsyntax_flags)
62-
6360
# Add static vprintf flag
6461
self.cmake_options.extend(self._enable_stdlib_static_vprintf)
6562

@@ -172,18 +169,6 @@ def _enable_experimental_distributed(self):
172169
return [('SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED:BOOL',
173170
self.args.enable_experimental_distributed)]
174171

175-
@property
176-
def _early_swiftsyntax_flags(self):
177-
result = []
178-
if self.args.build_early_swiftsyntax:
179-
build_root = os.path.dirname(self.build_dir)
180-
early_swiftsyntax_build_dir = os.path.join(
181-
'..', build_root, '%s-%s' % ('earlyswiftsyntax',
182-
self.args.host_target))
183-
result.append(('SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR:PATH',
184-
early_swiftsyntax_build_dir))
185-
return result
186-
187172
@property
188173
def _enable_stdlib_static_vprintf(self):
189174
return [('SWIFT_STDLIB_STATIC_PRINT',

0 commit comments

Comments
 (0)