You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/06/04 06:01:58 UTC

[royale-compiler] branch release_practice updated: no CRLF in .css files in swcs

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch release_practice
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/release_practice by this push:
     new 28ecf4f  no CRLF in .css files in swcs
28ecf4f is described below

commit 28ecf4f87366f5bab91733f089483844fb2698e3
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Jun 3 23:01:48 2019 -0700

    no CRLF in .css files in swcs
---
 .../royale/compiler/filespecs/FileSpecification.java    |  6 +++---
 .../main/java/org/apache/royale/swc/io/SWCWriter.java   | 17 ++++++++++++++---
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/filespecs/FileSpecification.java b/compiler-common/src/main/java/org/apache/royale/compiler/filespecs/FileSpecification.java
index db368ed..52be73c 100644
--- a/compiler-common/src/main/java/org/apache/royale/compiler/filespecs/FileSpecification.java
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/filespecs/FileSpecification.java
@@ -140,11 +140,11 @@ public class FileSpecification extends BaseFileSpecification implements IBinaryF
 		fileHandle.setLastModified(fileDate);
 	}
 	
-	class NoCRLFInputStream extends FilterInputStream
+	public static class NoCRLFInputStream extends FilterInputStream
 	{
-		public NoCRLFInputStream(BufferedInputStream strm)
+		public NoCRLFInputStream(InputStream fileInputStream)
 		{
-			super(strm);
+			super(fileInputStream);
 		}
 		
 		/**
diff --git a/compiler/src/main/java/org/apache/royale/swc/io/SWCWriter.java b/compiler/src/main/java/org/apache/royale/swc/io/SWCWriter.java
index 095e321..c64e6ad 100644
--- a/compiler/src/main/java/org/apache/royale/swc/io/SWCWriter.java
+++ b/compiler/src/main/java/org/apache/royale/swc/io/SWCWriter.java
@@ -37,7 +37,7 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
 import org.apache.commons.io.IOUtils;
-
+import org.apache.royale.compiler.filespecs.FileSpecification;
 import org.apache.royale.swc.ISWC;
 import org.apache.royale.swc.ISWCFileEntry;
 import org.apache.royale.swc.ISWCLibrary;
@@ -184,8 +184,19 @@ public class SWCWriter extends SWCWriterBase
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         final InputStream fileInputStream = fileEntry.createInputStream();
-        IOUtils.copy(fileInputStream, baos);
-        fileInputStream.close();
+        String name = fileEntry.getPath();
+        if (name.endsWith(".css")) // add other text files here
+        {
+        	FileSpecification.NoCRLFInputStream filteredInputStream = 
+        			new FileSpecification.NoCRLFInputStream(fileInputStream);
+        	IOUtils.copy(filteredInputStream, baos);
+        	filteredInputStream.close();
+        }
+        else
+        {
+        	IOUtils.copy(fileInputStream, baos);
+        	fileInputStream.close();
+        }
         
         ze.setSize(baos.size());
         ze.setCompressedSize(baos.size());