Skip to content

Commit 22ec18d

Browse files
author
zhourenjian
committed
Fixing a bug that packing *.z.js remove necessary whitespace characters.
1 parent aed4389 commit 22ec18d

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

sources/net.sf.j2s.lib/build/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
</classpath>
8787
</java>
8888
<java classname="net.sf.j2s.lib.build.UTF8Concat">
89-
<arg value="false"/>
89+
<arg value="none"/>
9090
<arg value="${j2s.lib.dist}/j2slib.z.js"/>
9191

9292
<arg value="${j2s.core.bin}"/>
@@ -103,7 +103,7 @@
103103

104104
<!-- j2slibcore.z.js does not contains Console -->
105105
<java classname="net.sf.j2s.lib.build.UTF8Concat">
106-
<arg value="false"/>
106+
<arg value="none"/>
107107
<arg value="${j2s.lib.dist}/j2slibcore.z.js"/>
108108

109109
<arg value="${j2s.core.bin}"/>

sources/net.sf.j2s.lib/src/net/sf/j2s/lib/build/UTF8Concat.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ public class UTF8Concat {
2828
*/
2929
public static void main(String[] args) {
3030
boolean completelyCompressing = true;
31+
boolean noCompressing = false;
3132
int indexDelta = 1;
32-
if (args.length > 0 && ("true".equals(args[0]) || "false".equals(args[0]))) {
33+
if (args.length > 0 && ("true".equals(args[0]) || "false".equals(args[0])
34+
|| "none".equals(args[0]))) {
3335
completelyCompressing = "true".equals(args[0]);
36+
noCompressing = "none".equals(args[0]);
3437
indexDelta++;
3538
}
3639
File dest = new File(args[indexDelta - 1]);
@@ -80,7 +83,9 @@ public static void main(String[] args) {
8083
try {
8184
FileOutputStream fos = new FileOutputStream(dest);
8285
fos.write(new byte[] {(byte) 0xef, (byte) 0xbb, (byte) 0xbf}); // UTF-8 header!
83-
if (completelyCompressing) {
86+
if (noCompressing) {
87+
fos.write(buf.toString().getBytes("UTF-8"));
88+
} else if (completelyCompressing) {
8489
fos.write(RegExCompress.regexCompress(buf.toString()).getBytes("UTF-8"));
8590
} else {
8691
fos.write(RegExCompress.regexCompress2(buf.toString()).getBytes("UTF-8"));

0 commit comments

Comments
 (0)