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 2016/09/09 19:11:09 UTC

git commit: [flex-falcon] [refs/heads/develop] - fix when we output css

Repository: flex-falcon
Updated Branches:
  refs/heads/develop 9ed1791da -> 9b6f5bd61


fix when we output css


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

Branch: refs/heads/develop
Commit: 9b6f5bd61258bc03fe61ff3845648fb0a90e380a
Parents: 9ed1791
Author: Alex Harui <ah...@apache.org>
Authored: Fri Sep 9 12:10:54 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Sep 9 12:11:05 2016 -0700

----------------------------------------------------------------------
 .../mxml/flexjs/MXMLFlexJSPublisher.java        | 36 ++++++++++----------
 .../js/flexjs/JSCSSCompilationSession.java      |  2 ++
 2 files changed, 20 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9b6f5bd6/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index d12a7e6..64b3c86 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -510,31 +510,31 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
 
     private void appendEncodedCSS(String path, String projectName) throws IOException
     {
-        if (!project.needCSS)
-            return;
-
         StringBuilder appendString = new StringBuilder();
         appendString.append("\n\n");
         appendString.append(projectName);
         appendString.append(".prototype.cssData = [");
         JSCSSCompilationSession cssSession = (JSCSSCompilationSession) project.getCSSCompilationSession();
         String s = cssSession.getEncodedCSS();
-        int reqidx = s.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-        if (reqidx != -1)
-        {
-            String reqs = s.substring(reqidx);
-            s = s.substring(0, reqidx - 1);
-            String fileData = readCode(new File(path));
-            reqidx = fileData.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-            String after = fileData.substring(reqidx);
-            String before = fileData.substring(0, reqidx - 1);
-            s = before + reqs + after + appendString.toString() + s;
-            writeFile(path, s, false);
-        }
-        else
+        if (s != null)
         {
-            appendString.append(s);
-            writeFile(path, appendString.toString(), true);
+	        int reqidx = s.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+	        if (reqidx != -1)
+	        {
+	            String reqs = s.substring(reqidx);
+	            s = s.substring(0, reqidx - 1);
+	            String fileData = readCode(new File(path));
+	            reqidx = fileData.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+	            String after = fileData.substring(reqidx);
+	            String before = fileData.substring(0, reqidx - 1);
+	            s = before + reqs + after + appendString.toString() + s;
+	            writeFile(path, s, false);
+	        }
+	        else
+	        {
+	            appendString.append(s);
+	            writeFile(path, appendString.toString(), true);
+	        }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9b6f5bd6/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
index b61bbf5..fdad4c3 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
@@ -56,6 +56,8 @@ public class JSCSSCompilationSession extends CSSCompilationSession
         StringBuilder sb = new StringBuilder();
         requires = new ArrayList<String>();
         encodeCSS(css, sb);
+        if (sb.length() == 0)
+        	return null;
         sb.append("];\n");
         for (String r : requires)
         {