Skip to content

Commit

Permalink
Update Bazel dependencies (#61)
Browse files Browse the repository at this point in the history
Updates the following, mostly in order to support rules_swift 2.x:

* Bazel version defined in `.bazelversion` to the latest stable release
(7.2.1)
* Add `apple_support` (required for Bazel 7.x)
* Update `platforms`: 0.0.8 -> 0.0.9
* Update `rules_apple`: 3.1.1 -> 3.6.0
* Update `rules_swift`: 1.13.0 -> 2.1.1

Also update tests to pass CI since it looks like GitHub's macOS runner
image environments may have changed recently.

---------

Signed-off-by: JP Simard <[email protected]>
  • Loading branch information
jpsim authored Jul 10, 2024
1 parent 7a07270 commit 53a322b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
7.2.1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/DerivedData/
/.swiftpm/
bazel-*
MODULE.bazel.lock
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
cc_library(
name = "CIndexStore",
hdrs = ["Sources/CIndexStore/include/indexstore.h"],
aspect_hints = ["@build_bazel_rules_swift//swift:auto_module"],
copts = ["-std=c++17"],
linkstatic = True,
tags = ["swift_module=CIndexStore"],
Expand Down
7 changes: 4 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "rules_apple", version = "3.1.1", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "apple_support", version = "1.16.0")
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "rules_apple", version = "3.6.0", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_swift", version = "2.1.1", repo_name = "build_bazel_rules_swift")

non_module_deps = use_extension("//:repositories.bzl", "bzlmod_deps")
use_repo(non_module_deps, "StaticIndexStore")
2 changes: 1 addition & 1 deletion Sources/CSwiftDemangle/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cc_library(
hdrs = glob([
"include/**/*.h",
]),
aspect_hints = ["@build_bazel_rules_swift//swift:auto_module"],
copts = ["-std=c++17"],
includes = [
"PrivateHeaders/include",
Expand All @@ -16,7 +17,6 @@ cc_library(
linkopts = [
"-lswiftDemangle",
],
tags = ["swift_module=CSwiftDemangle"],
textual_hdrs = glob([
"**/*.def",
]),
Expand Down
5 changes: 5 additions & 0 deletions Sources/CSwiftDemangle/include/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module CSwiftDemangle {
header "CSwiftDemangle.h"
link "CSwiftDemangle"
export *
}
2 changes: 1 addition & 1 deletion Tests/IndexStoreTests/DetermineIndexStorePath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
/// - Returns: Index store path for the current test environment
func determineIndexStorePath() -> String {
if let testSrcDir: String = ProcessInfo.processInfo.environment["TEST_SRCDIR"] {
return testSrcDir + "/__main__/Tests/IndexStoreTests/Data/main.indexstore"
return testSrcDir + "/_main/Tests/IndexStoreTests/Data/main.indexstore"
}
guard let service = ProcessInfo.processInfo.environment["XPC_SERVICE_NAME"] else {
preconditionFailure("Expected XPC_SERVICE_NAME environment variable")
Expand Down
14 changes: 12 additions & 2 deletions Tests/SwiftDemangleTests/SwiftDemangleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@ final class SwiftDemangleTests: XCTestCase {
func testSwiftExtensionUSR() throws {
let demangler = Demangler()
let root = try XCTUnwrap(demangler.demangle(symbol: kExtensionUSR))
let modules = Set(root.breadthFirstSequence().filter { $0.kind == .module }.compactMap { $0.text })
XCTAssertEqual(modules, ["Unidirectional", "Onboarding", "LyftKit"])
let textNodes = Set(root.breadthFirstSequence().compactMap { $0.text })
XCTAssertEqual(textNodes, [
"EffectProducer",
"GuestUser",
"LyftKit",
"NonemptyStack",
"Onboarding",
"OnboardingActionMask",
"OnboardingState",
"submitNameEffect",
"Unidirectional",
])
}

func testBreathFirstSequence() throws {
Expand Down

0 comments on commit 53a322b

Please sign in to comment.