Skip to content

Commit

Permalink
Switch back to build_file_content to simplify workspace issues, chang…
Browse files Browse the repository at this point in the history
…e to io_bazel_rules_go.
  • Loading branch information
davidlion committed Jun 27, 2024
1 parent 739b2ac commit 0d8c247
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 72 deletions.
12 changes: 8 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
module(name = "com_github_y_scope_clp_ffi_go", version = "0.0.5-beta")
module(
name = "com_github_y_scope_clp_ffi_go",
version = "0.0.5-beta",
)

bazel_dep(name = "gazelle", version = "0.37.0")
bazel_dep(name = "rules_go", version = "0.48.1")
bazel_dep(name = "rules_go", version = "0.48.1", repo_name = "io_bazel_rules_go")
bazel_dep(name = "platforms", version = "0.0.10")

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.22.3")
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.22.4")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
Expand Down
11 changes: 6 additions & 5 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions cpp/clp_ext_nlohmann_json.bzl

This file was deleted.

42 changes: 0 additions & 42 deletions cpp/clp_ffi_core.bzl

This file was deleted.

58 changes: 56 additions & 2 deletions cpp/deps.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

_build_clp_ext_com_github_nlohmann_json = """
cc_library(
name = "libjson",
srcs = ["json/single_include/nlohmann/json.hpp"],
hdrs = ["json/single_include/nlohmann/json.hpp"],
includes = ["."],
visibility = ["//visibility:public"],
)
"""

_build_com_github_y_scope_clp = """
cc_library(
name = "libclp_ffi_core",
srcs = [
"clp/components/core/src/BufferReader.cpp",
"clp/components/core/src/ReaderInterface.cpp",
"clp/components/core/src/string_utils.cpp",
"clp/components/core/src/ffi/encoding_methods.cpp",
"clp/components/core/src/ffi/ir_stream/encoding_methods.cpp",
"clp/components/core/src/ffi/ir_stream/decoding_methods.cpp",
],
hdrs = [
"clp/components/core/src/BufferReader.hpp",
"clp/components/core/src/Defs.h",
"clp/components/core/src/ErrorCode.hpp",
"clp/components/core/src/ReaderInterface.hpp",
"clp/components/core/src/string_utils.hpp",
"clp/components/core/src/string_utils.inc",
"clp/components/core/src/TraceableException.hpp",
"clp/components/core/src/type_utils.hpp",
"clp/components/core/src/ffi/encoding_methods.hpp",
"clp/components/core/src/ffi/encoding_methods.inc",
"clp/components/core/src/ffi/ir_stream/byteswap.hpp",
"clp/components/core/src/ffi/ir_stream/encoding_methods.hpp",
"clp/components/core/src/ffi/ir_stream/decoding_methods.hpp",
"clp/components/core/src/ffi/ir_stream/decoding_methods.inc",
"clp/components/core/src/ffi/ir_stream/protocol_constants.hpp",
],
includes = ["."],
copts = [
"-std=c++20",
] + select({
"@platforms//os:osx": [
"-mmacosx-version-min=10.15",
],
"//conditions:default": [],
}),
deps = [
"@clp_ext_com_github_nlohmann_json//:libjson",
],
visibility = ["//visibility:public"],
)
"""

def _clp_ext_com_github_nlohmann_json():
commit = "fec56a1a16c6e1c1b1f4e116a20e79398282626c"
commit_sha256 = "8cbda3504fd1624fbce641d3f6b884c76e5afead1fa6d6abfcbea4b734dc634b"
Expand All @@ -9,7 +63,7 @@ def _clp_ext_com_github_nlohmann_json():
urls = ["https://github.com/nlohmann/json/archive/{}.zip".format(commit)],
strip_prefix = "json-{}".format(commit),
add_prefix = "json",
build_file = "//:clp_ext_nlohmann_json.bzl",
build_file_content = _build_clp_ext_com_github_nlohmann_json,
)

def com_github_y_scope_clp():
Expand All @@ -23,7 +77,7 @@ def com_github_y_scope_clp():
urls = ["https://github.com/y-scope/clp/archive/{}.zip".format(commit)],
strip_prefix = "clp-{}".format(commit),
add_prefix = "clp",
build_file = "//:clp_ffi_core.bzl",
build_file_content = _build_com_github_y_scope_clp,
)

def _clp_ffi_go_ext_deps_impl(_):
Expand Down
6 changes: 2 additions & 4 deletions ffi/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
load("@rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "ffi",
srcs = [
glob("*.go", exclude=["build_*.go"]),
],
srcs = glob(["*.go"], exclude=["build_*.go", "*_test.go"]),
importpath = "github.com/y-scope/clp-ffi-go/ffi",
visibility = ["//visibility:public"],
)
Expand Down
6 changes: 2 additions & 4 deletions ir/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "ir",
srcs = [
glob("*.go", exclude=["build_*.go"]),
],
srcs = glob(["*.go"], exclude=["build_*.go", "*_test.go"]),
cgo = True,
cdeps = [
"//cpp:libclp_ffi_go",
Expand Down
6 changes: 2 additions & 4 deletions search/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
load("@rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "search",
srcs = [
glob("*.go", exclude=["build_*.go"]),
],
srcs = glob(["*.go"], exclude=["build_*.go", "*_test.go"]),
cgo = True,
cdeps = [
"//cpp:libclp_ffi_go",
Expand Down

0 comments on commit 0d8c247

Please sign in to comment.