Difference between revisions of "Globalyzer Lite"
(→Sharing Project Definition Files Between IDEs and Build Systems) |
|||
(73 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
+ | Globalyzer Lite scans source code for internationalization issues. It is well suited for use within automation routines and Continuous Integration (CI) systems. Additionally, it is designed to be used as an external tool from within Integrated Development Environments (IDEs) such as Visual Studio, IntelliJ IDEA, and Eclipse. |
||
− | Globalyzer Lite is a lightweight version of the Globalyzer Workbench Client. It is smaller and faster to install than the Globalyzer Workbench and requires no database. It is ideal for creating temporary projects and scans on the fly, executing those scans, and generating corresponding reports. |
||
+ | Globalyzer Lite generates scan reports to a directory specified via command line arguments / a project definition file. Scan reports are available in a variety of formats. |
||
− | Globalyzer Lite calls the Globalyzer API, but uses an in-memory, temporary database, rather than a physical one. This improves performance and allows multiple Globalyzer Lite programs to be running at the same time. In addition, Globalyzer Lite parses and executes Globalyzer projects that are defined in Globalyzer Project Definition XML files, bypassing the need to create projects and scans using the Globalyzer Workbench, or by writing your own Java program that calls the Globalyzer API. |
||
+ | Globalyzer Lite is delivered in a zip file and is available from the Client Download page on the Globalyzer Server. |
||
− | == Getting Started == |
||
− | Globalyzer Lite is a product that requires special licensing. It is delivered in a zip file. |
||
+ | '''Note''': For Eclipse, the <code>Clickable Console Plugin (1.0.0)</code> requires Eclipse Luna and above. |
||
− | Globalyzer Lite uses a Project Definition file which is an XML file with all the information for creating and scanning a project. |
||
+ | == Using Globalyzer Lite from an Integrated Development Environment == |
||
− | == Language Support == |
||
− | Globalyzer Lite supports the same languages as the full Globalyzer product. It allows users to scan a number of source code in different programming languages: |
||
− | * ActionScript, |
||
− | * C#, |
||
− | * C/C++ (many variations), |
||
− | * Delphi, |
||
− | * HTML (in various web files), |
||
− | * Java, |
||
− | * JavaScript, (includes AngularJS, NodeJS, and other libraries) |
||
− | * Objective-C, |
||
− | * MXML, |
||
− | * Perl, |
||
− | * PHP, |
||
− | * Qt, |
||
− | * SQL (Oracle, MS SQL, MySQL, PostgreSQL), |
||
− | * Visual Basic (Classic, .NET), |
||
− | * VBScript, and |
||
− | * XML |
||
+ | Lite may be used within many IDEs that support external tools, including Visual Studio, IntelliJ IDEA, and Eclipse. Configuring Lite as an external tool takes some initial setup, but is relatively easy to accomplish. Once configured, Lite may be used through the IDE's external tool menu with the click of a button. The recommended, documented tools: |
||
− | Globalyzer Lite uses the same rule sets that have been created for Globalyzer so that the reports created in either are identical. |
||
+ | # Scan the currently selected file/directory. |
||
− | == Using Globalyzer Lite == |
||
+ | # Scan everything within the parent directory of the currently selected file/directory. |
||
+ | # Scan the entire project. |
||
+ | Demonstration videos are available for: |
||
− | Globalyzer Lite makes use of the Globalyzer API. It is a way to use the API without a database, so program executions will be faster. Multiple instances of Globalyzer Lite can be run on the same machine at the same time. Globalyzer Lite lends itself to scripts and automation routines. |
||
+ | * [https://player.vimeo.com/video/137641243 Visual Studio] |
||
− | == Example Project Definition Template == |
||
+ | * [https://player.vimeo.com/video/137641242 IntelliJ IDEA] |
||
+ | * [https://player.vimeo.com/video/137641241 Eclipse] |
||
+ | To configure Lite in the IDE, please see this page: [https://www.globalyzer.com/gzserver/help/referenceLite/globalyzer-lite-IDE-usage.html Lite IDE Usage]. |
||
− | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||
+ | |||
− | <!-- All items should be allowed anywhere in the xml as long as the hierarchy |
||
+ | The developer can then use the power of the IDE to refactor the relevant issues or to mark false positives in the code using Globalyzer ignore comments, such as $NON-NLS-L$. For more information, see the Globalyzer Comment Tags in [[ False Positives | False Positives ]] . |
||
+ | |||
+ | Those refactoring and the comment tags are now part of the code: The Continuous Globalization System using the same Lite project definition file will show the same results in the Dashboard. |
||
+ | |||
+ | == Using Globalyzer Lite in a Continuous Globalization System == |
||
+ | |||
+ | Globalyzer Lite is easy to integrate into Continuous Integration (CI) systems. For instance, using Lite from Jenkins can be done through the following steps: |
||
+ | |||
+ | # Check in a project definition file into source control (or, if you prefer, place one in the Jenkins server's filesystem). |
||
+ | # Run the following from Jenkins' shell: |
||
+ | #:<code>java -jar globalyzer-lite.jar -f "${WORKSPACE}/lingoport/LiteProjectDefinitionFile.xml" --project-path "${WORKSPACE}" --report-path "globalyzer-lite-reports"</code> |
||
+ | # Use the Lingoport Dashboard to display the results from the generated reports. |
||
+ | |||
+ | You may also pass the reports to your own reporting system. |
||
+ | |||
+ | == Using Globalyzer Lite from the Command Prompt / Shell == |
||
+ | |||
+ | Globalyzer Lite can be executed from a command prompt or shell via the following command: |
||
+ | |||
+ | <code>java -jar globalyzer-lite.jar some_location/YourProjectDefinitionFile.xml</code> |
||
+ | |||
+ | It is strongly recommended to keep the definition under a repository top level directory 'lingoport' with the name 'LiteProjectDefinition.xml': |
||
+ | |||
+ | <code>java -jar globalyzer-lite.jar lingoport/LiteProjectDefinition.xml</code> |
||
+ | |||
+ | After lite finishes each scan, a relevant Globalyzer report is created at the location specified in the Project Definition's report path. |
||
+ | |||
+ | Lite also allows for altering the following parameters via command line options: |
||
+ | |||
+ | * The Project Path |
||
+ | * The Report Path |
||
+ | * The Files/Directories to scan |
||
+ | * The location of the Globalyzer License (if using Local Rule Sets) |
||
+ | |||
+ | == Sharing Project Definition Files Between IDEs and Build Systems == |
||
+ | |||
+ | It is common to check in a single project definition file per code repository. However, the desired IDE configuration may sometimes be incompatible with the desired build system configuration. |
||
+ | |||
+ | These incompatibilities are best solved by modifying the project definition file within the build system. The IDE config can then be used as the default. |
||
+ | |||
+ | Here is an example: The desired report type for Lite may be ScanDetailedCSV for developer usage, but will need to be ScanDetailedXML within the build system. The project definition file would then be written out with the <report-type> set to ScanDetailedCSV: |
||
+ | <pre><gzproject> |
||
+ | ... |
||
+ | <report-type>ScanDetailedCSV</report-type> |
||
+ | ... |
||
+ | </gzproject></pre> |
||
+ | |||
+ | The build system can then be set to auto-replace "ScanDetailedCSV" with "ScanDetailedXML". The following Linux command will do so: |
||
+ | |||
+ | <code>$ sed --in-place 's|ScanDetailedCSV|ScanDetailedXML|' $WORKSPACE/lingoport/LiteProjectDefinition.xml</code> |
||
+ | |||
+ | If desired, the opposite replacement also may be performed at the end of the build. |
||
+ | |||
+ | Finally, here is a bash function to replace the content of any XML field: |
||
+ | |||
+ | <pre>replace_xml_token() { |
||
+ | token_name=$1 |
||
+ | new_content=$2 |
||
+ | sed -ri "s|(<${token_name}>).*(</${token_name}>)|\1${new_content}\2|g" $WORKSPACE/ProjectDefinition.xml |
||
+ | }</pre> |
||
+ | |||
+ | It may be used like so: |
||
+ | |||
+ | <code>$ replace_xml_token "report-type" "ScanDetailedXML"</code> |
||
+ | |||
+ | == Ease of Installation == |
||
+ | |||
+ | Installing Lite is easy. To install: |
||
+ | |||
+ | # Unzip the Globalyzer Lite zip file at a desired location |
||
+ | # Run either lite-setup.bat or lite-setup.sh depending on your system. |
||
+ | |||
+ | == Configuration & Rule Sets == |
||
+ | |||
+ | Before use of Globalyzer Lite, rule sets will need to be configured on the Globalyzer Server. Properly configured rule sets better detect i18n issues, and cut down the rate of false positives. |
||
+ | |||
+ | A Project Definition File will then need to be created for the given project. This file may be distributed to multiple users working on the same project. Please note that you can create a project in the Workbench and export it to a Project Definition File. |
||
+ | |||
+ | The project definition file will need to make use of the correct rule sets relevant to the project, and to specify which directories to scan with each rule set. It is recommended that this file be configured by an i18n knowledgeable developer or i18n specialist. |
||
+ | |||
+ | == Globalyzer Lite and Local Rule Sets == |
||
+ | |||
+ | Globalyzer Lite can be configured to run locally, allowing scanning without accessing the Globalyzer Server. |
||
+ | Rule sets are stored in local zip files rather than retrieved from the Server. |
||
+ | |||
+ | To run locally: |
||
+ | # rule sets need to be exported to zip files and placed in the project-path/lingoport directory |
||
+ | # the '''use-local-rulesets''' flag needs to be set to true in the Lite Project Definition file |
||
+ | # the '''Globalyzer License''' needs to be downloaded from the Server and stored locally |
||
+ | |||
+ | Please click [[Local_Rule_Sets | here]] for detailed information on Local Rule Sets. |
||
+ | |||
+ | == Project Definition Format== |
||
+ | |||
+ | Here is the template for a project definition file. For the full instructions to setup a project definition file, see our |
||
+ | [https://www.globalyzer.com/gzserver/help/referenceLite/project-definition-file-overview.html help page]. |
||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||
+ | <!-- All items should be allowed anywhere in the xml as long as the hierarchy |
||
is preserved --> |
is preserved --> |
||
− | <gzproject> |
+ | <gzproject> |
− | <login> |
+ | <login> |
− | <username></username> |
+ | <username></username> |
− | <password></password> |
+ | <password></password> |
− | <server></server> |
+ | <server></server> |
+ | <use-local-rulesets></use-local-rulesets> <!-- optional. May be 'true' or 'false' --> |
||
− | <!-- Optional Parameters --> |
||
+ | <!-- if true, you need a Globalyzer.license --> |
||
− | <proxy-user></proxy-user> |
||
+ | <!-- Optional Parameters --> |
||
− | <proxy-password></proxy-password> |
||
+ | <optional> |
||
− | <proxy-host></proxy-host> |
||
− | <proxy- |
+ | <proxy-user></proxy-user> |
+ | <proxy-password></proxy-password> |
||
− | </login> |
||
+ | <proxy-host></proxy-host> |
||
+ | <proxy-port></proxy-port> |
||
+ | <optional> |
||
+ | </login> |
||
+ | <project-path></project-path> <!-- May instead be specified from command line --> |
||
+ | <project-name></project-name> |
||
+ | <report-path></report-path> <!-- May instead be specified from command line --> |
||
+ | <report-type></report-type> |
||
+ | <data-dictionary-location></data-dictionary-location> <!-- optional --> |
||
+ | <filter-with-dictionary></filter-with-dictionary> <!-- optional. May be 'true' or 'false' --> |
||
+ | <scan-timeout>500</scan-timeout> <!-- optional. Max value 600 (seconds) --> |
||
+ | <generate-partial-results></generate-partial-results> <!-- optional. May be 'true' or 'false' --> |
||
+ | <save-history></save-history> <!-- optional. May be 'true' or 'false' --> |
||
+ | <scans> |
||
+ | <scan> |
||
+ | <!-- create and execute a single scan with this info --> |
||
+ | <scan-name></scan-name> |
||
+ | <ruleset-name></ruleset-name> |
||
+ | <ruleset-owner></ruleset-owner> |
||
+ | </scan> |
||
+ | <scan> |
||
+ | <!-- create and execute a single scan with this info --> |
||
+ | <scan-name></scan-name> |
||
+ | <ruleset-name></ruleset-name> |
||
+ | <ruleset-owner></ruleset-owner> |
||
+ | <use-machine-learning>true</use-machine-learning> <!-- optional. May be 'true' or 'false' --> |
||
+ | <encoding>UTF-8</encoding> <!-- optional. Encoding of files to scan --> |
||
+ | <!-- optional: specify files/directories to scan --> |
||
+ | <scan-items> |
||
+ | <item></item> |
||
+ | <item></item> |
||
+ | </scan-items> |
||
+ | <!-- optional --> |
||
+ | <comments> |
||
+ | <!-- customize Globalyzer recognized comments --> |
||
+ | <todo>SPECIAL_GLOBALYZER_TODO_COMMENT</todo> |
||
+ | <ignore-next-line>GBLYZR_IGNORE_NEXT_LINE</ignore-next-line> |
||
+ | <start-ignore>GLOBALYZER_START_IGNORE</start-ignore> |
||
+ | <end-ignore>GBL_END_IGNORE</end-ignore> |
||
+ | </comments> |
||
+ | <!-- optional --> |
||
+ | <checks> |
||
+ | <!-- specify which issue types to detect --> |
||
+ | <embedded-strings>true</embedded-strings> |
||
+ | <locale-sensitive-methods>false</locale-sensitive-methods> |
||
+ | <general-patterns>true</general-patterns> |
||
+ | <static-file-references>false</static-file-references> |
||
+ | </checks> |
||
+ | </scan> |
||
+ | </scans> |
||
+ | </gzproject> |
||
+ | |||
+ | == The .globalyzerrc File == |
||
+ | |||
+ | Globalyzer Lite supports an optional .globalyzerrc file. This file may be used to specify login, server, and proxy parameters. Below is an example .globalyzerrc file. It contains all parameters that may be set within the rc file: |
||
+ | |||
+ | <pre>server https://www.globalyzer.com/gzserver |
||
+ | |||
+ | username user@company.com |
||
+ | password aPasswordHere |
||
+ | |||
+ | proxy-host https://internalhost.company.com |
||
+ | proxy-port 81038 |
||
+ | proxy-user ExampleUser |
||
+ | proxy-password ExamplePassword</pre> |
||
+ | |||
+ | All settings besides 'server' are optional. And project definition files do not need to specify parameters set in the rc file (with one exception). Any parameter that is set in the project definition file will override the rc file setting. |
||
+ | |||
+ | If you choose to use a .globalyzerrc, the 'server' parameter is mandatory. It must match the server specified in project definition files. This helps prevent rule sets from being retrieved from the wrong server. |
||
+ | |||
+ | == Setting Proxy Settings via Java == |
||
+ | |||
+ | If you prefer to specify proxy settings via Java, rather than through the project definition file, you may use any of the following Java settings. |
||
+ | |||
+ | -Dhttp.proxyHost=your.server.com |
||
+ | -Dhttp.proxyPort=80 |
||
+ | -Dhttps.proxyHost=your.server.com |
||
+ | -Dhttps.proxyPort=80 |
||
+ | -Dhttp.nonProxyHosts=123.210.123.210 |
||
+ | -DsocksProxyHost=your.server.com |
||
+ | -DsocksProxyPort=1080 |
||
+ | |||
+ | More info at: https://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html |
||
+ | |||
+ | == Exit Error Codes == |
||
+ | {| style="text-align: left;" |
||
+ | |- style="font-size: 125%;" |
||
+ | ! colspan="2" | Type |
||
+ | |- |
||
+ | ! Name !! style="padding-left: 15px;" | Exit Code |
||
+ | |- |
||
+ | | || |
||
+ | |||
+ | |- style="font-size: 125%;" |
||
+ | ! colspan="2" | Normal |
||
+ | |- |
||
+ | | EXIT_NORMAL || style="padding-left: 15px;" | 0 |
||
+ | |- |
||
+ | | || |
||
+ | |||
+ | |- style="font-size: 125%;" |
||
+ | ! colspan="2" |XML Issues |
||
+ | |- |
||
+ | |NO_PATH_TO_XML_FILE || style="padding-left: 15px;" | 10 |
||
+ | |- |
||
+ | | DUPLICATE_PARAMETER_IN_XML || style="padding-left: 15px;" | 11 |
||
+ | |- |
||
+ | | XML_PARAMETER_BLANK || style="padding-left: 15px;" | 12 |
||
+ | |- |
||
+ | | XML_INVALID_PARAMETER || style="padding-left: 15px;" | 13 |
||
+ | |- |
||
+ | | UNABLE_TO_READ_SCHEMA || style="padding-left: 15px;" | 14 |
||
+ | |- |
||
+ | | || |
||
+ | |||
+ | |- style="font-size: 125%;" |
||
+ | ! colspan="2" | Globalyzer API compatibility |
||
+ | |- |
||
+ | | GLOBALYZER_API_REPORT_TYPE_NOT_MATCHED || style="padding-left: 15px;" | 30 |
||
+ | |- |
||
+ | | GLOBALYZER_API_EXCEPTION || style="padding-left: 15px;" | 31 |
||
+ | |- style="height:20px" |
||
+ | |- |
||
+ | | || |
||
+ | |||
+ | |- style="font-size: 125%;" |
||
+ | ! colspan="2" | Input issues |
||
+ | |- |
||
+ | | IMPROPER_INPUT || style="padding-left: 15px;" | 51 |
||
+ | |- |
||
+ | | INVALID_COMMANDS || style="padding-left: 15px;" | 52 |
||
+ | |- |
||
+ | | PROJECT_PATH_DOES_NOT_EXIST || style="padding-left: 15px;" | 53 |
||
+ | |- |
||
+ | | || |
||
+ | |||
+ | |- style="font-size: 125%;" |
||
+ | ! colspan="2" | Output Issues |
||
+ | |- |
||
+ | | SCAN_FAILED || style="padding-left: 15px;" | 60 |
||
+ | |} |
||
+ | |||
+ | == Language Support == |
||
+ | Globalyzer Lite supports the same languages as the full Globalyzer product. It allows users to scan a number of source code in different programming languages: |
||
+ | * ActionScript, |
||
+ | * C#, |
||
+ | * C/C++ (many variations), |
||
+ | * Delphi, |
||
+ | * HTML (in various web files), |
||
+ | * Java, |
||
+ | * JavaScript, (includes AngularJS, NodeJS, React, and other libraries) |
||
+ | * Objective-C, |
||
+ | * MXML, |
||
+ | * Perl, |
||
+ | * PHP, |
||
+ | * Qt, |
||
+ | * SQL (Oracle, MS SQL, MySQL, PostgreSQL), |
||
+ | * Visual Basic (Classic, .NET), |
||
+ | * VBScript, and |
||
+ | * XML |
||
+ | == Lite vs the Globalyzer API == |
||
− | <project-path></project-path> |
||
− | <project-name></project-name> |
||
+ | Globalyzer Lite utilizes the Globalyzer API. Using the API directly is more powerful, but also requires writing a custom java application. |
||
− | <report-path></report-path> |
||
− | <report-type></report-type> |
||
+ | == Lite vs the Globalyzer Workbench == |
||
− | <scans> |
||
− | <scan> |
||
− | <!-- create and execute a single scan with this info --> |
||
− | <scan-name></scan-name> |
||
− | <ruleset-name></ruleset-name> |
||
− | <ruleset-owner></ruleset-owner> |
||
− | </scan> |
||
− | <scan> |
||
− | <!-- create and execute a single scan with this info --> |
||
− | <scan-name></scan-name> |
||
− | <ruleset-name></ruleset-name> |
||
− | <ruleset-owner></ruleset-owner> |
||
− | <!-- optional --> |
||
− | <scan-items> |
||
− | <item></item> |
||
− | <item></item> |
||
− | </scan-items> |
||
− | </scan> |
||
− | </scans> |
||
+ | In comparison to the Globalyzer Workbench, Globalyzer Lite is smaller, faster to install and does not require a database. Lite supports direct integration with IDEs, while the Workbench is its own standalone program. Additionally, unlike the workbench, multiple instances of Lite may be run concurrently. This allows Continuous Integration systems to use Lite to provision the scanning of multiple projects. |
||
− | </gzproject> |
Latest revision as of 15:20, 22 February 2022
Globalyzer Lite scans source code for internationalization issues. It is well suited for use within automation routines and Continuous Integration (CI) systems. Additionally, it is designed to be used as an external tool from within Integrated Development Environments (IDEs) such as Visual Studio, IntelliJ IDEA, and Eclipse.
Globalyzer Lite generates scan reports to a directory specified via command line arguments / a project definition file. Scan reports are available in a variety of formats.
Globalyzer Lite is delivered in a zip file and is available from the Client Download page on the Globalyzer Server.
Note: For Eclipse, the Clickable Console Plugin (1.0.0)
requires Eclipse Luna and above.
Contents
- 1 Using Globalyzer Lite from an Integrated Development Environment
- 2 Using Globalyzer Lite in a Continuous Globalization System
- 3 Using Globalyzer Lite from the Command Prompt / Shell
- 4 Sharing Project Definition Files Between IDEs and Build Systems
- 5 Ease of Installation
- 6 Configuration & Rule Sets
- 7 Globalyzer Lite and Local Rule Sets
- 8 Project Definition Format
- 9 The .globalyzerrc File
- 10 Setting Proxy Settings via Java
- 11 Exit Error Codes
- 12 Language Support
- 13 Lite vs the Globalyzer API
- 14 Lite vs the Globalyzer Workbench
Using Globalyzer Lite from an Integrated Development Environment
Lite may be used within many IDEs that support external tools, including Visual Studio, IntelliJ IDEA, and Eclipse. Configuring Lite as an external tool takes some initial setup, but is relatively easy to accomplish. Once configured, Lite may be used through the IDE's external tool menu with the click of a button. The recommended, documented tools:
- Scan the currently selected file/directory.
- Scan everything within the parent directory of the currently selected file/directory.
- Scan the entire project.
Demonstration videos are available for:
To configure Lite in the IDE, please see this page: Lite IDE Usage.
The developer can then use the power of the IDE to refactor the relevant issues or to mark false positives in the code using Globalyzer ignore comments, such as $NON-NLS-L$. For more information, see the Globalyzer Comment Tags in False Positives .
Those refactoring and the comment tags are now part of the code: The Continuous Globalization System using the same Lite project definition file will show the same results in the Dashboard.
Using Globalyzer Lite in a Continuous Globalization System
Globalyzer Lite is easy to integrate into Continuous Integration (CI) systems. For instance, using Lite from Jenkins can be done through the following steps:
- Check in a project definition file into source control (or, if you prefer, place one in the Jenkins server's filesystem).
- Run the following from Jenkins' shell:
java -jar globalyzer-lite.jar -f "${WORKSPACE}/lingoport/LiteProjectDefinitionFile.xml" --project-path "${WORKSPACE}" --report-path "globalyzer-lite-reports"
- Use the Lingoport Dashboard to display the results from the generated reports.
You may also pass the reports to your own reporting system.
Using Globalyzer Lite from the Command Prompt / Shell
Globalyzer Lite can be executed from a command prompt or shell via the following command:
java -jar globalyzer-lite.jar some_location/YourProjectDefinitionFile.xml
It is strongly recommended to keep the definition under a repository top level directory 'lingoport' with the name 'LiteProjectDefinition.xml':
java -jar globalyzer-lite.jar lingoport/LiteProjectDefinition.xml
After lite finishes each scan, a relevant Globalyzer report is created at the location specified in the Project Definition's report path.
Lite also allows for altering the following parameters via command line options:
- The Project Path
- The Report Path
- The Files/Directories to scan
- The location of the Globalyzer License (if using Local Rule Sets)
Sharing Project Definition Files Between IDEs and Build Systems
It is common to check in a single project definition file per code repository. However, the desired IDE configuration may sometimes be incompatible with the desired build system configuration.
These incompatibilities are best solved by modifying the project definition file within the build system. The IDE config can then be used as the default.
Here is an example: The desired report type for Lite may be ScanDetailedCSV for developer usage, but will need to be ScanDetailedXML within the build system. The project definition file would then be written out with the <report-type> set to ScanDetailedCSV:
<gzproject> ... <report-type>ScanDetailedCSV</report-type> ... </gzproject>
The build system can then be set to auto-replace "ScanDetailedCSV" with "ScanDetailedXML". The following Linux command will do so:
$ sed --in-place 's|ScanDetailedCSV|ScanDetailedXML|' $WORKSPACE/lingoport/LiteProjectDefinition.xml
If desired, the opposite replacement also may be performed at the end of the build.
Finally, here is a bash function to replace the content of any XML field:
replace_xml_token() { token_name=$1 new_content=$2 sed -ri "s|(<${token_name}>).*(</${token_name}>)|\1${new_content}\2|g" $WORKSPACE/ProjectDefinition.xml }
It may be used like so:
$ replace_xml_token "report-type" "ScanDetailedXML"
Ease of Installation
Installing Lite is easy. To install:
- Unzip the Globalyzer Lite zip file at a desired location
- Run either lite-setup.bat or lite-setup.sh depending on your system.
Configuration & Rule Sets
Before use of Globalyzer Lite, rule sets will need to be configured on the Globalyzer Server. Properly configured rule sets better detect i18n issues, and cut down the rate of false positives.
A Project Definition File will then need to be created for the given project. This file may be distributed to multiple users working on the same project. Please note that you can create a project in the Workbench and export it to a Project Definition File.
The project definition file will need to make use of the correct rule sets relevant to the project, and to specify which directories to scan with each rule set. It is recommended that this file be configured by an i18n knowledgeable developer or i18n specialist.
Globalyzer Lite and Local Rule Sets
Globalyzer Lite can be configured to run locally, allowing scanning without accessing the Globalyzer Server. Rule sets are stored in local zip files rather than retrieved from the Server.
To run locally:
- rule sets need to be exported to zip files and placed in the project-path/lingoport directory
- the use-local-rulesets flag needs to be set to true in the Lite Project Definition file
- the Globalyzer License needs to be downloaded from the Server and stored locally
Please click here for detailed information on Local Rule Sets.
Project Definition Format
Here is the template for a project definition file. For the full instructions to setup a project definition file, see our help page.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- All items should be allowed anywhere in the xml as long as the hierarchy is preserved --> <gzproject> <login> <username></username> <password></password> <server></server> <use-local-rulesets></use-local-rulesets> <!-- optional. May be 'true' or 'false' --> <!-- if true, you need a Globalyzer.license --> <!-- Optional Parameters --> <optional> <proxy-user></proxy-user> <proxy-password></proxy-password> <proxy-host></proxy-host> <proxy-port></proxy-port> <optional> </login> <project-path></project-path> <!-- May instead be specified from command line --> <project-name></project-name> <report-path></report-path> <!-- May instead be specified from command line --> <report-type></report-type> <data-dictionary-location></data-dictionary-location> <!-- optional --> <filter-with-dictionary></filter-with-dictionary> <!-- optional. May be 'true' or 'false' --> <scan-timeout>500</scan-timeout> <!-- optional. Max value 600 (seconds) --> <generate-partial-results></generate-partial-results> <!-- optional. May be 'true' or 'false' --> <save-history></save-history> <!-- optional. May be 'true' or 'false' --> <scans> <scan> <!-- create and execute a single scan with this info --> <scan-name></scan-name> <ruleset-name></ruleset-name> <ruleset-owner></ruleset-owner> </scan> <scan> <!-- create and execute a single scan with this info --> <scan-name></scan-name> <ruleset-name></ruleset-name> <ruleset-owner></ruleset-owner> <use-machine-learning>true</use-machine-learning> <!-- optional. May be 'true' or 'false' --> <encoding>UTF-8</encoding> <!-- optional. Encoding of files to scan --> <!-- optional: specify files/directories to scan --> <scan-items> <item></item> <item></item> </scan-items> <!-- optional --> <comments> <!-- customize Globalyzer recognized comments --> <todo>SPECIAL_GLOBALYZER_TODO_COMMENT</todo> <ignore-next-line>GBLYZR_IGNORE_NEXT_LINE</ignore-next-line> <start-ignore>GLOBALYZER_START_IGNORE</start-ignore> <end-ignore>GBL_END_IGNORE</end-ignore> </comments> <!-- optional --> <checks> <!-- specify which issue types to detect --> <embedded-strings>true</embedded-strings> <locale-sensitive-methods>false</locale-sensitive-methods> <general-patterns>true</general-patterns> <static-file-references>false</static-file-references> </checks> </scan> </scans> </gzproject>
The .globalyzerrc File
Globalyzer Lite supports an optional .globalyzerrc file. This file may be used to specify login, server, and proxy parameters. Below is an example .globalyzerrc file. It contains all parameters that may be set within the rc file:
server https://www.globalyzer.com/gzserver username user@company.com password aPasswordHere proxy-host https://internalhost.company.com proxy-port 81038 proxy-user ExampleUser proxy-password ExamplePassword
All settings besides 'server' are optional. And project definition files do not need to specify parameters set in the rc file (with one exception). Any parameter that is set in the project definition file will override the rc file setting.
If you choose to use a .globalyzerrc, the 'server' parameter is mandatory. It must match the server specified in project definition files. This helps prevent rule sets from being retrieved from the wrong server.
Setting Proxy Settings via Java
If you prefer to specify proxy settings via Java, rather than through the project definition file, you may use any of the following Java settings.
-Dhttp.proxyHost=your.server.com -Dhttp.proxyPort=80 -Dhttps.proxyHost=your.server.com -Dhttps.proxyPort=80 -Dhttp.nonProxyHosts=123.210.123.210 -DsocksProxyHost=your.server.com -DsocksProxyPort=1080
More info at: https://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html
Exit Error Codes
Type | |
---|---|
Name | Exit Code |
Normal | |
EXIT_NORMAL | 0 |
XML Issues | |
NO_PATH_TO_XML_FILE | 10 |
DUPLICATE_PARAMETER_IN_XML | 11 |
XML_PARAMETER_BLANK | 12 |
XML_INVALID_PARAMETER | 13 |
UNABLE_TO_READ_SCHEMA | 14 |
Globalyzer API compatibility | |
GLOBALYZER_API_REPORT_TYPE_NOT_MATCHED | 30 |
GLOBALYZER_API_EXCEPTION | 31 |
Input issues | |
IMPROPER_INPUT | 51 |
INVALID_COMMANDS | 52 |
PROJECT_PATH_DOES_NOT_EXIST | 53 |
Output Issues | |
SCAN_FAILED | 60 |
Language Support
Globalyzer Lite supports the same languages as the full Globalyzer product. It allows users to scan a number of source code in different programming languages:
- ActionScript,
- C#,
- C/C++ (many variations),
- Delphi,
- HTML (in various web files),
- Java,
- JavaScript, (includes AngularJS, NodeJS, React, and other libraries)
- Objective-C,
- MXML,
- Perl,
- PHP,
- Qt,
- SQL (Oracle, MS SQL, MySQL, PostgreSQL),
- Visual Basic (Classic, .NET),
- VBScript, and
- XML
Lite vs the Globalyzer API
Globalyzer Lite utilizes the Globalyzer API. Using the API directly is more powerful, but also requires writing a custom java application.
Lite vs the Globalyzer Workbench
In comparison to the Globalyzer Workbench, Globalyzer Lite is smaller, faster to install and does not require a database. Lite supports direct integration with IDEs, while the Workbench is its own standalone program. Additionally, unlike the workbench, multiple instances of Lite may be run concurrently. This allows Continuous Integration systems to use Lite to provision the scanning of multiple projects.