Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BBE0D19649 for ; Fri, 22 Apr 2016 13:13:14 +0000 (UTC) Received: (qmail 61069 invoked by uid 500); 22 Apr 2016 13:13:14 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 60966 invoked by uid 500); 22 Apr 2016 13:13:14 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 60874 invoked by uid 99); 22 Apr 2016 13:13:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Apr 2016 13:13:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 65004E176D; Fri, 22 Apr 2016 13:13:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: cdutz@apache.org To: commits@flex.apache.org Date: Fri, 22 Apr 2016 13:13:16 -0000 Message-Id: <807fef4599a14b4c862a0876cf6aaf7f@git.apache.org> In-Reply-To: <72e66e176a0e47cb8d9ac8fa6c2cacac@git.apache.org> References: <72e66e176a0e47cb8d9ac8fa6c2cacac@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/6] git commit: [flex-falcon] [refs/heads/feature/maven-migration-test] - compiler.jx: externc now supports a -named-module argument that will output JSModule metadata for classes in the same base package as the module name compiler.jx: externc now supports a -named-module argument that will output JSModule metadata for classes in the same base package as the module name Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/bfb462c6 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/bfb462c6 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/bfb462c6 Branch: refs/heads/feature/maven-migration-test Commit: bfb462c6d6460d2bbace8032ba5e66867636030b Parents: 021fa66 Author: Josh Tynjala Authored: Thu Apr 21 13:12:39 2016 -0700 Committer: Josh Tynjala Committed: Thu Apr 21 13:12:39 2016 -0700 ---------------------------------------------------------------------- .../compiler/clients/ExternCConfiguration.java | 54 ++++++++++++++++++++ .../externals/reference/ClassReference.java | 30 ++++++++++- 2 files changed, 83 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bfb462c6/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java b/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java index c15786a..c6e7212 100644 --- a/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java +++ b/compiler.jx/src/org/apache/flex/compiler/clients/ExternCConfiguration.java @@ -56,6 +56,8 @@ public class ExternCConfiguration extends Configuration private List externals = new ArrayList(); private List externalExterns = new ArrayList(); + private List namedModules = new ArrayList(); + private List classToFunctions = new ArrayList(); private List excludesClass = new ArrayList(); private List excludesField = new ArrayList(); @@ -295,6 +297,58 @@ public class ExternCConfiguration extends Configuration excludesClass.add(new ExcludedMember(className, null, "")); } + @Config(allowMultiple = true) + @Mapping("named-module") + @Arguments("module") + @InfiniteArguments + public void setNamedModules(ConfigurationValue cfgval, List values) + { + for (String moduleName : values) + { + addNamedModule(moduleName); + } + } + public void addNamedModule(String moduleName) + { + namedModules.add(moduleName); + } + + public String isNamedModule(ClassReference classReference) + { + String basePackageName = classReference.getPackageName(); + int packageIndex = basePackageName.indexOf("."); + if (packageIndex != -1) + { + basePackageName = basePackageName.substring(0, packageIndex); + } + for (String module : namedModules) + { + //convert to camel case + String camelCaseModule = module; + int moduleIndex = camelCaseModule.indexOf("-"); + while (moduleIndex != -1 && moduleIndex < camelCaseModule.length() - 1) + { + camelCaseModule = camelCaseModule.substring(0, moduleIndex) + + camelCaseModule.substring(moduleIndex + 1, moduleIndex + 2).toUpperCase() + + camelCaseModule.substring(moduleIndex + 2); + moduleIndex = camelCaseModule.indexOf("-"); + } + if(basePackageName.length() == 0) + { + if (classReference.getBaseName().equals(camelCaseModule)) + { + return module; + } + continue; + } + if(basePackageName.equals(camelCaseModule)) + { + return module; + } + } + return null; + } + public File getJsRoot() { return jsRoot; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bfb462c6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java index b04fb0e..fc1df39 100644 --- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java +++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java @@ -41,6 +41,7 @@ public class ClassReference extends BaseReference { private boolean isFinal; private boolean isDynamic; + private String moduleName; private int enumConstantCounter = 0; private Set imports = new HashSet(); @@ -142,6 +143,16 @@ public class ClassReference extends BaseReference this.isFinal = isFinal; } + public String getModuleName() + { + return moduleName; + } + + public void setModuleName(String moduleName) + { + this.moduleName = moduleName; + } + public final boolean isInterface() { return getComment().isInterface(); @@ -294,6 +305,8 @@ public class ClassReference extends BaseReference constructor = new MethodReference(model, this, functionNode, getBaseName(), comment, false); } + moduleName = model.getConfiguration().isNamedModule(this); + } private static List definedPackages = new ArrayList(); @@ -341,6 +354,21 @@ public class ClassReference extends BaseReference emitImports(sb); } + + if (moduleName != null) + { + sb.append("[JSModule"); + if (packageName.length() > 0 || !getBaseName().equals(moduleName)) + { + sb.append("("); + sb.append("name=\""); + sb.append(moduleName); + sb.append("\""); + sb.append(")"); + } + sb.append("]"); + sb.append("\n"); + } emitComment(sb); @@ -730,7 +758,7 @@ public class ClassReference extends BaseReference { if (outputJS) return; - + sb.append("public "); if (isDynamic) {