Skip to content

A miso project with a library can be a dependency of another - #30

Merged
dmjio merged 1 commit into
mainfrom
miso-project-dependencies
Oct 23, 2026
Merged

dmjio merged 1 commit into
mainfrom
miso-project-dependencies

Conversation

@dmjio

@dmjio dmjio commented Oct 23, 2026

Copy link
Copy Markdown
Member

The gap: a dependency from git: or path: had to be a Cabal package. A miso project with a library: section failed with "has no .cabal file", so a library made with miso could only be used inside its own project.

What this adds:

  • miso cabal (new command) prints the .cabal file for the library in the current folder's miso.yml:
    • its name, version, synopsis and author;
    • its modules (exposed-modules, or every module under source-dirs);
    • its dependencies by name;
    • its mhs-options, C and JavaScript files, include dirs and headers, cpp/cc/ld options and extra-libraries. MicroCabal builds and installs a library from these fields.
  • Dependencies that are miso projects: a dependency with a miso.yml and no .cabal file is copied to $MISO_HOME/src/cabalized/NAME-KEY, without .git/, .miso/, dist/, public/ or vendor/. The .cabal file goes next to the copy, and the copy is what's read and built.
    • The checkout itself is never changed.
    • The copy is made fresh each time, so a change to a path: dependency is picked up.
  • Clear errors for a project with no library:, a dependency whose name: differs from its project's, and a library that itself needs a git: or path: dependency (not supported yet: list it in the project that uses it).

Checked:

  • miso cabal on a library with two modules, cbits/, include/, cpp-options and extra-libraries; MicroCabal parses the result. Both error cases say why.
  • A test program confirmed:
    • the copy has the library's files and the .cabal file, but not .git/ or dist/;
    • the original folder is unchanged;
    • a name mismatch is an error;
    • a Cabal package is used as it is;
    • a source change appears in the next copy.
  • New smoke test case: a project depends by path: on a miso library that itself needs split, and runs. Then the library is changed and the change is picked up, and no .cabal file is written into the library's folder. This runs on every platform in CI.

Note: this and #31 (extra-libraries) both add a case at the end of scripts/smoke-test.sh. Whichever merges second will need a one-line conflict resolved.


Generated by Claude Code

A dependency from git: or a path: had to be a Cabal package: one with a
miso.yml and a library: section failed with "has no .cabal file".  So a
library made with miso could be used only in its own project.

miso cabal now prints the .cabal file of the library of the miso.yml
here: name, version, synopsis, author; the exposed modules (or every
module under source-dirs), its dependencies by name (the top-level list
and the library's), mhs-options, and the C and JavaScript files, include
dirs and headers, cpp/cc/ld options and extra-libraries.  MicroCabal
builds and installs a library from those fields.

A dependency with a miso.yml and no .cabal file is copied to
$MISO_HOME/src/cabalized/NAME-KEY (without .git/, .miso/, dist/, public/,
vendor/), with that .cabal file next to it, and the copy is what is read
for its dependencies and built; the checkout itself is not changed.  The
copy is made again each time, so a change to a path: dependency is built
(its key in the store still comes from its own files).  The dependency's
name in miso.yml has to be the project's.  Its own git: or path:
dependencies are an error that says to list them in the project that uses
it.

Checked:
- miso cabal on a library with two modules, cbits/, include/, cpp-options
  and extra-libraries; MicroCabal parses the result; a project with no
  library: section, and one whose library needs a git dependency, give
  errors that say why
- with a test program: the copy has the library's files and the .cabal
  file, not .git/ or dist/, and the original folder is unchanged; a
  dependency named otherwise than its project is an error; a Cabal package
  is used as it is; a change to the source is in the next copy
- the smoke test now builds and runs a project that depends on a miso
  library (which needs split) by path:, then changes the library and checks
  the change is picked up, and that no .cabal file was written into the
  library's folder
@dmjio
dmjio merged commit 2193d6a into main Oct 23, 2026
8 checks passed
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.

1 participant