How can I compile a complete Frege source tree

Following the answers to how to use several built-in statements in Frege , I learned how to compile two Frege modules A and B, where B depends on A: you must compile B. If the -make option is given, the compiler will find out that B depends on A, it will find A is on the source path (-sp flag) and compiles A first and then B.

However, I cannot just provide all the files that I like the compiler. Providing A and B to the compiler with a "circular dependency" error for me. And I also did not find a way to provide the directory to the compiler (it just didn't do anything).

It seems like I should have known the root of the dependency graph in order to make the right compilation of all the files needed for compilation. But

  • Perhaps I do not know the root.
  • There may be many.
  • It is very difficult to make appropriate assembly automation this way.

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

+4
source share
2 answers

This problem is now resolved by the frege-maven module:

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

which is available in the central maven center.

+2
source

EDIT: with later compiler releases, you can compile whole trees:

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

If the answer below is out of date.


The short answer is no.

Long answer:

  • If you have an application, you need to know the roots, these are modules containing the main functions. They can be compiled immediately with the -make option if they are independent of each other.
  • In the case of libraries, you can create a pseudo-module that simply imports all the modules belonging to the library and compiles them.
  • If none of the above steps help, and you just need to compile "all that is," you can do this by simply passing all the file names using the -make option (see below). The disadvantage is that some files may be compiled twice.
  • The Frege constructor of the eclipse plugin compiles all the files in the correct order in the full version.

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

By the way, I could not recover your error of "cyclic dependence". 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 noted if A imports B, and B (or something that imports B) imports A.

+2
source

Source: https://habr.com/ru/post/1502261/


All Articles