Skip to content

Commit cbd91ca

Browse files
authored
Adds support for bazel (#4)
Adds bazel support and gets all executable targets running.
1 parent e7d2ba4 commit cbd91ca

File tree

43 files changed

+248
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+248
-0
lines changed

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build --incompatible_disallow_empty_glob
2+
build --macos_minimum_os=12.0
3+
build --host_macos_minimum_os=12.0

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.1.0

.github/workflows/bazel.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Bazel
2+
on:
3+
pull_request:
4+
types: [opened]
5+
push:
6+
jobs:
7+
TestMac:
8+
runs-on: macos-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: swift-actions/setup-swift@v1
12+
- run: bazelisk test //Tests/... --test_output=errors

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/*.xcodeproj/
44
/DerivedData/
55
/.swiftpm/
6+
bazel-*

BUILD

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
2+
3+
cc_library(
4+
name = "CIndexStore",
5+
hdrs = ["Sources/CIndexStore/include/indexstore.h"],
6+
linkstatic = True,
7+
tags = ["swift_module=CIndexStore"],
8+
)
9+
10+
swift_library(
11+
name = "IndexStore",
12+
srcs = glob(["Sources/IndexStore/*.swift"]),
13+
linkopts = select({
14+
"@platforms//os:linux": ["-lIndexStore"],
15+
"//conditions:default": [],
16+
}),
17+
visibility = [
18+
"//visibility:public",
19+
],
20+
deps = [
21+
":CIndexStore",
22+
] + select({
23+
"@platforms//os:linux": [],
24+
"//conditions:default": [
25+
"@StaticIndexStore//:libIndexStore",
26+
],
27+
}),
28+
)
29+
30+
swift_library(
31+
name = "SwiftDemangle",
32+
srcs = glob(["Sources/SwiftDemangle/*.swift"]),
33+
module_name = "SwiftDemangle",
34+
visibility = [
35+
"//visibility:public",
36+
],
37+
deps = [
38+
"//Sources/CSwiftDemangle",
39+
],
40+
)

Sources/CSwiftDemangle/BUILD

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cc_library(
2+
name = "CSwiftDemangle",
3+
srcs = glob([
4+
"PrivateHeaders/**/*.h",
5+
]) + [
6+
"CSwiftDemangle.cpp",
7+
],
8+
hdrs = glob([
9+
"include/**/*.h",
10+
]),
11+
includes = [
12+
"PrivateHeaders/include",
13+
"include",
14+
],
15+
linkopts = [
16+
"-lswiftDemangle",
17+
],
18+
tags = ["swift_module=CSwiftDemangle"],
19+
textual_hdrs = glob([
20+
"**/*.def",
21+
]),
22+
visibility = [
23+
"//:__pkg__",
24+
],
25+
)

Sources/indexutil-annotate/BUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary")
2+
3+
swift_binary(
4+
name = "indexutil-annotate",
5+
srcs = [
6+
"Annotation.swift",
7+
"main.swift",
8+
],
9+
deps = [
10+
"//:IndexStore",
11+
],
12+
)

Sources/indexutil-export/BUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary")
2+
3+
swift_binary(
4+
name = "indexutil-export",
5+
srcs = [
6+
"TSVWriter.swift",
7+
"main.swift",
8+
],
9+
deps = [
10+
"//:IndexStore",
11+
],
12+
)

Sources/tycat/BUILD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary")
2+
3+
swift_binary(
4+
name = "tycat",
5+
srcs = [
6+
"TypeGraph.swift",
7+
"Xcode.swift",
8+
"main.swift",
9+
],
10+
deps = [
11+
"//:IndexStore",
12+
],
13+
)

Sources/unnecessary-testable/BUILD

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary")
2+
3+
swift_binary(
4+
name = "unnecessary-testable",
5+
srcs = [
6+
"main.swift",
7+
],
8+
deps = [
9+
"//:IndexStore",
10+
],
11+
)

0 commit comments

Comments
 (0)