flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject git commit: [flex-falcon] [refs/heads/develop] - make -library-path be additional libraries for both js-library-path and swf-library-path
Date Wed, 10 May 2017 18:24:49 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 1a5ea9f3a -> 8fb27211d


make -library-path be additional libraries for both js-library-path and swf-library-path


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/8fb27211
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/8fb27211
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/8fb27211

Branch: refs/heads/develop
Commit: 8fb27211d20ae85079461f8b7c52d1fbb3bcef12
Parents: 1a5ea9f
Author: Alex Harui <aharui@apache.org>
Authored: Wed May 10 10:51:41 2017 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed May 10 11:24:42 2017 -0700

----------------------------------------------------------------------
 .../internal/projects/FlexJSProject.java        | 10 +++---
 .../compiler/internal/projects/FlexProject.java | 10 +++---
 .../org/apache/flex/maven/flexjs/BaseMojo.java  | 38 ++++++++++++++++++++
 .../apache/flex/maven/flexjs/CompileASMojo.java | 23 +++++++++---
 .../flex/maven/flexjs/CompileAppMojo.java       | 19 +++++++---
 .../apache/flex/maven/flexjs/CompileJSMojo.java | 18 ++++++----
 .../resources/config/compile-app-config.xml     | 10 ++++++
 .../main/resources/config/compile-js-config.xml | 22 ++++++++++++
 .../resources/config/compile-swf-config.xml     | 10 ++++++
 9 files changed, 132 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8fb27211/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 2dbbcf7..a726d38 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
