flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [33/38] git commit: [flex-falcon] [refs/heads/develop] - changes to tell FlashBuilder not to keep compiling the project
Date Mon, 01 May 2017 03:47:59 GMT
changes to tell FlashBuilder not to keep compiling the project


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

Branch: refs/heads/develop
Commit: fba30de09f7897a54704789eac114fefbec5695c
Parents: b18fa99
Author: Alex Harui <aharui@apache.org>
Authored: Tue Mar 7 13:39:46 2017 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Tue Mar 7 13:39:46 2017 -0800

----------------------------------------------------------------------
 .../compiler/clients/JSCompilerEntryPoint.java  |  5 +++
 .../apache/flex/compiler/clients/MXMLJSC.java   | 26 ++++++++++++++
 .../flex/compiler/clients/MXMLJSCFlex.java      | 38 ++++++++++++++++++++
 .../flex/compiler/clients/MXMLJSCNative.java    | 38 ++++++++++++++++++++
 .../flex/compiler/clients/MXMLJSCNode.java      | 38 ++++++++++++++++++++
 .../main/java/flex2/tools/oem/Application.java  | 15 +++++---
 .../flex2/tools/oem/internal/OEMReport.java     | 18 ++++++----
 .../java/flex2/tools/oem/internal/OEMUtil.java  | 24 +++++++++++++
 8 files changed, 192 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fba30de0/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSCompilerEntryPoint.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSCompilerEntryPoint.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSCompilerEntryPoint.java
index 0ffa22e..6b028da 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSCompilerEntryPoint.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSCompilerEntryPoint.java
@@ -26,4 +26,9 @@ import java.util.List;
 public interface JSCompilerEntryPoint {
     public int mainNoExit(final String[] args, List<ICompilerProblem> problems,
                           Boolean printProblems);
+    
+    public List<String> getSourceList();
+    
+    public String getMainSource();
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fba30de0/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
index db96db7..6f02afc 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
@@ -28,6 +28,7 @@ import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
@@ -77,6 +78,7 @@ import org.apache.flex.compiler.targets.ITarget;
 import org.apache.flex.compiler.targets.ITarget.TargetType;
 import org.apache.flex.compiler.targets.ITargetSettings;
 import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.units.ICompilationUnit.UnitType;
 import org.apache.flex.swf.ISWF;
 import org.apache.flex.swf.SWF;
 import org.apache.flex.swf.types.RGB;
@@ -86,6 +88,7 @@ import org.apache.flex.utils.ArgumentUtil;
 import org.apache.flex.utils.FilenameNormalization;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 
 /**
@@ -258,6 +261,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
     protected IJSApplication jsTarget;
     private IJSPublisher jsPublisher;
     private MXMLC mxmlc;
+    private JSCompilerEntryPoint lastCompiler;
     public boolean noLink;
     public OutputStream err;
     
@@ -338,6 +342,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
 	                    break;
 	                case JS_FLEX:
 	                	MXMLJSCFlex flex = new MXMLJSCFlex();
+	                	lastCompiler = flex;
 	                    result = flex.mainNoExit(removeASArgs(args), problems.getProblems(),
false);
 	                    if (result != 0)
 	                    {
@@ -346,6 +351,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
 	                    break;
 	                case JS_NODE:
 	                	MXMLJSCNode node = new MXMLJSCNode();
+	                	lastCompiler = node;
 	                    result = node.mainNoExit(removeASArgs(args), problems.getProblems(),
false);
 	                    if (result != 0)
 	                    {
@@ -354,6 +360,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
 	                    break;
 	                case JS_NATIVE:
 	                	MXMLJSCNative jsc = new MXMLJSCNative();
+	                	lastCompiler = jsc;
 	                    result = jsc.mainNoExit(removeASArgs(args), problems.getProblems(),
false);
 	                    if (result != 0)
 	                    {
@@ -898,6 +905,25 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
         workspace.close();
     }
     
+    public List<String> getSourceList()
+    {
+        if (lastCompiler != null)
+        	return lastCompiler.getSourceList();
+        if (mxmlc != null)
+        	return mxmlc.getSourceList();
+        return null;
+    }
+    
+    public String getMainSource()
+    {
+        if (lastCompiler != null)
+        	return lastCompiler.getMainSource();
+        if (mxmlc != null)
+        	return mxmlc.getMainSource();
+        return null;
+    }
+    
+
     /**
      * return a data structure for FB integration
      * @return

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fba30de0/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCFlex.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCFlex.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCFlex.java
index dff367d..76186f3 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCFlex.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCFlex.java
@@ -27,6 +27,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
@@ -75,6 +76,7 @@ import org.apache.flex.compiler.targets.ITarget;
 import org.apache.flex.compiler.targets.ITarget.TargetType;
 import org.apache.flex.compiler.targets.ITargetSettings;
 import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.units.ICompilationUnit.UnitType;
 import org.apache.flex.tools.FlexTool;
 import org.apache.flex.utils.ArgumentUtil;
 import org.apache.flex.utils.FilenameNormalization;
@@ -743,4 +745,40 @@ public class MXMLJSCFlex implements JSCompilerEntryPoint, ProblemQueryProvider,
     {
         workspace.close();
     }
+    
+    public List<String> getSourceList()
+    {
+        ArrayList<String> list = new ArrayList<String>();
+        LinkedList<ICompilerProblem> problemList = new LinkedList<ICompilerProblem>();
+        try
+        {
+            ArrayList<ICompilationUnit> roots = new ArrayList<ICompilationUnit>();
+            roots.add(mainCU);
+            Set<ICompilationUnit> incs = target.getIncludesCompilationUnits();
+            roots.addAll(incs);
+            project.mixinClassNames = new TreeSet<String>();
+            List<ICompilationUnit> units = project.getReachableCompilationUnitsInSWFOrder(roots);
+            for (ICompilationUnit unit : units)
+            {
+                UnitType ut = unit.getCompilationUnitType();
+                if (ut == UnitType.AS_UNIT || ut == UnitType.MXML_UNIT)
+                {
+                    list.add(unit.getAbsoluteFilename());
+                }
+            }
+        }
+        catch (InterruptedException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+        return list;
+    }
+    
+    public String getMainSource()
+    {
+        return mainCU.getAbsoluteFilename();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fba30de0/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNative.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNative.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNative.java
index 5ae898d..2a33277 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNative.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNative.java
@@ -27,6 +27,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
@@ -75,6 +76,7 @@ import org.apache.flex.compiler.targets.ITarget;
 import org.apache.flex.compiler.targets.ITarget.TargetType;
 import org.apache.flex.compiler.targets.ITargetSettings;
 import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.units.ICompilationUnit.UnitType;
 import org.apache.flex.tools.FlexTool;
 import org.apache.flex.utils.ArgumentUtil;
 import org.apache.flex.utils.FilenameNormalization;
@@ -738,4 +740,40 @@ public class MXMLJSCNative implements JSCompilerEntryPoint, ProblemQueryProvider
     {
         workspace.close();
     }
+    
+    public List<String> getSourceList()
+    {
+        ArrayList<String> list = new ArrayList<String>();
+        LinkedList<ICompilerProblem> problemList = new LinkedList<ICompilerProblem>();
+        try
+        {
+            ArrayList<ICompilationUnit> roots = new ArrayList<ICompilationUnit>();
+            roots.add(mainCU);
+            Set<ICompilationUnit> incs = target.getIncludesCompilationUnits();
+            roots.addAll(incs);
+            project.mixinClassNames = new TreeSet<String>();
+            List<ICompilationUnit> units = project.getReachableCompilationUnitsInSWFOrder(roots);
+            for (ICompilationUnit unit : units)
+            {
+                UnitType ut = unit.getCompilationUnitType();
+                if (ut == UnitType.AS_UNIT || ut == UnitType.MXML_UNIT)
+                {
+                    list.add(unit.getAbsoluteFilename());
+                }
+            }
+        }
+        catch (InterruptedException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+        return list;
+    }
+    
+    public String getMainSource()
+    {
+        return mainCU.getAbsoluteFilename();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fba30de0/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNode.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNode.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNode.java
index 94b0842..49a4013 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNode.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCNode.java
@@ -27,6 +27,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
@@ -75,6 +76,7 @@ import org.apache.flex.compiler.targets.ITarget;
 import org.apache.flex.compiler.targets.ITarget.TargetType;
 import org.apache.flex.compiler.targets.ITargetSettings;
 import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.units.ICompilationUnit.UnitType;
 import org.apache.flex.tools.FlexTool;
 import org.apache.flex.utils.ArgumentUtil;
 import org.apache.flex.utils.FilenameNormalization;
@@ -736,4 +738,40 @@ public class MXMLJSCNode implements JSCompilerEntryPoint, ProblemQueryProvider,
     {
         workspace.close();
     }
+    
+    public List<String> getSourceList()
+    {
+        ArrayList<String> list = new ArrayList<String>();
+        LinkedList<ICompilerProblem> problemList = new LinkedList<ICompilerProblem>();
+        try
+        {
+            ArrayList<ICompilationUnit> roots = new ArrayList<ICompilationUnit>();
+            roots.add(mainCU);
+            Set<ICompilationUnit> incs = target.getIncludesCompilationUnits();
+            roots.addAll(incs);
+            project.mixinClassNames = new TreeSet<String>();
+            List<ICompilationUnit> units = project.getReachableCompilationUnitsInSWFOrder(roots);
+            for (ICompilationUnit unit : units)
+            {
+                UnitType ut = unit.getCompilationUnitType();
+                if (ut == UnitType.AS_UNIT || ut == UnitType.MXML_UNIT)
+                {
+                    list.add(unit.getAbsoluteFilename());
+                }
+            }
+        }
+        catch (InterruptedException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+        return list;
+    }
+    
+    public String getMainSource()
+    {
+        return mainCU.getAbsoluteFilename();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fba30de0/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java b/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java
index 626962a..0d9a307 100644
--- a/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java
+++ b/flex-compiler-oem/src/main/java/flex2/tools/oem/Application.java
@@ -56,6 +56,7 @@ import flex2.compiler.util.PerformanceData;
 import flex2.compiler.util.ThreadLocalToolkit;
 import flex2.linker.SimpleMovie;
 import flex2.tools.ToolsConfiguration;
+import flex2.tools.oem.internal.ApplicationCompilerConfiguration;
 import flex2.tools.oem.internal.OEMConfiguration;
 import flex2.tools.oem.internal.OEMReport;
 import flex2.tools.oem.internal.OEMUtil;
@@ -300,6 +301,8 @@ public class Application implements Builder
     // clean() would null out the following variables.
     private String cacheName, configurationReport;
     private List<Message> messages;
+    private boolean setOutputCalled;
+    private int loaded = 0;
 
     /**
      * @inheritDoc
@@ -378,6 +381,7 @@ public class Application implements Builder
      */
     public void setOutput(File output)
     {
+    	setOutputCalled = true;
         this.output = output;
     }
 
@@ -533,6 +537,9 @@ public class Application implements Builder
      */
     public void clean()
     {
+    	// assuming FB takes care of deleting bin-release and bin-debug, we want to delete bin.
+    	// but this also gets called when quitting FB.
+    	setOutputCalled = false;
     }
 
     /**
@@ -540,6 +547,7 @@ public class Application implements Builder
      */
     public void load(InputStream in) throws IOException
     {
+    	loaded++;
     }
 
     /**
@@ -547,6 +555,7 @@ public class Application implements Builder
      */
     public long save(OutputStream out) throws IOException
     {
+    	loaded--;
         return 1;
     }
 
@@ -661,12 +670,11 @@ public class Application implements Builder
     
     void processMXMLCReport(MXMLJSC mxmljsc, OEMConfiguration config)
     {
-        /* not sure we need this
         ApplicationCompilerConfiguration acc = ((ApplicationCompilerConfiguration)config.configuration);
         sources = new ArrayList<Source>();
         VirtualFile[] sourcePaths = acc.getCompilerConfiguration().getSourcePath();
-        List<String> sourceFiles = mxmlc.getSourceList();
-        String mainFile = mxmlc.getMainSource();
+        List<String> sourceFiles = mxmljsc.getSourceList();
+        String mainFile = mxmljsc.getMainSource();
         for (String sourceFile : sourceFiles)
         {
             for (VirtualFile sourcePath : sourcePaths)
@@ -685,7 +693,6 @@ public class Application implements Builder
                 }
             }
         }
-        */
         ProblemQuery pq = mxmljsc.getProblemQuery();
         List<ICompilerProblem> probs = pq.getProblems();
         for (ICompilerProblem prob : probs)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fba30de0/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMReport.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMReport.java b/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMReport.java
index c39aa25..21b1d73 100644
--- a/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMReport.java
+++ b/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMReport.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -158,7 +159,7 @@ public class OEMReport implements Report
 		
         if (sources != null)
         {
-            //processSources(sources, sourceNames, assetNames, libraryNames, data, locations);
+            processSources(sources, sourceNames, assetNames, libraryNames, data, locations);
         }
 
 		timestamps = new HashMap<String, Long>();
@@ -292,10 +293,6 @@ public class OEMReport implements Report
 	
 	public boolean contentUpdated()
 	{
-	    // AJH for now, just return true to force another build.  Someday be smarter about what
sources
-	    // we have and what their time stamps are.
-	    return true;
-	    /*
 		for (Iterator<String> i = timestamps.keySet().iterator(); i.hasNext(); )
 		{
 			String path = i.next();
@@ -308,7 +305,6 @@ public class OEMReport implements Report
 			}
 		}
 		return false;
-		*/
 	}
 	
 	public String[] getSourceNames(Object report)
@@ -526,10 +522,18 @@ public class OEMReport implements Report
 			}
 		}
 	}
