You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2013/05/03 22:05:32 UTC
git commit: [flex-falcon] [refs/heads/develop] - handle goog.events
in publisher
Updated Branches:
refs/heads/develop d80c98572 -> f44a31b12
handle goog.events in publisher
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f44a31b1
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f44a31b1
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f44a31b1
Branch: refs/heads/develop
Commit: f44a31b12eaf43591406efe3abfeae16497f9ea1
Parents: d80c985
Author: Alex Harui <ah...@apache.org>
Authored: Fri May 3 13:05:12 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri May 3 13:05:12 2013 -0700
----------------------------------------------------------------------
.../compiler/internal/graph/GoogDepsWriter.java | 136 +++++++++++----
1 files changed, 103 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f44a31b1/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index e64da37..9f8cae6 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -195,45 +195,114 @@ public class GoogDepsWriter {
String getFilePath(String className)
{
+ String fn;
+ File destFile;
+ File f;
+
System.out.println("Finding file for class: " + className);
String classPath = className.replace(".", File.separator);
- String fn = googPath + File.separator + "closure" + File.separator + "goog" + File.separator + classPath + ".js";
- File destFile;
- File f = new File(fn);
- if (f.exists())
+ if (className.contains("goog."))
{
- fn = outputFolderPath + File.separator + "library" +
- File.separator + "closure" + File.separator + "goog" +
- File.separator + classPath + ".js";
- destFile = new File(fn);
- // copy source to output
- try {
- FileUtils.copyFile(f, destFile);
- System.out.println("Copying file for class: " + className);
- } catch (IOException e) {
- System.out.println("Error copying file for class: " + className);
+ String googPackage = classPath.substring(0, classPath.lastIndexOf(File.separator));
+ String googClass = classPath.substring(classPath.lastIndexOf(File.separator) + 1);
+ fn = googPath + File.separator + "closure" + File.separator + googPackage + File.separator + googClass.toLowerCase() + ".js";
+ f = new File(fn);
+ if (f.exists())
+ {
+ fn = outputFolderPath + File.separator + "library" +
+ File.separator + "closure" +
+ File.separator + googPackage + File.separator + googClass.toLowerCase() + ".js";
+ destFile = new File(fn);
+ // copy source to output
+ try {
+ FileUtils.copyFile(f, destFile);
+ System.out.println("Copying file for class: " + className);
+ } catch (IOException e) {
+ System.out.println("Error copying file for class: " + className);
+ }
+ return fn;
+ }
+
+ fn = googPath + File.separator + "third_party" + File.separator + "closure" + File.separator + googPackage + File.separator + googClass.toLowerCase() + ".js";
+ f = new File(fn);
+ if (f.exists())
+ {
+ fn = outputFolderPath + File.separator + "library" +
+ File.separator + "third_party" + File.separator + "closure" +
+ File.separator + googPackage + File.separator + googClass.toLowerCase() + ".js";
+ destFile = new File(fn);
+ // copy source to output
+ try {
+ FileUtils.copyFile(f, destFile);
+ System.out.println("Copying file for class: " + className);
+ } catch (IOException e) {
+ System.out.println("Error copying file for class: " + className);
+ }
+ return fn;
+ }
+ // Closure Library also uses just goog.provide(goog.foo) in goog/foo/foo.js
+ fn = googPath + File.separator + "closure" + File.separator +
+ googPackage + File.separator + googClass.toLowerCase() + File.separator + googClass.toLowerCase() + ".js";
+ f = new File(fn);
+ if (f.exists())
+ {
+ fn = outputFolderPath + File.separator + "library" +
+ File.separator + "closure" +
+ File.separator + googPackage + File.separator + googClass.toLowerCase() + File.separator + googClass.toLowerCase() + ".js";
+ destFile = new File(fn);
+ // copy source to output
+ try {
+ FileUtils.copyFile(f, destFile);
+ System.out.println("Copying file for class: " + className);
+ } catch (IOException e) {
+ System.out.println("Error copying file for class: " + className);
+ }
+ return fn;
+ }
+
+ fn = googPath + File.separator + "third_party" + File.separator + "closure" + File.separator +
+ googPackage + File.separator + googClass.toLowerCase() + File.separator + googClass.toLowerCase() + ".js";
+ f = new File(fn);
+ if (f.exists())
+ {
+ fn = outputFolderPath + File.separator + "library" +
+ File.separator + "third_party" + File.separator + "closure" +
+ File.separator + googPackage + File.separator + googClass.toLowerCase() + File.separator + googClass.toLowerCase() + ".js";
+ destFile = new File(fn);
+ // copy source to output
+ try {
+ FileUtils.copyFile(f, destFile);
+ System.out.println("Copying file for class: " + className);
+ } catch (IOException e) {
+ System.out.println("Error copying file for class: " + className);
+ }
+ return fn;
+ }
+ // if we still haven't found it, use this hack for now. I guess
+ // eventually we should search every file.
+ if (googClass.equals("ListenableKey"))
+ googClass = "Listenable";
+ else if (googClass.equals("EventLike"))
+ googClass = "Event";
+ fn = googPath + File.separator + "closure" + File.separator + googPackage + File.separator + googClass.toLowerCase() + ".js";
+ f = new File(fn);
+ if (f.exists())
+ {
+ fn = outputFolderPath + File.separator + "library" +
+ File.separator + "closure" +
+ File.separator + googPackage + File.separator + googClass.toLowerCase() + ".js";
+ destFile = new File(fn);
+ // copy source to output
+ try {
+ FileUtils.copyFile(f, destFile);
+ System.out.println("Copying file for class: " + className);
+ } catch (IOException e) {
+ System.out.println("Error copying file for class: " + className);
+ }
+ return fn;
}
- return fn;
}
- fn = googPath + File.separator + "closure" + File.separator + "third_party" + File.separator + classPath + ".js";
- f = new File(fn);
- if (f.exists())
- {
- fn = outputFolderPath + File.separator + "library" +
- File.separator + "closure" + File.separator + "third_party" +
- File.separator + classPath + ".js";
- destFile = new File(fn);
- // copy source to output
- try {
- FileUtils.copyFile(f, destFile);
- System.out.println("Copying file for class: " + className);
- } catch (IOException e) {
- System.out.println("Error copying file for class: " + className);
- }
- return fn;
- }
-
fn = outputFolderPath + File.separator + classPath + ".js";
f = new File(fn);
if (f.exists())
@@ -260,6 +329,7 @@ public class GoogDepsWriter {
return fn;
}
}
+
System.out.println("Could not find file for class: " + className);
return "";
}