Skip to content

Commit

Permalink
Merge branch 'main' into alexkirsz/update-wasm-bindgen
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre authored Dec 14, 2023
2 parents 347aa60 + 2a5ca6a commit 47c594f
Show file tree
Hide file tree
Showing 967 changed files with 38,822 additions and 3,067 deletions.
35 changes: 31 additions & 4 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ tasks:
test_targets: *default_linux_targets
build_flags:
- "--compilation_mode=opt"
- "--@rules_rust//rust/settings:experimental_toolchain_generated_sysroot=True"
test_flags:
- "--compilation_mode=opt"
- "--@rules_rust//rust/settings:experimental_toolchain_generated_sysroot=True"
macos_opt:
name: Opt Mode
platform: macos
Expand Down Expand Up @@ -188,6 +186,22 @@ tasks:
test_targets: *default_windows_targets
soft_fail: yes
bazel: "rolling"
ubuntu2004_bzlmod_only:
name: With bzlmod
platform: ubuntu2004
# See https://bazel.build/external/migration#migration-process
# When WORKSPACE.bzlmod is provided, the workspace file is ignored.
shell_commands:
- "touch WORKSPACE.bzlmod"
build_flags:
- "--enable_bzlmod"
build_targets:
- "//bindgen/3rdparty:bindgen"
- "//crate_universe:cargo_bazel_bin"
- "//proto/prost/private:prost_runtime"
- "//tools/runfiles"
- "//util/import"
- "//wasm_bindgen/3rdparty:wasm_bindgen"
ubuntu2004_clang:
name: With Clang
platform: ubuntu2004
Expand Down Expand Up @@ -414,8 +428,6 @@ tasks:
- "//..."
# The proto rules do not work on windows
- "-//proto/..."
# The wasm rules do not work on windows
- "-//wasm/..."
# The bindgen rules are currently broken on windows
# https://github.com/bazelbuild/rules_rust/issues/2009
- "-//bindgen/..."
Expand Down Expand Up @@ -614,6 +626,21 @@ tasks:
# working_directory: examples/zig_cross_compiling
# build_targets:
# - "//..."
nix_cross_compiling:
name: Nix cross compiling test
platform: ubuntu2204
working_directory: examples/nix_cross_compiling
setup:
- curl -L https://nixos.org/nix/install | bash
- sudo cp ~/.nix-profile/bin/nix* /usr/local/bin/
- sudo mkdir /etc/nix
- echo "experimental-features = nix-command flakes" | sudo tee --append /etc/nix/nix.conf
build_targets:
# Root `build_test` target is called directly to catch missing platforms
# that would otherwise be quietly skipped due to `target_compatible_with`.
- "//:nix_cross_compiling"
test_targets:
- "//..."

buildifier:
version: latest
Expand Down
9 changes: 9 additions & 0 deletions .bcr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Bazel Central Registry

When the ruleset is released, we want it to be published to the
Bazel Central Registry automatically:
<https://registry.bazel.build>

This folder contains configuration files to automate the publish step.
See <https://github.com/bazel-contrib/publish-to-bcr/blob/main/templates/README.md>
for authoritative documentation about these files.
3 changes: 3 additions & 0 deletions .bcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fixedReleaser:
login: scentini
email: [email protected]
23 changes: 23 additions & 0 deletions .bcr/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"homepage": "https://github.com/bazelbuild/rules_rust",
"maintainers": [
{
"email": "[email protected]",
"github": "UebelAndre",
"name": "UebelAndre"
},
{
"email": "[email protected]",
"github": "illicitonion",
"name": "Daniel Wagner-Hall"
},
{
"email": "[email protected]",
"github": "scentini",
"name": "Rosica Dejanovska"
}
],
"repository": ["github:bazelbuild/rules_rust"],
"versions": [],
"yanked_versions": {}
}
1 change: 1 addition & 0 deletions .bcr/presubmit.yml
5 changes: 5 additions & 0 deletions .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz"
}
10 changes: 10 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# `nix-direnv` to provide developer tools to terminals and VSCode when working
# in the repo.
#
# See:
# - https://github.com/nix-community/nix-direnv
# - https://marketplace.visualstudio.com/items?itemName=mkhl.direnv

# Use `path:` syntax to avoid copying the entire repo to the Nix Store.
nix_direnv_watch_file ./nix/flake.nix
use flake path:./nix
12 changes: 11 additions & 1 deletion .github/workflows/formatting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- synchronize

