Skip to content

Commit

Permalink
Updated entire repository to account for creation of rules_rust_ext.
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Nov 19, 2024
1 parent 06937bc commit 2e8bfc1
Show file tree
Hide file tree
Showing 331 changed files with 1,950 additions and 2,293 deletions.
5 changes: 0 additions & 5 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ default_macos_targets: &default_macos_targets
default_windows_targets: &default_windows_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
- "-//test/proto/..."
- "-//test/unit/pipelined_compilation/..."
default_windows_no_runfiles_targets: &default_windows_no_runfiles_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
Expand All @@ -43,7 +42,6 @@ default_windows_no_runfiles_targets: &default_windows_no_runfiles_targets
- "-//crate_universe/..."
- "-//test/chained_direct_deps:mod3_doc_test"
- "-//test/out_dir_in_tests:demo_lib_doc_test"
- "-//test/proto/..."
- "-//test/rustc_env_files:output_test"
- "-//test/test_env_launcher:test"
- "-//test/test_env:test_manifest_dir"
Expand Down Expand Up @@ -238,12 +236,9 @@ tasks:
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
5 changes: 3 additions & 2 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.direnv
bzlmod
crate_universe/private/bootstrap
docs
examples
crate_universe/private/bootstrap
extensions
test/aliased_toolchains
test/bzlmod_repo_mapping
test/cc_common_link
test/no_std
.direnv
2 changes: 1 addition & 1 deletion .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-v{VERSION}.tar.gz"
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz"
}
12 changes: 6 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
**/*Cargo.Bazel.lock linguist-generated
**/cargo-bazel-lock.json linguist-generated
bindgen/3rdparty/crates/** linguist-generated
crate_universe/3rdparty/crates/** linguist-generated
crate_universe/test_data/metadata/*/metadata.json linguist-generated
examples/bzlmod/hello_world/third-party/crates/** linguist-generated
examples/crate_universe_unnamed/vendor_remote_manifests/crates/** linguist-generated
examples/crate_universe_unnamed/vendor_remote_pkgs/crates/** linguist-generated
examples/crate_universe/vendor_external/crates/** linguist-generated
examples/crate_universe/vendor_local_manifests/crates/** linguist-generated
examples/crate_universe/vendor_local_pkgs/crates/** linguist-generated
examples/crate_universe/vendor_remote_manifests/crates/** linguist-generated
examples/crate_universe/vendor_remote_pkgs/crates/** linguist-generated
examples/crate_universe_unnamed/vendor_remote_manifests/crates/** linguist-generated
examples/crate_universe_unnamed/vendor_remote_pkgs/crates/** linguist-generated
examples/sys/basic/3rdparty/crates/** linguist-generated
examples/sys/complex/3rdparty/crates/** linguist-generated
proto/prost/private/3rdparty/crates/** linguist-generated
proto/protobuf/3rdparty/crates/** linguist-generated
extensions/bindgen/3rdparty/crates/** linguist-generated
extensions/prost/private/3rdparty/crates/** linguist-generated
extensions/proto/protobuf/3rdparty/crates/** linguist-generated
extensions/wasm_bindgen/3rdparty/crates/** linguist-generated
tools/rust_analyzer/3rdparty/crates/** linguist-generated
util/import/3rdparty/crates/** linguist-generated
wasm_bindgen/3rdparty/crates/** linguist-generated
23 changes: 21 additions & 2 deletions .github/release_notes.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# {version}

Additional documentation can be found at: https://bazelbuild.github.io/rules_rust/#setup

## Bzlmod

```python
Expand All @@ -13,8 +15,25 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_rust",
integrity = "sha256-{sha256_base64}",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-v{version}.tar.gz"],
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"],
)
```

Additional documentation can be found at: https://bazelbuild.github.io/rules_rust/#setup
## extensions

### Bzlmod

```python
bazel_dep(name = "rules_rust_ext", version = "{version}")
```

### WORKSPACE

```python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_rust",
integrity = "sha256-{ext_sha256_base64}",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_ext-{version}.tar.gz"],
)
```
44 changes: 41 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,29 +128,57 @@ jobs:
- name: Create the rules archive
run: |
# Update urls and sha256 values
bazel ${BAZEL_STARTUP_FLAGS[@]} run //crate_universe/tools/urls_generator -- --artifacts-dir="${ARTIFACTS_DIR}" --url-prefix="${URL_PREFIX}"
bazel ${BAZEL_STARTUP_FLAGS[@]} run //crate_universe/tools/urls_generator \
-- --artifacts-dir="${ARTIFACTS_DIR}" --url-prefix="${URL_PREFIX}"
bazel clean
# Build an archive of the repo contents.
# `examples/bzlmod` is included for the BCR presubmit; it must appear before --exclude="examples"
tar -czf ${{ github.workspace }}/.github/rules_rust.tar.gz -C ${{ github.workspace }} --exclude=".git" --exclude=".github" --exclude="crate_universe/target" examples/bzlmod --exclude="examples" .
tar -czf ${{ github.workspace }}/.github/rules_rust.tar.gz \
-C ${{ github.workspace }} \
--exclude=".git" --exclude=".github" \
--exclude="crate_universe/target" \
examples/bzlmod \
--exclude="examples" \
--exclude="extensions" \
.
# Save the sha256 checksum of the distro archive to the environment
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
echo "ARCHIVE_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
env:
CARGO_BAZEL_GENERATOR_URL: file://${{ github.workspace }}/crate_universe/target/artifacts/x86_64-unknown-linux-gnu/cargo-bazel
ARTIFACTS_DIR: ${{ github.workspace }}/crate_universe/target/artifacts
URL_PREFIX: https://github.com/${{ github.repository_owner }}/rules_rust/releases/download/${{ env.RELEASE_VERSION }}
- name: Create the rules extensions archive
run: |
# Build an archive of the repo contents.
tar -czf ${{ github.workspace }}/.github/rules_rust_ext.tar.gz \
-C ${{ github.workspace }}/extensions \
--exclude="examples" \
.
# Save the sha256 checksum of the distro archive to the environment
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_ext.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
echo "ARCHIVE_EXT_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
# Upload the artifact in case creating a release fails so all artifacts can then be manually recovered.
- uses: actions/upload-artifact@v3
with:
name: "rules_rust.tar.gz"
path: ${{ github.workspace }}/.github/rules_rust.tar.gz
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: "rules_rust_ext.tar.gz"
path: ${{ github.workspace }}/.github/rules_rust_ext.tar.gz
if-no-files-found: error
- name: Generate release notes
run: |
# Generate the release notes
sed 's#{version}#${{ env.RELEASE_VERSION }}#g' ${{ github.workspace }}/.github/release_notes.template \
| sed 's#{sha256_base64}#${{ env.ARCHIVE_SHA256_BASE64 }}#g' \
| sed 's#{ext_sha256_base64}#${{ env.ARCHIVE_EXT_SHA256_BASE64 }}#g' \
> ${{ github.workspace }}/.github/release_notes.txt
- name: Create release
uses: softprops/action-gh-release@v1
Expand All @@ -169,10 +197,20 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.rules_rust_release.outputs.upload_url }}
asset_name: rules_rust-v${{ env.RELEASE_VERSION }}.tar.gz
asset_name: rules_rust-${{ env.RELEASE_VERSION }}.tar.gz
asset_path: ${{ github.workspace }}/.github/rules_rust.tar.gz
asset_content_type: application/gzip

- name: "Upload the rules extensions archive"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.rules_rust_release.outputs.upload_url }}
asset_name: rules_rust_ext-${{ env.RELEASE_VERSION }}.tar.gz
asset_path: ${{ github.workspace }}/.github/rules_rust_ext.tar.gz
asset_content_type: application/gzip

# There must be a upload action for each platform triple we create
- name: "Upload aarch64-apple-darwin"
uses: actions/upload-release-asset@v1
Expand Down
95 changes: 11 additions & 84 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,12 @@ bazel_dep(
name = "rules_license",
version = "0.0.8",
)
bazel_dep(
name = "rules_proto",
version = "6.0.2",
)
bazel_dep(
name = "apple_support",
version = "1.13.0",
repo_name = "build_bazel_apple_support",
)
bazel_dep(
name = "protobuf",
version = "21.7",
repo_name = "com_google_protobuf",
)
bazel_dep(
name = "aspect_rules_js",
version = "1.39.0",
)

bazel_dep(
name = "bazel_ci_rules",
version = "1.0.0",
dev_dependency = True,
)
bazel_dep(
name = "rules_python",
version = "0.31.0",
dev_dependency = True,
)
bazel_dep(
name = "rules_testing",
version = "0.6.0",
Expand Down Expand Up @@ -99,63 +76,14 @@ use_repo(
"cui__tracing-0.1.40",
"cui__tracing-subscriber-0.3.18",
"cui__url-2.5.2",
"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.70.1",
"rules_rust_bindgen__bindgen-cli-0.70.1",
"rules_rust_bindgen__clang-sys-1.8.1",
"rules_rust_bindgen__clap-4.5.17",
"rules_rust_bindgen__clap_complete-4.5.26",
"rules_rust_bindgen__env_logger-0.10.2",
"rules_rust_prost",
"rules_rust_prost__h2-0.4.6",
"rules_rust_prost__heck",
"rules_rust_prost__prost-0.13.1",
"rules_rust_prost__prost-types-0.13.1",
"rules_rust_prost__protoc-gen-prost-0.4.0",
"rules_rust_prost__protoc-gen-tonic-0.4.1",
"rules_rust_prost__tokio-1.39.3",
"rules_rust_prost__tokio-stream-0.1.15",
"rules_rust_prost__tonic-0.12.1",
"rules_rust_proto__grpc-0.6.2",
"rules_rust_proto__grpc-compiler-0.6.2",
"rules_rust_proto__log-0.4.17",
"rules_rust_proto__protobuf-2.8.2",
"rules_rust_proto__protobuf-codegen-2.8.2",
"rules_rust_proto__tls-api-0.1.22",
"rules_rust_proto__tls-api-stub-0.1.22",
"rules_rust_test_load_arbitrary_tool",
"rules_rust_tinyjson",
"rules_rust_toolchain_test_target_json",
"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.20.3",
"rules_rust_wasm_bindgen__wasm-bindgen-0.2.92",
"rules_rust_wasm_bindgen__wasm-bindgen-cli-support-0.2.92",
"rules_rust_wasm_bindgen__wasm-bindgen-shared-0.2.92",
"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 All @@ -166,24 +94,23 @@ register_toolchains(
"@rust_toolchains//:all",
)

register_toolchains(
"//proto/protobuf:default-proto-toolchain",
)

register_toolchains(
"//proto/prost:default_prost_toolchain",
)

register_toolchains(
"//bindgen:default_bindgen_toolchain",
)

rust_host_tools = use_extension("//rust:extensions.bzl", "rust_host_tools")
use_repo(rust_host_tools, "rust_host_tools")

cargo_bazel_bootstrap = use_extension("//crate_universe/private/module_extensions:cargo_bazel_bootstrap.bzl", "cargo_bazel_bootstrap")
use_repo(cargo_bazel_bootstrap, "cargo_bazel_bootstrap")

rust_test = use_extension("//test:test_extensions.bzl", "rust_test", dev_dependency = True)
use_repo(
rust_test,
"generated_inputs_in_external_repo",
"libc",
"rules_rust_test_load_arbitrary_tool",
"rules_rust_toolchain_test_target_json",
"t3p__serde-1.0.214",
"t3p__serde_json-1.0.132",
)

register_toolchains(
"//test/foreign_toolchain_make_variables:toolchain_for_test",
dev_dependency = True,
Expand Down
35 changes: 0 additions & 35 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,10 @@ load("//crate_universe/tools/cross_installer:cross_installer_deps.bzl", "cross_i

cross_installer_deps()

# buildifier: disable=bzl-visibility
load("@rules_rust//proto/prost/private:repositories.bzl", "rust_prost_dependencies", "rust_prost_register_toolchains")

rust_prost_dependencies()

rust_prost_register_toolchains()

load("@rules_rust//proto/prost:transitive_repositories.bzl", "rust_prost_transitive_repositories")

rust_prost_transitive_repositories()

load("@rules_rust//proto/protobuf:repositories.bzl", "rust_proto_protobuf_dependencies", "rust_proto_protobuf_register_toolchains")

rust_proto_protobuf_dependencies()

rust_proto_protobuf_register_toolchains()

load("@rules_rust//proto/protobuf:transitive_repositories.bzl", "rust_proto_protobuf_transitive_repositories")

rust_proto_protobuf_transitive_repositories()

load("@rules_rust//bindgen:repositories.bzl", "rust_bindgen_dependencies", "rust_bindgen_register_toolchains")

rust_bindgen_dependencies()

rust_bindgen_register_toolchains()

load("@rules_rust//bindgen:transitive_repositories.bzl", "rust_bindgen_transitive_dependencies")

rust_bindgen_transitive_dependencies()

load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies")

rust_analyzer_dependencies()

load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories")

rust_wasm_bindgen_repositories()

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()
Expand Down
1 change: 1 addition & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workspace(name = "rules_rust")
Binary file removed buildifier
Binary file not shown.
Loading

0 comments on commit 2e8bfc1

Please sign in to comment.