List of available compiler options
General compiler options
JavaScript compiler options
Reduce output size You can use these options to reduce the size of your compiled application:
Determines if the abstract
modifier may be used with classes. For more details, see Abstract Classes in ActionScript.
-allow-abstract-classes
Determines if alias syntax for for imported symbols is allowed or not.
-allow-import-aliases
Determines if the private
namespace may be used with class constructors. For more details, see Private Constructors in ActionScript.
-allow-private-constructors
Determines if names of identifiers must follow the strict rules of ActionScript 3.0, or if they may use the looser rules introduced in ECMAScript 5. Defaults to false
.
-strict-identifier-names
Sets the path to a custom distribution of Google's Closure library, instead of the default version used by the compiler.
-closure-lib path/to/closure
Specifies the file name of the HTML file generated by the compiler to load the Apache Royale application in the browser.
-html-output-filename custom.html
Specifies the path to an optional template for the HTML file generated by the compiler to load the Apache Royale application in the browser.
-html-template ./path/to/template.html
<htmlTemplate>${basedir}/target/javascript/bin/js-debug/jewel-example-index-template.html</htmlTemplate>
Determines if primitive constant values (such as numbers, booleans, and strings) will be inlined.
-inline-constants
<additionalCompilerOptions>-inline-constants=true;</additionalCompilerOptions>
Specifies one or more custom compiler options to pass to the Google Closure Compiler, which is used to create the release build of an Apache Royale application.
-js-compiler-option+="--variable_map_output_file gccvars.txt" -js-compiler-option+="--compilation_level SIMPLE_OPTIMIZATIONS"
<additionalCompilerOptions>-js-compiler-option=--variable_map_output_file gccvars.txt;-js-compiler-option+=--property_map_output_file gccprops.txt</additionalCompilerOptions>
Defaults to true. Enables or disables initialization of primitive (Number, Boolean, etc.) variables with default values in the generated JavaScript. Corresponds to AVM runtime implicit type intialization values.
Note that some reflection utility functions require this to be set to true in order for them to work correctly in JavaScript.
-js-default-initializers
<additionalCompilerOptions>-js-default-initializers=true;</additionalCompilerOptions>
If the definition of a member cannot be resolved at compile time, emit dynamic access instead of normal member access. Ensures that dynamic members aren't renamed.
-js-dynamic-access-unknown-members
<additionalCompilerOptions>-js-dynamic-access-unknown-members=true;</additionalCompilerOptions>
Defines a global constant at compile time for the JavaScript output. May be a boolean, number, string, or expression.
-js-define CONFIG::debugging true -js-define CONFIG::release false
For Boolean and numeric values, you may pass in literals like true, false, or 123. Format string values with nested quotes, like “‘hello’”, because the compiler will attempt to evaluate an expression when it encounters a quotation mark.
<defines> <property> <name>BUILD::buildNumber</name> <value>'"${buildTimestamp}"'</value> </property> <property> <name>BUILD::buildVersion</name> <value>'"${project.version}"'</value> </property> </defines>
Then in AS3 you can do:
// Build Number private static var _buildNumber :String = BUILD::buildNumber; // Project Version private static var _projectVersion :String = BUILD::buildVersion;
Specifies the locations of XML configuration files that define extra compiler options for JavaScript output.
-js-load-config path/to/project-config.xml
The path where the generated JavaScript output should be saved, if your are also using it for the .swf output path.
-js-output path/to/output
Use instead outputDirectory
in configuration
xml node
A custom implemention to use instead of default emulation of the AVM2 Vector
typed collection.
-js-vector-emulation-class=com.example.MyVectorClass
<additionalCompilerOptions>-js-vector-emulation-class=com.example.MyVectorClass;</additionalCompilerOptions>
Customize the factory to use for JSX syntax. Defaults to React.createElement
.
-jsx-factory=_jsx
<additionalCompilerOptions>-jsx-factory=_jsx;</additionalCompilerOptions>
Determines if asdoc comment annotations are kept in the generated JavaScript.
-keep-asdoc=false
<additionalCompilerOptions>-keep-asdoc=false;</additionalCompilerOptions>
Tells the Apache Royale compiler to remove circular dependencies in the generated JavaScript, where possible.
-remove-circulars
<removeCirculars>true</removeCirculars>
Set to false to remove all binding warnings.
-show-binding-warnings=false
<additionalCompilerOptions>-show-binding-warnings=false;</additionalCompilerOptions>
(Advanced) Set to false to skip transpiling ActionScript and MXML to JavaScript, and only run the release build. Generally used by contributors to the compiler only. Default s to false
.
-skip-transpile=true
<additionalCompilerOptions>-skip-transpile=true;</additionalCompilerOptions>
Emits a source map in the debug build for each ActionScript file. The default value is false.
-source-map
<additionalCompilerOptions>-source-map=true;</additionalCompilerOptions>
Sets a custom value for the sourceRoot
property in the generated source map files. This option will be ignored if the source-map
compiler option is false
.
-source-map-source-root=my/custom/path
<additionalCompilerOptions>-source-map-source-root=my/custom/path;</additionalCompilerOptions>
Specifies the target format of the code generated by the Apache Royale compiler. You can specify multiple targets.
-targets JSRoyale,SWF
The compiler supports the following values for “targets”:
<targets>JSRoyale</targets>
Enables or disables warnings about using public variables when it may be considered dangerous to use them.
-warn-public-vars
<additionalCompilerOptions>-warn-public-vars=true;</additionalCompilerOptions>
The following compiler options may be used to reduce the output size of JavaScript release builds. However, using these options may also prevent certain coding patterns in ActionScript and JavaScript from working correctly, so use with caution.
There are two main ways to reduce the size of a release build:
Disable exported symbols. When a symbol is exported, it may be accessed by external JavaScript <script>
elements in the same page. If a symbol is not exported, and it is not referenced elsewhere in the Royale project, the compiler may determine that it is “dead code” that should be removed from a release build.
Allow renaming of symbols. When a symbol is not allowed to be renamed in a release build, it may be accessed using dynamic string access, such as object["myProperty"]
. If a symbol is not prevented from being renamed, the compiler may determine that it can change the name of the symbol to a shorter value to reduce the size of the release build. If a symbol is renamed, dynamic string access will not be possible without knowing the new name of the symbol.
In a release build, determines if symbols in the public
namespace will be exported or not. The default value is true
.
-export-public-symbols=false
<additionalCompilerOptions>-export-public-symbols=false;</additionalCompilerOptions>
In a release build, determines if symbols in the protected
namespace will be exported. The default value is false
.
-export-protected-symbols=true
<additionalCompilerOptions>-export-protected-symbols=true;</additionalCompilerOptions>
In a release build, determines if symbols in the internal
namespace will be exported. The default value is false
.
-export-internal-symbols=true
<additionalCompilerOptions>-export-internal-symbols=true;</additionalCompilerOptions>
In a release build, determines if symbols in the public
namespace may be renamed or not. The default value is true
.
-prevent-rename-public-symbols=false
<additionalCompilerOptions>-prevent-rename-public-symbols=false;</additionalCompilerOptions>
When prevent-rename-public-symbols
option is true
, one or more the following options may be set to false
to allow renaming of certain specific subsets of public symbols.
prevent-rename-public-static-methods
prevent-rename-public-instance-methods
prevent-rename-public-static-variables
prevent-rename-public-instance-variables
prevent-rename-public-static-accessors
prevent-rename-public-instance-accessors
In a release build, determines if symbols in the protected
namespace may be renamed or not. The default value is true
.
-prevent-rename-protected-symbols=false
<additionalCompilerOptions>-prevent-rename-protected-symbols=false;</additionalCompilerOptions>
When prevent-rename-protected-symbols
option is true
, one or more the following options may be set to false
to allow renaming of certain specific subsets of protected symbols.
prevent-rename-protected-static-methods
prevent-rename-protected-instance-methods
prevent-rename-protected-static-variables
prevent-rename-protected-instance-variables
prevent-rename-protected-static-accessors
prevent-rename-protected-instance-accessors
In a release build, determines if symbols in the internal
namespace may be renamed or not. The default value is true
.
-prevent-rename-internal-symbols=false
<additionalCompilerOptions>-prevent-rename-internal-symbols=false;</additionalCompilerOptions>
When prevent-rename-internal-symbols
option is true
, one or more the following options may be set to false
to allow renaming of certain specific subsets of internal symbols.
prevent-rename-internal-static-methods
prevent-rename-internal-instance-methods
prevent-rename-internal-static-variables
prevent-rename-internal-instance-variables
prevent-rename-internal-static-accessors
prevent-rename-internal-instance-accessors
In a release build, determines if static methods in the public
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-public-symbols
compiler option is false
.
-prevent-rename-public-static-methods=false
<additionalCompilerOptions>-prevent-rename-static-methods=false;</additionalCompilerOptions>
In a release build, determines if instance (non-static) methods in the public
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-public-symbols
compiler option is false
.
-prevent-rename-public-instance-methods=false
<additionalCompilerOptions>-prevent-rename-public-instance-methods=false;</additionalCompilerOptions>
In a release build, determines if static variables in the public
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-public-symbols
compiler option is false
.
-prevent-rename-public-static-variables=false
<additionalCompilerOptions>-prevent-rename-static-variables=false;</additionalCompilerOptions>
In a release build, determines if instance (non-static) variables in the public
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-public-symbols
compiler option is false
.
-prevent-rename-public-instance-variables=false
<additionalCompilerOptions>-prevent-rename-public-instance-variables=false;</additionalCompilerOptions>
In a release build, determines if static accessors (getters and setters) in the public
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-public-symbols
compiler option is false
.
-prevent-rename-public-static-accessors=false
<additionalCompilerOptions>-prevent-rename-static-accessors=false;</additionalCompilerOptions>
In a release build, determines if instance (non-static) accessors (getters and setters) in the public
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-public-symbols
compiler option is false
.
-prevent-rename-public-instance-accessors=false
<additionalCompilerOptions>-prevent-rename-public-instance-accessors=false;</additionalCompilerOptions>
In a release build, determines if static methods in the protected
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-protected-symbols
compiler option is false
.
-prevent-rename-protected-static-methods=false
<additionalCompilerOptions>-prevent-rename-static-methods=false;</additionalCompilerOptions>
In a release build, determines if instance (non-static) methods in the protected
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-protected-symbols
compiler option is false
.
-prevent-rename-protected-instance-methods=false
<additionalCompilerOptions>-prevent-rename-protected-instance-methods=false;</additionalCompilerOptions>
In a release build, determines if static variables in the protected
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-protected-symbols
compiler option is false
.
-prevent-rename-protected-static-variables=false
<additionalCompilerOptions>-prevent-rename-static-variables=false;</additionalCompilerOptions>
In a release build, determines if instance (non-static) variables in the protected
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-protected-symbols
compiler option is false
.
-prevent-rename-protected-instance-variables=false
<additionalCompilerOptions>-prevent-rename-protected-instance-variables=false;</additionalCompilerOptions>
In a release build, determines if static accessors (getters and setters) in the protected
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-protected-symbols
compiler option is false
.
-prevent-rename-protected-static-accessors=false
<additionalCompilerOptions>-prevent-rename-static-accessors=false;</additionalCompilerOptions>
In a release build, determines if instance (non-static) accessors (getters and setters) in the protected
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-protected-symbols
compiler option is false
.
-prevent-rename-protected-instance-accessors=false
<additionalCompilerOptions>-prevent-rename-protected-instance-accessors=false;</additionalCompilerOptions>
In a release build, determines if static methods in the internal
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-internal-symbols
compiler option is false
.
-prevent-rename-internal-static-methods=false
<additionalCompilerOptions>-prevent-rename-static-methods=false;</additionalCompilerOptions>
In a release build, determines if instance (non-static) methods in the internal
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-internal-symbols
compiler option is false
.
-prevent-rename-internal-instance-methods=false
<additionalCompilerOptions>-prevent-rename-internal-instance-methods=false;</additionalCompilerOptions>
In a release build, determines if static variables in the internal
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-internal-symbols
compiler option is false
.
-prevent-rename-internal-static-variables=false
<additionalCompilerOptions>-prevent-rename-static-variables=false;</additionalCompilerOptions>
In a release build, determines if instance (non-static) variables in the internal
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-internal-symbols
compiler option is false
.
-prevent-rename-internal-instance-variables=false
<additionalCompilerOptions>-prevent-rename-internal-instance-variables=false;</additionalCompilerOptions>
In a release build, determines if static accessors (getters and setters) in the internal
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-internal-symbols
compiler option is false
.
-prevent-rename-internal-static-accessors=false
<additionalCompilerOptions>-prevent-rename-static-accessors=false;</additionalCompilerOptions>
In a release build, determines if instance (non-static) accessors (getters and setters) in the internal
namespace may be renamed or not. The default value is true
. This option will be ignored if the prevent-rename-internal-symbols
compiler option is false
.
-prevent-rename-internal-instance-accessors=false
<additionalCompilerOptions>-prevent-rename-internal-instance-accessors=false;</additionalCompilerOptions>