mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 07:10:29 +00:00
Updated Bazel Rust rules version
This commit is contained in:
parent
2029c873c2
commit
5d3f36c8af
35
WORKSPACE
35
WORKSPACE
@ -2,39 +2,18 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("//tools/bazel:vendor.bzl", "vendor")
|
||||
|
||||
http_archive(
|
||||
name = "io_bazel_rules_rust",
|
||||
sha256 = "5ed804fcd10a506a5b8e9e59bc6b3b7f43bc30c87ce4670e6f78df43604894fd",
|
||||
strip_prefix = "rules_rust-fdf9655ba95616e0314b4e0ebab40bb0c5fe005c",
|
||||
# Master branch as of 2020-07-30
|
||||
url = "https://github.com/bazelbuild/rules_rust/archive/fdf9655ba95616e0314b4e0ebab40bb0c5fe005c.tar.gz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "bazel_skylib",
|
||||
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
|
||||
name = "rules_rust",
|
||||
sha256 = "e6d835ee673f388aa5b62dc23d82db8fc76497e93fa47d8a4afe97abaf09b10d",
|
||||
strip_prefix = "rules_rust-f37b9d6a552e9412285e627f30cb124e709f4f7a",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
|
||||
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
|
||||
# Master branch as of 2021-01-27
|
||||
"https://github.com/bazelbuild/rules_rust/archive/f37b9d6a552e9412285e627f30cb124e709f4f7a.tar.gz",
|
||||
],
|
||||
)
|
||||
|
||||
load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")
|
||||
load("@rules_rust//rust:repositories.bzl", "rust_repositories")
|
||||
|
||||
bazel_version(name = "bazel_version")
|
||||
|
||||
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repository_set")
|
||||
|
||||
rust_repository_set(
|
||||
name = "rust_1_48_linux",
|
||||
exec_triple = "x86_64-unknown-linux-gnu",
|
||||
version = "1.48.0",
|
||||
)
|
||||
|
||||
rust_repository_set(
|
||||
name = "rust_1_48_darwin",
|
||||
exec_triple = "x86_64-apple-darwin",
|
||||
version = "1.48.0",
|
||||
)
|
||||
rust_repositories()
|
||||
|
||||
vendor(
|
||||
name = "third-party",
|
||||
|
2
third-party/BUILD
vendored
2
third-party/BUILD
vendored
@ -1,10 +1,8 @@
|
||||
load(
|
||||
"//tools/bazel:rust.bzl",
|
||||
glob = "third_party_glob",
|
||||
rust_binary = "third_party_rust_binary",
|
||||
rust_library = "third_party_rust_library",
|
||||
)
|
||||
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
||||
|
||||
rust_library(
|
||||
name = "bitflags",
|
||||
|
@ -0,0 +1,7 @@
|
||||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
|
||||
bzl_library(
|
||||
name = "bzl_srcs",
|
||||
srcs = glob(["**/*.bzl"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
@ -1,5 +1,7 @@
|
||||
"""A module wrapping the core rules of `rules_rust`"""
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_rust//rust:rust.bzl",
|
||||
"@rules_rust//rust:rust.bzl",
|
||||
_rust_binary = "rust_binary",
|
||||
_rust_library = "rust_library",
|
||||
_rust_test = "rust_test",
|
||||
|
@ -1,7 +1,15 @@
|
||||
# buildifier: disable=module-docstring
|
||||
load("@bazel_skylib//rules:run_binary.bzl", "run_binary")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
def rust_cxx_bridge(name, src, deps = []):
|
||||
"""A macro defining a cxx bridge library
|
||||
|
||||
Args:
|
||||
name (string): The name of the new target
|
||||
src (string): The rust source file to generate a bridge for
|
||||
deps (list, optional): A list of dependencies for the underlying cc_library. Defaults to [].
|
||||
"""
|
||||
native.alias(
|
||||
name = "%s/header" % name,
|
||||
actual = src + ".h",
|
||||
|
@ -1,3 +1,7 @@
|
||||
"""A module defining a repository rule for vendoring the dependencies
|
||||
of a crate in the current workspace.
|
||||
"""
|
||||
|
||||
def _impl(repository_ctx):
|
||||
# Link cxx repository into @third-party.
|
||||
lockfile = repository_ctx.path(repository_ctx.attr.lockfile)
|
||||
@ -48,7 +52,12 @@ def _log_cargo_vendor(repository_ctx, result):
|
||||
repository_ctx.execute(print, quiet = False)
|
||||
|
||||
vendor = repository_rule(
|
||||
attrs = {"lockfile": attr.label()},
|
||||
doc = "A rule used to vender the dependencies of a crate in the current workspace",
|
||||
attrs = {
|
||||
"lockfile": attr.label(
|
||||
doc = "A lockfile providing the set of crates to vendor",
|
||||
),
|
||||
},
|
||||
local = True,
|
||||
implementation = _impl,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user