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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/devcontainers/rust:2-1-trixie
FROM mcr.microsoft.com/devcontainers/base:2-trixie
LABEL org.opencontainers.image.authors="Christoph Knittel <ck@cca.io>"
LABEL org.opencontainers.image.description="Docker image for ReScript development."

Expand Down
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"extensions": [
"ocamllabs.ocaml-platform",
"chenglou92.rescript-vscode",
"biomejs.biome",
"rust-lang.rust-analyzer"
"biomejs.biome"
]
}
},
Expand Down
93 changes: 0 additions & 93 deletions .github/actions/build-rewatch/action.yml

This file was deleted.

40 changes: 7 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ concurrency:

env:
OCAMLRUNPARAM: b
RUST_BACKTRACE: "1"
RUSTFLAGS: "-Dwarnings"

jobs:
build-compiler:
Expand All @@ -42,7 +40,6 @@ jobs:
upload_binaries: true
upload_libs: true
node-target: linux-x64
rust-target: x86_64-unknown-linux-musl
dune-profile: static
- os: ubuntu-26.04-arm # ARM
ocaml_compiler: ocaml-variants.5.5.2+options,ocaml-option-static
Expand All @@ -52,30 +49,26 @@ jobs:
generate_api_docs: true
test_commit_records: true
node-target: linux-arm64
rust-target: aarch64-unknown-linux-musl
dune-profile: static
- os: macos-26 # ARM
ocaml_compiler: 5.5.2
upload_binaries: true
node-target: darwin-arm64
rust-target: aarch64-apple-darwin
dune-profile: release
- os: windows-2025
ocaml_compiler: 5.5.2
upload_binaries: true
node-target: win32-x64
rust-target: x86_64-pc-windows-gnu
exe-suffix: ".exe"
dune-profile: release

# Verify that the compiler still builds with the oldest OCaml version we support.
# Steps comparing OCaml and Rust rewatch are skipped on this job; the
# The build system's snapshot tests are skipped on this job; the
# first linux-x64 job runs them. OCaml 5.0 does not build with GCC 15
# (C23 by default), so this job stays on Ubuntu 24.04.
- os: ubuntu-24.04
ocaml_compiler: ocaml-variants.5.0.0+options,ocaml-option-static
node-target: linux-x64
rust-target: x86_64-unknown-linux-musl
dune-profile: static

runs-on: ${{matrix.os}}
Expand All @@ -102,14 +95,6 @@ jobs:
if: runner.os == 'Linux'
uses: ./.github/actions/setup-linux-dependencies

- name: Build rewatch
uses: ./.github/actions/build-rewatch
with:
cache-target: ${{ matrix.rust-target }}
rust-target: ${{ matrix.rust-target }}
exe-suffix: ${{ matrix.exe-suffix }}
run-quality-checks: "true"

- name: Setup OCaml ${{ matrix.ocaml_compiler }}
id: setup_ocaml
uses: ./.github/actions/setup-ocaml
Expand Down Expand Up @@ -235,43 +220,39 @@ jobs:
run: make -C tests/gentype_tests/typescript-react-example clean test
shell: bash

- name: Run OCaml rewatch parity tests
- name: Run rewatch snapshot tests
if: ${{ !contains(matrix.ocaml_compiler, '5.0.0') }}
timeout-minutes: 20
run: |
. rewatch-ocaml/tests/process_watchdog.sh
start_process_watchdog
bash rewatch-ocaml/tests/check_canonical_test_coverage.sh
bash rewatch-ocaml/tests/check_config_acceptance.sh \
packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe \
packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
bash rewatch-ocaml/tests/check_command_validation.sh \
packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe \
packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
shell: bash

- name: Run OCaml rewatch interactive output tests
- name: Run rewatch interactive output tests
# Terminal rendering depends on the host OS, not the CPU architecture.
# Use the faster ARM runners for one Linux and one macOS check. Windows
# does not provide a reliable native equivalent of the `script` PTY.
if: matrix.node-target == 'linux-arm64' || matrix.node-target == 'darwin-arm64'
timeout-minutes: 15
run: |
bash rewatch-ocaml/tests/check_interactive_output.sh \
packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe \
packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
shell: bash

- name: Run OCaml rewatch verbose output tests
- name: Run rewatch verbose output tests
if: ${{ !contains(matrix.ocaml_compiler, '5.0.0') }}
timeout-minutes: 10
run: |
bash rewatch-ocaml/tests/check_verbose_output.sh \
packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe \
packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
shell: bash

- name: Run OCaml rewatch unit tests
- name: Run rewatch unit tests
timeout-minutes: 10
run: |
opam exec -- dune build tests/rewatch_ounit_tests/rewatch_ounit_tests_main.exe
Expand All @@ -280,23 +261,16 @@ jobs:
opam exec -- ./_build/default/tests/rewatch_ounit_tests/rewatch_ounit_tests_main.exe -runner sequential
shell: bash

- name: Run OCaml rewatch focused integration tests
- name: Run rewatch focused integration tests
timeout-minutes: 30
run: |
sh rewatch-ocaml/tests/run.sh packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
shell: bash

- name: Run OCaml rewatch canonical tests
- name: Run rewatch canonical tests
run: ./rewatch/tests/suite.sh packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
shell: bash

# The Rust implementation is kept for comparison. One platform runs its
# shared suite; the parity steps exercise it on every platform.
- name: Run Rust rewatch reference tests
if: matrix.node-target == 'linux-arm64'
run: ./rewatch/tests/suite.sh packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe
shell: bash

- name: Build playground compiler
if: matrix.build_playground
run: opam exec -- make playground
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
env:
OS: ubuntu-26.04-arm
OCAML_COMPILER: 5.5.2
RUST_TARGET: aarch64-unknown-linux-gnu
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -33,11 +32,6 @@ jobs:
- name: Setup Linux dependencies
uses: ./.github/actions/setup-linux-dependencies

- name: Build rewatch
uses: ./.github/actions/build-rewatch
with:
cache-target: ${{ env.RUST_TARGET }}

- name: Setup OCaml ${{ env.OCAML_COMPILER }}
id: setup_ocaml
uses: ./.github/actions/setup-ocaml
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ packages/dev-playground/src/*.res.mjs
packages/dev-playground/public/playground-bundles/*
!packages/dev-playground/public/playground-bundles/.gitignore

rewatch/target/
rewatch/rewatch

tests/tools_tests/**/*.res.js
tests/tools_tests/lib
tests/analysis_tests*/lib
Expand Down
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"recommendations": [
"biomejs.biome",
"chenglou92.rescript-vscode",
"ocamllabs.ocaml-platform",
"rust-lang.rust-analyzer"
"ocamllabs.ocaml-platform"
],
"unwantedRecommendations": [
"dbaeumer.vscode-eslint",
Expand Down
19 changes: 8 additions & 11 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,17 @@ The Makefile’s targets build on each other in this order:

1. `yarn-install` runs automatically for targets that need JavaScript tooling (lib, playground, tests, formatting, etc.).
2. `build` (default target) builds the toolchain binaries (all copied into `packages/@rescript/<platform>/bin`):
- `compiler` builds the dune executables (`bsc`, `rescript-*`, `ounit_tests`, etc.), including the OCaml build system and CLI (`rescript`).
- `rewatch` builds the Rust implementation of the build system (`rescript-rust`).
- `compiler` builds the dune executables (`bsc`, `rescript-*`, `ounit_tests`, etc.), including the build system and CLI (`rescript`).
3. `lib` uses those toolchain outputs to build the runtime sources.
4. Test targets (`make test`, `make test-syntax`, etc.) reuse everything above.

## Area guidance

Before changing a subsystem, read its local agent instructions and area guide.
For compiler changes, read [compiler/AGENTS.md](compiler/AGENTS.md). For build
system changes, read [rewatch-ocaml/AGENTS.md](rewatch-ocaml/AGENTS.md) for the
OCaml implementation and [rewatch/AGENTS.md](rewatch/AGENTS.md) for the Rust
one. These apply even
when the task starts at the repository root. Changes spanning areas need the
relevant guidance from each.
system changes, read [rewatch-ocaml/AGENTS.md](rewatch-ocaml/AGENTS.md). These
apply even when the task starts at the repository root. Changes spanning areas
need the relevant guidance from each.

- [`compiler/syntax/README.md`](compiler/syntax/README.md) for parsing,
printing, and JSX transformation
Expand All @@ -47,8 +44,8 @@ relevant guidance from each.
- [`compiler/core/README.md`](compiler/core/README.md) for Lambda
optimization and JavaScript generation
- [`analysis/README.md`](analysis/README.md) for editor analysis
- [`rewatch-ocaml/README.md`](rewatch-ocaml/README.md) and
[`rewatch/README.md`](rewatch/README.md) for the build system
- [`rewatch-ocaml/README.md`](rewatch-ocaml/README.md) for the build system
and [`rewatch/README.md`](rewatch/README.md) for its integration suite
- [`tools/README.md`](tools/README.md) for `rescript-tools`

## Coding guidelines
Expand Down Expand Up @@ -109,8 +106,8 @@ on `master`. CI runs on every PR in the stack.
For compiler or standard-library changes, run `make test`. For syntax changes,
also run `make test-syntax`; use `make test-syntax-roundtrip` when parsing or
printing changes. Other focused suites are `make test-gentype`,
`make test-analysis`, `make test-tools`, `make test-rewatch` (OCaml build
system), and `make test-rewatch-rust` (Rust build system).
`make test-analysis`, `make test-tools`, and `make test-rewatch` (build
system).

### Testing Requirements

Expand Down
21 changes: 1 addition & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ for the compiler area you are changing:
- [type checker and typed tree](compiler/ml/README.md)
- [Lambda, Lam, and JavaScript generation](compiler/core/README.md)
- [editor analysis](analysis/README.md)
- [build system](rewatch/README.md)
- [build system](rewatch-ocaml/README.md)
- [`rescript-tools`](tools/README.md)

Public language and library documentation belongs on the
Expand All @@ -35,7 +35,6 @@ algorithm and representation invariants belong beside their implementation.
- [Node.js](https://nodejs.org/) v26.x or newer (the version in `.nvmrc`)
- [Yarn CLI](https://yarnpkg.com/getting-started/install) (can be installed with `corepack`, Homebrew, etc)
- C compiler toolchain (usually installed with `xcode` on Mac)
- Rust toolchain (required to build rewatch; follow the instructions at https://www.rust-lang.org/tools/install and install the version listed as `rust-version` in `rewatch/Cargo.toml`)
- `opam` (OCaml Package Manager) v2.2.0 or newer
- VSCode (+ [OCaml Platform Extension](https://marketplace.visualstudio.com/items?itemName=ocamllabs.ocaml-platform))

Expand Down Expand Up @@ -103,15 +102,6 @@ opam install . --deps-only --with-test --with-dev-setup -y

Run `yarn install`. This will install the npm dependencies required for the build scripts.

#### rustup install

[Rewatch](./rewatch/) is built with rust. Make sure you have [rustup](https://rustup.rs/) installed to manage rust versions.

```sh
rustup toolchain install 1.91
rustup override set 1.91
```

### B. Devcontainer

As an alternative to the manual installation, the repository provides a [development container](https://containers.dev/) definition that can be used with [VS Code's Remote Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). Use this to get a stable development environment without having to install anything locally other than VS Code and Docker.
Expand Down Expand Up @@ -156,9 +146,6 @@ Additional targets:
# Build the compiler executables only
make compiler

# Build rewatch only
make rewatch

# Run syntax tests
make test-syntax

Expand Down Expand Up @@ -286,12 +273,6 @@ npm link rescript

The `rescript` build system has the compiler built in, so to test a local compiler change, link the local package as shown above.

The Rust build system, `rescript-rust`, still runs `bsc.exe` and accepts the `RESCRIPT_BSC_EXE` environment variable pointing to your locally compiled `bsc.exe`:

```sh
RESCRIPT_BSC_EXE=your-rescript-repo/packages/@rescript/darwin-arm64/bin/bsc.exe npx rescript-rust
```

### Running Automatic Tests

We provide different test suites for different levels of the compiler and build system infrastructure. Always make sure to locally build your compiler before running any tests.
Expand Down
Loading
Loading