Licensed to the Apache Software Foundation (ASF) under one or more

contributor license agreements. See the NOTICE file distributed with

this work for additional information regarding copyright ownership.

The ASF licenses this file to You under the Apache License, Version 2.0

(the “License”); you may not use this file except in compliance with

the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an “AS IS” BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

layout: docpage title: Compiler Options description: List of available compiler options permalink: /compiler/compiler-options

Compiler Options

List of Available Compiler Options

Contents

Royale provides these options for its compiler:

JavaScript compiler options

html-output-filename

Specifies the file name of the HTML file generated by the compiler to load the Apache Royale application in the browser.

-compiler.html-output-filename custom.html

html-template

Specifies the path to an optional template for the the HTML file generated by the compiler to load the Apache Royale application in the browser.

-compiler.html-template ./path/to/template.html

Maven configuration:

<htmlTemplate>${basedir}/target/javascript/bin/js-debug/jewel-example-index-template.html</htmlTemplate>

js-compiler-option

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.

-compiler.js-compiler-option.variable_map_output_file gccvars.txt -compiler.compilation_level SIMPLE_OPTIMIZATIONS

Maven configuration:

<additionalCompilerOptions>-js-compiler-option=--variable_map_output_file gccvars.txt;-js-compiler-option+=--property_map_output_file gccprops.txt</additionalCompilerOptions>

js-default-initializers

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.

-compiler.js-default-initializers

Maven configuration:

<additionalCompilerOptions>-js-default-initializers=true;</additionalCompilerOptions>

js-define

Defines a global constant at compile time for the JavaScript output. May be a boolean, number, string, or expression.

-compiler.js-define CONFIG::debugging true -compiler.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.

Maven configuration:

<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;

js-load-config

Specifies the locations of XML configuration files that define extra compiler options for JavaScript output.

-compiler.js-load-config path/to/project-config.xml

Maven configuration:

js-output

The path where the generated JavaScript output should be saved, if your are also using it for the .swf output path.

-compiler.js-output path/to/output

Maven configuration:

Use instead outputDirectoryin configuration xml node

remove-circulars

Tells the Apache Royale compiler to remove circular dependencies in the generated JavaScript, where possible.

-compiler.remove-circulars

Maven configuration:

<removeCirculars>true</removeCirculars>

source-map

Emits a source map in the debug build for each ActionScript file. The default value is false.

-compiler.source-map

Maven configuration:

<additionalCompilerOptions>-source-map=true;</additionalCompilerOptions>

targets

Specifies the target format of the code generated by the Apache Royale compiler. You can specify multiple targets.

-compiler.targets JSRoyale,SWF

The compiler supports the following values for “targets”:

  • “JSRoyale”
  • “JS”
  • “JSNode”
  • “JSNodeModule”
  • “SWF”

Maven configuration:

<targets>JSRoyale</targets>

warn-public-vars

Enables or disables warnings about using public variables.

-compiler.warn-public-vars

Maven configuration:

<additionalCompilerOptions>-warn-public-vars=true;</additionalCompilerOptions>

show-binding-warnings

Set to false to remove all binding warnings.

-compiler.show-binding-warnings=false

Maven configuration:

<additionalCompilerOptions>-show-binding-warnings=false;</additionalCompilerOptions>