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

depend on cmi of singleton module #42

Open
mobileink opened this issue Nov 21, 2021 · 1 comment
Open

depend on cmi of singleton module #42

mobileink opened this issue Nov 21, 2021 · 1 comment

Comments

@mobileink
Copy link
Collaborator

mobileink commented Nov 21, 2021

Use case: target depends on a cmi only (Tezos does this). If we have the mli file then we just use ocaml_signature. If we have a singleton (only the ml file), then we have two options:

a. compile the ml file and depend on the resulting cmi
b. extract the mli from the ml and compile it.

Does it ever make sense to do b and not a? If so, we need to either enhance ocaml_signature to support this use case, or use a genrule to run ocamlc -i, or create a new rule. For now, assume option a will suffice.

@mobileink mobileink reopened this Jul 1, 2022
@mobileink mobileink changed the title extract cmi from ml file? depend on cmi of singleton module Jul 1, 2022
@mobileink
Copy link
Collaborator Author

Either way, we need a way to express this dependency in the language. We can express a dependency on a module, but the ocaml_module rule always delivers both a cmi file and a .cmo (or .cmx, .o)

Scenario: some kind of processing tool takes .cmi files as input. To use it with a module dependency, we would need an intermediate step to extract the .cmi from the module output.

The brute force way would be to write a genrule and then use $(locations) to get the module output and write some shell code to find the cmi. Or something like that.

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

1 participant