jobs:
clang-format-checking:
code-format-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -19,3 +19,13 @@ jobs:
source: '.'
extensions: 'h,c,cc,proto'
clangFormatVersion: 14
- uses: actionsx/prettier@v2
with:
args: --config "${{ github.workspace }}/.prettierrc.toml" --write "**/*.{js,ts}"
# Prettier has no diff view so we must make one ourselves
# https://github.com/prettier/prettier/issues/6885
- run: |
git diff
if [[ -n "$(git status --porcelain)" ]]; then
exit 1
fi
3 changes: 3 additions & 0 deletions .prettierrc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Prettier config file. For more opitons see https://prettier.io/docs/en/options
tabWidth = 4
trailingComma = "all"
6 changes: 6 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# rustfmt options: https://rust-lang.github.io/rustfmt/

# Skipping children allows rustfmt to run on crates with
# generated source files. Without this formatting will
# fail with: `failed to resolve mod ${MOD}`.
skip_children = true
33 changes: 12 additions & 21 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ load(
"extra_exec_rustc_flags",
"extra_rustc_flag",
"extra_rustc_flags",
"is_proc_macro_dep",
"is_proc_macro_dep_enabled",
"no_std",
"per_crate_rustc_flag",
"rustc_output_diagnostics",
)

exports_files(["LICENSE"])
exports_files([
"LICENSE",
"MODULE.bazel",
])

