[[Property:modification_date|Tue, 11 Mar 2025 10:53:22 GMT]]
[[Property:publication_date|Mon, 24 Dec 2018 08:45:22 GMT]]
[[Property:title|EiffelStudio: Using command line options]]
[[Property:link_title|Using command line options]]
[[Property:weight|1]]
[[Property:uuid|a6b6a676-8660-ce2d-6f37-03de7f23a78e]]
==Compiling and viewing==

The Eiffel Compiler line mode command '''ec''' has many options, as you can see from the tables below. It may be helpful to think of any one '''ec''' command as either a command to compile or a command to view software text. 


==Getting help==

You can get details of the usage and options of the '''ec''' command by executing the command with the '''-help''' option.

<code lang="text">
    ec -help
</code>

The usage and options display gives you information about which options are valid in a particular command context. Use this display along with the table below to choose the options that meet your needs.

Usage and options of the command line compiler vary from version to version in order to accommodate new and changed features. Here is an example of the command line help from the latest version of EiffelStudio:

<code lang="none">
ISE EiffelStudio version 25.02.9.8732 - win64

Usage:
  ec
  -help | -version | -appinfo name |
  -full |       -batch | -clean | -verbose | -use_settings |
  -freeze | -finalize [-keep] | -precompile [-finalize [-keep]] | -c_compile |
  -loop | -debug | -quick_melt | -melt |
  (-clients | -suppliers | -ancestors | -descendants) [-filter filtername] class |
  (-flatshort | -flat | -short) [-filter filtername] [-all | -all_and_parents | class] |
  (-aversions | -dversions | -implementers) [-filter filtername] class feature |
  -callers [-filter filtername] [-show_all] [-assigners | -creators] class feature |
  -callees [-filter filtername] [-show_all] [-assignees | -creators] class feature |
  -filter filtername [-all | class] |
  -pretty input_filename [output_filename] |
  -reset_ide_layout |
  [[-config config.ecf] [-target target] [-config_option option] |
  [class_file.e [-library library_name]] |
  -stop | -no_library |
  -project_path project_directory | -file file |
  -preference preference_name preference_value |
  -ca_class (-all | class) | -ca_default | -ca_rule rule | -ca_setting file |
  -gc_stats]

Options:
  default (no option): quick melt the system.

  -ancestors: show the ancestors of a class.
  -appinfo: Output various application information (-appinfo ? to list available informations).
  -aversions: show the ancestor versions of a feature.
  -batch: launch the compilation without user request.
  -c_compile: launch C compilation if needed.
  -ca_class: analyze code of a class or of all non-library classes (-all).
  -ca_default: restore default code analyzer preferences.
  -ca_rule: activate code analyzer rule(s) (with settings).
  -ca_setting: load code analyzer preferences from a file.
  -callees: show the callees of a feature.
  -callers: show the callers of a feature.
  -class_file.e: specify a class file for single file compilation.
  -clean: delete existing project if any and perform a fresh compilation.
  -clients: show the clients of a class.
  -config: specify the configuration (ECF) file.
  -config_option: override configuration options of a target.
  -debug: debug the system as a command loop.
  -descendants: show the descendants of a class.
  -dversions: show the descendant versions of a feature.
  -file: save the output to a file.
  -filter: show a filtered form (troff, ...) of the class text.
  -finalize: finalize the system (discard assertions by default).
  -flat: show the flat form of a class.
  -flatshort: show the flat-short form of a class.
  -freeze: freeze the system.
  -full: with full class checking regardless of ECF settings.
  -gc_stats: Show GC statistics.
  -gui: start the graphical environment.
  -help: show this help message.
  -implementers: show the classes implementing a feature.
  -library: specify a library for single file compilation.
  -loop: run ec as a command loop.
  -melt: melt the system.
  -metadata_cache_path: Location of .NET MetadData consumer cache.
  -no_library: do not convert clusters into libraries.
  -precompile: precompile the system.
  -preference: override default or stored preference value.
  -pretty: show the pretty form of a class.
  -project: specify the project file to load (obsolete).
  -project_path: specify the compilation directory.
  -quick_melt: quick melt the system.
  -reset_ide_layout: reset the IDE layout.
  -short: show the short form of a class.
  -stop: stop on error.
  -suppliers: show the suppliers of a class.
  -target: specify the target.
  -use_settings: use settings for project location.
  -version: show compiler version number.
</code>


==Commands for compiling==

The simplest compiling command you can enter is:

<code lang="text">
    ec
</code>

The command does not include any of the ''Compiling options'' shown below, so the default option "-melt" is used. The "-config" is omitted, so '''ec''' will try to find a configuration file named <code lang="text">Ace.ecf</code> in the current directory. 

