Skip to content

Commit f59a686

Browse files
authored
Adds working example usage for BCR (#56)
* Adds working example usage for BCR We need this target to exist to ensure that the rule can run during BCR validation Signed-off-by: Maxwell Elliott <maxwell@elliott.now> * update CI Signed-off-by: Maxwell Elliott <maxwell@elliott.now> --------- Signed-off-by: Maxwell Elliott <maxwell@elliott.now>
1 parent 9af86c1 commit f59a686

File tree

4 files changed

+317
-13
lines changed

4 files changed

+317
-13
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Build sourcekit-bazel-bsp (release)
2727
run: swift build -c release
2828
- name: Build sourcekit-bazel-bsp (Bazel)
29-
run: bazelisk build //Sources/sourcekit-bazel-bsp
29+
run: bazelisk run //:setup_sourcekit_bsp
3030
- name: Build example //HelloWorld iOS app
3131
run: |
3232
cd Example

BUILD.bazel

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
""" Sets up the sourcekit-bazel-bsp in the current workspace using the provided configuration. This is needed during integration testing in the BCR """
2+
3+
load("@sourcekit_bazel_bsp//rules:setup_sourcekit_bsp.bzl", "setup_sourcekit_bsp")
4+
5+
setup_sourcekit_bsp(
6+
name = "setup_sourcekit_bsp",
7+
bazel_wrapper = "bazel",
8+
files_to_watch = ["Sources/**/*.swift"],
9+
index_flags = [],
10+
targets = [
11+
"//Sources/sourcekit-bazel-bsp",
12+
"//Sources/SourceKitBazelBSP",
13+
"//Sources/BazelProtobufBindings",
14+
],
15+
)

MODULE.bazel.lock

Lines changed: 298 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rules/setup_sourcekit_bsp.bzl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def _setup_sourcekit_bsp_impl(ctx):
1616
for index_flag in ctx.attr.index_flags:
1717
bsp_config_argv.append("--index-flag")
1818
bsp_config_argv.append(index_flag)
19-
files_to_watch = ','.join(ctx.attr.files_to_watch)
19+
files_to_watch = ",".join(ctx.attr.files_to_watch)
2020
if files_to_watch:
2121
bsp_config_argv.append("--files-to-watch")
2222
bsp_config_argv.append(files_to_watch)
@@ -49,7 +49,6 @@ def _setup_sourcekit_bsp_impl(ctx):
4949
runfiles = tools_runfiles,
5050
)
5151

52-
5352
setup_sourcekit_bsp = rule(
5453
implementation = _setup_sourcekit_bsp_impl,
5554
executable = True,
@@ -90,10 +89,10 @@ setup_sourcekit_bsp = rule(
9089
"build_test_suffix": attr.string(
9190
doc = "The expected suffix for build_test targets.",
9291
default = "_skbsp",
93-
)
92+
),
9493
"separate_aquery_output": attr.bool(
9594
doc = "Whether to use a separate output base for compiler arguments requests. This greatly increases the performance of the server at the cost of more disk usage.",
9695
default = False,
97-
)
96+
),
9897
},
9998
)

0 commit comments

Comments
 (0)