Generating Code
If you develop apps based on Nexacro, all those programs will be converted into either JavaScript files or CSS files. This conversion process is called generation. Generated apps can be run on web browsers powered by operating systems. Otherwise, they are available in the Nexacro runtime environment (NRE).
To deploy a project that you develop through Nexacro Studio, you need to convert the codes of the project so that they are ready to be deployed. This conversion process is called "generation". You can generate codes through the menu [Generate] or [Deploy] in Nexacro Studio. However, it is better to use Nexacro Deploy when a project's scale is large or when you use an automatic build system. Nexacro Deploy is a tool for automatic generation and deployment.
Types of Nexacro Deploy
You can select and use the appropriate Nexacro Deploy according to your purpose.
nexacrodeploy.exe | Nexacro Deploy JAVA | |
---|---|---|
distribution method | Install with Nexacro Studio | Distributed separately as a jar file |
system requirements | Same as Nexacro Studio | Install JDK 1.8.0_131 or higher Need to set JAVA_HOME environment variable |
executable file name | Tools\nexacrodeploy.exe | bin\start.bat bin\start.sh |
Options
Required Options
The below three options must be specified.
nexacrodeploy.exe -P [ARG] -O [ARG] -B [ARG] start.bat -P [ARG] -O [ARG] -B [ARG] start.sh -P [ARG] -O [ARG] -B [ARG]
Option | Description |
---|---|
-P [ARG] | Specifies the path to the XPRJ file that contains a project to process. |
-O [ARG] | Specifies the output path where generate files are stored. Output path will be created automatically if nothing is specified. |
-B [ARG] | Specifies the path to the library files needed for generating files. |
The generated (deployed) file in the path specified with the -O(-D) option is not deleted even if you change the option specifying the work target or execute Generate(deploy) after deleting the file from the project. If necessary, the operator must manually delete the file.
If a file is deleted or renamed directly in the Nexacro Studio Project Explorer, the file created in the Ouputs path is also deleted or the file name is changed. This function is not a Nexacro Deploy function, but a function supported by Nexacro Studio.
CSS Rule Option
After installing Nexacro Studio version 21.0.0.1500 or higher, if you set a library version lower than the version 21.0.0.1500 in the -B option, the CSS Rule option must be set.
Option | Description |
---|---|
-CSSRULE | Specify the path where the CSS Rule file is located. If the option is not set, Nexacro Deploy's CSS Rule (1.3) is applied. |
When installing the SDK, the default CSS Rule path is as follows.
C:\Program Files (x86)\tobesoft\Nexacro N\SDK\21.0.0\generate
The CSS Rule with a version lower than the cssruleversion value of the library set in the -B option can be set.
If a version of CSS Rule higher than the cssruleversion value of the library is set, the generation fails and an error message is displayed.For example, if you set a library version lower than 21.0.0.1500 with the -B option and do not set the -CSSRULE option, the generation of the style-related file fails and an error message is displayed.
-CSSRULE version does not match the base library version (1.3).
Options for Specifying Target Files
If you do not set the below options, the deployment tool will work on all the files in a project.
Option | Description |
---|---|
-FILE [ARG...] | Specifies a list of paths to files to generate. Specifies IDs of themes to generate. Separated by a comma or semicolon when multiple inputs exist. The entire list of files must be enclosed in double quotation marks while each individual file is in single quotation marks. |
-SERVICE [ARG...] | Specifies the service prefix ID list to Generate. Separates multiple inputs with ','(Comma) or ';'(Semicolon). |
-BOOTSTRAP [ARG...] | Specifies the OS to which the created bootstrap files will apply. Separated by a comma or semicolon when multiple inputs exist. |
-MODULE | Used to generate only module files. |
If you do not specify the -FILE, -SERVICE, -BOOTSTRAP or -MODULE option, the deployment tool will deal with all the cases related to the project.
If there is a file that affects the bootstrap file such as the XADL file or environment.xml among the files specified with the -FILE option, then the bootstrap file may be recreated.
If multiple files are specified in the -FILE or -BOOTSTRAP option, there must be no white space between them.
(X) -FILE "'C:\a.xfdl', 'C:\b.xfdl'
(O) -FILE "'C:\a.xfdl','C:\b.xfdl'
Generate Options
Option | Description |
---|---|
-REGENERATE | Generates all files regardless of changes in files. If you do not specify this option, unchanged files will not be generated. |
-BROWSER [ARG...] | Specifies certain web browsers for which XCSS and Xtheme files will be generated. Separated by a comma or semicolon when multiple inputs exist. Note: you cannot specify a browser that is not supported by Nexacro. |
-UNARCHIVE | Does not archive a bootstrap file |
-JSVERSION | Set script validation rules to be applied when generating. If no option value is specified, the default is "ECMAScript 2015". You can choose "ECMAScript 5" or "ECMAScript 2015". When using the -JSVERSION option, Regenerate is performed on related items regardless of whether the file has been modified or not. |
-DEFER | When creating the Bootstrap file, set the defer attribute within the Script tag. |
-SPLASH | Sets whether or not to include a script to display Splash Loader when bootstrap file is created. |
You can specify below browsers as arguments of the -BROWSER option.
NRE
Nexacro Browser (deprecated)
Internet Explorer 11
Internet Explorer 10
Internet Explorer 9
Internet Explorer 8
Chrome
Firefox
Opera
Safari
If you want to specify the NRE and IE11, write code as below.
nexacrodeploy.exe -P -O -B -BROWSER "NRE,Internet Explorer 11" start.bat -P -O -B -BROWSER "NRE,Internet Explorer 11" start.sh -P -O -B -BROWSER "NRE,Internet Explorer 11"
It will generate files for all the browsers if you do not specify the -BROWSER option.
Currently, this command is applicable only to iOS, whose bootstrap file is Run.zip. The Run.html file will be created instead of Run.zip.
If multiple browsers are specified in the -BROWSER option, there must be no white space between them.
(X) -BROWSER "NRE, Internet Explorer 11"
(O) -BROWSER "NRE,Internet Explorer 11"
Deploy Options
Option | Description |
---|---|
-D [ARG] | Specifies the output path where deployed files are stored. Output path will be created automatically if a specified path is non-existent. Deployment will be conducted if this option is used. You cannot use the path specified by the '-O' option. |
-MERGE | Creates a single JS file by merging the JS files defined in a JSON file. |
-COMPRESS | Compresses JS files when deploying. |
-SHRINK | Obfuscates variable names. A function will not be obfuscated if it contains an eval statement. |
-IGNORECOMPRESS [ARG] | Specifies path for the .ignorecompress file, which stores a list of files that are not subject to compression. Note: this option is available only when the '-COMPRESS' option is applied. |
-IGNOREEVAL | Conducts obfuscation regardless of eval functions. (not recommended) Note: this option is available only when the '-SHRINK' option is applied. |
-COMPILE | Compiles files that will be used in the NRE. Note: only the NRE supports the files produced as a result of applying this option. |
-PRJURL [ARG] | Specifies the Project URl to load the App. Note: Option for iOS only. |
Other options
Option | Description |
---|---|
-L [ARG] | Specifies the path to a log file to save the process. Output path will be created automatically if nothing is specified. Creating a log file may increase the processing time. |
-H | -? | -HELP | Provides the help for Nexacro Deploy. |
Examples
The usage example was written based on nexacrodeploy.exe.
Generate
Generate entire Application
You can generate an Application based on C:\TestGenerate\TestGenerate.xprj file and produce the result to the E:\ResultGenerate folder.
You also can generate the files necessary to run the app (the console does not generate bootstrap files except for the ones related to the execution of the NRE or web browsers.)
The generation is conducted by referring to the path of base libraries, specified as the -B option.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib"
Generate only certain file
You can generate the C:\TestGenerate\aa.xfdl file specified as the -FILE option and produce the result to the E:\ResultGenerate folder.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -FILE "C:\TestGenerate\aa.xfdl"
You also can generate a theme file by specifying the ID of the target theme file.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -FILE "theme::default"
You can generate n number of files and produce the result to the E:\ResultGenerate folder.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -FILE "'C:\TestGenerate\aa.xfdl','C:\TestGenerate\bb.xfdl','C:\TestGenerate\cc.xfdl'"
When generating only specific services
Generate only the files corresponding to the Base service specified with the -SERVICE option and then create them under the "E:\ResultGenerate" folder.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -SERVICE "Base"
Generate n number of services and then create them under the "E:\ResultGenerate" folder.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -SERVICE "Base,FrameBase"
Generate only module files
You can generate only the module files in use located at C:\TestGenerate\nexacrolib and produce the result to the E:\ResultGenerate folder.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -MODULE
Generate only bootstrap files
You can generate bootstrap files of all OS types needed to run your app and produce the result to the E:\ResultGenerate folder.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -BOOTSTRAP
Generate bootstrap files but not archive them. (iOS)
You can generate bootstrap files of all OS types needed to run your app and produce the result to the E:\ResultGenerate folder. However, the result will be the Run.html file rather than Run.zip.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -BOOTSTRAP -UNARCHIVE
Deploy
Deploy entire Application
The application deployer generates files and produces the result to the path specified as the -O option. Then, it creates the files for deployment in the directory specified as the -D option.
In this case, all the options are applied to the generation process, which produces the result to the path specified as the -O option. (-R, -BROWSER, etc.)
The files in the directory of the -D option are produced based on the files in the directory of the -O option.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -D "E:\ResultDeploy"
Module merge option
You can create one JavaScript file by combining the JavaScript files in the nexacrolib folder. When you do so, the JavaScript files in nexacrolib will change their names in tandem with each relevant JSON file.
You can create the Framework.json file by merging all the JavaScript files in the framework folder.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -D "E:\ResultDeploy" -MERGE
Compress option
You can compress JavaScript files by removing their comments and whitespaces and thus making each file one-line code.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -D "E:\ResultDeploy" -COMPRESS
While compressing JavaScript files to make each file one-line code with their comments and whitespaces removed, you can also obfuscate the variables of those JS files at the same time. However, a function will not be obfuscated if it contains an eval statement.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -D "E:\ResultDeploy" -COMPRESS -SHRINK
While compressing JavaScript files to make each file one-line code with their comments and whitespaces removed, you can also obfuscate the variables of those files at the same time. Moreover, you can insist on obfuscation by ignoring eval statements included in functions.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -D "E:\ResultDeploy" -COMPRESS -SHRINK -IGNOREEVAL
Script (JS) files are compressed with 1line code with notes and spaces removed.
The js files designated in the ".ignorecompress" file are not compressed.
The ".ignorecompress" file is automatically created when [Ignore compress files] is set in the Nexacro Studio’s Compress option. If the file is created manually, the ".ignorecompress" file should be located in the same path as the xprj file and should be set as an XML file as follows.
Create files with js extensions to be excluded when compressing based on the output path (it will not work properly if only the folder is set).
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -D "E:\ResultDeploy" -COMPRESS -IGNORECOMPRESS "C:\TestGenerate\.ignorecompress"
<?xml version="1.0" encoding="utf-8"?> <CompressConfigue version="1.0"> <IgnoreCompress> <File path=".\Service0\test01.js"/> <File path=".\Service0\test02.js"/> </IgnoreCompress> </CompressConfigue>
Compile option
You can compress deployment files by encoding them with the format applicable only to the NRE. The resulting encoded files cannot be read through other editor programs.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -D "E:\ResultDeploy" -COMPILE
Others
Save generation result as log file
You can generate an Application based on C:\TestGenerate\TestGenerate.xprj file and produce the result to the E:\ResultGenerate folder. Then, you can save the details of the generation in the form of the C:\Log.txt file.
nexacrodeploy.exe -P "C:\TestGenerate\TestGenerate.xprj" -O "E:\ResultGenerate" -B "C:\TestGenerate\nexacrolib" -L "C:\log.txt"