This probably doesn't fully answer your question, but here is my experience regarding the build environment:
I really appreciate OASIS . It has a good set of functions that helps not only create a project, but also write documentation and support a test environment.
Build system
- OASIS creates the
setup.ml file from the specification ( _oasis file), which works mainly as a building script. It accepts the flags -configure , -build , -test , -distclean . I’m pretty used to them when working with different GNU and other projects that usually use Makefiles, and I find it convenient that you can use all of them automatically here. - Makefiles. Instead of generating
setup.ml you can also create a Makefile with all the options described above.
Structure
Usually my OASIS project has at least three directories: src , _build , scripts and tests .
- In the previous directory, all source files are stored in one directory: source (.ml) and interface (.mli) files are stored together. Maybe if the project is too large, it is worth adding additional subdirectories.
- The
_build directory is managed by the OASIS build system. Both source and object files are stored here, and I like that the build files do not interfere with the source files, so I can easily delete them if something goes wrong. - I store several shell scripts in the
scripts directory. Some of them are designed to run tests and create interface files. - All input and output files for tests that I store in a separate directory.
Interfaces / Documentation
Using interface files (.mli) has both advantages and disadvantages for me. It really helps to find errors of the type, but if you have them, you should edit them when making changes or improvements to your code. Sometimes forgetting about it causes unpleasant errors.
But the main reason I like interface files is the documentation. I use ocamldoc to create (OASIS supports this function with the -doc flag) html documentation pages automatically. In my opinion, it’s enough to write comments describing each function in the interface, and not insert comments in the middle of the code. In OCaml, functions are usually short and concise, and if you need to insert additional comments there, it might be better to separate the function.
Also note the -i flag for ocamlc . The compiler can automatically generate an interface file for the module.
Test
I did not find a reasonable solution to support the tests (I would like to have some ocamltest application), so I use my own scripts to execute and test use ocamltest . Fortunately, OASIS supports the execution of custom commands when setup.ml is executed with the -test flag.
I have not used OASIS for a long time, and if anyone knows any other interesting features, I would also like to know about them.
Also, you do not know OPAM , it is definitely worth a look. Without it, installing and managing new packages is a nightmare.
Pavel Zaichenkov Oct 14 '13 at 0:45 2013-10-14 00:45
source share