Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 7 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,9 @@ jobs:
with:
nix_path: ${{ env.NIXPKGS_CHANNEL }}

- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-12-07
components: rustc-dev, rust-src, llvm-tools-preview

- name: Set Rust library paths
run: |
# Get Rust sysroot and add its lib directory to library paths
RUST_SYSROOT=$(rustc +nightly-2024-12-07 --print sysroot)
echo "RUST_SYSROOT=$RUST_SYSROOT"
ls -la $RUST_SYSROOT/lib/ | head -10
echo "LIBRARY_PATH=$RUST_SYSROOT/lib:$LIBRARY_PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$RUST_SYSROOT/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
# No host Rust toolchain is installed: rocq-of-rust is built by rules_rust
# against a hermetic nightly+rustc-dev sysroot the build downloads itself
# (see docs/rules_rust-migration.md).

- name: Set up Bazel
uses: bazelbuild/setup-bazelisk@v3
Expand All @@ -85,17 +74,11 @@ jobs:
restore-keys: |
bazel-build-${{ runner.os }}-

- name: Clean rocq-of-rust cache
run: |
# Force re-fetch of rocq-of-rust to pick up new LLVM libs
bazel clean --expunge_async || true
rm -rf ~/.cache/bazel/*rocq_of_rust* || true

- name: Build RocqOfRust library
- name: Build rocq-of-rust (hermetic rules_rust build)
run: |
echo "Building RocqOfRust library..."
bazel build @rocq_of_rust_source//:rocq_of_rust_main
echo "RocqOfRust library built"
echo "Building rocq-of-rust and the RocqOfRust library..."
bazel build //coq_of_rust/rocq_of_rust:rocq-of-rust @rocq_of_rust_build//:rocq_of_rust_main
echo "rocq-of-rust built"

- name: Run tests
run: |
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
"Features"
"Quick Start"
"Examples"
"Toolchain Management"
"Toolchain Contents"
"License"
)

Expand All @@ -46,8 +46,8 @@ jobs:

# Check that README mentions key features
required_features=(
"Rocq Platform Integration"
"coq-of-rust Support"
"Rocq"
"rocq-of-rust"
"Bazel 8 bzlmod"
"Hermetic Toolchains"
"Cross-Platform"
Expand All @@ -65,6 +65,10 @@ jobs:
echo "✅ README structure is complete"

- name: Check markdown links
# Advisory only: external link checks are inherently flaky, and the
# smithy self-hosted runner does not provide npm. The README-structure
# check above is the blocking documentation gate.
continue-on-error: true
run: |
echo "🔗 Checking markdown links..."

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ bazel-out
bazel-rules_rocq_rust
bazel-testlogs
bazel-loom
bazel-rust_to_rocq
.claude/
MODULE.bazel.lock
third_party/
46 changes: 41 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ module(
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "platforms", version = "1.0.0")

# Note: rocq-of-rust is built with cargo directly in the repository rule
# because it requires rustc_private (nightly internals) and crate_universe
# can't handle edition2024 crates like archery 1.2.2.
# No Bazel Rust rules needed - cargo handles the build.
# rocq-of-rust is a Rust workspace built hermetically via rules_rust +
# crate_universe (migration in progress -- see docs/rules_rust-migration.md).
# The third-party dependency graph is pinned through the vendored Cargo.lock
# under coq_of_rust/cargo/, which keeps archery at 1.2.0 (edition 2021) and so
# avoids crate_universe's trouble with the edition-2024 archery 1.2.2.
bazel_dep(name = "rules_rust", version = "0.70.0")

# Nix integration for hermetic Coq/Rocq toolchain
bazel_dep(name = "rules_nixpkgs_core", version = "0.13.0")
Expand Down Expand Up @@ -59,13 +61,47 @@ use_repo(rocq, "rocq_toolchains", "rocq_stdlib", "rocq_coqutil", "rocq_hammer",
# Register Rocq toolchain
register_toolchains("@rocq_toolchains//:all")

# Hermetic Rust nightly (+rustc-dev) toolchain for the rocq-of-rust build.
# rocq-of-rust-rustc is a rustc_private driver, so the toolchain sysroot must
# carry the rustc-dev crates; rules_rust's stock `rust` extension does not ship
# them. See docs/rules_rust-migration.md (Stage 2).
rust_nightly = use_extension("//coq_of_rust:extensions.bzl", "rust_nightly_toolchain")
rust_nightly.toolchain(
rust_nightly = "nightly-2024-12-07",
)
use_repo(rust_nightly, "rocq_of_rust_rust_nightly")

# Register the hermetic nightly toolchain. It carries platform constraints so
# it only resolves on a matching host; rules_rust's own toolchains (if any) are
# unaffected.
register_toolchains("@rocq_of_rust_rust_nightly//:rust_nightly")

# Third-party Rust crates for the rocq-of-rust build, resolved by crate_universe
# from the vendored Cargo workspace under coq_of_rust/cargo/. Consumed by the
# rust_library/rust_binary targets in //coq_of_rust/rocq_of_rust.
#
# NOT a dev_dependency: the rocq_of_rust toolchain (registered below, non-dev)
# builds rocq-of-rust from these crates, so any module that consumes the
# toolchain needs @rocq_of_rust_crates too. The explicit `name` keeps this a
# distinct, isolated repo -- it does not merge into or clobber a consumer's
# own crate_universe hub.
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.from_cargo(
name = "rocq_of_rust_crates",
cargo_lockfile = "//coq_of_rust/cargo:Cargo.lock",
# Only the workspace root Cargo.toml is needed; crate_universe discovers the
# `lib` and `cli` members from it.
manifests = ["//coq_of_rust/cargo:Cargo.toml"],
)
use_repo(crate, "rocq_of_rust_crates")

# rocq-of-rust toolchain extension - translates Rust to Rocq
rocq_of_rust = use_extension("//coq_of_rust:extensions.bzl", "rocq_of_rust")
rocq_of_rust.toolchain(
# Uses pinned default: 877dd65142b3c5217ce6ae043ff49c8f540eb8a5
use_real_library = True, # Full library with coqutil + hammer + smpl
)
use_repo(rocq_of_rust, "rocq_of_rust_toolchains", "rocq_of_rust_source")
use_repo(rocq_of_rust, "rocq_of_rust_toolchains", "rocq_of_rust_build")

# Register rocq-of-rust toolchain
register_toolchains("@rocq_of_rust_toolchains//:toolchain")
Loading
Loading