Skip to content

Commit b465a05

Browse files
committed
WIP: Build SwiftSyntax statically for the toolchain
1 parent 5d0481a commit b465a05

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

Package.swift

+3-13
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,6 @@ if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil
3636

3737
package.targets.append(swiftSyntaxTarget)
3838

39-
let libraryType: Product.Library.LibraryType
40-
41-
/// When we're in a build-script environment, we want to build a dylib instead
42-
/// of a static library since we install the dylib into the toolchain.
43-
if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil {
44-
libraryType = .dynamic
45-
} else {
46-
libraryType = .static
47-
}
48-
49-
package.products.append(.library(name: "SwiftSyntax", type: libraryType, targets: ["SwiftSyntax"]))
50-
package.products.append(.library(name: "SwiftSyntaxParser", type: libraryType, targets: ["SwiftSyntaxParser"]))
51-
package.products.append(.library(name: "SwiftSyntaxBuilder", type: libraryType, targets: ["SwiftSyntaxBuilder"]))
39+
package.products.append(.library(name: "SwiftSyntax", type: .static, targets: ["SwiftSyntax"]))
40+
package.products.append(.library(name: "SwiftSyntaxParser", type: .static, targets: ["SwiftSyntaxParser"]))
41+
package.products.append(.library(name: "SwiftSyntaxBuilder", type: .static, targets: ["SwiftSyntaxBuilder"]))

build-script.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -606,18 +606,18 @@ def check_and_sync(file_path, install_path):
606606

607607

608608
def install(build_dir, dylib_dir, stdlib_rpath):
609-
for dylib_name in get_installed_dylib_names():
610-
611-
dylib_path = os.path.join(build_dir, dylib_name)
612-
613-
# users should find the dylib as if it's a part of stdlib.
614-
change_id_rpath(os.path.join("@rpath", dylib_name), dylib_path)
615-
616-
# we don't wanna hard-code the stdlib dylibs into rpath.
617-
delete_rpath(stdlib_rpath, dylib_path)
618-
check_and_sync(
619-
file_path=dylib_path, install_path=os.path.join(dylib_dir, dylib_name)
620-
)
609+
# for dylib_name in get_installed_dylib_names():
610+
#
611+
# dylib_path = os.path.join(build_dir, dylib_name)
612+
#
613+
# # users should find the dylib as if it's a part of stdlib.
614+
# change_id_rpath(os.path.join("@rpath", dylib_name), dylib_path)
615+
#
616+
# # we don't wanna hard-code the stdlib dylibs into rpath.
617+
# delete_rpath(stdlib_rpath, dylib_path)
618+
# check_and_sync(
619+
# file_path=dylib_path, install_path=os.path.join(dylib_dir, dylib_name)
620+
# )
621621

622622

623623
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)