-
Notifications
You must be signed in to change notification settings - Fork 262
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
Enable configuring Dafny options through a project file #2907
Comments
Why is #2906 a prerequisite? I would think if anything it would be in the other direction, and even then that the first version of |
Some notes on requirements and scoping down the initial version of this:
Additional features that will be nice to add AFTER the first version:
|
If we went along the route of defining a build file in Dafny, it could be great to get inspired by Mill if we went the route of having the project file defined in Dafny - which I think is an excellent idea. But Dafny lacks reflection that would be useful for a build tool. However, as @robin-aws , I think it would be good to reduce the scope of the project to something manageable for now. |
There's three pieces of work:
(3) depends on (1) and (2), and I scoped this issue to be (2) and (3), so it depends on (1). However, feel free to scope (3) into a separate issue and to consider this issue being just (2). |
Adding list of Dafny command and arguments which I think are relevant for project file :
|
Again I would argue that we should not check options both in parsing a project file and in using it in the CLI. Keep it simple. Keep it user-editable. To me a flat file with options and values would be just fine. |
List looks alright. I don't think it needs to be perfect in one go. You might even allow everything at first and see how that goes. I think you're general strategy might be:
|
Remember that a primary reason for the project file is to list the dependent files, more than the options per se. SO the UX for that use case has to be great. |
A flat file would provide some benefit, but a project file is much more useful with some awareness of what options apply to which commands. If you want to This is perhaps the difference between a project file and a file with a convenient batch of options to make CLI commands shorter. Personally when I feel the need for the latter, I make a shell script wrapper that prepends/appends common arguments instead, so I don't consider that a hard requirement. If the project file has a I do share the concern over the maintenance burden though. It would be technically possible to allow any options in a project file and just drop any that aren't supported by the current command, but then you're at risk of silently dropping a critical option. I can at least imagine an implementation strategy where we have project file sections that line up one-to-one with command and common property bags to make it easier. |
Absolutely, but we should be able to provide some incremental benefit by leaning on using |
Fixes #2907 #### From the updated docs: Commands on the Dafny CLI that can be passed a Dafny file, can also be passed a Dafny project file. Such a project file may define which Dafny files the project contains, and which Dafny options it uses. The project file must be a [TOML](https://toml.io/en/) file named `dafny.toml`. Here's an example of a Dafny project file: ```toml includes = ["src/**/*.dfy"] excludes = ["**/ignore.dfy"] [options] enforce-determinism = true warn-shadowing = true ``` Options are applied to a command if they can be. Invalid options are ignored. When using a Dafny IDE based on the `dafny server` command, the IDE will search for project files by traversing up the file tree, and options from the first found project file will override options passed to `dafny server`. ### Caveats - The IDE will only use the saved-on-disk versions of project files, so unsaved changes are ignored. ### Testing - Add CLI (through Lit) and `dafny server` tests (through XUnit) <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
Problems
Make
or a Bash script to enable easily invoking the Dafny CLI.Prerequisites
dafny server
command #2906Out of scope
Solution
Enable specifying options to the Dafny CLI in a Dafny project file, which can be passed as an argument when calling the Dafny CLI, also when using the
dafny server
command.The text was updated successfully, but these errors were encountered: