Skip to content

Commit

Permalink
Adds support for rules_swift 2.x.
Browse files Browse the repository at this point in the history
This does force users using this version of sourcekitten to also use rules_swift because of the `swift_c_module` removal.
  • Loading branch information
luispadron committed Jul 10, 2024
1 parent 59a7544 commit d8c294a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
11 changes: 7 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ module(
)

bazel_dep(name = "platforms", version = "0.0.8", dev_dependency = True)

bazel_dep(name = "apple_support", version = "1.11.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "rules_swift", version = "1.15.1", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "swift_argument_parser", version = "1.2.1", repo_name = "sourcekitten_com_github_apple_swift_argument_parser")
bazel_dep(name = "swxmlhash", version = "7.0.2", repo_name = "sourcekitten_com_github_drmohundro_SWXMLHash")
bazel_dep(name = "yams", version = "5.0.6", repo_name = "sourcekitten_com_github_jpsim_yams")
bazel_dep(name = "rules_cc", version = "0.0.2")
bazel_dep(name = "rules_swift", version = "2.0.0", repo_name = "build_bazel_rules_swift")

bazel_dep(name = "swift_argument_parser", version = "1.3.1.1", repo_name = "sourcekitten_com_github_apple_swift_argument_parser")
bazel_dep(name = "swxmlhash", version = "7.0.2.1", repo_name = "sourcekitten_com_github_drmohundro_SWXMLHash")
bazel_dep(name = "yams", version = "5.1.3", repo_name = "sourcekitten_com_github_jpsim_yams")

apple_cc_configure = use_extension("@build_bazel_apple_support//crosstool:setup.bzl", "apple_cc_configure_extension")
use_repo(apple_cc_configure, "local_config_apple_cc")
25 changes: 18 additions & 7 deletions Source/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_c_module")
load("@build_bazel_rules_swift//swift:swift_interop_hint.bzl", "swift_interop_hint")
load("@rules_cc//cc:defs.bzl", "cc_library")

exports_files(glob(["SourceKittenFramework/**/*.swift"]))

Expand All @@ -11,14 +12,19 @@ cc_library(
visibility = ["//visibility:public"],
)

swift_c_module(
cc_library(
name = "Clang_C",
module_map = "Clang_C/Clang_C.modulemap",
module_name = "Clang_C",
aspect_hints = [":Clang_C_SwiftInterop"],
visibility = ["//visibility:public"],
deps = [":Clang_CLibrary"],
)

swift_interop_hint(
name = "Clang_C_SwiftInterop",
module_map = "Clang_C/Clang_C.modulemap",
module_name = "Clang_C",
)

cc_library(
name = "SourceKitLibrary",
hdrs = glob(
Expand All @@ -28,14 +34,19 @@ cc_library(
visibility = ["//visibility:public"],
)

swift_c_module(
cc_library(
name = "SourceKit",
module_map = "SourceKit/SourceKit.modulemap",
module_name = "SourceKit",
aspect_hints = [":SourceKit_SwiftInterop"],
visibility = ["//visibility:public"],
deps = [":SourceKitLibrary"],
)

swift_interop_hint(
name = "SourceKit_SwiftInterop",
module_map = "SourceKit/SourceKit.modulemap",
module_name = "SourceKit",
)

filegroup(
name = "SourceKittenFrameworkSources",
srcs = glob(
Expand Down

0 comments on commit d8c294a

Please sign in to comment.