TransSECS tool files (.tsx and .xpj) are ASCII text XML file. These can be stored in a source control system such as GIT, Source Safe or similar for tracking and change management.

The TransSECS “headless” build allows the complete project to be built from the command line without the application opening and without user intervention. This command line can be used in a script to automatically build the deployment.

The headless build behaves exactly as if the application had been opened and the “build” button pressed. You must have a complete, licensed, TransSECS installation and a valid project folder in order to run the headless build. The project folder must contain the .tsx file and the .xpj. If other files have been added to the project, to support special functions such as Web Services the may also need to be in folder, but in general, just the .tsx and .xpj are required.

If you are running TransSECS from the executable, either the Windows TransSECS.exe (TransSECSDevices.exe for the Devices version) or on Linux from the Linux executable, you can edit the TransSECS.conf (or TransSECSDevices.conf) file to enable the headless build.

First, close all TransSECS applications.

Copy the TransSECS.exe to TransSECSHeadless.exe and TransSECS.conf to TransSECSHeadless.exe (for Devices, copy the TransSECSDevices.exe and TransSECSDevices.conf - whichever file you have been using to start TransSECS)

In TransSECSHeadless.conf, look for a line similar to this:

wrapper.java.additional.7=-Dtranssecs.headless=false

and change to:

wrapper.java.additional.7=-Dtranssecs.headless=true

When you double-click the executable, the application will start, compile the last project you had open, and then exit. You can test this by deleting the deployment folder in the project (everything except the .tsx and .xpj) and use the headless feature to rebuild it. You should see all the same files, including deployment, documentation, etc. as you would if you had build from within the TransSECS editor.

If you are running TransSECS from a script or a batch file, you will need to add the system property “-Dtranssecs.headless=true” to the start of the java command line:

java -Dtranssecs.headless=true ....

The property name “transsecs.headless” is case sensitive, it must be all lower case.

Choosing which Project to build

When running TransSECS normally, the project loaded is described in the “application.properties” file in the TransSECS Builder folder. This may look something like this:

#Default TransSECS Application Properties 2007-09-14 10:05:27.593
#Fri Sep 14 10:05:27 MDT 2007
lastBrowsedDirectory=C:\\Users\\Public\\ErgoTech\\TransSECSDevicesTrial\\Projects
project.dir=C:\\Users\\Public\\ErgoTech\\TransSECSDevicesTrial\\Projects\\GEMTool
way_criteria=1
sort_criteria=3

The same file applies when running a headless TransSECS build, the project listed in the “project.dir” line will be the project built.

When running TransSECS, the configuration property file to read is provided as an argument to the application. You will see this in the .conf file as the line “wrapper.app.parameter.2=application.properties”

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=com.ergotech.transsecs.secs.TransSecs
wrapper.app.parameter.2=application.properties

For this argument, you can provide a path (either relative to the TransSECS Builder directory or an absolute path) to the customized application.properties file. TransSECS will read that file at startup and compile the project described in the file. For example, if you create a subdirectory “buildprops” under the TransSECS Builder directory and place a “headlessbuild.propertie”s file in this subdirectory with this content:

#Default TransSECS Application Properties 2007-09-14 10:05:27.593
#Fri Sep 14 10:05:27 MDT 2007
lastBrowsedDirectory=C:\\Users\\Public\\ErgoTech\\TransSECSDevicesTrial\\Projects
project.dir=C:\\Users\\MyProjects\\GEMTool
way_criteria=1
sort_criteria=3

and you change the appropriate line in the.conf file to read:

wrapper.app.parameter.2=buildprops\\headlessbuild.properties

or as a full path for the headlessbuild.properties:

wrapper.app.parameter.2=C:\\Users\\Public\\ErgoTech\\TransSECSDevicesTrial\\buildprops\\headlessbuild.properties

When you start the headless build, the project in C:\\Users\\MyProjects\\GEMTool will be built.

This property can, again, be added as an argument in a script or batch file at the end of the command line:

java -Dtranssecs.headless=true [... the rest of the command line ...] buildprops/headlessbuild.properties

or, with a full path to the headlessbuild.properties

java -Dtranssecs.headless=true [... the rest of the command line ...] /home/username/TransSECSPlusReporting/MIStudioSuite/TransSECS/Builder/buildprops/headlessbuild.properties

where “the rest of the command line” contains the classpath -cp parameter (if classpath is not already defined), other java and jdk parameters and various TransSECS parameters as listed in the TransSECS.conf file in your script or batch file.

An example bash script for Linux to run TransSECS Builder headless (check the current command line parameters in your installation's TransSECS.conf to verify).

CLASSPATH="./:./addons/*:../documentation/*:../../MIStudio/lib/*:../../MIStudio/lib/:../../MIStudio/jars/*:../../MIStudio/core/*:../../MIStudio/core/:../../MIStudio/core/lib/*:../../MIStudio/core/ant/lib/*:${JAVA_HOME}/lib/tools.jar:"

/usr/lib/jvm/java-8-openjdk-amd64/bin/java -cp ${CLASSPATH} -Dsun.java2d.d3d=false -Dtranssecs.headless=true -Dsun.java2d.noddraw=true -Dtranssecs.applicationtype=0 -Dsun.lang.ClassLoader.allowArraySyntax=true -DLoggerClass=Log4JLogger   com.ergotech.transsecs.secs.TransSecs /home/ergotech/TransSECSPlusReporting/MIStudioSuite/TransSECS/Builder/buildprops/headlessbuild.properties

Building Only Selected Tools

Some TransSECS projects contain multiple tools. In this case, it is usual to build all the tools and the headless build will do this. There may be occasions where only a sub-set of the tools should be built. This is supported by adding additional tools to the command line. The name of the configuration properties file must be first - the “wrapper.app.parameter.2” as described above. The tools must then be added as “wrapper.app.parameter.3”, “wrapper.app.parameter.4” and so on. The property is just the name of the tool as defined in the TransSECS project. The tool must already exist in the project.

wrapper.app.parameter.2=buildprops\\headlessbuild.properties
wrapper.app.parameter.3=GEMTool
wrapper.app.parameter.4=RFIDReaderTool1
  • building_transsecs_projects_with_a_command_line.txt
  • Last modified: 2020/11/11 13:09
  • by wikiadmin