@@ -392,9 +392,8 @@ public class FlexJSProject extends FlexProject
     public List<String> getCompilerExternalLibraryPath(Configuration config)
     {
     	List<String> list = ((JSConfiguration)config).getCompilerJsExternalLibraryPath();
-    	if (list != null && list.size() > 0)
-    		return list;
-    	return config.getCompilerExternalLibraryPath();
+        list.addAll(config.getCompilerExternalLibraryPath());
+    	return list;
     }
 
     /**
@@ -403,9 +402,8 @@ public class FlexJSProject extends FlexProject
     public List<String> getCompilerLibraryPath(Configuration config)
     {
     	List<String> list = ((JSConfiguration)config).getCompilerJsLibraryPath();
-    	if (list != null && list.size() > 0)
-    		return list;
-    	return config.getCompilerLibraryPath();
+        list.addAll(config.getCompilerLibraryPath());
+    	return list;
     }
     
     /**

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8fb27211/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
index c2d58c4..b01eed5 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java
@@ -2340,9 +2340,8 @@ public class FlexProject extends ASProject implements IFlexProject
     public List<String> getCompilerExternalLibraryPath(Configuration config)
     {
     	List<String> list = config.getCompilerSwfExternalLibraryPath();
-    	if (list != null && list.size() > 0)
-    		return list;
-    	return config.getCompilerExternalLibraryPath();
+        list.addAll(config.getCompilerExternalLibraryPath());
+    	return list;
     }
 
     /**
@@ -2351,9 +2350,8 @@ public class FlexProject extends ASProject implements IFlexProject
     public List<String> getCompilerLibraryPath(Configuration config)
     {
     	List<String> list = config.getCompilerSwfLibraryPath();
-    	if (list != null && list.size() > 0)
-    		return list;
-    	return config.getCompilerLibraryPath();
+        list.addAll(config.getCompilerLibraryPath());
+    	return list;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8fb27211/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 315c8c1..40f05be 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
@@ -116,14 +116,18 @@ public abstract class BaseMojo
         List<Artifact> filteredLibraries = getFilteredLibraries(allLibraries);
         List<Artifact> libraries = getLibraries(filteredLibraries);
         List<Artifact> jsLibraries = getJSLibraries(filteredLibraries);
+        List<Artifact> swfLibraries = getSWFLibraries(filteredLibraries);
         List<Artifact> externalLibraries = getExternalLibraries(filteredLibraries);
         List<Artifact> jsExternalLibraries = getJSExternalLibraries(filteredLibraries);
+        List<Artifact> swfExternalLibraries = getSWFExternalLibraries(filteredLibraries);
         List<Artifact> themeLibraries = getThemeLibraries(filteredLibraries);
         List<String> sourcePaths = getSourcePaths();
         context.put("libraries", libraries);
         context.put("externalLibraries", externalLibraries);
         context.put("jsLibraries", jsLibraries);
         context.put("jsExternalLibraries", jsExternalLibraries);
+        context.put("swfLibraries", swfLibraries);
+        context.put("swfExternalLibraries", swfExternalLibraries);
         context.put("themeLibraries", themeLibraries);
         context.put("sourcePaths", sourcePaths);
         context.put("namespaces", getNamespaces());
@@ -321,6 +325,10 @@ public abstract class BaseMojo
         return internalGetLibrariesJS(artifacts);
     }
     
+    protected List<Artifact> getSWFLibraries(List<Artifact> artifacts) {
+        return internalGetLibrariesSWF(artifacts);
+    }
+    
     protected List<Artifact> getThemeLibraries(List<Artifact> artifacts) {
         List<Artifact> themeLibraries = new LinkedList<Artifact>();
         for(Artifact artifact : artifacts) {
@@ -360,6 +368,19 @@ public abstract class BaseMojo
         return externalLibraries;
     }
     
+    protected List<Artifact> getSWFExternalLibraries(List<Artifact> artifacts)
{
+        List<Artifact> externalLibraries = new LinkedList<Artifact>();
+        for(Artifact artifact : artifacts) {
+            if(("provided".equalsIgnoreCase(artifact.getScope()) || "runtime".equalsIgnoreCase(artifact.getScope()))
+               && includeLibrarySWF(artifact)) {
+                if(!"pom".equals(artifact.getType())) {
+                    externalLibraries.add(artifact);
+                }
+            }
+        }
+        return externalLibraries;
+    }
+    
     protected boolean isForceSwcExternalLibraryPath() {
         return forceSwcExternalLibraryPath;
     }
@@ -390,6 +411,19 @@ public abstract class BaseMojo
         return libraries;
     }
 
+    private List<Artifact> internalGetLibrariesSWF(List<Artifact> artifacts)
{
+        List<Artifact> libraries = new LinkedList<Artifact>();
+        for (Artifact artifact : artifacts) {
+            if (!("provided".equalsIgnoreCase(artifact.getScope()) || "runtime".equalsIgnoreCase(artifact.getScope()))
+                && includeLibrarySWF(artifact)) {
+                if(!"pom".equals(artifact.getType())) {
+                    libraries.add(artifact);
+                }
+            }
+        }
+        return libraries;
+    }
+    
     protected List<Define> getDefines() throws MojoExecutionException {
         List<Define> defines = new LinkedList<Define>();
         if(this.defines != null) {
@@ -407,5 +441,9 @@ public abstract class BaseMojo
     protected boolean includeLibraryJS(Artifact library) {
         return true;
     }
+    
+    protected boolean includeLibrarySWF(Artifact library) {
+        return true;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8fb27211/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 c4dbdc3..2610286 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
@@ -17,9 +17,11 @@ package org.apache.flex.maven.flexjs;
 import org.apache.flex.tools.FlexTool;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProjectHelper;
 
 import java.io.File;
 import java.util.LinkedList;
@@ -33,7 +35,7 @@ public class CompileASMojo
     extends BaseMojo
 {
 
-    @Parameter(defaultValue = "${project.artifactId}-${project.version}.swc")
+    @Parameter(defaultValue = "${project.artifactId}-${project.version}-swf.swc")
     private String outputFileName;
 
     @Parameter(defaultValue = "false")
@@ -42,6 +44,9 @@ public class CompileASMojo
     @Parameter(defaultValue = "false")
     private boolean skipAS;
 
+    @Component
+    private MavenProjectHelper projectHelper;
+    
     @Override
     protected String getToolGroupName() {
         return "FlexJS";
@@ -74,6 +79,7 @@ public class CompileASMojo
         if(getOutput().exists()) {
             // Attach the file created by the compiler as artifact file to maven.
             project.getArtifact().setFile(getOutput());
+            projectHelper.attachArtifact(project, getOutput(), "swf");
         }
     }
 
@@ -117,15 +123,22 @@ public class CompileASMojo
 
     @Override
     protected boolean includeLibrary(Artifact library) {
-        return !("typedefs".equalsIgnoreCase(library.getClassifier()) ||
-                 "js".equalsIgnoreCase(library.getClassifier()));
+        String classifier = library.getClassifier();
+        return (classifier == null) && !("provided".equalsIgnoreCase(library.getScope()));
     }
     
     @Override
     protected boolean includeLibraryJS(Artifact library) {
-        return "typedefs".equalsIgnoreCase(library.getClassifier()) ||
-                "js".equalsIgnoreCase(library.getClassifier());
+        String classifier = library.getClassifier();
+        return "typedefs".equalsIgnoreCase(classifier) ||
+                "js".equalsIgnoreCase(classifier);
     }
 
+    @Override
+    protected boolean includeLibrarySWF(Artifact library) {
+        String classifier = library.getClassifier();
+        return "swf".equalsIgnoreCase(classifier) ||
+        ((classifier == null) && "provided".equalsIgnoreCase(library.getScope()));
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8fb27211/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 61ab8bf..d8c5ded 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
@@ -169,18 +169,27 @@ public class CompileAppMojo
 
     @Override
     protected boolean includeLibrary(Artifact library) {
-        return !("typedefs".equalsIgnoreCase(library.getClassifier()) ||
-                 "js".equalsIgnoreCase(library.getClassifier()));
+        String classifier = library.getClassifier();
+        return (classifier == null) && !("provided".equalsIgnoreCase(library.getScope()));
     }
 
     @Override
     protected boolean includeLibraryJS(Artifact library) {
+        String classifier = library.getClassifier();
         // Strip out all externs except if the dependency was declared inside the pom itself.
-        return ("typedefs".equalsIgnoreCase(library.getClassifier()) ||
-                "js".equalsIgnoreCase(library.getClassifier()));
+        return "typedefs".equalsIgnoreCase(classifier) ||
+                "js".equalsIgnoreCase(classifier);
         // || library.getDependencyTrail().size() == 2;
     }
-    
+
+    @Override
+    protected boolean includeLibrarySWF(Artifact library) {
+        String classifier = library.getClassifier();
+        return "swf".equalsIgnoreCase(classifier) ||
+            ((classifier == null) && "provided".equalsIgnoreCase(library.getScope()));
+        // || library.getDependencyTrail().size() == 2;
+    }
+
     /*private void zipDirectory(File source, File target) {
         byte[] buffer = new byte[1024];
         try {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8fb27211/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 98bbe75..d30eec4 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
@@ -121,18 +121,24 @@ public class CompileJSMojo
 
     @Override
     protected boolean includeLibrary(Artifact library) {
-        return "typedefs".equalsIgnoreCase(library.getClassifier()) ||
-                "js".equalsIgnoreCase(library.getClassifier());
+        String classifier = library.getClassifier();
+        return (classifier == null) && !("provided".equalsIgnoreCase(library.getScope()));
     }
 
-    /* return false since we will already list the libraries we want on the
-       regular library-path and external-library-path
-     */
     @Override
     protected boolean includeLibraryJS(Artifact library) {
-        return false;
+        String classifier = library.getClassifier();
+        return "typedefs".equalsIgnoreCase(classifier) ||
+        "js".equalsIgnoreCase(classifier);
     }
 
