Skip to content

Commit

Permalink
use official rules-RUst
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigbug committed Aug 9, 2023
1 parent 2979cae commit 3dd7469
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
6 changes: 5 additions & 1 deletion Cargo.Bazel.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "744dd569fafa47a201b84ee3f99e9a01c645444fd61e34b7a6d248ec49816531",
"checksum": "01e7fd8b186277f5d802bd5104ee8a45ccdbe7a557bf91264a3553888cf151c2",
"crates": {
"addr2line 0.20.0": {
"name": "addr2line",
Expand Down Expand Up @@ -1903,6 +1903,10 @@
},
"build_script_env": {
"common": {
"BINDGEN_EXTRA_CLANG_ARGS_aarch64-apple-darwin": "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
"BINDGEN_EXTRA_CLANG_ARGS_aarch64-unknown-linux-gnu": "-I/usr/include/",
"BINDGEN_EXTRA_CLANG_ARGS_x86_64-apple-darwin": "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
"BINDGEN_EXTRA_CLANG_ARGS_x86_64-unknown-linux-gnu": "-I/usr/include/",
"BORING_BAZEL_BUILD": "1",
"BORING_BSSL_INCLUDE_PATH": "$(location @//deps/boringssl:include)",
"BORING_BSSL_PATH": "$(GENDIR)/deps/boringssl"
Expand Down
35 changes: 21 additions & 14 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
workspace(name = "clash-rs")

#load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# To find additional information on this release or newer ones visit:
# https://github.com/bazelbuild/rules_rust/releases

# http_archive(
# name = "rules_rust",
# sha256 = "9d04e658878d23f4b00163a72da3db03ddb451273eb347df7d7c50838d698f49",
# urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.26.0/rules_rust-v0.26.0.tar.gz"],
# )

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
http_archive(
name = "rules_rust",
branch = "pass-to-bindgen",
remote = "https://github.com/ibigbug/rules_rust.git",
sha256 = "9d04e658878d23f4b00163a72da3db03ddb451273eb347df7d7c50838d698f49",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.26.0/rules_rust-v0.26.0.tar.gz"],
)

# load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

# git_repository(
# name = "rules_rust",
# branch = "pass-to-bindgen",
# remote = "https://github.com/ibigbug/rules_rust.git",
# )

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")

rules_rust_dependencies()
Expand All @@ -32,10 +32,14 @@ rust_register_toolchains(

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")

crate_universe_dependencies(bootstrap = True)
crate_universe_dependencies()

load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository")

MACOS_BINDGEN_FLAGS = "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"

LINUX_BINDGEN_FLAGS = "-I/usr/include/"

crates_repository(
name = "crate_index",
annotations = {
Expand All @@ -47,14 +51,17 @@ crates_repository(
"BORING_BAZEL_BUILD": "1",
"BORING_BSSL_PATH": "$(GENDIR)/deps/boringssl",
"BORING_BSSL_INCLUDE_PATH": "$(location @//deps/boringssl:include)",
"BINDGEN_EXTRA_CLANG_ARGS_aarch64-apple-darwin": MACOS_BINDGEN_FLAGS,
"BINDGEN_EXTRA_CLANG_ARGS_x86_64-apple-darwin": MACOS_BINDGEN_FLAGS,
"BINDGEN_EXTRA_CLANG_ARGS_aarch64-unknown-linux-gnu": LINUX_BINDGEN_FLAGS,
"BINDGEN_EXTRA_CLANG_ARGS_x86_64-unknown-linux-gnu": LINUX_BINDGEN_FLAGS,
},
data = [
"@//deps/boringssl:lib",
],
)],
},
cargo_lockfile = "//:Cargo.lock",
generator = "@cargo_bazel_bootstrap//:cargo-bazel",
lockfile = "//:Cargo.Bazel.lock",
manifests = [
"//:Cargo.toml",
Expand Down

0 comments on commit 3dd7469

Please sign in to comment.