Skip to content

Commit c60346d

Browse files
committed
cleanup: Use apigen to generate the FFI code.
1 parent c9f8b93 commit c60346d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Diff for: BUILD.bazel

+16-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,24 @@ load("//tools/project:build_defs.bzl", "project")
44

55
project()
66

7+
[genrule(
8+
name = "api_" + src[:-2].replace("/", "_"),
9+
srcs = ["//c-toxcore:" + src],
10+
outs = ["src/FFI/%s.hs" % "/".join([mod.capitalize() for mod in src[:-2].split("/")])],
11+
cmd = "$(location //hs-apigen/tools:apigen) -hs $< > $@",
12+
exec_tools = ["//hs-apigen/tools:apigen"],
13+
) for src in [
14+
"tox/tox.h",
15+
]]
16+
717
haskell_library(
818
name = "hs-toxcore-c",
9-
srcs = glob(["src/**/*.*hs"]),
19+
srcs = glob(
20+
["src/**/*.*hs"],
21+
exclude = ["src/FFI/**"],
22+
) + [
23+
":api_tox_tox",
24+
],
1025
src_strip_prefix = "src",
1126
version = "0.2.12",
1227
visibility = ["//visibility:public"],

Diff for: tools/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ load("@rules_haskell//haskell:defs.bzl", "haskell_binary")
33
haskell_binary(
44
name = "groupbot",
55
srcs = ["groupbot.hs"],
6+
visibility = ["//tools/haskell:__pkg__"],
67
deps = [
78
"//hs-toxcore-c",
89
"//third_party/haskell:base",

0 commit comments

Comments
 (0)