The command:

<code lang="text">
    ec -config my_config_file.ecf
</code>

melts the system having the configuration file in the current directory <code lang="text">my_config_file.ecf</code> .

To freeze or finalize that system, you would just include the appropriate ''Compiling option'':

<code lang="text">
    ec -freeze -config my_config_file.ecf
</code>

You can specify the name of a file which contains the root class of a system in the current directory:

<code lang="text">
    ec application.e
</code>

This command will compile a system with the class in <code>application.e</code> as its root. If there is no configuration file named <code>application.ecf</code> in the current directory, then '''ec''' will create one. It will also use any classes in the current working directory and by default the library EiffelBase. 


{{tip|This "configuration-less" form of compilation is convenient to use for a quick compile. But you should understand that because it does create a configuration file with default names for the configuration file itself, the project, and the root cluster, using it against a root class file in a folder in which a configuration file with another name already exists could lead to confusion. }}


You can add additional libraries to the configuration by using the "-library" option and specifying either the short name of one of the EiffelStudio libraries or a path to a library configuration file. To include EiffelTime in the compilation of <code>application.e</code>, you could use this command:

<code lang="text">
    ec application.e -library time
</code>

This immediately adds the EiffelTime library to the configuration file <code>application.ecf</code>, so if you compile again, it is not necessary to respecify the library. 


==Commands for viewing==

By selecting certain options on the '''ec''' command, you can generate advanced views of your software much like those provided by EiffelStudio. In the table below you will see the set of ''Viewing options''. These options take arguments that are either a class name or a class name and feature name. The following examples will give you an idea of how to use the ''Viewing options''.

To see the "flat" form of class <code>APPLICATION</code> in the example used above:

<code lang="text">
    ec -flat application -config application.ecf
</code>

To save the output, add the "-file" option with a file name:

<code lang="text">
    ec -flat application -config application.ecf -file application_flat_form.txt
</code>

Feature-oriented options, like "-implementers", take a class name and feature name:

<code lang="text">
    ec -implementers application some_feature -config application.ecf
</code>


===Commands for generating documentation===

You can use variations of the viewing commands to generate documentation for your Eiffel system much like [[Producing and Exporting Documentation|you can from EiffelStudio]].

The following command will produce the ''Chart'', ''Relations'', and ''Text'' documentation for the "application" system in html-stylesheet format in the "Documentation" subfolder of the project folder.

<code lang="text">
    ec -filter html-stylesheet -all -config application.ecf
</code>

To produce documentation for a view other than ''Text'', use its option in the command. The following generates ''Chart'', ''Relations'', and ''Flat Short'' documentation:

<code lang="text">
    ec -flatshort -filter html-stylesheet -all -config application.ecf
</code>

==Commands for the Code Analyzer==
The Code Analyzer is invoked when an option to analyze the whole system or a particular class is specified in the command line. Additional command-line options are used to specify some preferences and to enable specific rules:

<code lang="shell">
    ec -config project.ecf [-ca_class (-all | <CLASS_NAME(S)>) | -ca_default | -ca_rule <RULE_SPEC(S)> | -ca_setting <FILE_NAME>]
</code>

;<code lang="shell">-ca_default</code>: Requests to reset all Code Analyzer preferences to their default values before the analysis is run. For example, this enables all rules that are enabled by default, no matter whether they have been disabled before.

;<code lang="shell">-ca_setting</code>: Requests to use preferences from the specified file. The file is generated by exporting the current preferences from the GUI.

;<code lang="shell">-ca_class</code>: Asks to analyze a given class or a set of classes. Several class names can be specified, separated either by spaces or semicolons. In that case, the argument may need to be enclosed in double quotes (e.g., `"CLASS1; CLASS2"`). A special value `-all` triggers analysis of the whole system.

;<code lang="shell">-ca_rule</code>: Followed by a list of rules, enables those rules for the analysis and disables all the others, overriding the current preferences. Specific rule preferences can also be provided in parentheses. Preferences are separated by commas. The rule names can optionally be separated by semicolons. Example:

<code lang="shell">
-ca_rule "CA001; CA033 (maximum_feature_count=10; maximum_instruction_count=100); CA066 (enforce_prefix=False)"
</code>

==Command options==

The table below lists the available ''options'', the arguments they require, and their effect: 

