Skip to content

Commit 47c2d98

Browse files
committed
Install SourceKit-LSP configuration schema into toolchain at share/sourcekit-lsp/config.schema.json
This allows IDEs like VS Code to pick up the schema and provide code assistance when editing `.sourcekit-lsp/config.json`.
1 parent 863c0e2 commit 47c2d98

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Utilities/build-script-helper.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,12 @@ def run_tests(swift_exec: str, args: argparse.Namespace) -> None:
248248
raise SystemExit(1)
249249

250250

251-
def install_binary(exe: str, source_dir: str, install_dir: str, verbose: bool) -> None:
252-
cmd = ['rsync', '-a', os.path.join(source_dir, exe), install_dir]
253-
check_call(cmd, verbose=verbose)
251+
def copy_file(source: str, destination_dir: str, verbose: bool) -> None:
252+
"""
253+
Copies the file at `source` into `destination_dir`.
254+
"""
255+
os.makedirs(destination_dir)
256+
check_call(['rsync', '-a', source, destination_dir], verbose=verbose)
254257

255258

256259
def install(swift_exec: str, args: argparse.Namespace) -> None:
@@ -268,9 +271,10 @@ def install(swift_exec: str, args: argparse.Namespace) -> None:
268271
dynamic_library_extension = "so"
269272

270273
for prefix in args.install_prefixes:
271-
install_binary('sourcekit-lsp', bin_path, os.path.join(prefix, 'bin'), verbose=args.verbose)
272-
install_binary(f'libSwiftSourceKitPlugin.{dynamic_library_extension}', bin_path, os.path.join(prefix, 'lib'), verbose=args.verbose)
273-
install_binary(f'libSwiftSourceKitClientPlugin.{dynamic_library_extension}', bin_path, os.path.join(prefix, 'lib'), verbose=args.verbose)
274+
copy_file(os.path.join(bin_path, 'sourcekit-lsp'), os.path.join(prefix, 'bin'), verbose=args.verbose)
275+
copy_file(os.path.join(bin_path, f'libSwiftSourceKitPlugin.{dynamic_library_extension}'), os.path.join(prefix, 'lib'), verbose=args.verbose)
276+
copy_file(os.path.join(bin_path, f'libSwiftSourceKitClientPlugin.{dynamic_library_extension}'), os.path.join(prefix, 'lib'), verbose=args.verbose)
277+
copy_file(os.path.join(args.package_path, 'config.schema.json'), os.path.join(prefix, 'share', 'sourcekit-lsp'), verbose=args.verbose)
274278

275279

276280
def handle_invocation(swift_exec: str, args: argparse.Namespace) -> None:

0 commit comments

Comments
 (0)