Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exploring Better Monorepo and Faster Build Support for ReScript #6248

Open
cristianoc opened this issue May 8, 2023 · 4 comments
Open

Exploring Better Monorepo and Faster Build Support for ReScript #6248

cristianoc opened this issue May 8, 2023 · 4 comments
Milestone

Comments

@cristianoc
Copy link
Collaborator

cristianoc commented May 8, 2023

Title: Exploring Better Monorepo and Faster Build Support for ReScript

Description:
There has been a discussion about improving monorepo support and faster build times for ReScript projects. A Rust-based tool called rewatch has been developed by @rolandpeelen and @jaap to address these issues in their own monorepo setup. It bypasses ninja and calls bsc directly, which provides a 2x to 3x improvement in build times and reduces stale builds. Some participants in the discussion considered the benefits and challenges of writing the tool in OCaml instead of Rust, while others discussed the possibility of cross-compilation and improving CI support for various platforms. The goal is to improve monorepo support and build times for a wider range of ReScript projects.

Key points from the discussion:

  • rewatch is not a ninja generator, but does clever stuff to avoid rebuilding things that have already been built.
  • The tool is currently tailored for a specific monorepo setup and needs further work to support the full bsconfig spec.
  • The main reason for faster build times is putting all compiler assets in a single folder, which reduces the number of include paths for bsc and speeds up lookups.
  • The tool compiles the entire monorepo as if it's a single project, which makes monorepo builds more consistent.
  • It watches for changes in the monorepo as a whole and efficiently calculates the files that need to be recompiled.
  • Dependency tracking is done globally, providing a more efficient and accurate tracking compared to bsb.
  • Some potential improvements were identified, such as passing the bsconfig location as a parameter to save IO lookups.
  • Rust was chosen over OCaml for rewatch due to its advantages in file watching, efficient OS system calls, and cross-platform support. However, certain aspects of the implementation might still require binding to C-libraries if done in OCaml.
  • Participants discussed the possibility of integrating the Rust tool directly into the compiler to avoid the overhead of spawning processes and calling the compiler separately.

Actions:

  • Document the current monorepo setup and how rewatch has improved the build process for it.
  • Investigate how other monorepo setups can benefit from these improvements.
  • Consider the benefits and challenges of writing the tool in OCaml for better integration with ReScript's ecosystem.
  • Continue working on supporting the full bsconfig spec and fixing any remaining bugs.
  • Explore cross-compilation options and improve CI support for various platforms, including statically linked Linux binaries.
@fhammerschmidt
Copy link
Member

Referencing #3521 here, so that we don't forget about symlink support on the way.

@jfrolich
Copy link

@fhammerschmidt I think this is supported by rewatch currently?

@fhammerschmidt
Copy link
Member

Yes.

I did not think of rewatch when I made that comment, as it was not as far is it is today.

Copy link

github-actions bot commented Sep 7, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Old issues that went stale label Sep 7, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 14, 2024
@zth zth reopened this Sep 14, 2024
@github-actions github-actions bot removed the stale Old issues that went stale label Sep 15, 2024
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

No branches or pull requests

4 participants