-
Notifications
You must be signed in to change notification settings - Fork 43
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
[DO NOT MERGE] Configure esy monorepo workflow (2) #74
Conversation
- `esy.json` links to all packages via `link-dev:` This collects & installs all `"devDependencies"` for packages and makes them available to `'build"` command (or `"buildDev"` if it's configured). - Fixes `src/refmterr/lib/dune` to have access to `Common` (not sure why it's worked before). - Adds `"buildDev"` with `refmterr` for those packages (`file-context-printer`) which only rely on `refmterr` in dev. Workflow is the following: ``` % esy install # install % esy build # build in dev mode % esy build --release # build in release mode ```
This package hosts tests.
This configures `"build"` (and `"buildDev"` where needed) with `esydune` instead of `dune`. This makes sure we invoke dune with the right arguments, this effectively enables warnings in reason-native. Then this commits update `dune` files with flags to disable erroring on 29 (unused bindings) and 9 (unbound record fields in patterns) warnings.
console.json
Outdated
"build": "dune build -p console", | ||
"install": "esy-installer console.install" | ||
"build": "esydune build", | ||
"install": "esydune install" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make esy
's built in install process automatically look to see if there's a .install
file that matches your package name (minus any scope) and just use that one so you don't have to specify it or use esydune install
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Will implement now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR updated not to include redundant "install"
config.
That seems good to have even without monorepos.
I think these could be confusing to newcomers just because they already have to What about: esy build --package=./rely.json cmd Then it's clear this is just an extension of the This is a kind of rare command to need, so a little extra verbosity would not be bad.
I'm confused because I thought that for linked packages with out of source Other question: How was the circularity solved? |
Yep, this is needed as we've added
This can be done for
Overall - I agree, let's implement it that way instead of adding a new command.
Packages now specify their dependencies/devDependencies in their own
|
Nope, we always check for staleness but I think we could indeed don't do that for out of source builds. |
5310521
to
52b1355
Compare
New CLI in latest nightly allows to use
Therefore |
Okay, so if that optimization is made for linked packages then we can continue to keep the package config .jsons at the root without any penalty it seems. (People could move them down deeper if they like, but it's nice that they wouldn't have to). |
Looking really good! |
Update: dune has merged PR (ocaml/dune#1750) which enables merlin to see original source locations for linked packages in a monorepo. I'm adding needed fixes for esy to enable that. After dune new version is released this PR could be merged. |
I'm guessing this is no longer relevant and can be closed given how old it is. |
This is a 2nd attempt at esy monorepo workflow (replaces #42).
The PR works only with esy nightly builds for now:
How it works
esy.json
links to each package in the repository usinglink-dev:./path/to/package.json
.Each package linked with
link-dev:
behaves exactly like a root package in a regular esy workflow:"devDependencies"
are installed"buildDev"
command is executed on build (if it's defined, falls back to"build"
)"devDependencies"
Workflow
Install dependencies:
Build dependencies (each package has access to its
"devDependencies"
, runs"buildDev"
command if it's defined):Build dependencies in release mode (run
"build"
command w/o access to"devDependencies"
):Discussion
Is it possible to run builds commands for a specified package?
Yes, use
esy build-package
command:Is it possible to run commands in a build env of a specified package?
Yes, use
esy build-exec
command:The command
esy build-exec CMD
is an analogue ofesy build CMD
command butallows to specify the package.
Is it possible to make change detection more granular?
When one changes sources (do
touch ./src/console/Console.re
for example) allpackages are being rebuilt (actually they are not being rebuilt, esy just runs
build commands but as dune works incrementally those commands are noop).
It's possible to make esy detect changes in a more granular fashin but that requires moving package roots into different dirs, for example:
I've experimented with this approach and it doesn't work with the current setup
for
common
- if we move package root to thesrc/
thencopy_files
doesn'twork as it can't copy files from outside the package root.
If we change how we vendor code from
common/
dir we can enable more granularchange detection with esy.
Changes
394ecfc
Convert to esy monorepo
esy.json
links to all packages vialink-dev:
This collects & installsall
"devDependencies"
for packages and makes them available to'build"
command (or
"buildDev"
if it's configured).Fixes
src/refmterr/lib/dune
to have access toCommon
(not sure why it'sworked before).
Adds
"buildDev"
withrefmterr
for those packages(
file-context-printer
) which only rely onrefmterr
in dev.c53ee3f
Add @reason-native/tests package
This package hosts tests.
1d24018
Use esydune wrapper for dune
This configures
"build"
(and"buildDev"
where needed) withesydune
instead of
dune
. This makes sure we invoke dune with the right arguments,this effectively enables warnings in reason-native.
Then this commits update
dune
files with flags to disable erroring on 29(unused bindings) and 9 (unbound record fields in patterns) warnings.
5310521 Update esy.lock (not for review)