+	*/
 	
 	private void processSources(List<Source> sources, TreeSet<String> sourceNames,
TreeSet<String> assetNames,
                                 TreeSet<String> libraryNames, Map<String, Data>
data, Map<String, String> locations)
 	{
+		// use this version for now
+		for (Source s : sources)
+		{
+			sourceNames.add(s.getName());
+		}
+		/*
+		// AJH not sure why all this is needed
 		for (Source s : sources)
 		{
 			CompilationUnit u = (s == null) ? null : s.getCompilationUnit();
@@ -609,8 +613,10 @@ public class OEMReport implements Report
 				data.put(s.getName(), d);
 			}
 		}
+		*/
 	}
 
+	/*
 	private void processFrames(SimpleMovie movie)
 	{
 		int count = movie == null ? 0 : movie.frames.size();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fba30de0/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMUtil.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMUtil.java b/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMUtil.java
index ae805f1..b6e1d5b 100644
--- a/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMUtil.java
+++ b/flex-compiler-oem/src/main/java/flex2/tools/oem/internal/OEMUtil.java
@@ -212,6 +212,30 @@ public class OEMUtil
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
+        List<String> libraries = config.getCompilerLibraryPath();
+        String[] libs = new String[libraries.size()];
+        libraries.toArray(libs);
+        try
+        {
+            cc.cfgLibraryPath(null, libs);
+        }
+        catch (ConfigurationException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        List<String> sources = config.getCompilerSourcePath();
+        String[] srcs = new String[sources.size()];
+        sources.toArray(srcs);
+        try
+        {
+            cc.cfgSourcePath(null, srcs);
+        }
+        catch (ConfigurationException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
 	    
 	    return acc;
 	}


Mime
View raw message