Skip to content

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Jan 18, 2026

Summary

Implements actual Coq compilation in rocq_library using the nix toolchain.

Changes

  • rocq/toolchain.bzl: Add RocqToolchainInfo provider and rocq_toolchain_info rule
  • rocq/private/rocq.bzl: Update rocq_library to invoke coqc and produce .vo files
  • toolchains/rocq_nix_toolchain.bzl: Update BUILD file to use rocq_toolchain_info

How it works

  1. rocq_library gets the toolchain via ctx.toolchains
  2. Extracts coqc from RocqToolchainInfo
  3. For each .v file, runs coqc to produce .vo and .glob
  4. If no toolchain available, falls back to source-only mode

Test plan

  • Verify rules load with bazel query //rocq/...
  • Test compilation on a project with nix installed

- Add RocqToolchainInfo provider with coqc, coq_tools, stdlib fields
- Create rocq_toolchain_info rule for toolchain configuration
- Update rocq_library to invoke coqc and produce .vo files
- Update nix toolchain BUILD to use rocq_toolchain_info
- Add fallback to source-only mode when toolchain unavailable

The rocq_library rule now:
1. Gets coqc from the registered Rocq toolchain
2. Compiles each .v file to .vo and .glob
3. Handles dependencies via include paths
4. Falls back to source collection if no toolchain
@avrabe avrabe merged commit c3a9782 into main Jan 18, 2026
5 checks passed
@avrabe avrabe deleted the feat/coqc-compilation branch January 18, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants