Skip to content

Conversation

nojaf
Copy link
Member

@nojaf nojaf commented Sep 15, 2025

Fixes #7436

It produces a lib/bs/compiler-info.json file which contains:

{
  "version": "12.0.0-beta.12",
  "bsc_path": "/Users/nojaf/Projects/vrindelycker/node_modules/@rescript/darwin-arm64/bin/bsc.exe",
  "bsc_hash": "7d113813ca550965be97771da2ce2d47f85d297eda9e568763e54d31e0b8098d",
  "rescript_config_hash": "226055db0876bea957f7b3b597478f95fdaefb4547704d6557c5dceb64772a1b",
  "runtime_path": "/Users/nojaf/Projects/vrindelycker/node_modules/@rescript/runtime",
  "generated_at": "1757936814848"
}

"runtime_path" and "bsc_path" might be interesting for tooling to pick up.

That hash compare is also really useful when working with a local compiler.

Copy link

pkg-pr-new bot commented Sep 15, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7889

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7889

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7889

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7889

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7889

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@7889

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7889

commit: bef0e40

@nojaf nojaf marked this pull request as ready for review September 15, 2025 12:11
@nojaf nojaf requested a review from jfrolich September 15, 2025 12:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements compiler tracking functionality during builds to detect compiler changes and trigger necessary package cleaning. It adds compiler metadata including version, BSC path/hash, and runtime path to facilitate build invalidation when the compiler environment changes.

Key changes:

  • Introduces a CompilerInfo struct containing BSC path, hash, and runtime path
  • Adds compiler verification logic that compares current compiler info with stored metadata
  • Implements automatic package cleaning when compiler changes are detected

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rewatch/src/build/compiler_info.rs New module implementing compiler info verification and metadata file writing
rewatch/src/build/build_types.rs Adds CompilerInfo struct and updates BuildState to use it
rewatch/src/build.rs Integrates compiler verification into build initialization
rewatch/src/build/packages.rs Adds method to get compiler info file path
rewatch/src/build/parse.rs Updates AST generation to use compiler info
rewatch/src/build/compile.rs Refactors runtime path handling and updates compilation
rewatch/src/build/clean.rs Updates cleaning logic and adds compiler info cleanup
Comments suppressed due to low confidence (1)

rewatch/src/build/compiler_info.rs:1

  • This TODO comment appears to be in the wrong location. It's placed in the compile.rs diff but seems unrelated to the compiler info functionality being added.
use crate::helpers;

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

Rewatch: detect changes to config and compiler version
1 participant