Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Aug 7, 2024
1 parent c157da8 commit 61f7d3f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ cc_library(
deps = [
":mbgl-core-generated-private-artifacts",
":mbgl-core-generated-public-artifacts",
"//rustutils:bridge",
"//rustutils:rustutils",
"//vendor:boost",
"//vendor:earcut.hpp",
Expand Down
6 changes: 6 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_apple", version = "3.7.0", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_swift", version = "2.1.1", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "rules_xcodeproj", version = "2.5.2")
bazel_dep(name = "rules_rust", version = "0.49.0")

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(versions = ["1.80.0"])
use_repo(rust, "rust_toolchains")
register_toolchains("@rust_toolchains//:all")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
Expand Down
44 changes: 22 additions & 22 deletions bazel/extension.bzl
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#load("//third-party/bazel:defs.bzl", _crate_repositories = "crate_repositories")
#
#def _crates_vendor_remote_repository_impl(repository_ctx):
# repository_ctx.symlink(repository_ctx.attr.build_file, "BUILD.bazel")
#
#_crates_vendor_remote_repository = repository_rule(
# implementation = _crates_vendor_remote_repository_impl,
# attrs = {
# "build_file": attr.label(mandatory = True),
# },
#)
#
#def _crate_repositories_impl(module_ctx):
# _crate_repositories()
# _crates_vendor_remote_repository(
# name = "crates.io",
# build_file = "//third-party/bazel:BUILD.bazel",
# )
#
#crate_repositories = module_extension(
# implementation = _crate_repositories_impl,
#)
load("//third-party/bazel:defs.bzl", _crate_repositories = "crate_repositories")

def _crates_vendor_remote_repository_impl(repository_ctx):
repository_ctx.symlink(repository_ctx.attr.build_file, "BUILD.bazel")

_crates_vendor_remote_repository = repository_rule(
implementation = _crates_vendor_remote_repository_impl,
attrs = {
"build_file": attr.label(mandatory = True),
},
)

def _crate_repositories_impl(module_ctx):
_crate_repositories()
_crates_vendor_remote_repository(
name = "crates.io",
build_file = "//third-party/bazel:BUILD.bazel",
)

crate_repositories = module_extension(
implementation = _crate_repositories_impl,
)
4 changes: 3 additions & 1 deletion rustutils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_static_library")
load("//bazel:rust_cxx_bridge.bzl", "rust_cxx_bridge")

package(default_visibility = ["//visibility:public"])

rust_cxx_bridge(
name = "bridge",
src = "src/lib.rs",
)

rust_static_library(
name = "rustutils",
srcs = ["src/**/*.rs"],
srcs = ["src/lib.rs"],
edition = "2021",
)

0 comments on commit 61f7d3f

Please sign in to comment.