Skip to content

Commit ca9ef8c

Browse files
authored
Merge pull request #2147 from ahoppen/install-config-schema
Install SourceKit-LSP configuration schema into toolchain at `share/sourcekit-lsp/config.schema.json`
2 parents 07dd943 + 33d7c5d commit ca9ef8c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ find_package(SwiftToolsProtocols CONFIG REQUIRED)
3535

3636
include(SwiftSupport)
3737

38+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.schema.json DESTINATION share/sourcekit-lsp)
39+
3840
add_subdirectory(Sources)

Utilities/build-script-helper.py

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

255255

256-
def install_binary(exe: str, source_dir: str, install_dir: str, verbose: bool) -> None:
257-
cmd = ['rsync', '-a', os.path.join(source_dir, exe), install_dir]
258-
check_call(cmd, verbose=verbose)
256+
def copy_file(source: str, destination_dir: str, verbose: bool) -> None:
257+
"""
258+
Copies the file at `source` into `destination_dir`.
259+
"""
260+
os.makedirs(destination_dir)
261+
check_call(['rsync', '-a', source, destination_dir], verbose=verbose)
259262

260263

261264
def install(swift_exec: str, args: argparse.Namespace) -> None:
@@ -273,9 +276,10 @@ def install(swift_exec: str, args: argparse.Namespace) -> None:
273276
dynamic_library_extension = "so"
274277

275278
for prefix in args.install_prefixes:
276-
install_binary('sourcekit-lsp', bin_path, os.path.join(prefix, 'bin'), verbose=args.verbose)
277-
install_binary(f'libSwiftSourceKitPlugin.{dynamic_library_extension}', bin_path, os.path.join(prefix, 'lib'), verbose=args.verbose)
278-
install_binary(f'libSwiftSourceKitClientPlugin.{dynamic_library_extension}', bin_path, os.path.join(prefix, 'lib'), verbose=args.verbose)
279+
copy_file(os.path.join(bin_path, 'sourcekit-lsp'), os.path.join(prefix, 'bin'), verbose=args.verbose)
280+
copy_file(os.path.join(bin_path, f'libSwiftSourceKitPlugin.{dynamic_library_extension}'), os.path.join(prefix, 'lib'), verbose=args.verbose)
281+
copy_file(os.path.join(bin_path, f'libSwiftSourceKitClientPlugin.{dynamic_library_extension}'), os.path.join(prefix, 'lib'), verbose=args.verbose)
282+
copy_file(os.path.join(args.package_path, 'config.schema.json'), os.path.join(prefix, 'share', 'sourcekit-lsp'), verbose=args.verbose)
279283

280284

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

0 commit comments

Comments
 (0)