-
Notifications
You must be signed in to change notification settings - Fork 261
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
dafny build
with extern
declarations
#3611
Comments
An additional note:
If this approach was permitted, then it would offer me a solution. I could copy the native Java code into position beforehand. |
I think you have to pass the
That's indeed a bug. It should generate it when |
David - you should be able to just have the .java file on the command-line. A.java: public class A { test.dfy: method {:extern "p.A","mjava"} mm() And then, with those two files in your current directory: The test.jar that is created (by build) is an executable jar. It includes compiled .class files for any .java files that are on the commandline. |
Hey David & Remy, Great --- thanks, I will try that out. It wasn't obvious to me that was how you're supposed to do it. |
One issue I have encountered straightaway:
The problem we have here is that Dafny is trying to replace the build system, but not providing all the functionality of a build system. Anyways, there is one possible solution here:
Personally, I think a better approach would be to allow all commands which generate code to have an option like |
aside from not providing the DafnyRuntime.jar, does |
Hey David, Yes, I think so. I just suggested |
I think there is another option for me actually. That is to avoid |
The |
That works for sure :-) I think externs are only needed when there is functionality that you want to be available statically, without requiring closures or traits to be passed around. |
### Changes - Remove unused references to RuntimeLib - Rename RuntimeLib to IncludeRuntimeSources - Let Java properly include runtime sources ### Testing - Update the test ManualCompile.dfy so that it no longer uses `DafnyRuntime.jar` from the binary directory, but instead only relies on source files generated by the Dafny binary. Fixes #3611 <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>
Dafny version
3.12.0
Code to produce this issue
Command to run and resulting output
This resulted in the following:
What happened?
I don't necessarily believe the above was unexpected --- but I am stuck. The question is: how do I compile Dafny containing
{:extern}
functions to Java?Instead of using
dafny build
I logically trieddafny translate
next. Unfortunately, this does not generate theDafnyRuntime.jar
even with--include-runtime
provided (perhaps that is the real bug here). This means I cannot build just from the Dafny source, but would have to check the runtime jar into my repository.My requirements for building the project are:
src/dafny
)src/java
) which provides implementation for{:extern}
functions.bin/java
).src/java
andbin/java
together.I should also note that
dafny test
has similar problems todafny build
. However, I cannot control howdafny test
is trying to build my project. It does not even support the--output
option fromdafny build
.Anyway, any thoughts on this would be appreciated.
What type of operating system are you experiencing the problem on?
Linux
The text was updated successfully, but these errors were encountered: