Skip to content

Allow multiple library paths #2436

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Allow multiple library paths #2436

wants to merge 2 commits into from

Conversation

bcarlet
Copy link
Contributor

@bcarlet bcarlet commented Mar 27, 2025

This makes it possible to specify multiple library paths, which is useful for frontends that wish to provide their own primitive libraries in addition to Calyx's standard library.

)]
pub lib_path: PathBuf,
#[argh(option, short = 'l')]
pub lib_path: Vec<PathBuf>,
Copy link
Contributor

Choose a reason for hiding this comment

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

this will break existing "cargo install calyx" users. Please add back the default repo.

src/main.rs Outdated
@@ -55,6 +55,9 @@ fn main() -> PassResult<()> {
}
}

opts.lib_path
.push(option_env!("CALYX_PRIMITIVES_DIR").unwrap_or(".").into());
Copy link
Contributor

Choose a reason for hiding this comment

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

This will always add the primitives dir to the lib path which is not the behavior of the existing set up.

Copy link
Contributor

@rachitnigam rachitnigam left a comment

Choose a reason for hiding this comment

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

Seems reasonable!

There is one breaking default in this PR that should be fixed.

Also: what happens when the same file name exists across many paths? I think we should generate an error instead of silently overriding an existing path file.

@bcarlet
Copy link
Contributor Author

bcarlet commented Mar 28, 2025

I've changed it so that it emits an error if it finds an import in multiple library paths.

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.

2 participants