Question

Following the answeres to how to use multiple inline assertions in Frege I learned how to compile two Frege modules A and B where B depends on A: you have to compile B. If given the -make option, the compiler will figure out that B depends on A, will find A on the sourcepath (-sp flag), and will compile A first and then B.

However, I cannot just give all files I care about to the compiler. Giving both A and B to the compiler failed with a "cyclic dependency" error for me. And I also found no way to give a directory to the compiler (it just did nothing).

This looks like I had to know the root of the dependency graph to do a proper compilation of all need-to-be-compiled files. But

  • I may not know the root.
  • There may be many of them.
  • It's very difficult to do a proper build automation that way.

Is there a combination of compiler options where I can just let the compiler compile all files in a source tree?

Était-ce utile?

La solution

This issue has now been addressed by the frege-maven-plugin:

https://github.com/Frege/frege-maven-plugin

which is available in maven central.

Autres conseils

EDIT: With more recent compiler releases, you can indeed compile whole trees:

java -jar fregec.jar -d classes/ -make directory1/ directory2/

Insofar, the answer below is obsolete.


The short answer is "no".

The long answer:

  1. If you have an application, you should know the roots, it's the modules that contain main functions. One can compile all of them at once with the -make option, as long as they do not depend on each other.
  2. In case of libraries, you could create a pseudo module that just imports all modules that belong to the library and compile that one.
  3. If none of the above helps, and you simply need to compile "all that is there", you can do so by just passing all file names with the -make option (see below). The downside is that some files may get compiled twice.
  4. The Frege builder of the eclipse plugin does compile all files in the correct order on a full build.

It would seem that such functionality is needed also for the command line compiler.

By the way, I couldn't retrace your "cyclic dependency" error. I used the following command:

java -jar ~/frege/fregec.jar  -d bin -make -sp Real_World_Frege-master/ $(find . -type f -name '*.fr' -print)

In fact, this error should only be flagged in the case that A imports B while B (or something that B imports) imports A.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top