Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 277F8200ACA for ; Thu, 9 Jun 2016 09:53:50 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2607F160A58; Thu, 9 Jun 2016 07:53:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EB853160A2B for ; Thu, 9 Jun 2016 09:53:48 +0200 (CEST) Received: (qmail 75144 invoked by uid 500); 9 Jun 2016 07:53:48 -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 75136 invoked by uid 99); 9 Jun 2016 07:53:48 -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; Thu, 09 Jun 2016 07:53:48 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 04D0DE083B; Thu, 9 Jun 2016 07:53:48 +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 Message-Id: <999dd4b7e0554188ab0a7be5bbeb9c84@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-falcon] [refs/heads/develop] - - Added more config options to the plugin -- support of defining 'defines' in the pom -- fixed setting the default defines using the config-file instead of the commandline (The problems that I was having w Date: Thu, 9 Jun 2016 07:53:48 +0000 (UTC) archived-at: Thu, 09 Jun 2016 07:53:50 -0000 Repository: flex-falcon Updated Branches: refs/heads/develop cf3dd695a -> 7c1c183b4 - Added more config options to the plugin -- support of defining 'defines' in the pom -- fixed setting the default defines using the config-file instead of the commandline (The problems that I was having were because I had 'AS' instead of 'AS3' in the constant) Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/7c1c183b Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/7c1c183b Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/7c1c183b Branch: refs/heads/develop Commit: 7c1c183b457a5ca9a415f84e20633120073ee28c Parents: cf3dd69 Author: Christofer Dutz Authored: Thu Jun 9 09:44:02 2016 +0200 Committer: Christofer Dutz Committed: Thu Jun 9 09:44:02 2016 +0200 ---------------------------------------------------------------------- .../org/apache/flex/maven/flexjs/BaseMojo.java | 27 +++++++++++++++- .../apache/flex/maven/flexjs/CompileASMojo.java | 16 ++++----- .../flex/maven/flexjs/CompileAppMojo.java | 18 +++++------ .../flex/maven/flexjs/CompileExternMojo.java | 16 ++++----- .../apache/flex/maven/flexjs/CompileJSMojo.java | 8 +++++ .../org/apache/flex/maven/flexjs/Define.java | 34 ++++++++++++++++++++ .../flex/maven/flexjs/GenerateExterncMojo.java | 9 ++++++ .../resources/config/compile-app-config.xml | 11 +++---- .../main/resources/config/compile-as-config.xml | 15 +++++---- .../resources/config/compile-extern-config.xml | 11 +++---- .../main/resources/config/compile-js-config.xml | 11 +++---- .../config/generate-externc-config.xml | 11 +++---- 12 files changed, 125 insertions(+), 62 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/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 1f99067..6cbaddb 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 @@ -9,7 +9,8 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.*; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectDependenciesResolver; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; @@ -45,6 +46,9 @@ public abstract class BaseMojo private IncludeFile[] includeFiles; @Parameter + private Define[] defines; + + @Parameter private String targetPlayer = "11.1"; @Parameter @@ -53,6 +57,9 @@ public abstract class BaseMojo @Parameter private boolean debug = false; + @Parameter + private Boolean includeLookupOnly = null; + @Parameter(readonly = true, defaultValue = "${repositorySystemSession}") private RepositorySystemSession repositorySystemSession; @@ -82,9 +89,13 @@ public abstract class BaseMojo context.put("namespaceUris", getNamespaceUris()); context.put("includeClasses", includeClasses); context.put("includeFiles", includeFiles); + context.put("defines", getDefines()); context.put("targetPlayer", targetPlayer); context.put("includeSources", includeSources); context.put("debug", debug); + if(includeLookupOnly != null) { + context.put("includeLookupOnly", includeLookupOnly); + } context.put("output", getOutput()); return context; @@ -136,6 +147,10 @@ public abstract class BaseMojo protected List getCompilerArgs(File configFile) throws MojoExecutionException { List args = new LinkedList(); args.add("-load-config=" + configFile.getPath()); + // It seems we need to manually pass this as it is not picked up by the compiler from the config file --> + /*for(Define define : getDefines()) { + args.add("-define=" + define.getName() + "," + define.getValue()); + }*/ return args; } @@ -211,6 +226,16 @@ public abstract class BaseMojo return externalLibraries; } + protected List getDefines() { + List defines = new LinkedList(); + if(this.defines != null) { + for(Define define : this.defines) { + defines.add(define); + } + } + return defines; + } + protected boolean includeLibrary(Artifact library) { return true; } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileASMojo.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileASMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileASMojo.java index 17f453f..3a73f7c 100644 --- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileASMojo.java +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileASMojo.java @@ -67,14 +67,6 @@ public class CompileASMojo } @Override - protected List getCompilerArgs(File configFile) throws MojoExecutionException { - List args = super.getCompilerArgs(configFile); - args.add("-define=COMPILE::AS3,true"); - args.add("-define=COMPILE::JS,false"); - return args; - } - - @Override public void execute() throws MojoExecutionException { super.execute(); @@ -96,6 +88,14 @@ public class CompileASMojo } @Override + protected List getDefines() { + List defines = super.getDefines(); + defines.add(new Define("COMPILE::JS", "false")); + defines.add(new Define("COMPILE::AS3", "true")); + return defines; + } + + @Override protected boolean includeLibrary(Artifact library) { return !"extern".equalsIgnoreCase(library.getClassifier()); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/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 0b8b9df..b65eaec 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 @@ -16,22 +16,14 @@ package org.apache.flex.maven.flexjs; -import edu.emory.mathcs.backport.java.util.Arrays; import org.apache.flex.tools.FlexTool; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; import java.io.File; -import java.io.IOException; -import java.util.ArrayList; import java.util.List; /** @@ -81,8 +73,6 @@ public class CompileAppMojo throw new MojoExecutionException("Could not find main class"); } List args = super.getCompilerArgs(configFile); - args.add("-define=COMPILE::AS3,true"); - args.add("-define=COMPILE::JS,false"); args.add(mainClassPath); return args; } @@ -145,6 +135,14 @@ public class CompileAppMojo }*/ @Override + protected List getDefines() { + List defines = super.getDefines(); + defines.add(new Define("COMPILE::JS", "false")); + defines.add(new Define("COMPILE::AS3", "true")); + return defines; + } + + @Override protected boolean includeLibrary(Artifact library) { return !"extern".equalsIgnoreCase(library.getClassifier()); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileExternMojo.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileExternMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileExternMojo.java index 393274c..3f7fe6c 100644 --- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileExternMojo.java +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileExternMojo.java @@ -71,14 +71,6 @@ public class CompileExternMojo } @Override - protected List getCompilerArgs(File configFile) throws MojoExecutionException { - List args = super.getCompilerArgs(configFile); - args.add("-define=COMPILE::AS3,false"); - args.add("-define=COMPILE::JS,true"); - return args; - } - - @Override public void execute() throws MojoExecutionException { super.execute(); @@ -101,6 +93,14 @@ public class CompileExternMojo } @Override + protected List getDefines() { + List defines = super.getDefines(); + defines.add(new Define("COMPILE::JS", "true")); + defines.add(new Define("COMPILE::AS3", "false")); + return defines; + } + + @Override protected boolean includeLibrary(Artifact library) { return "extern".equalsIgnoreCase(library.getClassifier()); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java index c1298c0..86f68de 100644 --- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java @@ -98,6 +98,14 @@ public class CompileJSMojo } @Override + protected List getDefines() { + List defines = super.getDefines(); + defines.add(new Define("COMPILE::JS", "true")); + defines.add(new Define("COMPILE::AS3", "false")); + return defines; + } + + @Override protected boolean includeLibrary(Artifact library) { return "extern".equalsIgnoreCase(library.getClassifier()); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/Define.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/Define.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/Define.java new file mode 100644 index 0000000..8a01894 --- /dev/null +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/Define.java @@ -0,0 +1,34 @@ +package org.apache.flex.maven.flexjs; + +/** + * Created by christoferdutz on 07.06.16. + */ +public class Define { + + private String name; + private String value; + + public Define() { + } + + public Define(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/GenerateExterncMojo.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/GenerateExterncMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/GenerateExterncMojo.java index f7d3d9e..32240f8 100644 --- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/GenerateExterncMojo.java +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/GenerateExterncMojo.java @@ -101,4 +101,13 @@ public class GenerateExterncMojo } } } + + @Override + protected List getDefines() { + List defines = super.getDefines(); + defines.add(new Define("COMPILE::JS", "true")); + defines.add(new Define("COMPILE::AS3", "false")); + return defines; + } + } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/resources/config/compile-app-config.xml ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/resources/config/compile-app-config.xml b/flexjs-maven-plugin/src/main/resources/config/compile-app-config.xml index 5729616..db5c53b 100644 --- a/flexjs-maven-plugin/src/main/resources/config/compile-app-config.xml +++ b/flexjs-maven-plugin/src/main/resources/config/compile-app-config.xml @@ -67,14 +67,11 @@ false false - - COMPILE::JS - false - - - COMPILE::AS3 - true +#foreach($define in $defines) + $define.name + $define.value +#end #if($includeSources) http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/resources/config/compile-as-config.xml ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/resources/config/compile-as-config.xml b/flexjs-maven-plugin/src/main/resources/config/compile-as-config.xml index 1c9e1e2..5608c5f 100644 --- a/flexjs-maven-plugin/src/main/resources/config/compile-as-config.xml +++ b/flexjs-maven-plugin/src/main/resources/config/compile-as-config.xml @@ -67,14 +67,11 @@ false false - - COMPILE::JS - false - - - COMPILE::AS3 - true +#foreach($define in $defines) + $define.name + $define.value +#end #if($includeSources) @@ -104,6 +101,10 @@ #end +#if($includeLookupOnly) + $includeLookupOnly +#end + ${targetPlayer} ${output} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/resources/config/compile-extern-config.xml ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/resources/config/compile-extern-config.xml b/flexjs-maven-plugin/src/main/resources/config/compile-extern-config.xml index ad2a205..2cacb7f 100644 --- a/flexjs-maven-plugin/src/main/resources/config/compile-extern-config.xml +++ b/flexjs-maven-plugin/src/main/resources/config/compile-extern-config.xml @@ -49,14 +49,11 @@ false - - COMPILE::JS - true - - - COMPILE::AS3 - false +#foreach($define in $defines) + $define.name + $define.value +#end #if($includeSources) http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/resources/config/compile-js-config.xml ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/resources/config/compile-js-config.xml b/flexjs-maven-plugin/src/main/resources/config/compile-js-config.xml index 9e487e8..831cce8 100644 --- a/flexjs-maven-plugin/src/main/resources/config/compile-js-config.xml +++ b/flexjs-maven-plugin/src/main/resources/config/compile-js-config.xml @@ -65,14 +65,11 @@ false - - COMPILE::JS - true - - - COMPILE::AS3 - false +#foreach($define in $defines) + $define.name + $define.value +#end #if($includeSources) http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7c1c183b/flexjs-maven-plugin/src/main/resources/config/generate-externc-config.xml ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/resources/config/generate-externc-config.xml b/flexjs-maven-plugin/src/main/resources/config/generate-externc-config.xml index 53a8c53..1455a00 100644 --- a/flexjs-maven-plugin/src/main/resources/config/generate-externc-config.xml +++ b/flexjs-maven-plugin/src/main/resources/config/generate-externc-config.xml @@ -19,14 +19,11 @@ - - COMPILE::JS - true - - - COMPILE::AS3 - false +#foreach($define in $defines) + $define.name + $define.value +#end