config xml file usable inside of it?
We can auto-generate flex-confix xml file from flash-builder so that users who want to compile project on their own would be capable of doing such thing without buying FB. So we use something like -dump-config slotConfig.xml
as flex compiler argument. This generates a file for us... with lots of detailed comments like this one I generated from that project:
<flex-config>
<!-- benchmark: output performance benchmark-->
<!-- benchmark usage:
<benchmark>boolean</benchmark>
-->
<compiler>
<!-- compiler.accessible: generate an accessible SWF-->
<accessible>false</accessible>
<!-- compiler.actionscript-file-encoding: specifies actionscript file encoding. If there is no BOM in the AS3 source files, the compiler will use this file encoding.-->
<!-- compiler.actionscript-file-encoding usage:
<actionscript-file-encoding>string</actionscript-file-encoding>
-->
<!-- compiler.allow-source-path-overlap: checks if a source-path entry is a subdirectory of another source-path entry. It helps make the package names of MXML components unambiguous.-->
<allow-source-path-overlap>false</allow-source-path-overlap>
<!-- compiler.as3: use the ActionScript 3 class based object model for greater performance and better error reporting. In the class based object model most built-in functions are implemented as fixed methods of classes.-->
<as3>true</as3>
<!-- compiler.context-root: path to replace {context.root} tokens for service channel endpoints-->
<!-- compiler.context-root usage:
<context-root>context-path</context-root>
-->
<!-- compiler.debug: generates a movie that is suitable for debugging-->
<debug>true</debug>
<!-- compiler.defaults-css-files usage:
<defaults-css-files>
<filename>string</filename>
<filename>string</filename>
</defaults-css-files>
-->
<!-- compiler.defaults-css-url: defines the location of the default style sheet. Setting this option overrides the implicit use of the defaults.css style sheet in the framework.swc file.-->
<!-- compiler.defaults-css-url usage:
<defaults-css-url>string</defaults-css-url>
-->
<!-- compiler.define: define a global AS3 conditional compilation definition, e.g. -define=CONFIG::debugging,true or -define+=CONFIG::debugging,true (to append to existing definitions in flex-config.xml) -->
<!-- compiler.define usage:
<define>
<name>string</name>
<value>string</value>
<value>string</value>
</define>
-->
<!-- compiler.enable-runtime-design-layers usage:
<enable-runtime-design-layers>boolean</enable-runtime-design-layers>
-->
<!-- compiler.es: use the ECMAScript edition 3 prototype based object model to allow dynamic overriding of prototype properties. In the prototype based object model built-in functions are implemented as dynamic properties of prototype objects.-->
<es>false</es>
<extensions>
<!-- compiler.extensions.extension usage:
<extension>
<extension>string</extension>
<parameters>string</parameters>
</extension>
-->
</extensions>
<!-- compiler.external-library-path: list of SWC files or directories to compile against but to omit from linking-->
<external-library-path>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibsplayer10.1playerglobal.swc</path-element>
</external-library-path>
<fonts>
<!-- compiler.fonts.advanced-anti-aliasing: enables advanced anti-aliasing for embedded fonts, which provides greater clarity for small fonts.-->
<advanced-anti-aliasing>true</advanced-anti-aliasing>
<!-- compiler.fonts.flash-type: enables FlashType for embedded fonts, which provides greater clarity for small fonts.-->
<!-- compiler.fonts.flash-type usage:
<flash-type>boolean</flash-type>
-->
<languages>
<!-- compiler.fonts.languages.language-range: a range to restrict the number of font glyphs embedded into the SWF-->
<!-- compiler.fonts.languages.language-range usage:
<language-range>
<lang>string</lang>
<range>string</range>
<range>string</range>
</language-range>
-->
</languages>
<!-- compiler.fonts.local-font-paths usage:
<local-font-paths>
<path-element>string</path-element>
<path-element>string</path-element>
</local-font-paths>
-->
<!-- compiler.fonts.local-fonts-snapshot: File containing system font data produced by flex2.tools.FontSnapshot.-->
<local-fonts-snapshot>${flexlib}/localFonts.ser</local-fonts-snapshot>
<!-- compiler.fonts.managers: Compiler font manager classes, in policy resolution order-->
<managers>
<manager-class>flash.fonts.JREFontManager</manager-class>
<manager-class>flash.fonts.BatikFontManager</manager-class>
<manager-class>flash.fonts.AFEFontManager</manager-class>
<manager-class>flash.fonts.CFFFontManager</manager-class>
</managers>
<!-- compiler.fonts.max-cached-fonts: sets the maximum number of fonts to keep in the server cache. The default value is 20.-->
<max-cached-fonts>20</max-cached-fonts>
<!-- compiler.fonts.max-glyphs-per-face: sets the maximum number of character glyph-outlines to keep in the server cache for each font face. The default value is 1000.-->
<max-glyphs-per-face>1000</max-glyphs-per-face>
</fonts>
<!-- compiler.headless-server: a flag to set when Flex is running on a server without a display-->
<!-- compiler.headless-server usage:
<headless-server>boolean</headless-server>
-->
<!-- compiler.include-libraries: a list of libraries (SWCs) to completely include in the SWF-->
<!-- compiler.include-libraries usage:
<include-libraries>
<library>string</library>
<library>string</library>
</include-libraries>
-->
<!-- compiler.incremental: enables incremental compilation-->
<!-- compiler.incremental usage:
<incremental>boolean</incremental>
-->
<!-- compiler.isolate-styles: enables the compiled application or module to set styles that only affect itself and its children-->
<!-- compiler.isolate-styles usage:
<isolate-styles>boolean</isolate-styles>
-->
<!-- compiler.keep-all-type-selectors: disables the pruning of unused CSS type selectors-->
<!-- compiler.keep-all-type-selectors usage:
<keep-all-type-selectors>boolean</keep-all-type-selectors>
-->
<!-- compiler.keep-as3-metadata: keep the specified metadata in the SWF-->
<!-- compiler.keep-as3-metadata usage:
<keep-as3-metadata>
<name>string</name>
<name>string</name>
</keep-as3-metadata>
-->
<!-- compiler.keep-generated-actionscript: save temporary source files generated during MXML compilation-->
<keep-generated-actionscript>false</keep-generated-actionscript>
<!-- compiler.library-path: list of SWC files or directories that contain SWC files-->
<library-path>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibstextLayout.swc</path-element>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibsosmf.swc</path-element>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibsframework.swc</path-element>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibsspark.swc</path-element>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibssparkskins.swc</path-element>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibsrpc.swc</path-element>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibsdatavisualization.swc</path-element>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibsflash-integration.swc</path-element>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslibsutilities.swc</path-element>
<path-element>C:downloadsflex_sdk_4.1.0.16076frameworkslocale{locale}</path-element>
<path-element>C:UsersAvestaAdobe Flash Builder 4CloudObserverAdvancedPlayerlibs</path-element>
</library-path>
<!-- compiler.locale: specifies the locale for internationalization-->
<locale>
<locale-element>en_US</locale-element>
</locale>
<!-- compiler.minimum-supported-version usage:
<minimum-supported-version>string</minimum-supported-version>
-->
<mxml>
<!-- compiler.mxml.compatibility-version: specifies a compatibility version. e.g. -compatibility-version=2.0.1-->
<!-- compiler.mxml.compatibility-version usage:
<compatibility-version>version</compatibility-version>
-->
<!-- compiler.mxml.minimum-supported-version usage:
<minimum-supported-version>string</minimum-supported-version>
-->
<!-- compiler.mxml.qualified-type-selectors usage:
<qualified-type-selectors>boolean</qualified-type-selectors>
-->
</mxml>
<namespaces>
<!-- compiler.namespaces.namespace: Specify a URI to associate with a manifest of components for use as MXML elements-->
<namespace>
<uri>http://ns.adobe.com/mxml/2009</uri>
<manifest>mxml-2009-manifest.xml</manifest>
</namespace>
<namespace>
<uri>library://ns.adobe.com/flex/spark</uri>
<manifest>spark-manifest.xml</manifest>
</namespace>
<namespace>
<uri>library://ns.adobe.com/flex/mx</uri>
<manifest>mx-manifest.xml</manifest>
</namespace>
<namespace>
<uri>http://www.adobe.com/2006/mxml</uri>
<manifest>mxml-manifest.xml</manifest>
</namespace>
</namespaces>
<!-- compiler.omit-trace-statements: toggle whether trace statements are omitted-->
<omit-trace-statements>true</omit-trace-statements>
<!-- compiler.optimize: Enable post-link SWF optimization-->
<optimize>true</optimize>
<!-- compiler.report-invalid-styles-as-warnings: enables reporting of invalid styles as warnings-->
<!-- compiler.report-invalid-styles-as-warnings usage:
<report-invalid-styles-as-warnings>boolean</report-invalid-styles-as-warnings>
-->
<!-- compiler.services: path to Flex Data Services configuration file-->
<!-- compiler.services usage:
<services>filename</services>
-->
<!-- compiler.show-actionscript-warnings: runs the AS3 compiler in a mode that detects legal but potentially incorrect code-->
<show-actionscript-warnings>false</show-actionscript-warnings>
<!-- compiler.show-binding-warnings: toggle whether warnings generated from data binding code are displayed-->
<show-binding-warnings>false</show-binding-warnings>
<!-- compiler.show-invalid-css-property-warnings: toggle whether invalid css property warnings are reported-->
<!-- compiler.show-invalid-css-property-warnings usage:
<show-invalid-css-property-warnings>boolean</show-invalid-css-property-warnings>
-->
<!-- compiler.show-shadowed-device-font-warnings: toggles whether warnings are displayed when an embedded font name shadows a device font name-->
<show-shadowed-device-font-warnings>false</show-shadowed-device-font-warnings>
<!-- compiler.show-unused-type-selector-warnings: toggle whether warnings generated from unused CSS type selectors are displayed-->
<show-unused-type-selector-warnings>false</show-unused-type-selector-warnings>
<!-- compiler.source-path: list of path elements that form the roots of ActionScript class hierarchies-->
<source-path>
<path-element>C:UsersAvestaAdobe Flash Builder 4CloudObserverAdvancedPlayersrc</path-element>
</source-path>
<!-- compiler.strict: runs the AS3 compiler in strict error checking mode.-->
<strict>true</strict>
<!-- compiler.theme: list of CSS or SWC files to apply as a theme-->
<theme>
<filename>themes/Spark/spark.css</filename>
</theme>
<theme>
<filename>C:downloadsflex_sdk_4.1.0.16076frameworksthemesWireframewireframe.swc</filename>
</theme>
<!-- compiler.use-resource-bundle-metadata: determines whether resources bundles are included in the application.-->
<use-resource-bundle-metadata>true</use-resource-bundle-metadata>
<!-- compiler.verbose-stacktraces: save callstack information to the SWF for debugging-->
<verbose-stacktraces>false</verbose-stacktraces>
<!-- compiler.warn-array-tostring-changes: Array.toString() format has changed.-->
<warn-array-tostring-changes>false</warn-array-tostring-changes>
<!-- compiler.warn-assignment-within-conditional: Assignment within conditional.-->
<warn-assignment-within-conditional>true</warn-assignment-within-conditional>
<!-- compiler.warn-bad-array-cast: Possibly invalid Array cast operation.-->
<warn-bad-array-cast>true</warn-bad-array-cast>
<!-- compiler.warn-bad-bool-assignment: Non-Boolean value used where a Boolean value was expected.-->
<warn-bad-bool-assignment>true</warn-bad-bool-assignment>
<!-- compiler.warn-bad-date-cast: Invalid Date cast operation.-->
<warn-bad-date-cast>true</warn-bad-date-cast>
<!-- compiler.warn-bad-es3-type-method: Unknown method.-->
<warn-bad-es3-type-method>true</warn-bad-es3-type-method>
<!-- compiler.warn-bad-es3-type-prop: Unknown property.-->
<warn-bad-es3-type-prop>true</warn-bad-es3-type-prop>
<!-- compiler.warn-bad-nan-comparison: Illogical comparison with NaN. Any comparison operation involving NaN will evaluate to false because NaN != NaN.-->
<warn-bad-nan-comparison>true</warn-bad-nan-comparison>
<!-- compiler.warn-bad-null-assignment: Impossible assignment to null.-->
<warn-bad-null-assignment>true</warn-bad-null-assignment>
<!-- compiler.warn-bad-null-comparison: Illogical comparison with null.-->
<warn-bad-null-comparison>true</warn-bad-null-comparison>
<!-- compiler.warn-bad-undefined-comparison: Illogical comparison with undefined. Only untyped variables (or variables of type *) can be undefined.-->
<warn-bad-undefined-comparison>true</warn-bad-undefined-comparison>
<!-- compiler.warn-boolean-constructor-with-no-args: Boolean() with no arguments returns false in ActionScript 3.0. Boolean() returned undefined in ActionScript 2.0.-->
<warn-boolean-constructor-with-no-args>false</warn-boolean-constructor-with-no-args>
<!-- compiler.warn-changes-in-resolve: __resolve is no longer supported.-->
<warn-changes-in-resolve>false</warn-changes-in-resolve>
<!-- compiler.warn-class-is-sealed: Class is sealed. It cannot have members added to it dynamically.-->
<warn-class-is-sealed>true</warn-class-is-sealed>
<!-- compiler.warn-const-not-initialized: Constant not initialized.-->
<warn-const-not-initialized>true</warn-const-not-initialized>
<!-- compiler.warn-constructor-returns-value: Function used in new expression returns a value. Result will be what the function returns, rather than a new instance of that function.-->
<warn-constructor-returns-value>false</warn-constructor-returns-value>
<!-- compiler.warn-deprecated-event-handler-error: EventHandler was not added as a listener.-->
<warn-deprecated-event-handler-error>false</warn-deprecated-event-handler-error>
<!-- compiler.warn-deprecated-function-error: Unsupported ActionScript 2.0 function.-->
<warn-deprecated-function-error>true</warn-deprecated-function-error>
<!-- compiler.warn-deprecated-property-error: Unsupported ActionScript 2.0 property.-->
<warn-deprecated-property-error>true</warn-deprecated-property-error>
<!-- compiler.warn-duplicate-argument-names: More than one argument by the same name.-->
<warn-duplicate-argument-names>true</warn-duplicate-argument-names>
<!-- compiler.warn-duplicate-variable-def: Duplicate variable definition -->
<warn-duplicate-variable-def>true</warn-duplicate-variable-def>
<!-- compiler.warn-for-var-in-changes: ActionScript 3.0 iterates over an object's properties within a "for x in target" statement in random order.-->
<warn-for-var-in-changes>false</warn-for-var-in-changes>
<!-- compiler.warn-import-hides-class: Importing a package by the same name as the current class will hide that class identifier in this scope.-->
<warn-import-hides-class>true</warn-import-hides-class>
<!-- compiler.warn-instance-of-changes: Use of the instanceof operator.-->
<warn-instance-of-changes>true</warn-instance-of-changes>
<!-- compiler.warn-internal-error: Internal error in compiler.-->
<warn-internal-error>true</warn-internal-error>
<!-- compiler.warn-level-not-supported: _level is no longer supported. For more information, see the flash.display package.-->
<warn-level-not-supported>true</warn-level-not-supported>
<!-- compiler.warn-missing-namespace-decl: Missing namespace declaration (e.g. variable is not defined to be public, private, etc.).-->
<warn-missing-namespace-decl>true</warn-missing-namespace-decl>
<!-- compiler.warn-negative-uint-literal: Negative value will become a large positive value when assigned to a uint data type.-->
<warn-negative-uint-literal>true</warn-negative-uint-literal>
<!-- compiler.warn-no-constructor: Missing constructor.-->
<warn-no-constructor>false</warn-no-constructor>
<!-- compiler.warn-no-explicit-super-call-in-constructor: The super() statement was not called within the constructor.-->
<warn-no-explicit-super-call-in-constructor>false</warn-no-explicit-super-call-in-constructor>
<!-- compiler.warn-no-type-decl: Missing type declaration.-->
<warn-no-type-decl>true</warn-no-type-decl>
<!-- compiler.warn-number-from-string-changes: In ActionScript 3.0, white space is ignored and '' returns 0. Number() returns NaN in ActionScript 2.0 when the parameter is '' or contains white space.-->
<warn-number-from-string-changes>false</warn-number-from-string-changes>
<!-- compiler.warn-scoping-change-in-this: Change in scoping for the this keyword. Class methods extracted from an instance of a class will always resolve this back to that instance. In ActionScript 2.0 this is looked up dynamically based on where the method is invoked from.-->
<warn-scoping-change-in-this>false</warn-scoping-change-in-this>
<!-- compiler.warn-slow-text-field-addition: Inefficient use of += on a TextField.-->
<warn-slow-text-field-addition>true</warn-slow-text-field-addition>
<!-- compiler.warn-unlikely-function-value: Possible missing parentheses.-->
<warn-unlikely-function-value>true</warn-unlikely-function-value>
<!-- compiler.warn-xml-class-has-changed: Possible usage of the ActionScript 2.0 XML class.-->
<warn-xml-class-has-changed>false</warn-xml-class-has-changed>
</compiler>
<!-- debug-password: the password to include in debuggable SWFs-->
<!-- debug-password usage:
<debug-password>string</debug-password>
-->
<!-- default-background-color: default background color (may be overridden by the application code)-->
<default-background-color>0xFFFFFF</default-background-color>
<!-- default-frame-rate: default frame rate to be used in the SWF.-->
<default-frame-rate>24</default-frame-rate>
<!-- default-script-limits: default script execution limits (may be overridden by root attributes)-->
<default-script-limits>
<max-recursion-depth>1000</max-recursion-depth>
<max-execution-time>60</max-execution-time>
</default-script-limits>
<!-- default-size: default application size (may be overridden by root attributes in the application)-->
<default-size>
<width>500</width>
<height>375</height>
</default-size>
<!-- externs: a list of symbols to omit from linking when building a SWF-->
<!-- externs usage:
<externs>
<symbol>string</symbol>
<symbol>string</symbol>
</externs>
-->
<frames>
<!-- frames.frame: A SWF frame label with a sequence of classnames that will be linked onto the frame.-->
<!-- frames.frame usage:
<frame>
<label>string</label>
<classname>string</classname>
</frame>
-->
</frames>
<framework>halo</framework>
<!-- include-resource-bundles: a list of resource bundles to include in the output SWC-->
<!-- include-resource-bundles usage:
<include-resource-bundles>
<bundle>string</bundle>
<bundle>string</bundle>
</include-resource-bundles>
-->
<!-- includes: a list of symbols to always link in when building a SWF-->
<!-- includes usage:
<includes>
<symbol>string</symbol>
<symbol>string</symbol>
</includes>
-->
<!-- link-report: Output a XML-formatted report of all definitions linked into the application.-->
<!-- link-report usage:
<link-report>filename</link-report>
-->
<!-- load-config: load a file containing configuration options-->
<load-config>${flexlib}/${configname}-config.xml</load-config>
<!-- load-externs: an XML file containing <def>, <pre>, and <ext> symbols to omit from linking when building a SWF-->
<!-- load-externs usage:
<load-externs>filename</load-externs>
-->
<metadata>
<!-- metadata.contributor: A contributor's name to store in the SWF metadata-->
<!-- metadata.contributor usage:
<contributor>name</contributor>
-->
<!-- metadata.creator: A creator's name to store in the SWF metadata-->
<creator>unknown</creator>
<!-- metadata.date: The creation date to store in the SWF metadata-->
<!-- metadata.date usage:
<date>text</date>
-->
<!-- metadata.description: The default description to store in the SWF metadata-->
<description>http://www.adobe.com/products/flex</description>
<!-- metadata.language: The language to store in the SWF metadata (i.e. EN, FR)-->
<language>EN</language>
<!-- metadata.localized-description: A localized RDF/XMP description to store in the SWF metadata-->
<!-- metadata.localized-description usage:
<localized-description>
<text>string</text>
<lang>string</lang>
<lang>string</lang>
</localized-description>
-->
<!-- metadata.localized-title: A localized RDF/XMP title to store in the SWF metadata-->
<!-- metadata.localized-title usage:
<localized-title>
<title>string</title>
<lang>string</lang>
<lang>string</lang>
</localized-title>
-->
<!-- metadata.publisher: A publisher's name to store in the SWF metadata-->
<publisher>unknown</publisher>
<!-- metadata.title: The default title to store in the SWF metadata-->
<title>Adobe Flex 4 Application</title>
</metadata>
<!-- raw-metadata: XML text to store in the SWF metadata (overrides metadata.* configuration)-->
<!-- raw-metadata usage:
<raw-metadata>text</raw-metadata>
-->
<!-- resource-bundle-list: prints a list of resource bundles to a file for input to the compc compiler to create a resource bundle SWC file. -->
<!-- resource-bundle-list usage:
<resource-bundle-list>filename</resource-bundle-list>
-->
<!-- runtime-shared-libraries: a list of runtime shared library URLs to be loaded before the application starts-->
<!-- runtime-shared-libraries usage:
<runtime-shared-libraries>
<url>string</url>
<url>string</url>
</runtime-shared-libraries>
-->
<!-- runtime-shared-library-path usage:
<runtime-shared-library-path>
<path-element>string</path-element>
<rsl-url>string</rsl-url>
<policy-file-url>string</policy-file-url>
</runtime-shared-library-path>
-->
<!-- static-link-runtime-shared-libraries: statically link the libraries specified by the -runtime-shared-libraries-path option.-->
<static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>
<!-- target-player: specifies the version of the player the application is targeting. Features requiring a later version will not be compiled into the application. The minimum value supported is "9.0.0".-->
<target-player>10.1.0</target-player>
<!-- tools-locale: specifies the locale used by the compiler when reporting errors and warnings.-->
<!-- tools-locale usage:
<tools-locale>string</tools-locale>
-->
<!-- use-network: toggle whether the SWF is flagged for access to network resources-->
<use-network>true</use-network>
<!-- verify-digests: verifies the libraries loaded at runtime are the correct ones.-->
<verify-digests>true</verify-digests>
<!-- warnings: toggle the display of warnings-->
<!-- warnings usage:
<warnings>boolean</warnings>
-->
</flex-config>
as you can see it contains lots of absolute paths. But we want to deploy this script. So we defiantly need to create a layer of abstraction for stuff like pathes to flex SDK ( here "C:downloadsflex_sdk_4.1.0.16076") or path to <path-element>C:UsersAvestaAdobe Flash Builder 4CloudObserverAdvancedPlayersrc</path-element>
and of course path to libs
<path-element>C:UsersAvestaAdobe Flash Builder 4CloudObserverAdvancedPlayerlibs</path-element>
Also fact that FB generates such "dirty" file seems strange to me. Does not compiler knows where he is in File System? And why we can not use dynamic addresses, relative paths?
So generally some of this problems can be solved: for example we can (CAN WE?) create some varSdk, varSource, varLibs in that xml and replace there content ( <varSdk>_varSdkContent_</varSdk>
)with such scripts (windows - bat, linux, mac - sh) put that scripts somewhere into our project and add th them line that compiles all project like:
mxmlc MainApp.mxml load-config flex-config.xml output /pathToRelease
So... my questions are
or if first 2 are not solvable:
You can use custom variables in your config file.
Just add the variable to the command line like +someProperty=someValue
Then in the config file you can use the ${someProperty} variable and it will be expanded to someValue.
Custom variables in config files are not available.
-dump-config
is used to see what parameters are used in compilation (there are a lot of possible parameter sources). It is not supposed to be used this way.
There are several solutions for your task:
Create Ant build script for your project - it's an industry standard. Path to the Flex SDK is specified in local.properties
file that is loaded into the build.xml
Create Maven build script
Create a shell script - although it's not a cross-platform solution
下一篇: 配置xml文件里面可用吗?