New "eiffel" tool with EiffelStudio 18.01

by Jocelyn-Fiat (modified: 2020 Sep 18)

Do you know that EiffelStudio 18.01 comes with a new tool eiffel?

Use it to execute an Eiffel project by providing its ECF file. As simply as eiffel path-to-project.ecf arg1 arg2 ....

You can find the eiffel tool within EiffelStudio installation, at $ISE_EIFFEL/tools/spec/$ISE_PLATFORM/bin/eiffel .

It is a simple replacement for: > ec -config path-to-project.ecf -finalize -c_compile -project_path path-to-compilation-dir > cp path-to-compilation-dir/EIFGENs/target_name/F_code/executable_name path-to-binary-folder/executable_name > rmdir path-to-compilation-dir/EIFGENs/target_name > path-to-binary-folder/executable_name arg1 arg2.

(note: with eiffel, the user does not need to know the target name, and the expected output execution name)

But eiffel is a bit more than a set of instructions, as it supports cache and recompilation behavior:

  • the first time, the project is compiled, and on successful compilation the executable is kept somewhere, and launched with the given arguments.
  • the next time(s), eiffel reuses the executable previously compiled for the execution.

A (re)compilation is triggered when:

  • the ECF file changed,
  • any of the classes included in the project's clusters changed,
  • any of the ECF for the included libraries changed,
  • it is required by the eiffelcommand using specific options -bor --build.

Note: to execute a specific target from the given ECF file, use the --target target_name option, such as :eiffel --target hello_world path-to-hello-project.ecf

Also a build tool

In addition, this eiffel tool can also be used as a simple build tool to compile an Eiffel project and get the executable. For instance:eiffel build --target hello_world path-to-hello-project.ecf my_hello_world

It is convenient to build an Eiffel project, without knowing the expected executable name.

Suggestions, comments, ...

If you have any suggestion for future evolution of this tool, please tell the EiffelStudio team (via the support site, comment on this post, or use the Eiffel groups).

Thanks.

For more information, check the usage (eiffel --help):

USAGE: eiffel (-v|--verbose) (-h|--help) (-b|--build) (--check class,project) (--target ecf_target_name) <project.ecf> ... eiffel build (-v|--verbose) (--target ecf_target_name) <project.ecf> <output_executable_path> ... COMMANDS: <project.ecf> ... : build once and launch <project.ecf> execution. build : build project and save executable as <output_executable_path>. OPTIONS: --target <ecf-target-name> : optional target name. --check <level> : check level for recompilation, either class (default), or project. : class = check timestamp of system class files, : and ecf files for included libraries : (ignoring classes from libraries). : project = only check the timestamp of main project ecf file. -b --build : force a fresh system build. -o --executable-output <path> : build and save executable as <path>. : without any execution.! -v --verbose : verbose output. -h --help : display this help. ... : arguments for the <project.ecf> execution. Note: you can overwrite default value, using EIFFEL_SCRIPT_DIR : root directory for eiffel script app (default under Eiffel user files/.apps) EIFFEL_SCRIPT_CACHE_DIR : directory caching the compiled executables ($EIFFEL_SCRIPT_DIR/cache) EIFFEL_SCRIPT_COMP_DIR : directory caching the EIFGENs compilation ($EIFFEL_SCRIPT_DIR/comp)

(See https://www.eiffel.org/resources/tools/eiffel-script .)