bzl_library(
name = "bzl_lib",
Expand All @@ -32,6 +34,13 @@ error_format(
visibility = ["//visibility:public"],
)

# This setting may be changed from the command line to generate rustc diagnostics.
rustc_output_diagnostics(
name = "rustc_output_diagnostics",
build_setting_default = False,
visibility = ["//visibility:public"],
)

# This setting may be used to pass extra options to clippy from the command line.
# It applies across all targets.
clippy_flags(
Expand All @@ -40,24 +49,6 @@ clippy_flags(
visibility = ["//visibility:public"],
)

# This setting may be used to identify dependencies of proc-macro-s.
# This feature is only enabled if `is_proc_macro_dep_enabled` is true.
# Its value controls the BAZEL_RULES_RUST_IS_PROC_MACRO_DEP environment variable
# made available to the rustc invocation.
is_proc_macro_dep(
name = "is_proc_macro_dep",
build_setting_default = False,
visibility = ["//visibility:public"],
)

# This setting enables the feature to identify dependencies of proc-macro-s,
# see `is_proc_macro_dep`.
is_proc_macro_dep_enabled(
name = "is_proc_macro_dep_enabled",
build_setting_default = False,
visibility = ["//visibility:public"],
)

# This setting may be used to pass extra options to rustc from the command line
# in non-exec configuration.
# It applies across all targets whereas the rustc_flags option on targets applies only
Expand Down
115 changes: 110 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,23 +1,128 @@
"""bazelbuild/rules_rust"""

module(
name = "rules_rust",
version = "0.20.0",
version = "0.33.0",
)

print("WARNING: The rules_rust Bazel module is still highly experimental and subject to change at any time. Only use it to try out bzlmod for now.") # buildifier: disable=print

bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "bazel_skylib", version = "1.2.0")
bazel_dep(
name = "bazel_skylib",
version = "1.5.0",
)
bazel_dep(
name = "platforms",
version = "0.0.8",
)
bazel_dep(
name = "rules_cc",
version = "0.0.9",
)
bazel_dep(
name = "rules_proto",
version = "5.3.0-21.7",
)
bazel_dep(
name = "apple_support",
version = "1.3.1",
version = "1.11.1",
repo_name = "build_bazel_apple_support",
)
bazel_dep(
name = "protobuf",
version = "21.7",
repo_name = "com_google_protobuf",
)

internal_deps = use_extension("//rust/private:extensions.bzl", "internal_deps")
use_repo(
internal_deps,
"bazelci_rules",
"com_google_googleapis",
"cui",
"cui__anyhow-1.0.75",
"cui__cargo-lock-9.0.0",
"cui__cargo-platform-0.1.4",
"cui__cargo_metadata-0.18.1",
"cui__cargo_toml-0.17.1",
"cui__cfg-expr-0.15.5",
"cui__clap-4.3.11",
"cui__crates-index-2.2.0",
"cui__hex-0.4.3",
"cui__indoc-2.0.4",
"cui__itertools-0.11.0",
"cui__maplit-1.0.2",
"cui__normpath-1.1.1",
"cui__pathdiff-0.2.1",
"cui__regex-1.10.2",
"cui__semver-1.0.20",
"cui__serde-1.0.190",
"cui__serde_json-1.0.108",
"cui__serde_starlark-0.1.14",
"cui__sha2-0.10.8",
"cui__spectral-0.6.0",
"cui__tempfile-3.8.1",
"cui__tera-1.19.1",
"cui__textwrap-0.16.0",
"cui__toml-0.8.6",
"cui__tracing-0.1.40",
"cui__tracing-subscriber-0.3.17",
"generated_inputs_in_external_repo",
"libc",
"llvm-raw",
"rrra__anyhow-1.0.71",
"rrra__clap-4.3.11",
"rrra__env_logger-0.10.0",
"rrra__itertools-0.11.0",
"rrra__log-0.4.19",
"rrra__serde-1.0.171",
"rrra__serde_json-1.0.102",
"rules_rust_bindgen__bindgen-0.65.1",
"rules_rust_bindgen__bindgen-cli-0.65.1",
"rules_rust_bindgen__clang-sys-1.6.1",
"rules_rust_bindgen__clap-4.3.3",
"rules_rust_bindgen__clap_complete-4.3.1",
"rules_rust_bindgen__env_logger-0.10.0",
"rules_rust_prost",
"rules_rust_prost__h2-0.3.19",
"rules_rust_prost__heck",
"rules_rust_prost__prost-0.11.9",
"rules_rust_prost__prost-types-0.11.9",
"rules_rust_prost__protoc-gen-prost-0.2.2",
"rules_rust_prost__protoc-gen-tonic-0.2.2",
"rules_rust_prost__tokio-1.28.2",
"rules_rust_prost__tokio-stream-0.1.14",
"rules_rust_prost__tonic-0.9.2",
"rules_rust_test_load_arbitrary_tool",
"rules_rust_tinyjson",
"rules_rust_toolchain_test_target_json",
"rules_rust_util_import__aho-corasick-0.7.15",
"rules_rust_util_import__lazy_static-1.4.0",
"rules_rust_util_import__proc-macro2-1.0.33",
"rules_rust_util_import__quickcheck-1.0.3",
"rules_rust_util_import__quote-1.0.10",
"rules_rust_util_import__syn-1.0.82",
"rules_rust_wasm_bindgen__anyhow-1.0.71",
"rules_rust_wasm_bindgen__assert_cmd-1.0.8",
"rules_rust_wasm_bindgen__diff-0.1.13",
"rules_rust_wasm_bindgen__docopt-1.1.1",
"rules_rust_wasm_bindgen__env_logger-0.8.4",
"rules_rust_wasm_bindgen__log-0.4.19",
"rules_rust_wasm_bindgen__predicates-1.0.8",
"rules_rust_wasm_bindgen__rayon-1.7.0",
"rules_rust_wasm_bindgen__rouille-3.6.2",
"rules_rust_wasm_bindgen__serde-1.0.171",
"rules_rust_wasm_bindgen__serde_derive-1.0.171",
"rules_rust_wasm_bindgen__serde_json-1.0.102",
"rules_rust_wasm_bindgen__tempfile-3.6.0",
"rules_rust_wasm_bindgen__ureq-2.8.0",
"rules_rust_wasm_bindgen__walrus-0.19.0",
"rules_rust_wasm_bindgen__wasm-bindgen-0.2.88",
"rules_rust_wasm_bindgen__wasm-bindgen-cli-support-0.2.88",
"rules_rust_wasm_bindgen__wasm-bindgen-shared-0.2.88",
"rules_rust_wasm_bindgen__wasmparser-0.102.0",
"rules_rust_wasm_bindgen__wasmprinter-0.2.60",
"rules_rust_wasm_bindgen_cli",
)

rust = use_extension("//rust:extensions.bzl", "rust")
Expand Down
9 changes: 8 additions & 1 deletion bindgen/3rdparty/crates/crates.bzl

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

14 changes: 13 additions & 1 deletion bindgen/3rdparty/crates/defs.bzl

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

Loading

0 comments on commit 47c594f

Please sign in to comment.