You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pi...@apache.org on 2017/08/19 12:42:22 UTC
[1/9] git commit: [flex-falcon] [refs/heads/feature/amf] - initial
support for modules
Repository: flex-falcon
Updated Branches:
refs/heads/feature/amf 7bc6f7025 -> f422c99c4
initial support for modules
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f8b724e4
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f8b724e4
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f8b724e4
Branch: refs/heads/feature/amf
Commit: f8b724e46af9a8d7916bdb95a44369eab7273121
Parents: 7edc034
Author: Alex Harui <ah...@apache.org>
Authored: Tue Aug 15 10:20:53 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Aug 15 10:23:24 2017 -0700
----------------------------------------------------------------------
.../javascript/jscomp/CompilerMapFetcher.java | 53 +++++
.../mxml/flexjs/MXMLFlexJSPublisher.java | 91 +++++++--
.../utils/JSClosureCompilerWrapper.java | 204 ++++++++++++++++++-
3 files changed, 329 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f8b724e4/compiler-jx/src/main/java/com/google/javascript/jscomp/CompilerMapFetcher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/com/google/javascript/jscomp/CompilerMapFetcher.java b/compiler-jx/src/main/java/com/google/javascript/jscomp/CompilerMapFetcher.java
new file mode 100644
index 0000000..5fbb7ae
--- /dev/null
+++ b/compiler-jx/src/main/java/com/google/javascript/jscomp/CompilerMapFetcher.java
@@ -0,0 +1,53 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package com.google.javascript.jscomp;
+
+public class CompilerMapFetcher
+{
+
+ private static final long serialVersionUID = 2021530437904249081L;
+
+ public CompilerMapFetcher()
+ {
+ super();
+ }
+
+ public static VariableMap getVariableMap(Compiler compiler)
+ {
+ return compiler.getVariableMap();
+ }
+
+ public static VariableMap getPropertyMap(Compiler compiler)
+ {
+ return compiler.getPropertyMap();
+ }
+
+ public static void setVariableMap(CompilerOptions options, VariableMap input)
+ {
+ options.inputVariableMap = input;
+ }
+
+ public static void setPropertyMap(CompilerOptions options, VariableMap input)
+ {
+ options.inputPropertyMap = input;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f8b724e4/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index a46c9ba..0683573 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -323,24 +323,35 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
// is generated here so it can be used for outputting the html templates.
String depsFileData = gdw.generateDeps(project, problems);
- File template = ((JSGoogConfiguration)configuration).getHtmlTemplate();
- // Create the index.html for the debug-js version.
- if (!((JSGoogConfiguration)configuration).getSkipTranspile()) {
- if (template != null) {
- writeTemplate(template, "intermediate", projectName, intermediateDir, depsFileData, gdw.additionalHTML);
- } else {
- writeHTML("intermediate", projectName, intermediateDir, depsFileData, gdw.additionalHTML);
- }
- }
- // Create the index.html for the release-js version.
- if (configuration.release()) {
- if (template != null) {
- writeTemplate(template, "release", projectName, releaseDir, depsFileData, gdw.additionalHTML);
- } else {
- writeHTML("release", projectName, releaseDir, null, gdw.additionalHTML);
- }
+ if (depsFileData.contains("UIModule.js"))
+ {
+ // need better test someday
+ depsFileData += "\ngoog.require('" + projectName + "');\n";
+ writeFile(new File(intermediateDir, projectName + "__deps.js"), depsFileData, false);
+ Set<String> provideds = computeProvideds(depsFileData);
+ compilerWrapper.setProvideds(provideds);
+ gdw.needCSS = true;
}
-
+ else
+ {
+ File template = ((JSGoogConfiguration)configuration).getHtmlTemplate();
+ // Create the index.html for the debug-js version.
+ if (!((JSGoogConfiguration)configuration).getSkipTranspile()) {
+ if (template != null) {
+ writeTemplate(template, "intermediate", projectName, intermediateDir, depsFileData, gdw.additionalHTML);
+ } else {
+ writeHTML("intermediate", projectName, intermediateDir, depsFileData, gdw.additionalHTML);
+ }
+ }
+ // Create the index.html for the release-js version.
+ if (configuration.release()) {
+ if (template != null) {
+ writeTemplate(template, "release", projectName, releaseDir, depsFileData, gdw.additionalHTML);
+ } else {
+ writeHTML("release", projectName, releaseDir, null, gdw.additionalHTML);
+ }
+ }
+ }
/////////////////////////////////////////////////////////////////////////////////
// Generate or copy the main CSS resources.
@@ -378,6 +389,23 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
return true;
}
+ private Set<String> computeProvideds(String data)
+ {
+ HashSet<String> set = new HashSet<String>();
+ String[] lines = data.split("\n");
+ for (String line : lines)
+ {
+ int c = line.indexOf("['");
+ if (c != -1)
+ {
+ int c2 = line.indexOf("'", c + 2);
+ String name = line.substring(c + 2, c2);
+ set.add(name);
+ }
+ }
+ return set;
+ }
+
protected List<SourceFile> closureFilesInOrder(String path, List<SourceFile> files, String entryPoint)
{
ArrayList<String> sortedFiles = new ArrayList<String>();
@@ -768,6 +796,11 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
return true;
}
+ private String[] reservedFunctions = {
+ "org['apache']['flex']['core']['UIBase'] = function(){};",
+ "org['apache']['flex']['html']['Label'] = function(){};",
+ };
+
private void writeExportedNames(JSClosureCompilerWrapper compilerWrapper)
{
if (!googConfiguration.getExportPublicSymbols())
@@ -801,6 +834,30 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
compilerWrapper.addJSExternsFile(exportsFile.getAbsolutePath());
}
}
+ else
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("/**\n");
+ sb.append(" * generated by Apache FlexJS compiler\n");
+ sb.append(" * @externs\n");
+ sb.append(" */\n");
+ for (String name : reservedFunctions)
+ {
+ sb.append("\n\n");
+ sb.append("/**\n");
+ sb.append(" */\n");
+ sb.append(name + "\n");
+ }
+ File exportsFile = new File(outputFolder, "dontrename.js");
+ try {
+ writeFile(exportsFile, sb.toString(), false);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //compilerWrapper.addJSExternsFile(exportsFile.getAbsolutePath());
+
+ }
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f8b724e4/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
index 42ad2b3..05c791b 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
@@ -19,18 +19,26 @@
package org.apache.flex.compiler.utils;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.logging.Level;
import com.google.javascript.jscomp.CheckLevel;
import com.google.javascript.jscomp.CommandLineRunner;
import com.google.javascript.jscomp.CompilationLevel;
import com.google.javascript.jscomp.Compiler;
+import com.google.javascript.jscomp.CompilerMapFetcher;
import com.google.javascript.jscomp.CompilerOptions;
import com.google.javascript.jscomp.CompilerOptions.LanguageMode;
import com.google.javascript.jscomp.DependencyOptions;
@@ -39,6 +47,7 @@ import com.google.javascript.jscomp.FlexJSDiagnosticGroups;
import com.google.javascript.jscomp.ModuleIdentifier;
import com.google.javascript.jscomp.SourceFile;
import com.google.javascript.jscomp.SourceMap;
+import com.google.javascript.jscomp.VariableMap;
import com.google.javascript.jscomp.WarningLevel;
public class JSClosureCompilerWrapper
@@ -49,7 +58,8 @@ public class JSClosureCompilerWrapper
Compiler.setLoggingLevel(Level.INFO);
compiler_ = new Compiler();
-
+ filterOptions(args);
+
ArrayList<String> splitArgs = new ArrayList<String>();
for (String s : args)
{
@@ -77,6 +87,11 @@ public class JSClosureCompilerWrapper
private CompilerOptions options_;
private List<SourceFile> jsExternsFiles_;
private List<SourceFile> jsSourceFiles_;
+ private String variableMapOutputPath;
+ private String propertyMapOutputPath;
+ private String variableMapInputPath;
+ private String propertyMapInputPath;
+ private Set<String> provideds;
public String targetFilePath;
@@ -100,12 +115,45 @@ public class JSClosureCompilerWrapper
jsSourceFiles_.add(file);
}
+ public void setProvideds(Set<String> set)
+ {
+ provideds = set;
+ }
+
public void compile()
{
System.out.println("list of source files");
for (SourceFile file : jsSourceFiles_)
System.out.println(file.getName());
System.out.println("end of list of source files");
+ File outputFolder = new File(targetFilePath).getParentFile();
+ if (variableMapInputPath != null)
+ {
+ File inputFile = new File(outputFolder, variableMapInputPath);
+ try {
+ VariableMap map = VariableMap.load(inputFile.getAbsolutePath());
+ CompilerMapFetcher.setVariableMap(options_, map);
+ Set<String> usedVars = getUsedVars(inputFile);
+ compiler_.addExportedNames(usedVars);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ if (propertyMapInputPath != null)
+ {
+ File inputFile = new File(outputFolder, propertyMapInputPath);
+ try {
+ VariableMap map = VariableMap.load(inputFile.getAbsolutePath());
+ CompilerMapFetcher.setPropertyMap(options_, map);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
compiler_.compile(jsExternsFiles_, jsSourceFiles_, options_);
try
@@ -123,6 +171,30 @@ public class JSClosureCompilerWrapper
System.out.println(error);
}
+ if (variableMapOutputPath != null)
+ {
+ File outputFile = new File(outputFolder, variableMapOutputPath);
+ VariableMap map = CompilerMapFetcher.getVariableMap(compiler_);
+ try {
+ map.save(outputFile.getAbsolutePath());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ if (propertyMapOutputPath != null)
+ {
+ File outputFile = new File(outputFolder, propertyMapOutputPath);
+ VariableMap map = CompilerMapFetcher.getPropertyMap(compiler_);
+ try {
+ map.save(outputFile.getAbsolutePath());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
/*
for (JSError message : compiler_.getWarnings())
{
@@ -136,6 +208,64 @@ public class JSClosureCompilerWrapper
*/
}
+ private Set<String> getUsedVars(File file)
+ {
+ HashMap<String, String> vars = new HashMap<String, String>();
+
+ try
+ {
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8"));
+
+ String line = in.readLine();
+
+ while (line != null)
+ {
+ int c = line.indexOf(":");
+ if (c != -1)
+ {
+ String name = line.substring(0, c);
+
+ String var = line.substring(c + 1).trim();
+ vars.put(name, var);
+ }
+ line = in.readLine();
+ }
+
+ // remove all vars that are used by this module
+ // that way they will re-use the names in the
+ // loader
+ for (String name : provideds)
+ {
+ name = name.replace('.', '$');
+ Set<String> keys = vars.keySet();
+ ArrayList<String> remKeys = new ArrayList<String>();
+ for (String key : keys)
+ {
+ if (key.contains(name))
+ {
+ remKeys.add(key);
+ }
+ }
+ for (String key : remKeys)
+ {
+ vars.remove(key);
+ }
+ }
+ in.close();
+ }
+ catch (Exception e)
+ {
+ // nothing to see, move along...
+ }
+ HashSet<String> usedVars = new HashSet<String>();
+ Set<String> keys = vars.keySet();
+ for (String key : keys)
+ {
+ usedVars.add(vars.get(key));
+ }
+ return usedVars;
+ }
+
@SuppressWarnings( "deprecation" )
private void initExterns()
{
@@ -153,10 +283,62 @@ public class JSClosureCompilerWrapper
}
}
+ private void filterOptions(List<String> args)
+ {
+ final String PROPERTY_MAP = "--property_map_output_file ";
+ final String VARIABLE_MAP = "--variable_map_output_file ";
+ final String PROPERTY_INPUT_MAP = "--property_map_input_file ";
+ final String VARIABLE_INPUT_MAP = "--variable_map_input_file ";
+ String propEntry = null;
+ String varEntry = null;
+ String propInputEntry = null;
+ String varInputEntry = null;
+
+ for (String s : args)
+ {
+ if (s.startsWith(PROPERTY_MAP))
+ {
+ propEntry = s;
+ propertyMapOutputPath = s.substring(PROPERTY_MAP.length());
+ }
+
+ if (s.startsWith(PROPERTY_INPUT_MAP))
+ {
+ propInputEntry = s;
+ propertyMapInputPath = s.substring(PROPERTY_INPUT_MAP.length());
+ }
+
+ if (s.startsWith(VARIABLE_MAP))
+ {
+ varEntry = s;
+ variableMapOutputPath = s.substring(VARIABLE_MAP.length());
+ }
+
+ if (s.startsWith(VARIABLE_INPUT_MAP))
+ {
+ varInputEntry = s;
+ variableMapInputPath = s.substring(VARIABLE_INPUT_MAP.length());
+ }
+ }
+ if (varEntry != null)
+ args.remove(varEntry);
+ if (propEntry != null)
+ args.remove(propEntry);
+ if (varInputEntry != null)
+ args.remove(varInputEntry);
+ if (propInputEntry != null)
+ args.remove(propInputEntry);
+
+ }
+
private void initOptions(List<String> args)
{
final String JS_FLAG = "--js ";
-
+ final String PROPERTY_MAP = "--property_map_output_file ";
+ final String VARIABLE_MAP = "--variable_map_output_file ";
+ String propEntry = null;
+ String varEntry = null;
+
boolean hasCompilationLevel = false;
boolean hasWarningLevel = false;
for (String s : args)
@@ -171,7 +353,25 @@ public class JSClosureCompilerWrapper
if (s.startsWith("--warning_level ") ||
s.startsWith("-W "))
hasWarningLevel = true;
+
+ if (s.startsWith(PROPERTY_MAP))
+ {
+ propEntry = s;
+ propertyMapOutputPath = s.substring(PROPERTY_MAP.length());
+ }
+
+ if (s.startsWith(VARIABLE_MAP))
+ {
+ varEntry = s;
+ variableMapOutputPath = s.substring(VARIABLE_MAP.length());
+ }
+
}
+ if (varEntry != null)
+ args.remove(varEntry);
+ if (propEntry != null)
+ args.remove(propEntry);
+
if (!hasCompilationLevel)
CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(
options_);
[3/9] git commit: [flex-falcon] [refs/heads/feature/amf] - try to fix
maven build
Posted by pi...@apache.org.
try to fix maven build
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1abf6439
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1abf6439
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1abf6439
Branch: refs/heads/feature/amf
Commit: 1abf6439b5754ada9c78c8767e7292c7e941037c
Parents: c8cb855
Author: Alex Harui <ah...@apache.org>
Authored: Wed Aug 16 18:57:25 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Aug 16 18:57:35 2017 -0700
----------------------------------------------------------------------
.../flex/compiler/internal/codegen/js/jx/LiteralEmitter.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1abf6439/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
index 5cd6a48..ed780e5 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
@@ -169,8 +169,10 @@ public class LiteralEmitter extends JSSubEmitter implements
s = s.replace("'", "\\'");
s = "'" + s + "'";
}
+ s = s.replace("\u00A0", "\\u00A0");
s = s.replace("\u2028", "\\u2028");
s = s.replace("\u2029", "\\u2029");
+ s = s.replace("\u3000", "\\u3000");
}
}
[5/9] git commit: [flex-falcon] [refs/heads/feature/amf] - use
IModule to detect Module compilation
Posted by pi...@apache.org.
use IModule to detect Module compilation
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/9539c83f
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/9539c83f
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/9539c83f
Branch: refs/heads/feature/amf
Commit: 9539c83f6d024eb04a4f7bbbc725518752691180
Parents: 9cf18a0
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 18 08:46:22 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 18 08:46:22 2017 -0700
----------------------------------------------------------------------
.../mxml/flexjs/MXMLFlexJSPublisher.java | 31 +-------------------
.../internal/projects/FlexJSProject.java | 20 +++++++++++++
2 files changed, 21 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9539c83f/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 0683573..69167e4 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -323,7 +323,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
// is generated here so it can be used for outputting the html templates.
String depsFileData = gdw.generateDeps(project, problems);
- if (depsFileData.contains("UIModule.js"))
+ if (project.isModule(projectName))
{
// need better test someday
depsFileData += "\ngoog.require('" + projectName + "');\n";
@@ -796,11 +796,6 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
return true;
}
- private String[] reservedFunctions = {
- "org['apache']['flex']['core']['UIBase'] = function(){};",
- "org['apache']['flex']['html']['Label'] = function(){};",
- };
-
private void writeExportedNames(JSClosureCompilerWrapper compilerWrapper)
{
if (!googConfiguration.getExportPublicSymbols())
@@ -834,30 +829,6 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
compilerWrapper.addJSExternsFile(exportsFile.getAbsolutePath());
}
}
- else
- {
- StringBuilder sb = new StringBuilder();
- sb.append("/**\n");
- sb.append(" * generated by Apache FlexJS compiler\n");
- sb.append(" * @externs\n");
- sb.append(" */\n");
- for (String name : reservedFunctions)
- {
- sb.append("\n\n");
- sb.append("/**\n");
- sb.append(" */\n");
- sb.append(name + "\n");
- }
- File exportsFile = new File(outputFolder, "dontrename.js");
- try {
- writeFile(exportsFile, sb.toString(), false);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- //compilerWrapper.addJSExternsFile(exportsFile.getAbsolutePath());
-
- }
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9539c83f/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java
index 8c2b232..4d905bf 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java
@@ -35,8 +35,11 @@ import org.apache.flex.compiler.config.Configurator;
import org.apache.flex.compiler.css.ICSSMediaQueryCondition;
import org.apache.flex.compiler.css.ICSSRule;
import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.definitions.ITypeDefinition;
import org.apache.flex.compiler.definitions.metadata.IMetaTag;
import org.apache.flex.compiler.definitions.metadata.IMetaTagAttribute;
+import org.apache.flex.compiler.definitions.references.IResolvedQualifiersReference;
+import org.apache.flex.compiler.definitions.references.ReferenceFactory;
import org.apache.flex.compiler.driver.IBackend;
import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitterTokens;
import org.apache.flex.compiler.internal.css.codegen.CSSCompilationSession;
@@ -51,6 +54,7 @@ import org.apache.flex.compiler.internal.tree.mxml.MXMLDocumentNode;
import org.apache.flex.compiler.internal.tree.mxml.MXMLFileNode;
import org.apache.flex.compiler.internal.units.SWCCompilationUnit;
import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.mxml.IMXMLTypeConstants;
import org.apache.flex.compiler.targets.ITargetSettings;
import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.as.IDefinitionNode;
@@ -443,4 +447,20 @@ public class FlexJSProject extends FlexProject
{
return exportedNames;
}
+
+ public boolean isModule(String mainClass)
+ {
+ IResolvedQualifiersReference iModuleRef = ReferenceFactory.packageQualifiedReference(
+ getWorkspace(), "org.apache.flex.core.IModule");
+ ITypeDefinition moddef = (ITypeDefinition)iModuleRef.resolve(this);
+ IResolvedQualifiersReference mainRef = ReferenceFactory.packageQualifiedReference(
+ getWorkspace(), mainClass);
+ IDefinition maindef = mainRef.resolve(this);
+ if (maindef instanceof ITypeDefinition)
+ {
+ ITypeDefinition type = (ITypeDefinition)maindef;
+ return type.isInstanceOf(moddef, this);
+ }
+ return false;
+ }
}
[6/9] git commit: [flex-falcon] [refs/heads/feature/amf] - This looks
like an omission of something that was intended to be configurable.
Posted by pi...@apache.org.
This looks like an omission of something that was intended to be configurable.
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/96a358c5
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/96a358c5
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/96a358c5
Branch: refs/heads/feature/amf
Commit: 96a358c579bafba3cb1f9cd66de0fefc65cbaca0
Parents: 1abf643
Author: greg-dove <gr...@gmail.com>
Authored: Sat Aug 19 18:38:13 2017 +1200
Committer: greg-dove <gr...@gmail.com>
Committed: Sat Aug 19 18:38:13 2017 +1200
----------------------------------------------------------------------
.../src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/96a358c5/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
----------------------------------------------------------------------
diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
index d8c5ded..93298f5 100644
--- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
+++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
@@ -95,7 +95,7 @@ public class CompileAppMojo
throw new MojoExecutionException("Could not find main class");
}
List<String> args = super.getCompilerArgs(configFile);
- File jsOutput = new File(outputDirectory, "javascript");
+ File jsOutput = new File(outputDirectory, javascriptOutputDirectoryName);
args.add("-js-output=" + jsOutput.getAbsolutePath());
args.add("-compiler.targets=" + targets);
args.add(mainClassPath);
[7/9] git commit: [flex-falcon] [refs/heads/feature/amf] - Saw an
issue with TestFlexJSExpressions::testVisitStringLiteralChinese in ant build
This appears to fix it.
Posted by pi...@apache.org.
Saw an issue with TestFlexJSExpressions::testVisitStringLiteralChinese in ant build
This appears to fix it.
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/14578bdb
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/14578bdb
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/14578bdb
Branch: refs/heads/feature/amf
Commit: 14578bdbce0a764f8fedef4d2d0fc69e0451eef7
Parents: 96a358c
Author: greg-dove <gr...@gmail.com>
Authored: Sat Aug 19 18:39:28 2017 +1200
Committer: greg-dove <gr...@gmail.com>
Committed: Sat Aug 19 18:39:28 2017 +1200
----------------------------------------------------------------------
compiler-jx/src/test/build.xml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/14578bdb/compiler-jx/src/test/build.xml
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/build.xml b/compiler-jx/src/test/build.xml
index fad70f4..9c36f30 100644
--- a/compiler-jx/src/test/build.xml
+++ b/compiler-jx/src/test/build.xml
@@ -40,7 +40,9 @@
<target name="compile.unit.tests">
<delete dir="${compiler}/target/test-classes"/>
<mkdir dir="${compiler}/target/test-classes"/>
- <javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${compiler}/target/test-classes" includeAntRuntime="true">
+ <javac debug="${javac.debug}" deprecation="${javac.deprecation}"
+ encoding="UTF-8"
+ destdir="${compiler}/target/test-classes" includeAntRuntime="true">
<src path="${compiler.tests}/java"/>
<compilerarg value="-Xlint:all,-path"/>
<classpath>
@@ -60,6 +62,7 @@
printsummary="true" showoutput="true"
haltonerror="true" haltonfailure="true"
failureproperty="tests.unit.failed">
+ <jvmarg value="-Dfile.encoding=UTF-8"/>
<classpath>
<pathelement location="${compiler}/target/test-classes"/>
<pathelement location="${compiler}/../compiler-test-utils/target/classes"/>
@@ -100,6 +103,7 @@
printsummary="true" showoutput="true"
haltonerror="true" haltonfailure="true"
failureproperty="tests.unit.failed">
+ <jvmarg value="-Dfile.encoding=UTF-8"/>
<classpath>
<pathelement location="${compiler}/target/test-classes"/>
<pathelement location="${compiler}/../compiler-test-utils/target/classes"/>
[4/9] git commit: [flex-falcon] [refs/heads/feature/amf] - fix using
_id instead of id for JS localId output
Posted by pi...@apache.org.
fix using _id instead of id for JS localId output
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/9cf18a06
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/9cf18a06
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/9cf18a06
Branch: refs/heads/feature/amf
Commit: 9cf18a060d20036ff2015efd6803f5b6769795c6
Parents: 1abf643
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 18 08:43:35 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 18 08:43:35 2017 -0700
----------------------------------------------------------------------
.../mxml/flexjs/MXMLDescriptorSpecifier.java | 14 ++++++++-----
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 21 ++++++++++----------
2 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9cf18a06/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java
index 9eac5d5..36d6d48 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java
@@ -88,6 +88,12 @@ public class MXMLDescriptorSpecifier extends MXMLNodeSpecifier
public String id;
//---------------------------------
+ // effectiveId
+ //---------------------------------
+
+ public String effectiveId;
+
+ //---------------------------------
// isTopNode
//---------------------------------
@@ -177,17 +183,15 @@ public class MXMLDescriptorSpecifier extends MXMLNodeSpecifier
}
}
- if (id != null)
+ if (id != null || effectiveId != null)
{
write(propertySpecifiers.size() + 1 + "");
writeDelimiter(writeNewline);
- boolean isEffectiveID = id.startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX.getToken()) ||
- id.startsWith(MXMLFlexJSEmitterTokens.BINDING_PREFIX.getToken());
- String idPropName = (isEffectiveID) ? "_id"
+ String idPropName = (effectiveId != null) ? "_id"
: "id";
writeSimpleDescriptor(idPropName, ASEmitterTokens.TRUE.getToken(),
ASEmitterTokens.SINGLE_QUOTE.getToken()
- + id + ASEmitterTokens.SINGLE_QUOTE.getToken(),
+ + ((id != null) ? id : effectiveId) + ASEmitterTokens.SINGLE_QUOTE.getToken(),
writeNewline);
writeDelimiter(writeNewline);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9cf18a06/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 56b49e1..77bbf52 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -948,8 +948,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
for (MXMLDescriptorSpecifier instance : instances)
{
- if (!instance.id.startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX
- .getToken()))
+ if (instance.id != null)
{
PackageFooterEmitter.AccessorData data = asEmitter.packageFooterEmitter.new AccessorData();
accessorData.add(data);
@@ -1122,7 +1121,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
writeNewline(" */");
write(ASEmitterTokens.THIS);
write(ASEmitterTokens.MEMBER_ACCESS);
- write(instance.id + "_");
+ write((instance.id != null ? instance.id : instance.effectiveId) + "_");
writeNewline(ASEmitterTokens.SEMICOLON);
}
}
@@ -1600,8 +1599,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
int n = 0;
for (MXMLDescriptorSpecifier instance : instances)
{
- if (!instance.id.startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX
- .getToken()))
+ if (instance.id != null)
{
n++;
}
@@ -1618,8 +1616,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
int i = 0;
for (MXMLDescriptorSpecifier instance : instances)
{
- if (!instance.id.startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX
- .getToken()))
+ if (instance.id != null)
{
indentPush();
writeNewline("/** @export */");
@@ -1792,15 +1789,19 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
MXMLDescriptorSpecifier currentPropertySpecifier = getCurrentDescriptor("ps");
+ String effectiveId = null;
String id = node.getID();
if (id == null)
- id = node.getEffectiveID();
- if (id == null)
- id = MXMLFlexJSEmitterTokens.ID_PREFIX.getToken() + idCounter++;
+ {
+ effectiveId = node.getEffectiveID();
+ if (effectiveId == null)
+ effectiveId = MXMLFlexJSEmitterTokens.ID_PREFIX.getToken() + idCounter++;
+ }
MXMLDescriptorSpecifier currentInstance = new MXMLDescriptorSpecifier();
currentInstance.isProperty = false;
currentInstance.id = id;
+ currentInstance.effectiveId = effectiveId;
currentInstance.name = formatQualifiedName(cdef.getQualifiedName());
currentInstance.parent = currentPropertySpecifier;
[2/9] git commit: [flex-falcon] [refs/heads/feature/amf] - allow ';
' as separator between multiple additional compiler options
Posted by pi...@apache.org.
allow ';' as separator between multiple additional compiler options
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/c8cb8557
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/c8cb8557
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/c8cb8557
Branch: refs/heads/feature/amf
Commit: c8cb855769e64ef7c7e950170d50a8913c87a34e
Parents: f8b724e
Author: Alex Harui <ah...@apache.org>
Authored: Wed Aug 16 10:09:35 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Aug 16 10:09:35 2017 -0700
----------------------------------------------------------------------
.../main/java/org/apache/flex/maven/flexjs/BaseMojo.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c8cb8557/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/BaseMojo.java
----------------------------------------------------------------------
diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/BaseMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/BaseMojo.java
index 40f05be..c79c232 100644
--- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/BaseMojo.java
+++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/BaseMojo.java
@@ -236,7 +236,16 @@ public abstract class BaseMojo
List<String> args = new LinkedList<String>();
args.add("-load-config=" + configFile.getPath());
if(additionalCompilerOptions != null) {
- args.add(additionalCompilerOptions);
+ if (additionalCompilerOptions.contains(";"))
+ {
+ String[] options = additionalCompilerOptions.split(";");
+ for (String option : options)
+ {
+ args.add(option);
+ }
+ }
+ else
+ args.add(additionalCompilerOptions);
}
return args;
}
[9/9] git commit: [flex-falcon] [refs/heads/feature/amf] - Merge
branch 'develop' into feature/amf
Posted by pi...@apache.org.
Merge branch 'develop' into feature/amf
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f422c99c
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f422c99c
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f422c99c
Branch: refs/heads/feature/amf
Commit: f422c99c4e1f72cf33e5c894c2d127a274d7bc52
Parents: 7bc6f70 1b3b89a
Author: piotrz <pi...@apache.org>
Authored: Sat Aug 19 14:41:40 2017 +0200
Committer: piotrz <pi...@apache.org>
Committed: Sat Aug 19 14:41:40 2017 +0200
----------------------------------------------------------------------
.../javascript/jscomp/CompilerMapFetcher.java | 53 +++++
.../internal/codegen/js/jx/LiteralEmitter.java | 2 +
.../mxml/flexjs/MXMLDescriptorSpecifier.java | 14 +-
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 21 +-
.../mxml/flexjs/MXMLFlexJSPublisher.java | 62 ++++--
.../internal/projects/FlexJSProject.java | 20 ++
.../utils/JSClosureCompilerWrapper.java | 204 ++++++++++++++++++-
compiler-jx/src/test/build.xml | 6 +-
.../org/apache/flex/maven/flexjs/BaseMojo.java | 11 +-
.../flex/maven/flexjs/CompileAppMojo.java | 2 +-
10 files changed, 358 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
[8/9] git commit: [flex-falcon] [refs/heads/feature/amf] - Merge
branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-falcon into
develop
Posted by pi...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-falcon into develop
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1b3b89aa
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1b3b89aa
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1b3b89aa
Branch: refs/heads/feature/amf
Commit: 1b3b89aa80d1da03ad375beeef9ed4d015be1dba
Parents: 14578bd 9539c83
Author: greg-dove <gr...@gmail.com>
Authored: Sat Aug 19 18:39:46 2017 +1200
Committer: greg-dove <gr...@gmail.com>
Committed: Sat Aug 19 18:39:46 2017 +1200
----------------------------------------------------------------------
.../mxml/flexjs/MXMLDescriptorSpecifier.java | 14 +++++----
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 21 ++++++-------
.../mxml/flexjs/MXMLFlexJSPublisher.java | 31 +-------------------
.../internal/projects/FlexJSProject.java | 20 +++++++++++++
4 files changed, 41 insertions(+), 45 deletions(-)
----------------------------------------------------------------------