Skip to content

Commit 27ef10a

Browse files
authored
Add bzlmod support (#58)
Fixes #55
1 parent 7ea4bef commit 27ef10a

File tree

6 files changed

+34
-32
lines changed

6 files changed

+34
-32
lines changed

.bazelrc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,3 @@ build --incompatible_disallow_empty_glob
22
build --macos_minimum_os=13.0
33
build --host_macos_minimum_os=13.0
44
build --test_output=errors
5-
6-
build --enable_platform_specific_config
7-
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
8-
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
9-
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.1.0
1+
6.4.0

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: ci
22
on:
33
pull_request:
4-
types: [opened]
54
push:
65
branches:
76
- main

MODULE.bazel

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module(
2+
name = "swift-index-store",
3+
version = "0",
4+
compatibility_level = 1,
5+
)
6+
7+
bazel_dep(name = "platforms", version = "0.0.8")
8+
bazel_dep(name = "rules_apple", version = "3.1.1", repo_name = "build_bazel_rules_apple")
9+
bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift")
10+
11+
non_module_deps = use_extension("//:repositories.bzl", "bzlmod_deps")
12+
use_repo(non_module_deps, "StaticIndexStore")

WORKSPACE.bzlmod

Whitespace-only changes.

repositories.bzl

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,38 @@ def _maybe(repo_rule, name, **kwargs):
1414
if not native.existing_rule(name):
1515
repo_rule(name = name, **kwargs)
1616

17-
def swift_index_store_dependencies():
18-
build_bazel_rules_swift_sha = "40c36c936c9c80b4aefa3f008ecf99dbe002be2c"
19-
_maybe(
20-
http_archive,
21-
name = "build_bazel_rules_swift",
22-
sha256 = "dd08813524deb0b449b0bcbde193caa284f45dd8fd624f9ed4ef1fcbfa78b8a8",
23-
url = "https://github.com/bazelbuild/rules_swift/archive/%s.zip" % build_bazel_rules_swift_sha,
24-
strip_prefix = "rules_swift-%s" % build_bazel_rules_swift_sha,
25-
)
26-
27-
build_bazel_rules_apple_sha = "5f036277bd2e1e357fd8502bf0ade9d293cf91b3"
28-
_maybe(
29-
http_archive,
30-
name = "build_bazel_rules_apple",
31-
sha256 = "635de45a7c07daed728962a9be983503221da22b6c6759e2f67f283cbb6cbe37",
32-
url = "https://github.com/bazelbuild/rules_apple/archive/%s.zip" % build_bazel_rules_apple_sha,
33-
strip_prefix = "rules_apple-%s" % build_bazel_rules_apple_sha,
34-
)
17+
def swift_index_store_dependencies(bzlmod = False):
18+
if not bzlmod:
19+
_maybe(
20+
http_archive,
21+
name = "build_bazel_rules_swift",
22+
sha256 = "28a66ff5d97500f0304f4e8945d936fe0584e0d5b7a6f83258298007a93190ba",
23+
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.13.0/rules_swift.1.13.0.tar.gz",
24+
)
25+
_maybe(
26+
http_archive,
27+
name = "build_bazel_rules_apple",
28+
sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7",
29+
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz",
30+
)
3531

3632
_maybe(
3733
http_archive,
3834
name = "StaticIndexStore",
3935
url = "https://github.com/keith/StaticIndexStore/releases/download/5.7/libIndexStore.xcframework.zip",
4036
sha256 = "da69bab932357a817aa0756e400be86d7156040bfbea8eded7a3acc529320731",
4137
build_file_content = """
42-
load(
43-
"@build_bazel_rules_apple//apple:apple.bzl",
44-
"apple_static_xcframework_import",
45-
)
38+
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework_import")
4639
4740
apple_static_xcframework_import(
4841
name = "libIndexStore",
49-
visibility = [
50-
"//visibility:public",
51-
],
42+
visibility = ["//visibility:public"],
5243
xcframework_imports = glob(["libIndexStore.xcframework/**"]),
5344
)
5445
""",
5546
)
47+
48+
def _bzlmod_deps(_):
49+
swift_index_store_dependencies(bzlmod = True)
50+
51+
bzlmod_deps = module_extension(implementation = _bzlmod_deps)

0 commit comments

Comments
 (0)