+    @Override
+    protected boolean includeLibrarySWF(Artifact library) {
+        String classifier = library.getClassifier();
+        return "typedefs".equalsIgnoreCase(classifier) ||
+        "js".equalsIgnoreCase(classifier);
+    }
+    
     private void createEmptySwc(File outputFile) throws MojoExecutionException {
         if(!outputFile.getParentFile().exists()) {
             if(!outputFile.getParentFile().mkdirs()) {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8fb27211/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 60a87e4..425552a 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
@@ -65,6 +65,11 @@
 #foreach($artifact in $jsExternalLibraries)            <path-element>$artifact.file</path-element>
 #end
     </js-external-library-path>
+    
+    <swf-external-library-path>
+        #foreach($artifact in $swfExternalLibraries)            <path-element>$artifact.file</path-element>
+        #end
+    </swf-external-library-path>
 
     <!-- Turn on writing of generated/*.as files to disk. These files are generated by
-->
     <!-- the compiler during mxml translation and are helpful with understanding and 
 -->
@@ -89,6 +94,11 @@
 #end
     </js-library-path>
 
+    <swf-library-path>
+        #foreach($artifact in $swfLibraries)            <path-element>$artifact.file</path-element>
+        #end
+    </swf-library-path>
+
     <allow-subclass-overrides>$allowSubclassOverrides</allow-subclass-overrides>
 
     <mxml>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8fb27211/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 8d010e4..2731b1e 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
@@ -33,6 +33,28 @@
 #end
         </external-library-path>
 
+        <js-library-path>
+            #foreach($artifact in $jsLibraries)           <path-element>$artifact.file</path-element>
+            #end
+        </js-library-path>
+
+        <!-- use js libraries for SWF compile as well -->
+        <swf-library-path>
+            #foreach($artifact in $jsLibraries)           <path-element>$artifact.file</path-element>
+            #end
+        </swf-library-path>
+
+        <js-external-library-path>
+            #foreach($artifact in $jsExternalLibraries)           <path-element>$artifact.file</path-element>
+            #end
+        </js-external-library-path>
+
+        <!-- use js libraries for SWF compile as well -->
+        <swf-external-library-path>
+            #foreach($artifact in $jsExternalLibraries)           <path-element>$artifact.file</path-element>
+            #end
+        </swf-external-library-path>
+
         <source-path>
 #foreach($sourcePath in $sourcePaths)           <path-element>$sourcePath</path-element>
 #end

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8fb27211/flexjs-maven-plugin/src/main/resources/config/compile-swf-config.xml
----------------------------------------------------------------------
diff --git a/flexjs-maven-plugin/src/main/resources/config/compile-swf-config.xml b/flexjs-maven-plugin/src/main/resources/config/compile-swf-config.xml
index afee4db..7633a94 100644
--- a/flexjs-maven-plugin/src/main/resources/config/compile-swf-config.xml
+++ b/flexjs-maven-plugin/src/main/resources/config/compile-swf-config.xml
@@ -33,6 +33,11 @@
             #end
         </js-library-path>
 
+        <swf-library-path>
+            #foreach($artifact in $swfLibraries)            <path-element>$artifact.file</path-element>
+            #end
+        </swf-library-path>
+
         <external-library-path>
 #foreach($artifact in $externalLibraries)            <path-element>$artifact.file</path-element>
 #end
@@ -43,6 +48,11 @@
             #end
         </js-external-library-path>
 
+        <swf-external-library-path>
+            #foreach($artifact in $swfExternalLibraries)            <path-element>$artifact.file</path-element>
+            #end
+        </swf-external-library-path>
+
         <theme>
 #foreach($artifact in $themeLibraries)           <filename>$artifact.file</filename>
 #end


Mime
View raw message