got it working for DataBindingExample
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/4d0e513d Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/4d0e513d Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/4d0e513d Branch: refs/heads/dual Commit: 4d0e513db057c7a7a62ad1638fe04232a28254fe Parents: 0dd8835 Author: Alex Harui <[email protected]> Authored: Tue Jan 31 09:07:19 2017 -0800 Committer: Alex Harui <[email protected]> Committed: Tue Jan 31 09:07:19 2017 -0800 ---------------------------------------------------------------------- .../apache/flex/compiler/clients/MXMLJSC.java | 38 ++++++++++++++++++-- .../compiler/common/CompilerConfiguration.java | 6 ++-- .../main/java/flex2/tools/oem/Application.java | 19 +++++----- .../oem/internal/ConfigurationConstants.java | 6 ++++ .../tools/oem/internal/OEMConfiguration.java | 5 +++ 5 files changed, 60 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4d0e513d/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java index 4d4410e..8ce5f4c 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java @@ -24,6 +24,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -75,6 +76,10 @@ import org.apache.flex.compiler.targets.ITarget; import org.apache.flex.compiler.targets.ITarget.TargetType; import org.apache.flex.compiler.targets.ITargetSettings; import org.apache.flex.compiler.units.ICompilationUnit; +import org.apache.flex.swf.ISWF; +import org.apache.flex.swf.SWF; +import org.apache.flex.swf.types.RGB; +import org.apache.flex.swf.types.Rect; import org.apache.flex.tools.FlexTool; import org.apache.flex.utils.ArgumentUtil; import org.apache.flex.utils.FilenameNormalization; @@ -243,6 +248,9 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider, protected ITargetSettings targetSettings; protected IJSApplication jsTarget; private IJSPublisher jsPublisher; + private MXMLC mxmlc; + public boolean noLink; + public OutputStream err; public MXMLJSC() { @@ -307,8 +315,11 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider, switch (JSTargetType.fromString(target)) { case SWF: - MXMLC mxmlc = new MXMLC(); - result = mxmlc.mainNoExit(removeJSArgs(args)); + mxmlc = new MXMLC(); + if (noLink) + result = mxmlc.mainCompileOnly(removeJSArgs(args), err); + else + result = mxmlc.mainNoExit(removeJSArgs(args)); if (result != 0) { problems.addAll(mxmlc.problems.getProblems()); @@ -852,4 +863,27 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider, { workspace.close(); } + + /** + * return a data structure for FB integration + * @return + */ + public ISWF getSWFTarget() + { + SWF swf = new SWF(); + Rect rect = new Rect(getTargetSettings().getDefaultWidth(), + getTargetSettings().getDefaultHeight()); + swf.setFrameSize(rect); + // we might need to report actual color some day + swf.setBackgroundColor(new RGB(255, 255, 255)); + swf.setTopLevelClass(config.getTargetFile()); + return swf; + } + + public long writeSWF(OutputStream output) + { + if (mxmlc != null) + return mxmlc.writeSWF(output); + return 0; + } } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4d0e513d/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java b/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java index 627d178..cce9fb6 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java @@ -1496,12 +1496,12 @@ public class CompilerConfiguration implements As3Configuration, return targets.length > 0 ? locales[0] : null; } - public void cfgTarget( ConfigurationValue cv, String[] newTargets ) + public void cfgTargets( ConfigurationValue cv, String[] newTargets ) { - locales = (String[])merge(newTargets, targets, String.class); + targets = (String[])merge(newTargets, targets, String.class); } - public static ConfigurationInfo getTargetInfo() + public static ConfigurationInfo getTargetsInfo() { return new ConfigurationInfo( -1, new String[] { "target-element" } ) { http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4d0e513d/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java b/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java index 5c5cfe5..626962a 100644 --- a/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java +++ b/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java @@ -33,7 +33,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.apache.flex.compiler.clients.MXMLC; +import org.apache.flex.compiler.clients.MXMLJSC; import org.apache.flex.compiler.clients.problems.ProblemFormatter; import org.apache.flex.compiler.clients.problems.ProblemQuery; import org.apache.flex.compiler.problems.CompilerProblemSeverity; @@ -622,15 +622,16 @@ public class Application implements Builder //Map licenseMap = OEMUtil.getLicenseMap(tempOEMConfiguration.configuration); - mxmlc = new MXMLC(); + mxmljsc = new MXMLJSC(); + mxmljsc.noLink = true; //int returnValue = mxmlc.mainCompileOnly(constructCommandLine2(tempOEMConfiguration.configuration), null); - int returnValue = mxmlc.mainCompileOnly(constructCommandLine(oemConfiguration), null); + int returnValue = mxmljsc.mainNoExit(constructCommandLine(oemConfiguration), null, true); if (returnValue == 0) returnValue = OK; else returnValue = FAIL; - processMXMLCReport(mxmlc, tempOEMConfiguration); + processMXMLCReport(mxmljsc, tempOEMConfiguration); clean(returnValue == FAIL /* cleanData */, false /* cleanCache */, @@ -650,15 +651,15 @@ public class Application implements Builder public long link(OutputStream output) { - return mxmlc.writeSWF(output); + return mxmljsc.writeSWF(output); } - private MXMLC mxmlc = new MXMLC(); + private MXMLJSC mxmljsc = new MXMLJSC(); private List<Source> sources; private SimpleMovie movie; private SourceList sourceList; - void processMXMLCReport(MXMLC mxmlc, OEMConfiguration config) + void processMXMLCReport(MXMLJSC mxmljsc, OEMConfiguration config) { /* not sure we need this ApplicationCompilerConfiguration acc = ((ApplicationCompilerConfiguration)config.configuration); @@ -685,7 +686,7 @@ public class Application implements Builder } } */ - ProblemQuery pq = mxmlc.getProblems(); + ProblemQuery pq = mxmljsc.getProblemQuery(); List<ICompilerProblem> probs = pq.getProblems(); for (ICompilerProblem prob : probs) { @@ -774,7 +775,7 @@ public class Application implements Builder } } - ISWF swf = mxmlc.getSWFTarget(); + ISWF swf = mxmljsc.getSWFTarget(); movie = new SimpleMovie(null); org.apache.flex.swf.types.Rect r = swf.getFrameSize(); flash.swf.types.Rect fr = new flash.swf.types.Rect(); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4d0e513d/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/ConfigurationConstants.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/ConfigurationConstants.java b/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/ConfigurationConstants.java index 1d59834..8f4a64d 100644 --- a/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/ConfigurationConstants.java +++ b/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/ConfigurationConstants.java @@ -28,6 +28,7 @@ package flex2.tools.oem.internal; interface ConfigurationConstants { String USE_NETWORK = "--use-network"; + String REMOVE_CIRCULARS = "--remove-circulars"; String RUNTIME_SHARED_LIBRARIES = "--runtime-shared-libraries"; String RAW_METADATA = "--raw-metadata"; String PROJECTOR = "--projector"; @@ -38,6 +39,7 @@ interface ConfigurationConstants String METADATA_DATE = "--metadata.date"; String METADATA_CREATOR = "--metadata.creator"; String METADATA_CONTRIBUTOR = "--metadata.contributor"; + String JS_OUTPUT = "--js-output"; String LINK_REPORT = "--link-report"; String SIZE_REPORT = "--size-report"; String LICENSES_LICENSE = "--licenses.license"; @@ -104,7 +106,9 @@ interface ConfigurationConstants String COMPILER_NAMESPACES_NAMESPACE = "--compiler.namespaces.namespace"; String COMPILER_MOBILE = "--compiler.mobile"; String COMPILER_LOCALE = "--compiler.locale"; + String COMPILER_TARGETS = "--compiler.targets"; String COMPILER_LIBRARY_PATH = "--compiler.library-path"; + String COMPILER_JS_LIBRARY_PATH = "--compiler.js-library-path"; String COMPILER_INCLUDE_LIBRARIES = "--compiler.include-libraries"; String COMPILER_KEEP_GENERATED_ACTIONSCRIPT = "--compiler.keep-generated-actionscript"; String COMPILER_KEEP_AS3_METADATA = "--compiler.keep-as3-metadata"; @@ -119,6 +123,7 @@ interface ConfigurationConstants String COMPILER_FONTS_FLASH_TYPE = "--compiler.fonts.flash-type"; String COMPILER_FONTS_ADVANCED_ANTI_ALIASING = "--compiler.fonts.advanced-anti-aliasing"; String COMPILER_EXTERNAL_LIBRARY_PATH = "--compiler.external-library-path"; + String COMPILER_JS_EXTERNAL_LIBRARY_PATH = "--compiler.js-external-library-path"; String COMPILER_ES = "--compiler.es"; String COMPILER_DEFAULTS_CSS_URL = "--compiler.defaults-css-url"; String COMPILER_DEBUG = "--compiler.debug"; @@ -133,6 +138,7 @@ interface ConfigurationConstants String VERIFY_DIGESTS = "--verify-digests"; String COMPILER_COMPUTE_DIGEST = "--compute-digest"; String COMPILER_DEFINE = "--compiler.define"; + String COMPILER_JS_DEFINE = "--compiler.js-define"; String COMPILER_MXML_COMPATIBILITY = "--compiler.mxml.compatibility-version"; String COMPILER_EXTENSIONS = "--compiler.extensions.extension"; String REMOVE_UNUSED_RSLS = "--remove-unused-rsls"; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4d0e513d/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMConfiguration.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMConfiguration.java b/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMConfiguration.java index f8f3ff1..f141fd8 100644 --- a/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMConfiguration.java +++ b/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMConfiguration.java @@ -978,6 +978,11 @@ public class OEMConfiguration implements Configuration, ConfigurationConstants, addFiles(COMPILER_LIBRARY_PATH, paths); } + public void setTargets(String[] targets) + { + args.put(COMPILER_TARGETS, targets); + } + /** * Sets the locales that the compiler would use to replace <code>{locale}</code> tokens that appear in some configuration values. * This is equivalent to using <code>mxmlc/compc --compiler.locale</code>.