{| border="1"
|- 
| width="175pt" | '''OPTION'''
| '''ARGUMENTS'''
| '''EFFECT'''
|- 
| ''Compiling options''
|- 
| -melt
| 
| [[Melting Ice Technology#Melting|Melt]] compilation. This is the default option, if no other compiling or viewing option is specified. 
|- 
| -freeze
| 
| [[Melting Ice Technology#Freezing|Freeze]] system.
|- 
| -finalize
| 
| [[Melting Ice Technology#Finalizing|Finalize]] system. See note below.
|- 
| -precompile
| 
| [[Melting Ice Technology#Precompiling|Precompile]] system, treating it as a library.
|- 
| -full
| 
| Full class checking. Rechecks features of the parent classes for validity in heirs. See example in [[Converting existing software to void-safety#Enable full class checking|Converting existing software to void-safety]]. NOTE: Full class checking increases compile times, which may be noticeable in large systems.
|- 
| -compat
| 
| Compile using facilities that are [[Eiffel compatibility options#EiffelStudio and Eiffel compiler options|compatible with older versions]] of Eiffel.
|- 
| -experiment
| 
| Compile using facilities that are [[Eiffel compatibility options#EiffelStudio and Eiffel compiler options|compatible with an upcoming version]] of Eiffel.
|- 
| ''Viewing options''
|- 
| -ancestors
| class_name
| Print the ancestors of the class.
|- 
| -aversions
| class_name, feature_name
| Print the ancestor versions of the feature.
|- 
| -callers
| class_name, feature_name
| Print all the routines that call the feature.
|- 
| -clients
| class_name
| Print the clients of the class
|- 
| -descendants
| class_name
| Print the descendants of the class.
|- 
| -dversions
| class_name, feature_name
| Print all the versions of the feature in the descendant versions of the class.
|- 
| -flat
|  class_name
| Print the flat view of the class.
|- 
| -flatshort
| class_name
| Print the Flat Contract view (previously called flat-short form) of the class.
|- 
| -implementers
| class_name, feature_name
| Print all the classes that declare or redeclare the feature.
|- 
| -short
| class_name
| Print the Contract view (previously called short form) of the class.
|- 
| -suppliers
| class_name
| Print all the suppliers of the class.
|- 
| ''Other options''
|- 
| -batch
| 
| Launch the compilation without user request.
|- 
| -clean
| 
| Delete project if already compiled and compile project as if it was the first time.
|- 
| -config
| file_name
| Use the file as configuration.
|- 
| -c_compile
| 
| Launch C compilation, if needed, after Eiffel compilation.
|- 
| -file
| file_name
| Save the output to the file.
|- 
| -filter
| filter_file_name
| Print text as processed by the [[Appendix: Writing Documentation Filters with EFF, the Eiffel Filter Format|filter]] defined in the file named "''filter_file_name''.fil"  
|- 
| -help
| 
| Print the help.
|- 
| -keep
| 
| Keep assertions in final mode. Useful with -finalize only.
|-
| -library
| library_name
| Library is included in the configuration when a file name for the root class is given. 
|-
| -loop
|  
| Enter interactive mode. See: [[Command line interactive mode]].
|- 
| -metadata_cache_path
| directory_name
| Specify location of Metadata Cache used for .NET compilation. This overrides any settings from your configuration file.
|- 
| -no_library
|  
| When converting an old configuration file format, do not convert clusters into libraries.
|- 
| -project_path
| directory_name
| Use this directory as compilation directory. (Default: current directory.)
|- 
| -stop
| 
| Stop on errors. (Default: no.)
|- 
| -target
| target_name
| Act on the system target named ''target_name''.
|- 
| -use_settings
| 
| Use the project global settings to retrieve the project location for the last compilation of this project.
|- 
| -verbose
| 
| Display detail progress report during compile.
|- 
| -version
| 
| Print compiler version number.
|}


{{note|In the third column, to '''print''' means to produce the requested information on the default output of the '''ec''' command.}}


{{note|When using '''-finalize''', assertions will be discarded (unlike in EiffelStudio which asks first). The assertion disposition specified in the project configuration file can be retained in finalization by combining the '''-keep''' option with '''-finalize'''.}}


Some options can have modifiers that can affect their results. The modifiers are listed in the table below:
{| border="1"
|- 
| <center>'''Option'''</center>
| <center>'''Modifier'''</center>
| <center>'''Effect'''</center>
|- 
| -callers
! colspan="2" | 
|- 
| 
| -show_all
| Include all callers rather than only those in the specified class.
|- 
| 
| -assigners
| Restrict callers to those that use given feature only as a target of an assignment instruction.
|- 
| 
| -creators
| Restrict callers to those that use given feature only as a target of a creation instruction.
|}


{{seealso|<br/>
[[Batch compilation|Batch compilation]]  }}




