This is an old revision of the document!
It is possible using the duplicate-module target of the Ant's build.xml file to duplicate an existing module located in the capsis4/src directory by giving it a new package name, a new module name and a new prefix. The user chooses the new package name and the new prefix, and the new module name is created automatically from the new package name.
Note: the new prefix can be the same as the one of the initial module.
In order to duplicate a module, you have to type the following command from the capsis4 directory:
sh ant duplicate-module -Dpackage.name=packagename -Dnew.package.name=newpackagename -Dnew.prefix=Newprefix
ant duplicate-module -Dpackage.name=packagename -Dnew.package.name=newpackagename -Dnew.prefix=Newprefix
- package.name is the package name of the initial module (module to duplicate stored in capsis4/src directory);
- new.package.name and new.prefix are respectively the package name and the prefix of the new module (module to create in capsis4/src directory).
For example, the following command (on Linux/MacOS):
sh ant duplicate-module -Dpackage.name=training -Dnew.package.name=training2 -Dnew.prefix=Tra2
will create from the training package (that is Training module) a new module having the following characteristics:
- package name: training2;
- module name: Training2 (default value generated from package name);
- prefix: Tra2.
Technical note: in addition to the renamed files (.java source files and .properties translation files mainly) and classes contained in source files, local variables whose name begins with the prefix (with a lowercase first letter) are also renamed. Therefore, with the previous example, if the TraModel.java class contains the following instruction stored in the TraModel class\\:
TraScene traScene = (TraScene) step.getScene().getEvolutionBase();
then the Tra2Model class (Tra2Model.java file) will contain the following instruction:
Tra2Scene tra2Scene = (Tra2Scene) step.getScene().getEvolutionBase();