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 61f7d3f commit 5e404f4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
17 changes: 11 additions & 6 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ 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 Expand Up @@ -66,3 +60,14 @@ darwin_config = use_repo_rule("//platform/darwin:bazel/darwin_config_repository_
darwin_config(
name = "darwin_config",
)

bazel_dep(name = "rules_rust", version = "0.49.1")

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")

crate_repositories = use_extension("//bazel:extension.bzl", "crate_repositories")
use_repo(crate_repositories, "crates.io")
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,
#)
2 changes: 1 addition & 1 deletion bazel/rust_cxx_bridge.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def rust_cxx_bridge(name, src, deps = []):
"-o",
"$(location %s.cc)" % src,
],
tool = "@cxx.rs//:codegen",
tool = "cxxbridge", # FIXME!!! how do i call an app that's already installed locally? Or perhaps set up some pipeline to download/build it?
)

cc_library(
Expand Down

0 comments on commit 5e404f4

Please sign in to comment.