You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2015/07/02 15:13:30 UTC

[2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

We've worked so hard to create AS classes from the Closure externs, let's not forget what these were originally intended for... and what we need them for: prevent renaming of externally declared functions. We needed to include the original extern files in their respective SWCs so we can later present them to the GCC.

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


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

Branch: refs/heads/develop
Commit: 1f35e5260e580b8b40f95551f383a362c2474edd
Parents: e425a86
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Thu Jul 2 15:12:50 2015 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Thu Jul 2 15:12:50 2015 +0200

----------------------------------------------------------------------
 .../mxml/flexjs/MXMLFlexJSPublisher.java        | 43 +++++++++++++++++++-
 externs/jasmine/compile-config.xml              |  5 +++
 externs/jquery/compile-config.xml               |  5 +++
 3 files changed, 51 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 1d6c7aa..cf3869b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -22,7 +22,9 @@ import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.OutputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -49,6 +51,8 @@ import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
 import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.utils.JSClosureCompilerWrapper;
+import org.apache.flex.swc.ISWC;
+import org.apache.flex.swc.ISWCFileEntry;
 
 public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
 {
@@ -57,6 +61,8 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
     public static final String FLEXJS_INTERMEDIATE_DIR_NAME = "js-debug";
     public static final String FLEXJS_RELEASE_DIR_NAME = "js-release";
 
+    private static final String FLEXJS_EXTERNS = "externs";
+
     class DependencyRecord
     {
         String path;
@@ -278,8 +284,41 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
 
         JSClosureCompilerWrapper compilerWrapper = new JSClosureCompilerWrapper();
 
-        GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir, projectName, (JSGoogConfiguration) configuration,
-                project.getLibraries());
+        List<ISWC> swcs = project.getLibraries();
+
+        // (erikdebruin) We don't want to forget that we need to tell the GCC
+        //               about them fancy externs we've been working so hard on
+        for (ISWC swc : swcs)
+        {
+            String srcName = swc.getSWCFile().getName().replace(".swc", ".js");
+            String srcPath = FLEXJS_EXTERNS + File.separator + srcName;
+
+            ISWCFileEntry fileEntry = swc.getFile(FLEXJS_EXTERNS + File.separator + srcName);
+            if (fileEntry != null)
+            {
+                File destFile = new File(intermediateDirPath + File.separator + srcPath);
+
+                InputStream inStream = fileEntry.createInputStream();
+                OutputStream outStream = FileUtils.openOutputStream(destFile);
+                byte[] b = new byte[1024 * 1024];
+                int bytes_read;
+                while ((bytes_read = inStream.read(b)) != -1)
+                {
+                    outStream.write(b, 0, bytes_read);
+                }
+                outStream.flush();
+                outStream.close();
+                inStream.close();
+
+                String destPath = destFile.getAbsolutePath();
+
+                System.out.println("using extern: " + destPath);
+
+                compilerWrapper.addJSExternsFile(destPath);
+            }
+        }
+
+        GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir, projectName, (JSGoogConfiguration) configuration, swcs);
         StringBuilder depsFileData = new StringBuilder();
         try
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jasmine/compile-config.xml
----------------------------------------------------------------------
diff --git a/externs/jasmine/compile-config.xml b/externs/jasmine/compile-config.xml
index abf867e..2af1e2a 100644
--- a/externs/jasmine/compile-config.xml
+++ b/externs/jasmine/compile-config.xml
@@ -67,6 +67,11 @@
         <path-element>out/as/functions</path-element>
     </include-sources>
 
+    <include-file>
+        <name>externs/jasmine-2.0.js</name>
+        <path>externs/jasmine-2.0.js</path>
+    </include-file>
+
     <!--
     <include-file>
         <name>defaults.css</name>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jquery/compile-config.xml
----------------------------------------------------------------------
diff --git a/externs/jquery/compile-config.xml b/externs/jquery/compile-config.xml
index c0c7f34..3ff4f10 100644
--- a/externs/jquery/compile-config.xml
+++ b/externs/jquery/compile-config.xml
@@ -71,6 +71,11 @@
         <path-element>out/as/functions</path-element>
     </include-sources>
 
+    <include-file>
+        <name>externs/jquery-1.9.js</name>
+        <path>externs/jquery-1.9.js</path>
+    </include-file>
+
     <!--
     <include-file>
         <name>defaults.css</name>


RE: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Frédéric THOMAS <we...@hotmail.com>.




Frédéric THOMAS


----------------------------------------
> From: erikdebruin@apache.org
> Date: Thu, 2 Jul 2015 15:19:13 +0200
> Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming
> To: dev@flex.apache.org
>
> This commit makes the 'release' version of Fred's excellent example work
> (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
> needs to pick up the JS file.
>
> Looking further into those warnings.
>
> EdB
>
>
>
> On Thu, Jul 2, 2015 at 3:13 PM, <er...@apache.org> wrote:
>
>> GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use
>> those to prevent renaming
>>
>> We've worked so hard to create AS classes from the Closure externs, let's
>> not forget what these were originally intended for... and what we need them
>> for: prevent renaming of externally declared functions. We needed to
>> include the original extern files in their respective SWCs so we can later
>> present them to the GCC.
>>
>> Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1f35e526
>> Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1f35e526
>> Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1f35e526
>>
>> Branch: refs/heads/develop
>> Commit: 1f35e5260e580b8b40f95551f383a362c2474edd
>> Parents: e425a86
>> Author: Erik de Bruin <er...@ixsoftware.nl>
>> Authored: Thu Jul 2 15:12:50 2015 +0200
>> Committer: Erik de Bruin <er...@ixsoftware.nl>
>> Committed: Thu Jul 2 15:12:50 2015 +0200
>>
>> ----------------------------------------------------------------------
>> .../mxml/flexjs/MXMLFlexJSPublisher.java | 43 +++++++++++++++++++-
>> externs/jasmine/compile-config.xml | 5 +++
>> externs/jquery/compile-config.xml | 5 +++
>> 3 files changed, 51 insertions(+), 2 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> index 1d6c7aa..cf3869b 100644
>> ---
>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> +++
>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> @@ -22,7 +22,9 @@ import java.io.BufferedReader;
>> import java.io.File;
>> import java.io.FileInputStream;
>> import java.io.IOException;
>> +import java.io.InputStream;
>> import java.io.InputStreamReader;
>> +import java.io.OutputStream;
>> import java.net.URL;
>> import java.util.ArrayList;
>> import java.util.Collection;
>> @@ -49,6 +51,8 @@ import
>> org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
>> import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
>> import org.apache.flex.compiler.internal.projects.FlexJSProject;
>> import org.apache.flex.compiler.utils.JSClosureCompilerWrapper;
>> +import org.apache.flex.swc.ISWC;
>> +import org.apache.flex.swc.ISWCFileEntry;
>>
>> public class MXMLFlexJSPublisher extends JSGoogPublisher implements
>> IJSPublisher
>> {
>> @@ -57,6 +61,8 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher
>> implements IJSPublisher
>> public static final String FLEXJS_INTERMEDIATE_DIR_NAME = "js-debug";
>> public static final String FLEXJS_RELEASE_DIR_NAME = "js-release";
>>
>> + private static final String FLEXJS_EXTERNS = "externs";
>> +
>> class DependencyRecord
>> {
>> String path;
>> @@ -278,8 +284,41 @@ public class MXMLFlexJSPublisher extends
>> JSGoogPublisher implements IJSPublisher
>>
>> JSClosureCompilerWrapper compilerWrapper = new
>> JSClosureCompilerWrapper();
>>
>> - GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>> projectName, (JSGoogConfiguration) configuration,
>> - project.getLibraries());
>> + List<ISWC> swcs = project.getLibraries();
>> +
>> + // (erikdebruin) We don't want to forget that we need to tell the
>> GCC
>> + // about them fancy externs we've been working so
>> hard on
>> + for (ISWC swc : swcs)
>> + {
>> + String srcName = swc.getSWCFile().getName().replace(".swc",
>> ".js");
>> + String srcPath = FLEXJS_EXTERNS + File.separator + srcName;
>> +
>> + ISWCFileEntry fileEntry = swc.getFile(FLEXJS_EXTERNS +
>> File.separator + srcName);
>> + if (fileEntry != null)
>> + {
>> + File destFile = new File(intermediateDirPath +
>> File.separator + srcPath);
>> +
>> + InputStream inStream = fileEntry.createInputStream();
>> + OutputStream outStream =
>> FileUtils.openOutputStream(destFile);
>> + byte[] b = new byte[1024 * 1024];
>> + int bytes_read;
>> + while ((bytes_read = inStream.read(b)) != -1)
>> + {
>> + outStream.write(b, 0, bytes_read);
>> + }
>> + outStream.flush();
>> + outStream.close();
>> + inStream.close();
>> +
>> + String destPath = destFile.getAbsolutePath();
>> +
>> + System.out.println("using extern: " + destPath);
>> +
>> + compilerWrapper.addJSExternsFile(destPath);
>> + }
>> + }
>> +
>> + GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>> projectName, (JSGoogConfiguration) configuration, swcs);
>> StringBuilder depsFileData = new StringBuilder();
>> try
>> {
>>
>>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jasmine/compile-config.xml
>> ----------------------------------------------------------------------
>> diff --git a/externs/jasmine/compile-config.xml
>> b/externs/jasmine/compile-config.xml
>> index abf867e..2af1e2a 100644
>> --- a/externs/jasmine/compile-config.xml
>> +++ b/externs/jasmine/compile-config.xml
>> @@ -67,6 +67,11 @@
>> <path-element>out/as/functions</path-element>
>> </include-sources>
>>
>> + <include-file>
>> + <name>externs/jasmine-2.0.js</name>
>> + <path>externs/jasmine-2.0.js</path>
>> + </include-file>
>> +
>> <!--
>> <include-file>
>> <name>defaults.css</name>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jquery/compile-config.xml
>> ----------------------------------------------------------------------
>> diff --git a/externs/jquery/compile-config.xml
>> b/externs/jquery/compile-config.xml
>> index c0c7f34..3ff4f10 100644
>> --- a/externs/jquery/compile-config.xml
>> +++ b/externs/jquery/compile-config.xml
>> @@ -71,6 +71,11 @@
>> <path-element>out/as/functions</path-element>
>> </include-sources>
>>
>> + <include-file>
>> + <name>externs/jquery-1.9.js</name>
>> + <path>externs/jquery-1.9.js</path>
>> + </include-file>
>> +
>> <!--
>> <include-file>
>> <name>defaults.css</name>
>>
>>
 		 	   		  

RE: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Frédéric THOMAS <we...@hotmail.com>.
> Are you using IntelliJ?

Yes

> I'll post my command line script, if that might help?

ok

Frédéric THOMAS


----------------------------------------
> From: erik@ixsoftware.nl
> Date: Thu, 2 Jul 2015 17:33:12 +0200
> Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming
> To: dev@flex.apache.org
>
> Are you using IntelliJ?
>
> Then you're on your own :-P
>
> I'll post my command line script, if that might help?
>
> EdB
>
>
>
> On Thu, Jul 2, 2015 at 5:31 PM, Frédéric THOMAS <we...@hotmail.com>
> wrote:
>
>>
>>> This commit makes the 'release' version of Fred's excellent example work
>>> (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
>>> needs to pick up the JS file.
>>
>> I rebuilt falcon, the externs, the project and I still have
>> Uncaught ReferenceError: Main is not defined
>> with js-release, what did I miss ?
>>
>> Thanks,
>> Frédéric THOMAS
>>
>>
>> ----------------------------------------
>>> From: erikdebruin@apache.org
>>> Date: Thu, 2 Jul 2015 15:19:13 +0200
>>> Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC
>> and externs: add the 'externs.js' files to the SWCs; tell GCC to use those
>> to prevent renaming
>>> To: dev@flex.apache.org
>>>
>>> This commit makes the 'release' version of Fred's excellent example work
>>> (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
>>> needs to pick up the JS file.
>>>
>>> Looking further into those warnings.
>>>
>>> EdB
>>>
>>>
>>>
>>> On Thu, Jul 2, 2015 at 3:13 PM, <er...@apache.org> wrote:
>>>
>>>> GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use
>>>> those to prevent renaming
>>>>
>>>> We've worked so hard to create AS classes from the Closure externs,
>> let's
>>>> not forget what these were originally intended for... and what we need
>> them
>>>> for: prevent renaming of externally declared functions. We needed to
>>>> include the original extern files in their respective SWCs so we can
>> later
>>>> present them to the GCC.
>>>>
>>>> Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
>>>>
>>>>
>>>> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
>>>> Commit:
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1f35e526
>>>> Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1f35e526
>>>> Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1f35e526
>>>>
>>>> Branch: refs/heads/develop
>>>> Commit: 1f35e5260e580b8b40f95551f383a362c2474edd
>>>> Parents: e425a86
>>>> Author: Erik de Bruin <er...@ixsoftware.nl>
>>>> Authored: Thu Jul 2 15:12:50 2015 +0200
>>>> Committer: Erik de Bruin <er...@ixsoftware.nl>
>>>> Committed: Thu Jul 2 15:12:50 2015 +0200
>>>>
>>>> ----------------------------------------------------------------------
>>>> .../mxml/flexjs/MXMLFlexJSPublisher.java | 43 +++++++++++++++++++-
>>>> externs/jasmine/compile-config.xml | 5 +++
>>>> externs/jquery/compile-config.xml | 5 +++
>>>> 3 files changed, 51 insertions(+), 2 deletions(-)
>>>> ----------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>> ----------------------------------------------------------------------
>>>> diff --git
>>>>
>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>>
>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>> index 1d6c7aa..cf3869b 100644
>>>> ---
>>>>
>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>> +++
>>>>
>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>> @@ -22,7 +22,9 @@ import java.io.BufferedReader;
>>>> import java.io.File;
>>>> import java.io.FileInputStream;
>>>> import java.io.IOException;
>>>> +import java.io.InputStream;
>>>> import java.io.InputStreamReader;
>>>> +import java.io.OutputStream;
>>>> import java.net.URL;
>>>> import java.util.ArrayList;
>>>> import java.util.Collection;
>>>> @@ -49,6 +51,8 @@ import
>>>> org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
>>>> import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
>>>> import org.apache.flex.compiler.internal.projects.FlexJSProject;
>>>> import org.apache.flex.compiler.utils.JSClosureCompilerWrapper;
>>>> +import org.apache.flex.swc.ISWC;
>>>> +import org.apache.flex.swc.ISWCFileEntry;
>>>>
>>>> public class MXMLFlexJSPublisher extends JSGoogPublisher implements
>>>> IJSPublisher
>>>> {
>>>> @@ -57,6 +61,8 @@ public class MXMLFlexJSPublisher extends
>> JSGoogPublisher
>>>> implements IJSPublisher
>>>> public static final String FLEXJS_INTERMEDIATE_DIR_NAME = "js-debug";
>>>> public static final String FLEXJS_RELEASE_DIR_NAME = "js-release";
>>>>
>>>> + private static final String FLEXJS_EXTERNS = "externs";
>>>> +
>>>> class DependencyRecord
>>>> {
>>>> String path;
>>>> @@ -278,8 +284,41 @@ public class MXMLFlexJSPublisher extends
>>>> JSGoogPublisher implements IJSPublisher
>>>>
>>>> JSClosureCompilerWrapper compilerWrapper = new
>>>> JSClosureCompilerWrapper();
>>>>
>>>> - GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>>>> projectName, (JSGoogConfiguration) configuration,
>>>> - project.getLibraries());
>>>> + List<ISWC> swcs = project.getLibraries();
>>>> +
>>>> + // (erikdebruin) We don't want to forget that we need to tell the
>>>> GCC
>>>> + // about them fancy externs we've been working so
>>>> hard on
>>>> + for (ISWC swc : swcs)
>>>> + {
>>>> + String srcName = swc.getSWCFile().getName().replace(".swc",
>>>> ".js");
>>>> + String srcPath = FLEXJS_EXTERNS + File.separator + srcName;
>>>> +
>>>> + ISWCFileEntry fileEntry = swc.getFile(FLEXJS_EXTERNS +
>>>> File.separator + srcName);
>>>> + if (fileEntry != null)
>>>> + {
>>>> + File destFile = new File(intermediateDirPath +
>>>> File.separator + srcPath);
>>>> +
>>>> + InputStream inStream = fileEntry.createInputStream();
>>>> + OutputStream outStream =
>>>> FileUtils.openOutputStream(destFile);
>>>> + byte[] b = new byte[1024 * 1024];
>>>> + int bytes_read;
>>>> + while ((bytes_read = inStream.read(b)) != -1)
>>>> + {
>>>> + outStream.write(b, 0, bytes_read);
>>>> + }
>>>> + outStream.flush();
>>>> + outStream.close();
>>>> + inStream.close();
>>>> +
>>>> + String destPath = destFile.getAbsolutePath();
>>>> +
>>>> + System.out.println("using extern: " + destPath);
>>>> +
>>>> + compilerWrapper.addJSExternsFile(destPath);
>>>> + }
>>>> + }
>>>> +
>>>> + GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>>>> projectName, (JSGoogConfiguration) configuration, swcs);
>>>> StringBuilder depsFileData = new StringBuilder();
>>>> try
>>>> {
>>>>
>>>>
>>>>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jasmine/compile-config.xml
>>>> ----------------------------------------------------------------------
>>>> diff --git a/externs/jasmine/compile-config.xml
>>>> b/externs/jasmine/compile-config.xml
>>>> index abf867e..2af1e2a 100644
>>>> --- a/externs/jasmine/compile-config.xml
>>>> +++ b/externs/jasmine/compile-config.xml
>>>> @@ -67,6 +67,11 @@
>>>> <path-element>out/as/functions</path-element>
>>>> </include-sources>
>>>>
>>>> + <include-file>
>>>> + <name>externs/jasmine-2.0.js</name>
>>>> + <path>externs/jasmine-2.0.js</path>
>>>> + </include-file>
>>>> +
>>>> <!--
>>>> <include-file>
>>>> <name>defaults.css</name>
>>>>
>>>>
>>>>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jquery/compile-config.xml
>>>> ----------------------------------------------------------------------
>>>> diff --git a/externs/jquery/compile-config.xml
>>>> b/externs/jquery/compile-config.xml
>>>> index c0c7f34..3ff4f10 100644
>>>> --- a/externs/jquery/compile-config.xml
>>>> +++ b/externs/jquery/compile-config.xml
>>>> @@ -71,6 +71,11 @@
>>>> <path-element>out/as/functions</path-element>
>>>> </include-sources>
>>>>
>>>> + <include-file>
>>>> + <name>externs/jquery-1.9.js</name>
>>>> + <path>externs/jquery-1.9.js</path>
>>>> + </include-file>
>>>> +
>>>> <!--
>>>> <include-file>
>>>> <name>defaults.css</name>
>>>>
>>>>
>>
>>
>
>
>
> --
> Ix Multimedia Software
>
> Jan Luykenstraat 27
> 3521 VB Utrecht
>
> T. 06-51952295
> I. www.ixsoftware.nl
 		 	   		  

Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Michael Schmalle <te...@gmail.com>.
Side Note: Erik, I didn't forget what they are for, it's that I wrote the
EXTERNC compiler out of the idea of the JSC pure js and GCC as a post
processor wasn't on my #1 list, since in the end, I am going to make all
GCC annotations and injections optional witht he JSC output type so
theoretically people can use their own dependency load with a compiler hook
or something connected to the backend.

Mike

On Thu, Jul 2, 2015 at 11:40 AM, Frédéric THOMAS <we...@hotmail.com>
wrote:

>
> > Can you check in the 'js-debug' if the Main.js has an 'exportSymbol'
> > statement at the bottom?
> // Ensures the symbol will be visible after compiler renaming.
> goog.exportSymbol('Main', Main);
> Frédéric THOMAS
>
>
> ----------------------------------------
> > From: erik@ixsoftware.nl
> > Date: Thu, 2 Jul 2015 17:34:58 +0200
> > Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC
> and externs: add the 'externs.js' files to the SWCs; tell GCC to use those
> to prevent renaming
> > To: dev@flex.apache.org
> >
> > Can you check in the 'js-debug' if the Main.js has an 'exportSymbol'
> > statement at the bottom?
> >
> > EdB
> >
> >
> >
> > On Thu, Jul 2, 2015 at 5:33 PM, Erik de Bruin <er...@ixsoftware.nl>
> wrote:
> >
> >> Are you using IntelliJ?
> >>
> >> Then you're on your own :-P
> >>
> >> I'll post my command line script, if that might help?
> >>
> >> EdB
> >>
> >>
> >>
> >> On Thu, Jul 2, 2015 at 5:31 PM, Frédéric THOMAS <
> webdoublefx@hotmail.com>
> >> wrote:
> >>
> >>>
> >>>> This commit makes the 'release' version of Fred's excellent example
> work
> >>>> (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as
> it
> >>>> needs to pick up the JS file.
> >>>
> >>> I rebuilt falcon, the externs, the project and I still have
> >>> Uncaught ReferenceError: Main is not defined
> >>> with js-release, what did I miss ?
> >>>
> >>> Thanks,
> >>> Frédéric THOMAS
> >>>
> >>>
> >>> ----------------------------------------
> >>>> From: erikdebruin@apache.org
> >>>> Date: Thu, 2 Jul 2015 15:19:13 +0200
> >>>> Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] -
> GCC
> >>> and externs: add the 'externs.js' files to the SWCs; tell GCC to use
> those
> >>> to prevent renaming
> >>>> To: dev@flex.apache.org
> >>>>
> >>>> This commit makes the 'release' version of Fred's excellent example
> work
> >>>> (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as
> it
> >>>> needs to pick up the JS file.
> >>>>
> >>>> Looking further into those warnings.
> >>>>
> >>>> EdB
> >>>>
> >>>>
> >>>>
> >>>> On Thu, Jul 2, 2015 at 3:13 PM, <er...@apache.org> wrote:
> >>>>
> >>>>> GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to
> >>> use
> >>>>> those to prevent renaming
> >>>>>
> >>>>> We've worked so hard to create AS classes from the Closure externs,
> >>> let's
> >>>>> not forget what these were originally intended for... and what we
> need
> >>> them
> >>>>> for: prevent renaming of externally declared functions. We needed to
> >>>>> include the original extern files in their respective SWCs so we can
> >>> later
> >>>>> present them to the GCC.
> >>>>>
> >>>>> Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
> >>>>>
> >>>>>
> >>>>> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
> >>>>> Commit:
> >>> http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1f35e526
> >>>>> Tree:
> http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1f35e526
> >>>>> Diff:
> http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1f35e526
> >>>>>
> >>>>> Branch: refs/heads/develop
> >>>>> Commit: 1f35e5260e580b8b40f95551f383a362c2474edd
> >>>>> Parents: e425a86
> >>>>> Author: Erik de Bruin <er...@ixsoftware.nl>
> >>>>> Authored: Thu Jul 2 15:12:50 2015 +0200
> >>>>> Committer: Erik de Bruin <er...@ixsoftware.nl>
> >>>>> Committed: Thu Jul 2 15:12:50 2015 +0200
> >>>>>
> >>>>>
> ----------------------------------------------------------------------
> >>>>> .../mxml/flexjs/MXMLFlexJSPublisher.java | 43 +++++++++++++++++++-
> >>>>> externs/jasmine/compile-config.xml | 5 +++
> >>>>> externs/jquery/compile-config.xml | 5 +++
> >>>>> 3 files changed, 51 insertions(+), 2 deletions(-)
> >>>>>
> ----------------------------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >>>>>
> ----------------------------------------------------------------------
> >>>>> diff --git
> >>>>>
> >>>
> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >>>>>
> >>>
> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >>>>> index 1d6c7aa..cf3869b 100644
> >>>>> ---
> >>>>>
> >>>
> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >>>>> +++
> >>>>>
> >>>
> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >>>>> @@ -22,7 +22,9 @@ import java.io.BufferedReader;
> >>>>> import java.io.File;
> >>>>> import java.io.FileInputStream;
> >>>>> import java.io.IOException;
> >>>>> +import java.io.InputStream;
> >>>>> import java.io.InputStreamReader;
> >>>>> +import java.io.OutputStream;
> >>>>> import java.net.URL;
> >>>>> import java.util.ArrayList;
> >>>>> import java.util.Collection;
> >>>>> @@ -49,6 +51,8 @@ import
> >>>>> org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
> >>>>> import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
> >>>>> import org.apache.flex.compiler.internal.projects.FlexJSProject;
> >>>>> import org.apache.flex.compiler.utils.JSClosureCompilerWrapper;
> >>>>> +import org.apache.flex.swc.ISWC;
> >>>>> +import org.apache.flex.swc.ISWCFileEntry;
> >>>>>
> >>>>> public class MXMLFlexJSPublisher extends JSGoogPublisher implements
> >>>>> IJSPublisher
> >>>>> {
> >>>>> @@ -57,6 +61,8 @@ public class MXMLFlexJSPublisher extends
> >>> JSGoogPublisher
> >>>>> implements IJSPublisher
> >>>>> public static final String FLEXJS_INTERMEDIATE_DIR_NAME = "js-debug";
> >>>>> public static final String FLEXJS_RELEASE_DIR_NAME = "js-release";
> >>>>>
> >>>>> + private static final String FLEXJS_EXTERNS = "externs";
> >>>>> +
> >>>>> class DependencyRecord
> >>>>> {
> >>>>> String path;
> >>>>> @@ -278,8 +284,41 @@ public class MXMLFlexJSPublisher extends
> >>>>> JSGoogPublisher implements IJSPublisher
> >>>>>
> >>>>> JSClosureCompilerWrapper compilerWrapper = new
> >>>>> JSClosureCompilerWrapper();
> >>>>>
> >>>>> - GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
> >>>>> projectName, (JSGoogConfiguration) configuration,
> >>>>> - project.getLibraries());
> >>>>> + List<ISWC> swcs = project.getLibraries();
> >>>>> +
> >>>>> + // (erikdebruin) We don't want to forget that we need to tell the
> >>>>> GCC
> >>>>> + // about them fancy externs we've been working so
> >>>>> hard on
> >>>>> + for (ISWC swc : swcs)
> >>>>> + {
> >>>>> + String srcName = swc.getSWCFile().getName().replace(".swc",
> >>>>> ".js");
> >>>>> + String srcPath = FLEXJS_EXTERNS + File.separator + srcName;
> >>>>> +
> >>>>> + ISWCFileEntry fileEntry = swc.getFile(FLEXJS_EXTERNS +
> >>>>> File.separator + srcName);
> >>>>> + if (fileEntry != null)
> >>>>> + {
> >>>>> + File destFile = new File(intermediateDirPath +
> >>>>> File.separator + srcPath);
> >>>>> +
> >>>>> + InputStream inStream = fileEntry.createInputStream();
> >>>>> + OutputStream outStream =
> >>>>> FileUtils.openOutputStream(destFile);
> >>>>> + byte[] b = new byte[1024 * 1024];
> >>>>> + int bytes_read;
> >>>>> + while ((bytes_read = inStream.read(b)) != -1)
> >>>>> + {
> >>>>> + outStream.write(b, 0, bytes_read);
> >>>>> + }
> >>>>> + outStream.flush();
> >>>>> + outStream.close();
> >>>>> + inStream.close();
> >>>>> +
> >>>>> + String destPath = destFile.getAbsolutePath();
> >>>>> +
> >>>>> + System.out.println("using extern: " + destPath);
> >>>>> +
> >>>>> + compilerWrapper.addJSExternsFile(destPath);
> >>>>> + }
> >>>>> + }
> >>>>> +
> >>>>> + GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
> >>>>> projectName, (JSGoogConfiguration) configuration, swcs);
> >>>>> StringBuilder depsFileData = new StringBuilder();
> >>>>> try
> >>>>> {
> >>>>>
> >>>>>
> >>>>>
> >>>
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jasmine/compile-config.xml
> >>>>>
> ----------------------------------------------------------------------
> >>>>> diff --git a/externs/jasmine/compile-config.xml
> >>>>> b/externs/jasmine/compile-config.xml
> >>>>> index abf867e..2af1e2a 100644
> >>>>> --- a/externs/jasmine/compile-config.xml
> >>>>> +++ b/externs/jasmine/compile-config.xml
> >>>>> @@ -67,6 +67,11 @@
> >>>>> <path-element>out/as/functions</path-element>
> >>>>> </include-sources>
> >>>>>
> >>>>> + <include-file>
> >>>>> + <name>externs/jasmine-2.0.js</name>
> >>>>> + <path>externs/jasmine-2.0.js</path>
> >>>>> + </include-file>
> >>>>> +
> >>>>> <!--
> >>>>> <include-file>
> >>>>> <name>defaults.css</name>
> >>>>>
> >>>>>
> >>>>>
> >>>
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jquery/compile-config.xml
> >>>>>
> ----------------------------------------------------------------------
> >>>>> diff --git a/externs/jquery/compile-config.xml
> >>>>> b/externs/jquery/compile-config.xml
> >>>>> index c0c7f34..3ff4f10 100644
> >>>>> --- a/externs/jquery/compile-config.xml
> >>>>> +++ b/externs/jquery/compile-config.xml
> >>>>> @@ -71,6 +71,11 @@
> >>>>> <path-element>out/as/functions</path-element>
> >>>>> </include-sources>
> >>>>>
> >>>>> + <include-file>
> >>>>> + <name>externs/jquery-1.9.js</name>
> >>>>> + <path>externs/jquery-1.9.js</path>
> >>>>> + </include-file>
> >>>>> +
> >>>>> <!--
> >>>>> <include-file>
> >>>>> <name>defaults.css</name>
> >>>>>
> >>>>>
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Ix Multimedia Software
> >>
> >> Jan Luykenstraat 27
> >> 3521 VB Utrecht
> >>
> >> T. 06-51952295
> >> I. www.ixsoftware.nl
> >>
> >
> >
> >
> > --
> > Ix Multimedia Software
> >
> > Jan Luykenstraat 27
> > 3521 VB Utrecht
> >
> > T. 06-51952295
> > I. www.ixsoftware.nl
>
>

RE: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Frédéric THOMAS <we...@hotmail.com>.
> Can you check in the 'js-debug' if the Main.js has an 'exportSymbol'
> statement at the bottom?
// Ensures the symbol will be visible after compiler renaming.
goog.exportSymbol('Main', Main);
Frédéric THOMAS


----------------------------------------
> From: erik@ixsoftware.nl
> Date: Thu, 2 Jul 2015 17:34:58 +0200
> Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming
> To: dev@flex.apache.org
>
> Can you check in the 'js-debug' if the Main.js has an 'exportSymbol'
> statement at the bottom?
>
> EdB
>
>
>
> On Thu, Jul 2, 2015 at 5:33 PM, Erik de Bruin <er...@ixsoftware.nl> wrote:
>
>> Are you using IntelliJ?
>>
>> Then you're on your own :-P
>>
>> I'll post my command line script, if that might help?
>>
>> EdB
>>
>>
>>
>> On Thu, Jul 2, 2015 at 5:31 PM, Frédéric THOMAS <we...@hotmail.com>
>> wrote:
>>
>>>
>>>> This commit makes the 'release' version of Fred's excellent example work
>>>> (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
>>>> needs to pick up the JS file.
>>>
>>> I rebuilt falcon, the externs, the project and I still have
>>> Uncaught ReferenceError: Main is not defined
>>> with js-release, what did I miss ?
>>>
>>> Thanks,
>>> Frédéric THOMAS
>>>
>>>
>>> ----------------------------------------
>>>> From: erikdebruin@apache.org
>>>> Date: Thu, 2 Jul 2015 15:19:13 +0200
>>>> Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC
>>> and externs: add the 'externs.js' files to the SWCs; tell GCC to use those
>>> to prevent renaming
>>>> To: dev@flex.apache.org
>>>>
>>>> This commit makes the 'release' version of Fred's excellent example work
>>>> (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
>>>> needs to pick up the JS file.
>>>>
>>>> Looking further into those warnings.
>>>>
>>>> EdB
>>>>
>>>>
>>>>
>>>> On Thu, Jul 2, 2015 at 3:13 PM, <er...@apache.org> wrote:
>>>>
>>>>> GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to
>>> use
>>>>> those to prevent renaming
>>>>>
>>>>> We've worked so hard to create AS classes from the Closure externs,
>>> let's
>>>>> not forget what these were originally intended for... and what we need
>>> them
>>>>> for: prevent renaming of externally declared functions. We needed to
>>>>> include the original extern files in their respective SWCs so we can
>>> later
>>>>> present them to the GCC.
>>>>>
>>>>> Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
>>>>>
>>>>>
>>>>> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
>>>>> Commit:
>>> http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1f35e526
>>>>> Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1f35e526
>>>>> Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1f35e526
>>>>>
>>>>> Branch: refs/heads/develop
>>>>> Commit: 1f35e5260e580b8b40f95551f383a362c2474edd
>>>>> Parents: e425a86
>>>>> Author: Erik de Bruin <er...@ixsoftware.nl>
>>>>> Authored: Thu Jul 2 15:12:50 2015 +0200
>>>>> Committer: Erik de Bruin <er...@ixsoftware.nl>
>>>>> Committed: Thu Jul 2 15:12:50 2015 +0200
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>> .../mxml/flexjs/MXMLFlexJSPublisher.java | 43 +++++++++++++++++++-
>>>>> externs/jasmine/compile-config.xml | 5 +++
>>>>> externs/jquery/compile-config.xml | 5 +++
>>>>> 3 files changed, 51 insertions(+), 2 deletions(-)
>>>>> ----------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git
>>>>>
>>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>>>
>>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>>> index 1d6c7aa..cf3869b 100644
>>>>> ---
>>>>>
>>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>>> +++
>>>>>
>>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>>>>> @@ -22,7 +22,9 @@ import java.io.BufferedReader;
>>>>> import java.io.File;
>>>>> import java.io.FileInputStream;
>>>>> import java.io.IOException;
>>>>> +import java.io.InputStream;
>>>>> import java.io.InputStreamReader;
>>>>> +import java.io.OutputStream;
>>>>> import java.net.URL;
>>>>> import java.util.ArrayList;
>>>>> import java.util.Collection;
>>>>> @@ -49,6 +51,8 @@ import
>>>>> org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
>>>>> import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
>>>>> import org.apache.flex.compiler.internal.projects.FlexJSProject;
>>>>> import org.apache.flex.compiler.utils.JSClosureCompilerWrapper;
>>>>> +import org.apache.flex.swc.ISWC;
>>>>> +import org.apache.flex.swc.ISWCFileEntry;
>>>>>
>>>>> public class MXMLFlexJSPublisher extends JSGoogPublisher implements
>>>>> IJSPublisher
>>>>> {
>>>>> @@ -57,6 +61,8 @@ public class MXMLFlexJSPublisher extends
>>> JSGoogPublisher
>>>>> implements IJSPublisher
>>>>> public static final String FLEXJS_INTERMEDIATE_DIR_NAME = "js-debug";
>>>>> public static final String FLEXJS_RELEASE_DIR_NAME = "js-release";
>>>>>
>>>>> + private static final String FLEXJS_EXTERNS = "externs";
>>>>> +
>>>>> class DependencyRecord
>>>>> {
>>>>> String path;
>>>>> @@ -278,8 +284,41 @@ public class MXMLFlexJSPublisher extends
>>>>> JSGoogPublisher implements IJSPublisher
>>>>>
>>>>> JSClosureCompilerWrapper compilerWrapper = new
>>>>> JSClosureCompilerWrapper();
>>>>>
>>>>> - GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>>>>> projectName, (JSGoogConfiguration) configuration,
>>>>> - project.getLibraries());
>>>>> + List<ISWC> swcs = project.getLibraries();
>>>>> +
>>>>> + // (erikdebruin) We don't want to forget that we need to tell the
>>>>> GCC
>>>>> + // about them fancy externs we've been working so
>>>>> hard on
>>>>> + for (ISWC swc : swcs)
>>>>> + {
>>>>> + String srcName = swc.getSWCFile().getName().replace(".swc",
>>>>> ".js");
>>>>> + String srcPath = FLEXJS_EXTERNS + File.separator + srcName;
>>>>> +
>>>>> + ISWCFileEntry fileEntry = swc.getFile(FLEXJS_EXTERNS +
>>>>> File.separator + srcName);
>>>>> + if (fileEntry != null)
>>>>> + {
>>>>> + File destFile = new File(intermediateDirPath +
>>>>> File.separator + srcPath);
>>>>> +
>>>>> + InputStream inStream = fileEntry.createInputStream();
>>>>> + OutputStream outStream =
>>>>> FileUtils.openOutputStream(destFile);
>>>>> + byte[] b = new byte[1024 * 1024];
>>>>> + int bytes_read;
>>>>> + while ((bytes_read = inStream.read(b)) != -1)
>>>>> + {
>>>>> + outStream.write(b, 0, bytes_read);
>>>>> + }
>>>>> + outStream.flush();
>>>>> + outStream.close();
>>>>> + inStream.close();
>>>>> +
>>>>> + String destPath = destFile.getAbsolutePath();
>>>>> +
>>>>> + System.out.println("using extern: " + destPath);
>>>>> +
>>>>> + compilerWrapper.addJSExternsFile(destPath);
>>>>> + }
>>>>> + }
>>>>> +
>>>>> + GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>>>>> projectName, (JSGoogConfiguration) configuration, swcs);
>>>>> StringBuilder depsFileData = new StringBuilder();
>>>>> try
>>>>> {
>>>>>
>>>>>
>>>>>
>>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jasmine/compile-config.xml
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/externs/jasmine/compile-config.xml
>>>>> b/externs/jasmine/compile-config.xml
>>>>> index abf867e..2af1e2a 100644
>>>>> --- a/externs/jasmine/compile-config.xml
>>>>> +++ b/externs/jasmine/compile-config.xml
>>>>> @@ -67,6 +67,11 @@
>>>>> <path-element>out/as/functions</path-element>
>>>>> </include-sources>
>>>>>
>>>>> + <include-file>
>>>>> + <name>externs/jasmine-2.0.js</name>
>>>>> + <path>externs/jasmine-2.0.js</path>
>>>>> + </include-file>
>>>>> +
>>>>> <!--
>>>>> <include-file>
>>>>> <name>defaults.css</name>
>>>>>
>>>>>
>>>>>
>>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jquery/compile-config.xml
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/externs/jquery/compile-config.xml
>>>>> b/externs/jquery/compile-config.xml
>>>>> index c0c7f34..3ff4f10 100644
>>>>> --- a/externs/jquery/compile-config.xml
>>>>> +++ b/externs/jquery/compile-config.xml
>>>>> @@ -71,6 +71,11 @@
>>>>> <path-element>out/as/functions</path-element>
>>>>> </include-sources>
>>>>>
>>>>> + <include-file>
>>>>> + <name>externs/jquery-1.9.js</name>
>>>>> + <path>externs/jquery-1.9.js</path>
>>>>> + </include-file>
>>>>> +
>>>>> <!--
>>>>> <include-file>
>>>>> <name>defaults.css</name>
>>>>>
>>>>>
>>>
>>>
>>
>>
>>
>> --
>> Ix Multimedia Software
>>
>> Jan Luykenstraat 27
>> 3521 VB Utrecht
>>
>> T. 06-51952295
>> I. www.ixsoftware.nl
>>
>
>
>
> --
> Ix Multimedia Software
>
> Jan Luykenstraat 27
> 3521 VB Utrecht
>
> T. 06-51952295
> I. www.ixsoftware.nl
 		 	   		  

Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Erik de Bruin <er...@ixsoftware.nl>.
Can you check in the 'js-debug' if the Main.js has an 'exportSymbol'
statement at the bottom?

EdB



On Thu, Jul 2, 2015 at 5:33 PM, Erik de Bruin <er...@ixsoftware.nl> wrote:

> Are you using IntelliJ?
>
> Then you're on your own :-P
>
> I'll post my command line script, if that might help?
>
> EdB
>
>
>
> On Thu, Jul 2, 2015 at 5:31 PM, Frédéric THOMAS <we...@hotmail.com>
> wrote:
>
>>
>> > This commit makes the 'release' version of Fred's excellent example work
>> > (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
>> > needs to pick up the JS file.
>>
>> I rebuilt falcon, the externs, the project and I still have
>> Uncaught ReferenceError: Main is not defined
>> with js-release, what did I miss ?
>>
>> Thanks,
>> Frédéric THOMAS
>>
>>
>> ----------------------------------------
>> > From: erikdebruin@apache.org
>> > Date: Thu, 2 Jul 2015 15:19:13 +0200
>> > Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC
>> and externs: add the 'externs.js' files to the SWCs; tell GCC to use those
>> to prevent renaming
>> > To: dev@flex.apache.org
>> >
>> > This commit makes the 'release' version of Fred's excellent example work
>> > (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
>> > needs to pick up the JS file.
>> >
>> > Looking further into those warnings.
>> >
>> > EdB
>> >
>> >
>> >
>> > On Thu, Jul 2, 2015 at 3:13 PM, <er...@apache.org> wrote:
>> >
>> >> GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to
>> use
>> >> those to prevent renaming
>> >>
>> >> We've worked so hard to create AS classes from the Closure externs,
>> let's
>> >> not forget what these were originally intended for... and what we need
>> them
>> >> for: prevent renaming of externally declared functions. We needed to
>> >> include the original extern files in their respective SWCs so we can
>> later
>> >> present them to the GCC.
>> >>
>> >> Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
>> >>
>> >>
>> >> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
>> >> Commit:
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1f35e526
>> >> Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1f35e526
>> >> Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1f35e526
>> >>
>> >> Branch: refs/heads/develop
>> >> Commit: 1f35e5260e580b8b40f95551f383a362c2474edd
>> >> Parents: e425a86
>> >> Author: Erik de Bruin <er...@ixsoftware.nl>
>> >> Authored: Thu Jul 2 15:12:50 2015 +0200
>> >> Committer: Erik de Bruin <er...@ixsoftware.nl>
>> >> Committed: Thu Jul 2 15:12:50 2015 +0200
>> >>
>> >> ----------------------------------------------------------------------
>> >> .../mxml/flexjs/MXMLFlexJSPublisher.java | 43 +++++++++++++++++++-
>> >> externs/jasmine/compile-config.xml | 5 +++
>> >> externs/jquery/compile-config.xml | 5 +++
>> >> 3 files changed, 51 insertions(+), 2 deletions(-)
>> >> ----------------------------------------------------------------------
>> >>
>> >>
>> >>
>> >>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> >> ----------------------------------------------------------------------
>> >> diff --git
>> >>
>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> >>
>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> >> index 1d6c7aa..cf3869b 100644
>> >> ---
>> >>
>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> >> +++
>> >>
>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> >> @@ -22,7 +22,9 @@ import java.io.BufferedReader;
>> >> import java.io.File;
>> >> import java.io.FileInputStream;
>> >> import java.io.IOException;
>> >> +import java.io.InputStream;
>> >> import java.io.InputStreamReader;
>> >> +import java.io.OutputStream;
>> >> import java.net.URL;
>> >> import java.util.ArrayList;
>> >> import java.util.Collection;
>> >> @@ -49,6 +51,8 @@ import
>> >> org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
>> >> import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
>> >> import org.apache.flex.compiler.internal.projects.FlexJSProject;
>> >> import org.apache.flex.compiler.utils.JSClosureCompilerWrapper;
>> >> +import org.apache.flex.swc.ISWC;
>> >> +import org.apache.flex.swc.ISWCFileEntry;
>> >>
>> >> public class MXMLFlexJSPublisher extends JSGoogPublisher implements
>> >> IJSPublisher
>> >> {
>> >> @@ -57,6 +61,8 @@ public class MXMLFlexJSPublisher extends
>> JSGoogPublisher
>> >> implements IJSPublisher
>> >> public static final String FLEXJS_INTERMEDIATE_DIR_NAME = "js-debug";
>> >> public static final String FLEXJS_RELEASE_DIR_NAME = "js-release";
>> >>
>> >> + private static final String FLEXJS_EXTERNS = "externs";
>> >> +
>> >> class DependencyRecord
>> >> {
>> >> String path;
>> >> @@ -278,8 +284,41 @@ public class MXMLFlexJSPublisher extends
>> >> JSGoogPublisher implements IJSPublisher
>> >>
>> >> JSClosureCompilerWrapper compilerWrapper = new
>> >> JSClosureCompilerWrapper();
>> >>
>> >> - GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>> >> projectName, (JSGoogConfiguration) configuration,
>> >> - project.getLibraries());
>> >> + List<ISWC> swcs = project.getLibraries();
>> >> +
>> >> + // (erikdebruin) We don't want to forget that we need to tell the
>> >> GCC
>> >> + // about them fancy externs we've been working so
>> >> hard on
>> >> + for (ISWC swc : swcs)
>> >> + {
>> >> + String srcName = swc.getSWCFile().getName().replace(".swc",
>> >> ".js");
>> >> + String srcPath = FLEXJS_EXTERNS + File.separator + srcName;
>> >> +
>> >> + ISWCFileEntry fileEntry = swc.getFile(FLEXJS_EXTERNS +
>> >> File.separator + srcName);
>> >> + if (fileEntry != null)
>> >> + {
>> >> + File destFile = new File(intermediateDirPath +
>> >> File.separator + srcPath);
>> >> +
>> >> + InputStream inStream = fileEntry.createInputStream();
>> >> + OutputStream outStream =
>> >> FileUtils.openOutputStream(destFile);
>> >> + byte[] b = new byte[1024 * 1024];
>> >> + int bytes_read;
>> >> + while ((bytes_read = inStream.read(b)) != -1)
>> >> + {
>> >> + outStream.write(b, 0, bytes_read);
>> >> + }
>> >> + outStream.flush();
>> >> + outStream.close();
>> >> + inStream.close();
>> >> +
>> >> + String destPath = destFile.getAbsolutePath();
>> >> +
>> >> + System.out.println("using extern: " + destPath);
>> >> +
>> >> + compilerWrapper.addJSExternsFile(destPath);
>> >> + }
>> >> + }
>> >> +
>> >> + GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>> >> projectName, (JSGoogConfiguration) configuration, swcs);
>> >> StringBuilder depsFileData = new StringBuilder();
>> >> try
>> >> {
>> >>
>> >>
>> >>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jasmine/compile-config.xml
>> >> ----------------------------------------------------------------------
>> >> diff --git a/externs/jasmine/compile-config.xml
>> >> b/externs/jasmine/compile-config.xml
>> >> index abf867e..2af1e2a 100644
>> >> --- a/externs/jasmine/compile-config.xml
>> >> +++ b/externs/jasmine/compile-config.xml
>> >> @@ -67,6 +67,11 @@
>> >> <path-element>out/as/functions</path-element>
>> >> </include-sources>
>> >>
>> >> + <include-file>
>> >> + <name>externs/jasmine-2.0.js</name>
>> >> + <path>externs/jasmine-2.0.js</path>
>> >> + </include-file>
>> >> +
>> >> <!--
>> >> <include-file>
>> >> <name>defaults.css</name>
>> >>
>> >>
>> >>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jquery/compile-config.xml
>> >> ----------------------------------------------------------------------
>> >> diff --git a/externs/jquery/compile-config.xml
>> >> b/externs/jquery/compile-config.xml
>> >> index c0c7f34..3ff4f10 100644
>> >> --- a/externs/jquery/compile-config.xml
>> >> +++ b/externs/jquery/compile-config.xml
>> >> @@ -71,6 +71,11 @@
>> >> <path-element>out/as/functions</path-element>
>> >> </include-sources>
>> >>
>> >> + <include-file>
>> >> + <name>externs/jquery-1.9.js</name>
>> >> + <path>externs/jquery-1.9.js</path>
>> >> + </include-file>
>> >> +
>> >> <!--
>> >> <include-file>
>> >> <name>defaults.css</name>
>> >>
>> >>
>>
>>
>
>
>
> --
> Ix Multimedia Software
>
> Jan Luykenstraat 27
> 3521 VB Utrecht
>
> T. 06-51952295
> I. www.ixsoftware.nl
>



-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Erik de Bruin <er...@ixsoftware.nl>.
Are you using IntelliJ?

Then you're on your own :-P

I'll post my command line script, if that might help?

EdB



On Thu, Jul 2, 2015 at 5:31 PM, Frédéric THOMAS <we...@hotmail.com>
wrote:

>
> > This commit makes the 'release' version of Fred's excellent example work
> > (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
> > needs to pick up the JS file.
>
> I rebuilt falcon, the externs, the project and I still have
> Uncaught ReferenceError: Main is not defined
> with js-release, what did I miss ?
>
> Thanks,
> Frédéric THOMAS
>
>
> ----------------------------------------
> > From: erikdebruin@apache.org
> > Date: Thu, 2 Jul 2015 15:19:13 +0200
> > Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC
> and externs: add the 'externs.js' files to the SWCs; tell GCC to use those
> to prevent renaming
> > To: dev@flex.apache.org
> >
> > This commit makes the 'release' version of Fred's excellent example work
> > (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
> > needs to pick up the JS file.
> >
> > Looking further into those warnings.
> >
> > EdB
> >
> >
> >
> > On Thu, Jul 2, 2015 at 3:13 PM, <er...@apache.org> wrote:
> >
> >> GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use
> >> those to prevent renaming
> >>
> >> We've worked so hard to create AS classes from the Closure externs,
> let's
> >> not forget what these were originally intended for... and what we need
> them
> >> for: prevent renaming of externally declared functions. We needed to
> >> include the original extern files in their respective SWCs so we can
> later
> >> present them to the GCC.
> >>
> >> Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
> >>
> >>
> >> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
> >> Commit:
> http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1f35e526
> >> Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1f35e526
> >> Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1f35e526
> >>
> >> Branch: refs/heads/develop
> >> Commit: 1f35e5260e580b8b40f95551f383a362c2474edd
> >> Parents: e425a86
> >> Author: Erik de Bruin <er...@ixsoftware.nl>
> >> Authored: Thu Jul 2 15:12:50 2015 +0200
> >> Committer: Erik de Bruin <er...@ixsoftware.nl>
> >> Committed: Thu Jul 2 15:12:50 2015 +0200
> >>
> >> ----------------------------------------------------------------------
> >> .../mxml/flexjs/MXMLFlexJSPublisher.java | 43 +++++++++++++++++++-
> >> externs/jasmine/compile-config.xml | 5 +++
> >> externs/jquery/compile-config.xml | 5 +++
> >> 3 files changed, 51 insertions(+), 2 deletions(-)
> >> ----------------------------------------------------------------------
> >>
> >>
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >> ----------------------------------------------------------------------
> >> diff --git
> >>
> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >>
> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >> index 1d6c7aa..cf3869b 100644
> >> ---
> >>
> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >> +++
> >>
> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> >> @@ -22,7 +22,9 @@ import java.io.BufferedReader;
> >> import java.io.File;
> >> import java.io.FileInputStream;
> >> import java.io.IOException;
> >> +import java.io.InputStream;
> >> import java.io.InputStreamReader;
> >> +import java.io.OutputStream;
> >> import java.net.URL;
> >> import java.util.ArrayList;
> >> import java.util.Collection;
> >> @@ -49,6 +51,8 @@ import
> >> org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
> >> import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
> >> import org.apache.flex.compiler.internal.projects.FlexJSProject;
> >> import org.apache.flex.compiler.utils.JSClosureCompilerWrapper;
> >> +import org.apache.flex.swc.ISWC;
> >> +import org.apache.flex.swc.ISWCFileEntry;
> >>
> >> public class MXMLFlexJSPublisher extends JSGoogPublisher implements
> >> IJSPublisher
> >> {
> >> @@ -57,6 +61,8 @@ public class MXMLFlexJSPublisher extends
> JSGoogPublisher
> >> implements IJSPublisher
> >> public static final String FLEXJS_INTERMEDIATE_DIR_NAME = "js-debug";
> >> public static final String FLEXJS_RELEASE_DIR_NAME = "js-release";
> >>
> >> + private static final String FLEXJS_EXTERNS = "externs";
> >> +
> >> class DependencyRecord
> >> {
> >> String path;
> >> @@ -278,8 +284,41 @@ public class MXMLFlexJSPublisher extends
> >> JSGoogPublisher implements IJSPublisher
> >>
> >> JSClosureCompilerWrapper compilerWrapper = new
> >> JSClosureCompilerWrapper();
> >>
> >> - GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
> >> projectName, (JSGoogConfiguration) configuration,
> >> - project.getLibraries());
> >> + List<ISWC> swcs = project.getLibraries();
> >> +
> >> + // (erikdebruin) We don't want to forget that we need to tell the
> >> GCC
> >> + // about them fancy externs we've been working so
> >> hard on
> >> + for (ISWC swc : swcs)
> >> + {
> >> + String srcName = swc.getSWCFile().getName().replace(".swc",
> >> ".js");
> >> + String srcPath = FLEXJS_EXTERNS + File.separator + srcName;
> >> +
> >> + ISWCFileEntry fileEntry = swc.getFile(FLEXJS_EXTERNS +
> >> File.separator + srcName);
> >> + if (fileEntry != null)
> >> + {
> >> + File destFile = new File(intermediateDirPath +
> >> File.separator + srcPath);
> >> +
> >> + InputStream inStream = fileEntry.createInputStream();
> >> + OutputStream outStream =
> >> FileUtils.openOutputStream(destFile);
> >> + byte[] b = new byte[1024 * 1024];
> >> + int bytes_read;
> >> + while ((bytes_read = inStream.read(b)) != -1)
> >> + {
> >> + outStream.write(b, 0, bytes_read);
> >> + }
> >> + outStream.flush();
> >> + outStream.close();
> >> + inStream.close();
> >> +
> >> + String destPath = destFile.getAbsolutePath();
> >> +
> >> + System.out.println("using extern: " + destPath);
> >> +
> >> + compilerWrapper.addJSExternsFile(destPath);
> >> + }
> >> + }
> >> +
> >> + GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
> >> projectName, (JSGoogConfiguration) configuration, swcs);
> >> StringBuilder depsFileData = new StringBuilder();
> >> try
> >> {
> >>
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jasmine/compile-config.xml
> >> ----------------------------------------------------------------------
> >> diff --git a/externs/jasmine/compile-config.xml
> >> b/externs/jasmine/compile-config.xml
> >> index abf867e..2af1e2a 100644
> >> --- a/externs/jasmine/compile-config.xml
> >> +++ b/externs/jasmine/compile-config.xml
> >> @@ -67,6 +67,11 @@
> >> <path-element>out/as/functions</path-element>
> >> </include-sources>
> >>
> >> + <include-file>
> >> + <name>externs/jasmine-2.0.js</name>
> >> + <path>externs/jasmine-2.0.js</path>
> >> + </include-file>
> >> +
> >> <!--
> >> <include-file>
> >> <name>defaults.css</name>
> >>
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jquery/compile-config.xml
> >> ----------------------------------------------------------------------
> >> diff --git a/externs/jquery/compile-config.xml
> >> b/externs/jquery/compile-config.xml
> >> index c0c7f34..3ff4f10 100644
> >> --- a/externs/jquery/compile-config.xml
> >> +++ b/externs/jquery/compile-config.xml
> >> @@ -71,6 +71,11 @@
> >> <path-element>out/as/functions</path-element>
> >> </include-sources>
> >>
> >> + <include-file>
> >> + <name>externs/jquery-1.9.js</name>
> >> + <path>externs/jquery-1.9.js</path>
> >> + </include-file>
> >> +
> >> <!--
> >> <include-file>
> >> <name>defaults.css</name>
> >>
> >>
>
>



-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

RE: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Frédéric THOMAS <we...@hotmail.com>.
> This commit makes the 'release' version of Fred's excellent example work
> (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
> needs to pick up the JS file.

I rebuilt falcon, the externs, the project and I still have 
Uncaught ReferenceError: Main is not defined
with js-release, what did I miss ?

Thanks,
Frédéric THOMAS


----------------------------------------
> From: erikdebruin@apache.org
> Date: Thu, 2 Jul 2015 15:19:13 +0200
> Subject: Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming
> To: dev@flex.apache.org
>
> This commit makes the 'release' version of Fred's excellent example work
> (with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
> needs to pick up the JS file.
>
> Looking further into those warnings.
>
> EdB
>
>
>
> On Thu, Jul 2, 2015 at 3:13 PM, <er...@apache.org> wrote:
>
>> GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use
>> those to prevent renaming
>>
>> We've worked so hard to create AS classes from the Closure externs, let's
>> not forget what these were originally intended for... and what we need them
>> for: prevent renaming of externally declared functions. We needed to
>> include the original extern files in their respective SWCs so we can later
>> present them to the GCC.
>>
>> Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1f35e526
>> Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1f35e526
>> Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1f35e526
>>
>> Branch: refs/heads/develop
>> Commit: 1f35e5260e580b8b40f95551f383a362c2474edd
>> Parents: e425a86
>> Author: Erik de Bruin <er...@ixsoftware.nl>
>> Authored: Thu Jul 2 15:12:50 2015 +0200
>> Committer: Erik de Bruin <er...@ixsoftware.nl>
>> Committed: Thu Jul 2 15:12:50 2015 +0200
>>
>> ----------------------------------------------------------------------
>> .../mxml/flexjs/MXMLFlexJSPublisher.java | 43 +++++++++++++++++++-
>> externs/jasmine/compile-config.xml | 5 +++
>> externs/jquery/compile-config.xml | 5 +++
>> 3 files changed, 51 insertions(+), 2 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> index 1d6c7aa..cf3869b 100644
>> ---
>> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> +++
>> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
>> @@ -22,7 +22,9 @@ import java.io.BufferedReader;
>> import java.io.File;
>> import java.io.FileInputStream;
>> import java.io.IOException;
>> +import java.io.InputStream;
>> import java.io.InputStreamReader;
>> +import java.io.OutputStream;
>> import java.net.URL;
>> import java.util.ArrayList;
>> import java.util.Collection;
>> @@ -49,6 +51,8 @@ import
>> org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
>> import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
>> import org.apache.flex.compiler.internal.projects.FlexJSProject;
>> import org.apache.flex.compiler.utils.JSClosureCompilerWrapper;
>> +import org.apache.flex.swc.ISWC;
>> +import org.apache.flex.swc.ISWCFileEntry;
>>
>> public class MXMLFlexJSPublisher extends JSGoogPublisher implements
>> IJSPublisher
>> {
>> @@ -57,6 +61,8 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher
>> implements IJSPublisher
>> public static final String FLEXJS_INTERMEDIATE_DIR_NAME = "js-debug";
>> public static final String FLEXJS_RELEASE_DIR_NAME = "js-release";
>>
>> + private static final String FLEXJS_EXTERNS = "externs";
>> +
>> class DependencyRecord
>> {
>> String path;
>> @@ -278,8 +284,41 @@ public class MXMLFlexJSPublisher extends
>> JSGoogPublisher implements IJSPublisher
>>
>> JSClosureCompilerWrapper compilerWrapper = new
>> JSClosureCompilerWrapper();
>>
>> - GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>> projectName, (JSGoogConfiguration) configuration,
>> - project.getLibraries());
>> + List<ISWC> swcs = project.getLibraries();
>> +
>> + // (erikdebruin) We don't want to forget that we need to tell the
>> GCC
>> + // about them fancy externs we've been working so
>> hard on
>> + for (ISWC swc : swcs)
>> + {
>> + String srcName = swc.getSWCFile().getName().replace(".swc",
>> ".js");
>> + String srcPath = FLEXJS_EXTERNS + File.separator + srcName;
>> +
>> + ISWCFileEntry fileEntry = swc.getFile(FLEXJS_EXTERNS +
>> File.separator + srcName);
>> + if (fileEntry != null)
>> + {
>> + File destFile = new File(intermediateDirPath +
>> File.separator + srcPath);
>> +
>> + InputStream inStream = fileEntry.createInputStream();
>> + OutputStream outStream =
>> FileUtils.openOutputStream(destFile);
>> + byte[] b = new byte[1024 * 1024];
>> + int bytes_read;
>> + while ((bytes_read = inStream.read(b)) != -1)
>> + {
>> + outStream.write(b, 0, bytes_read);
>> + }
>> + outStream.flush();
>> + outStream.close();
>> + inStream.close();
>> +
>> + String destPath = destFile.getAbsolutePath();
>> +
>> + System.out.println("using extern: " + destPath);
>> +
>> + compilerWrapper.addJSExternsFile(destPath);
>> + }
>> + }
>> +
>> + GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
>> projectName, (JSGoogConfiguration) configuration, swcs);
>> StringBuilder depsFileData = new StringBuilder();
>> try
>> {
>>
>>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jasmine/compile-config.xml
>> ----------------------------------------------------------------------
>> diff --git a/externs/jasmine/compile-config.xml
>> b/externs/jasmine/compile-config.xml
>> index abf867e..2af1e2a 100644
>> --- a/externs/jasmine/compile-config.xml
>> +++ b/externs/jasmine/compile-config.xml
>> @@ -67,6 +67,11 @@
>> <path-element>out/as/functions</path-element>
>> </include-sources>
>>
>> + <include-file>
>> + <name>externs/jasmine-2.0.js</name>
>> + <path>externs/jasmine-2.0.js</path>
>> + </include-file>
>> +
>> <!--
>> <include-file>
>> <name>defaults.css</name>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jquery/compile-config.xml
>> ----------------------------------------------------------------------
>> diff --git a/externs/jquery/compile-config.xml
>> b/externs/jquery/compile-config.xml
>> index c0c7f34..3ff4f10 100644
>> --- a/externs/jquery/compile-config.xml
>> +++ b/externs/jquery/compile-config.xml
>> @@ -71,6 +71,11 @@
>> <path-element>out/as/functions</path-element>
>> </include-sources>
>>
>> + <include-file>
>> + <name>externs/jquery-1.9.js</name>
>> + <path>externs/jquery-1.9.js</path>
>> + </include-file>
>> +
>> <!--
>> <include-file>
>> <name>defaults.css</name>
>>
>>
 		 	   		  

Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Erik de Bruin <er...@ixsoftware.nl>.
I've a commit ready that disables those warnings.

I've tried to use the suggested '@export/@nocollapse' pair of annotations,
but that gives problems. Not sure what we're doing wrong so that it doesn't
work, but I gave up after a couple of hours.

Right now I'm working on getting the GCC to include the svg.js from js.swc
as an externs file. Do you know of a way to iterate over the files in a
"subdirectory" in an SWC? I've managed to put the 'svg.js' file in a
'externs' directory in the SWC. For the other externs swc, I simply assumed
a JS file with the same name as the SWC exists, but for 'js.swc', I need to
generically check if there are any files in the 'externs' "directory" in
the SWC so I can include them in the procedure I wrote.

Thanks,

EdB



On Thu, Jul 2, 2015 at 5:05 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 7/2/15, 6:19 AM, "Erik de Bruin" <er...@apache.org> wrote:
>
> >This commit makes the 'release' version of Fred's excellent example work
> >(with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
> >needs to pick up the JS file.
> >
> >Looking further into those warnings.
>
> Many warnings are due to our use of @expose.  I’m currently seeing if we
> can use @export instead.
>
> -Alex
>
>


-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Alex Harui <ah...@adobe.com>.

On 7/2/15, 6:19 AM, "Erik de Bruin" <er...@apache.org> wrote:

>This commit makes the 'release' version of Fred's excellent example work
>(with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
>needs to pick up the JS file.
>
>Looking further into those warnings.

Many warnings are due to our use of @expose.  I’m currently seeing if we
can use @export instead.

-Alex


Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use those to prevent renaming

Posted by Erik de Bruin <er...@apache.org>.
This commit makes the 'release' version of Fred's excellent example work
(with warnings). Don't forget to rebuild the 'jquery' externs SWC, as it
needs to pick up the JS file.

Looking further into those warnings.

EdB



On Thu, Jul 2, 2015 at 3:13 PM, <er...@apache.org> wrote:

> GCC and externs: add the 'externs.js' files to the SWCs; tell GCC to use
> those to prevent renaming
>
> We've worked so hard to create AS classes from the Closure externs, let's
> not forget what these were originally intended for... and what we need them
> for: prevent renaming of externally declared functions. We needed to
> include the original extern files in their respective SWCs so we can later
> present them to the GCC.
>
> Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1f35e526
> Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1f35e526
> Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1f35e526
>
> Branch: refs/heads/develop
> Commit: 1f35e5260e580b8b40f95551f383a362c2474edd
> Parents: e425a86
> Author: Erik de Bruin <er...@ixsoftware.nl>
> Authored: Thu Jul 2 15:12:50 2015 +0200
> Committer: Erik de Bruin <er...@ixsoftware.nl>
> Committed: Thu Jul 2 15:12:50 2015 +0200
>
> ----------------------------------------------------------------------
>  .../mxml/flexjs/MXMLFlexJSPublisher.java        | 43 +++++++++++++++++++-
>  externs/jasmine/compile-config.xml              |  5 +++
>  externs/jquery/compile-config.xml               |  5 +++
>  3 files changed, 51 insertions(+), 2 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> ----------------------------------------------------------------------
> diff --git
> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> index 1d6c7aa..cf3869b 100644
> ---
> a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> +++
> b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
> @@ -22,7 +22,9 @@ import java.io.BufferedReader;
>  import java.io.File;
>  import java.io.FileInputStream;
>  import java.io.IOException;
> +import java.io.InputStream;
>  import java.io.InputStreamReader;
> +import java.io.OutputStream;
>  import java.net.URL;
>  import java.util.ArrayList;
>  import java.util.Collection;
> @@ -49,6 +51,8 @@ import
> org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
>  import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
>  import org.apache.flex.compiler.internal.projects.FlexJSProject;
>  import org.apache.flex.compiler.utils.JSClosureCompilerWrapper;
> +import org.apache.flex.swc.ISWC;
> +import org.apache.flex.swc.ISWCFileEntry;
>
>  public class MXMLFlexJSPublisher extends JSGoogPublisher implements
> IJSPublisher
>  {
> @@ -57,6 +61,8 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher
> implements IJSPublisher
>      public static final String FLEXJS_INTERMEDIATE_DIR_NAME = "js-debug";
>      public static final String FLEXJS_RELEASE_DIR_NAME = "js-release";
>
> +    private static final String FLEXJS_EXTERNS = "externs";
> +
>      class DependencyRecord
>      {
>          String path;
> @@ -278,8 +284,41 @@ public class MXMLFlexJSPublisher extends
> JSGoogPublisher implements IJSPublisher
>
>          JSClosureCompilerWrapper compilerWrapper = new
> JSClosureCompilerWrapper();
>
> -        GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
> projectName, (JSGoogConfiguration) configuration,
> -                project.getLibraries());
> +        List<ISWC> swcs = project.getLibraries();
> +
> +        // (erikdebruin) We don't want to forget that we need to tell the
> GCC
> +        //               about them fancy externs we've been working so
> hard on
> +        for (ISWC swc : swcs)
> +        {
> +            String srcName = swc.getSWCFile().getName().replace(".swc",
> ".js");
> +            String srcPath = FLEXJS_EXTERNS + File.separator + srcName;
> +
> +            ISWCFileEntry fileEntry = swc.getFile(FLEXJS_EXTERNS +
> File.separator + srcName);
> +            if (fileEntry != null)
> +            {
> +                File destFile = new File(intermediateDirPath +
> File.separator + srcPath);
> +
> +                InputStream inStream = fileEntry.createInputStream();
> +                OutputStream outStream =
> FileUtils.openOutputStream(destFile);
> +                byte[] b = new byte[1024 * 1024];
> +                int bytes_read;
> +                while ((bytes_read = inStream.read(b)) != -1)
> +                {
> +                    outStream.write(b, 0, bytes_read);
> +                }
> +                outStream.flush();
> +                outStream.close();
> +                inStream.close();
> +
> +                String destPath = destFile.getAbsolutePath();
> +
> +                System.out.println("using extern: " + destPath);
> +
> +                compilerWrapper.addJSExternsFile(destPath);
> +            }
> +        }
> +
> +        GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir,
> projectName, (JSGoogConfiguration) configuration, swcs);
>          StringBuilder depsFileData = new StringBuilder();
>          try
>          {
>
>
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jasmine/compile-config.xml
> ----------------------------------------------------------------------
> diff --git a/externs/jasmine/compile-config.xml
> b/externs/jasmine/compile-config.xml
> index abf867e..2af1e2a 100644
> --- a/externs/jasmine/compile-config.xml
> +++ b/externs/jasmine/compile-config.xml
> @@ -67,6 +67,11 @@
>          <path-element>out/as/functions</path-element>
>      </include-sources>
>
> +    <include-file>
> +        <name>externs/jasmine-2.0.js</name>
> +        <path>externs/jasmine-2.0.js</path>
> +    </include-file>
> +
>      <!--
>      <include-file>
>          <name>defaults.css</name>
>
>
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f35e526/externs/jquery/compile-config.xml
> ----------------------------------------------------------------------
> diff --git a/externs/jquery/compile-config.xml
> b/externs/jquery/compile-config.xml
> index c0c7f34..3ff4f10 100644
> --- a/externs/jquery/compile-config.xml
> +++ b/externs/jquery/compile-config.xml
> @@ -71,6 +71,11 @@
>          <path-element>out/as/functions</path-element>
>      </include-sources>
>
> +    <include-file>
> +        <name>externs/jquery-1.9.js</name>
> +        <path>externs/jquery-1.9.js</path>
> +    </include-file>
> +
>      <!--
>      <include-file>
>          <name>defaults.css</name>
>
>