I’m confused about the options here. If I’m reading this right, there’s 3 scenarios: 1. Generate js-debug and js-release 2. Only generate js-debug 3. Only generate js-release from an existing js-debug.
Did I get that right? If so, what are the compile arguments for each case? On Apr 13, 2016, at 10:08 PM, aha...@apache.org wrote: > FalconJX now checks debug flag to determine whether to generate the release > build via Google Closure Compiler. Also added -skip-transpile option so when > debug==false, you can skip the debug-mode transpilation. By default, when > debug==false, the compiler wil first transpile into the js-debug folder then > call GCC on that folder. If you set -skip-transpile, the copiler will not > transpile into the js-debug folder and just hand the js-debug folder to GCC. > This can come in handy if the compiler isn't generating the right code and > you want to hand-edit it before sending it to GCC for optimization > > > Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo > Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/3357a102 > Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/3357a102 > Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/3357a102 > > Branch: refs/heads/develop > Commit: 3357a10216f66f0ef93630a8861c43f975f509da > Parents: fd87205 > Author: Alex Harui <aha...@apache.org> > Authored: Wed Apr 13 12:07:52 2016 -0700 > Committer: Alex Harui <aha...@apache.org> > Committed: Wed Apr 13 12:07:52 2016 -0700 > > ---------------------------------------------------------------------- > .../apache/flex/compiler/clients/MXMLJSC.java | 109 ++++++++------- > .../mxml/flexjs/MXMLFlexJSPublisher.java | 140 ++++++++++--------- > .../driver/js/goog/JSGoogConfiguration.java | 20 +++ > 3 files changed, 154 insertions(+), 115 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3357a102/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java > ---------------------------------------------------------------------- > diff --git a/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java > b/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java > index d324c9f..c6d9508 100644 > --- a/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java > +++ b/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java > @@ -349,7 +349,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, > ProblemQueryProvider, > if (continueCompilation) > { > project.setProblems(problems.getProblems()); > - compile(); > + compile(); > if (problems.hasFilteredProblems()) > { > if (problems.hasErrors()) > @@ -410,12 +410,14 @@ public class MXMLJSC implements JSCompilerEntryPoint, > ProblemQueryProvider, > { > > project.getSourceCompilationUnitFactory().addHandler(asFileHandler); > > - if (!setupTargetFile()) > - return false; > - > - buildArtifact(); > + if (!((JSGoogConfiguration) config).getSkipTranspile()) > + { > + if (!setupTargetFile()) > + return false; > > - if (jsTarget != null) > + buildArtifact(); > + } > + if (jsTarget != null || ((JSGoogConfiguration) > config).getSkipTranspile()) > { > List<ICompilerProblem> errors = new > ArrayList<ICompilerProblem>(); > List<ICompilerProblem> warnings = new > ArrayList<ICompilerProblem>(); > @@ -432,54 +434,57 @@ public class MXMLJSC implements JSCompilerEntryPoint, > ProblemQueryProvider, > > File outputFolder = jsPublisher.getOutputFolder(); > > - ArrayList<ICompilationUnit> roots = new > ArrayList<ICompilationUnit>(); > - roots.add(mainCU); > - Set<ICompilationUnit> incs = > target.getIncludesCompilationUnits(); > - roots.addAll(incs); > - List<ICompilationUnit> reachableCompilationUnits = > project.getReachableCompilationUnitsInSWFOrder(roots); > - for (final ICompilationUnit cu : reachableCompilationUnits) > + if (!((JSGoogConfiguration) config).getSkipTranspile()) > { > - ICompilationUnit.UnitType cuType = > cu.getCompilationUnitType(); > - > - if (cuType == ICompilationUnit.UnitType.AS_UNIT > - || cuType == ICompilationUnit.UnitType.MXML_UNIT) > - { > - final File outputClassFile = getOutputClassFile( > - cu.getQualifiedNames().get(0), outputFolder); > - > - System.out.println("Compiling file: " + > outputClassFile); > - > - ICompilationUnit unit = cu; > - > - IJSWriter writer; > - if (cuType == ICompilationUnit.UnitType.AS_UNIT) > - { > - writer = (IJSWriter) > JSSharedData.backend.createWriter(project, > - errors, unit, false); > - } > - else > - { > - writer = (IJSWriter) > JSSharedData.backend.createMXMLWriter( > - project, errors, unit, false); > - } > - > - BufferedOutputStream out = new BufferedOutputStream( > - new FileOutputStream(outputClassFile)); > - > - File outputSourceMapFile = null; > - if (project.config.getSourceMap()) > - { > - outputSourceMapFile = getOutputSourceMapFile( > - cu.getQualifiedNames().get(0), > outputFolder); > - } > - > - writer.writeTo(out, outputSourceMapFile); > - out.flush(); > - out.close(); > - writer.close(); > - } > + ArrayList<ICompilationUnit> roots = new > ArrayList<ICompilationUnit>(); > + roots.add(mainCU); > + Set<ICompilationUnit> incs = > target.getIncludesCompilationUnits(); > + roots.addAll(incs); > + List<ICompilationUnit> reachableCompilationUnits = > project.getReachableCompilationUnitsInSWFOrder(roots); > + for (final ICompilationUnit cu : > reachableCompilationUnits) > + { > + ICompilationUnit.UnitType cuType = > cu.getCompilationUnitType(); > + > + if (cuType == ICompilationUnit.UnitType.AS_UNIT > + || cuType == > ICompilationUnit.UnitType.MXML_UNIT) > + { > + final File outputClassFile = getOutputClassFile( > + cu.getQualifiedNames().get(0), > outputFolder); > + > + System.out.println("Compiling file: " + > outputClassFile); > + > + ICompilationUnit unit = cu; > + > + IJSWriter writer; > + if (cuType == ICompilationUnit.UnitType.AS_UNIT) > + { > + writer = (IJSWriter) > JSSharedData.backend.createWriter(project, > + errors, unit, false); > + } > + else > + { > + writer = (IJSWriter) > JSSharedData.backend.createMXMLWriter( > + project, errors, unit, false); > + } > + > + BufferedOutputStream out = new > BufferedOutputStream( > + new FileOutputStream(outputClassFile)); > + > + File outputSourceMapFile = null; > + if (project.config.getSourceMap()) > + { > + outputSourceMapFile = > getOutputSourceMapFile( > + cu.getQualifiedNames().get(0), > outputFolder); > + } > + > + writer.writeTo(out, outputSourceMapFile); > + out.flush(); > + out.close(); > + writer.close(); > + } > + } > } > - > + > if (jsPublisher != null) > { > compilationSuccess = jsPublisher.publish(problems); > > http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3357a102/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java > ---------------------------------------------------------------------- > diff --git > a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java > > b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java > index 5f5387c..170a24b 100644 > --- > a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java > +++ > b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java > @@ -130,7 +130,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher > implements IJSPublisher > > // (erikdebruin) Marmotinni handles file management, so we > // bypass the setup. > - if (!isMarmotinniRun) > + if (!isMarmotinniRun && > !((JSGoogConfiguration)configuration).getSkipTranspile()) > setupOutputFolder(); > > return outputFolder; > @@ -162,12 +162,15 @@ public class MXMLFlexJSPublisher extends > JSGoogPublisher implements IJSPublisher > org.apache.commons.io.FileUtils.deleteQuietly(releaseDir); > } > > - if (!releaseDir.mkdirs()) > - { > - throw new IOException("Unable to create release directory at > " + releaseDir.getAbsolutePath()); > - } > + if (!configuration.debug()) > + { > + if (!releaseDir.mkdirs()) > + { > + throw new IOException("Unable to create release > directory at " + releaseDir.getAbsolutePath()); > + } > + } > } > - > + > // If the closure-lib parameter is empty we'll try to find the > resources > // in the classpath, dump its content to the output directory and use > // this > @@ -222,7 +225,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher > implements IJSPublisher > closureLibDirPath = ((JSGoogConfiguration) > configuration).getClosureLib(); > } > } > - > + > // Dump FlexJS to the target directory. > @SuppressWarnings("unused") > String flexJsLibDirPath; > @@ -273,18 +276,21 @@ public class MXMLFlexJSPublisher extends > JSGoogPublisher implements IJSPublisher > final String depsTgtFilePath = intermediateDirPath + "/deps.js"; > final String projectIntermediateJSFilePath = intermediateDirPath + > File.separator + outputFileName; > final String projectReleaseJSFilePath = releaseDirPath + > File.separator + outputFileName; > - > - appendExportSymbol(projectIntermediateJSFilePath, projectName); > - appendEncodedCSS(projectIntermediateJSFilePath, projectName); > - > - // if (!subsetGoog) > - // { > - // (erikdebruin) We need to leave the 'goog' files and dependencies > well > - // enough alone. We copy the entire library over so the > - // 'goog' dependencies will resolve without our help. > - FileUtils.copyDirectory(new File(closureGoogSrcLibDirPath), new > File(closureGoogTgtLibDirPath)); > - // } > - > + > + if (!((JSGoogConfiguration)configuration).getSkipTranspile()) > + { > + appendExportSymbol(projectIntermediateJSFilePath, projectName); > + appendEncodedCSS(projectIntermediateJSFilePath, projectName); > + > + // if (!subsetGoog) > + // { > + // (erikdebruin) We need to leave the 'goog' files and > dependencies well > + // enough alone. We copy the entire library over so the > + // 'goog' dependencies will resolve without our help. > + FileUtils.copyDirectory(new File(closureGoogSrcLibDirPath), new > File(closureGoogTgtLibDirPath)); > + // } > + } > + > JSClosureCompilerWrapper compilerWrapper = new > JSClosureCompilerWrapper(((JSGoogConfiguration) > configuration).getJSCompilerOptions()); > > List<ISWC> swcs = project.getLibraries(); > @@ -407,56 +413,64 @@ public class MXMLFlexJSPublisher extends > JSGoogPublisher implements IJSPublisher > IOFileFilter subdirs = > FileFilterUtils.or(DirectoryFileFilter.DIRECTORY, assetFiles); > > FileUtils.copyDirectory(srcDir, intermediateDir, subdirs); > - FileUtils.copyDirectory(srcDir, releaseDir, subdirs); > + if (!configuration.debug()) > + FileUtils.copyDirectory(srcDir, releaseDir, subdirs); > > - // File srcDeps = new File(depsSrcFilePath); > + // File srcDeps = new File(depsSrcFilePath); > > - writeHTML("intermediate", projectName, intermediateDirPath, > depsFileData.toString(), gdw.additionalHTML); > - writeHTML("release", projectName, releaseDirPath, null, > gdw.additionalHTML); > - if (project.needCSS) > + if (!((JSGoogConfiguration)configuration).getSkipTranspile()) > + writeHTML("intermediate", projectName, intermediateDirPath, > depsFileData.toString(), gdw.additionalHTML); > + if (!configuration.debug()) > + writeHTML("release", projectName, releaseDirPath, null, > gdw.additionalHTML); > + if (project.needCSS || > ((JSGoogConfiguration)configuration).getSkipTranspile()) > { > - writeCSS(projectName, intermediateDirPath); > - writeCSS(projectName, releaseDirPath); > + if (!((JSGoogConfiguration)configuration).getSkipTranspile()) > + writeCSS(projectName, intermediateDirPath); > + if (!configuration.debug()) > + FileUtils.copyFile(new File(intermediateDirPath + > File.separator + projectName + ".css"), > + new File(releaseDirPath + > File.separator + projectName + ".css")); > } > - > - /* > - * if (!subsetGoog) { // (erikdebruin) add 'goog' files > Collection<File> > - * files = org.apache.commons.io.FileUtils.listFiles(new File( > - * closureGoogTgtLibDirPath), new RegexFileFilter("^.*(\\.js)"), > - * DirectoryFileFilter.DIRECTORY); for (File file : files) { > - * compilerWrapper.addJSSourceFile(file.getCanonicalPath()); } } > - */ > - Collection<File> files = > org.apache.commons.io.FileUtils.listFiles(new File(closureGoogSrcLibDirPath), > - new RegexFileFilter("^.*(\\.js)"), > DirectoryFileFilter.DIRECTORY); > - for (File file : files) > + > + if (!configuration.debug()) > { > - compilerWrapper.addJSSourceFile(file.getCanonicalPath()); > + /* > + * if (!subsetGoog) { // (erikdebruin) add 'goog' files > Collection<File> > + * files = org.apache.commons.io.FileUtils.listFiles(new File( > + * closureGoogTgtLibDirPath), new RegexFileFilter("^.*(\\.js)"), > + * DirectoryFileFilter.DIRECTORY); for (File file : files) { > + * compilerWrapper.addJSSourceFile(file.getCanonicalPath()); } } > + */ > + Collection<File> files = > org.apache.commons.io.FileUtils.listFiles(new File(closureGoogSrcLibDirPath), > + new RegexFileFilter("^.*(\\.js)"), > DirectoryFileFilter.DIRECTORY); > + for (File file : files) > + { > + compilerWrapper.addJSSourceFile(file.getCanonicalPath()); > + } > + > + /* > + * // (erikdebruin) add project files for (String filePath : > + * gdw.filePathsInOrder) { compilerWrapper.addJSSourceFile( new > + * File(filePath).getCanonicalPath()); } > + */ > + > + compilerWrapper.setOptions(projectReleaseJSFilePath, > useStrictPublishing, projectName); > + > + /* > + * // (erikdebruin) Include the 'goog' deps to allow the > compiler to > + * resolve // dependencies. compilerWrapper.addJSSourceFile( > + * closureGoogSrcLibDirPath + File.separator + "deps.js"); > + */ > + List<String> externs = ((JSGoogConfiguration) > configuration).getExternalJSLib(); > + for (String extern : externs) > + { > + compilerWrapper.addJSExternsFile(extern); > + } > + > + compilerWrapper.targetFilePath = projectReleaseJSFilePath; > + compilerWrapper.compile(); > + > + appendSourceMapLocation(projectReleaseJSFilePath, projectName); > } > - > - /* > - * // (erikdebruin) add project files for (String filePath : > - * gdw.filePathsInOrder) { compilerWrapper.addJSSourceFile( new > - * File(filePath).getCanonicalPath()); } > - */ > - > - compilerWrapper.setOptions(projectReleaseJSFilePath, > useStrictPublishing, projectName); > - > - /* > - * // (erikdebruin) Include the 'goog' deps to allow the compiler to > - * resolve // dependencies. compilerWrapper.addJSSourceFile( > - * closureGoogSrcLibDirPath + File.separator + "deps.js"); > - */ > - List<String> externs = ((JSGoogConfiguration) > configuration).getExternalJSLib(); > - for (String extern : externs) > - { > - compilerWrapper.addJSExternsFile(extern); > - } > - > - compilerWrapper.targetFilePath = projectReleaseJSFilePath; > - compilerWrapper.compile(); > - > - appendSourceMapLocation(projectReleaseJSFilePath, projectName); > - > /* > * if (!isMarmotinniRun) { String allDeps = ""; if (!subsetGoog) { > * allDeps += FileUtils.readFileToString(srcDeps); } allDeps += > > http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3357a102/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java > ---------------------------------------------------------------------- > diff --git > a/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java > > b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java > index 0f03323..6eb1037 100644 > --- > a/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java > +++ > b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java > @@ -256,6 +256,26 @@ public class JSGoogConfiguration extends JSConfiguration > } > > > + // > + // 'skip-transpile' > + // > + > + private boolean skipTranspile = false; > + > + public boolean getSkipTranspile() > + { > + return skipTranspile; > + } > + > + @Config > + @Mapping("skip-transpile") > + public void setSkipTranspile(ConfigurationValue cv, boolean value) > + throws ConfigurationException > + { > + skipTranspile = value; > + } > + > + > > protected String getAbsolutePathFromPathRelativeToMXMLC(String > relativePath) > throws IOException >