Changeset 4315
- Timestamp:
- 11/06/09 07:53:57 (3 weeks ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
ProjectFortress/src/com/sun/fortress/compiler/ByteCodeWriter.java (modified) (2 diffs)
-
ProjectFortress/src/com/sun/fortress/compiler/NamingCzar.java (modified) (1 diff)
-
ProjectFortress/src/com/sun/fortress/compiler/codegen/CodeGen.java (modified) (6 diffs)
-
bin/run (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ProjectFortress/src/com/sun/fortress/compiler/ByteCodeWriter.java
r3912 r4315 20 20 import com.sun.fortress.repository.ProjectProperties; 21 21 import java.io.FileOutputStream; 22 import java.io.IOException; 23 import java.util.jar.JarOutputStream; 24 import java.util.zip.ZipEntry; 22 25 23 26 public class ByteCodeWriter { … … 25 28 static Character slash = '/'; 26 29 30 public static void writeJarredClass(JarOutputStream jos, String file, byte[] bytes) { 31 String fileName = file.replace(dot, slash) + ".class"; 32 ZipEntry ze = new ZipEntry(fileName); 33 try { 34 jos.putNextEntry(ze); 35 jos.write(bytes); 36 jos.closeEntry(); 37 } catch (IOException e) { 38 throw new RuntimeException(e); 39 } 40 41 } 42 27 43 public static void writeClass(String repository, String file, byte[] bytes) { 28 44 String fileName = repository + file.replace(dot, slash) + ".class"; -
trunk/ProjectFortress/src/com/sun/fortress/compiler/NamingCzar.java
r4311 r4315 572 572 } 573 573 574 p rivatestatic String javaPackageClassForApi(APIName api, String sep) {574 public static String javaPackageClassForApi(APIName api, String sep) { 575 575 return javaPackageClassForApi(api.getText(), sep); 576 576 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/codegen/CodeGen.java
r4311 r4315 17 17 package com.sun.fortress.compiler.codegen; 18 18 19 import java.io.BufferedOutputStream; 20 import java.io.FileNotFoundException; 19 21 import java.io.FileOutputStream; 22 import java.io.IOException; 20 23 import java.io.PrintWriter; 21 24 import java.math.BigInteger; 22 25 import java.util.*; 26 import java.util.jar.JarOutputStream; 23 27 24 28 import org.objectweb.asm.*; … … 101 105 private final ComponentIndex ci; 102 106 private GlobalEnvironment env; 107 private final JarOutputStream jos; 103 108 104 109 private static final int NO_SELF = -1; … … 130 135 this.emittingFunctionalMethodWrappers = c.emittingFunctionalMethodWrappers; 131 136 this.currentTraitObjectDecl = c.currentTraitObjectDecl; 137 this.jos = c.jos; 132 138 133 139 this.component = c.component; … … 143 149 component = c; 144 150 packageAndClassName = NamingCzar.javaPackageClassForApi(c.getName()); 151 String dotted = NamingCzar.javaPackageClassForApi(c.getName(), "."); 152 try { 153 this.jos = new JarOutputStream(new BufferedOutputStream( new FileOutputStream(NamingCzar.cache + dotted + ".jar"))); 154 } catch (FileNotFoundException e) { 155 throw new RuntimeException(e); 156 } catch (IOException e) { 157 throw new RuntimeException(e); 158 } 145 159 this.ta = ta; 146 160 this.pa = pa; … … 356 370 CheckClassAdapter.verify(new ClassReader(cw.toByteArray()), true, pw); 357 371 358 ByteCodeWriter.write Class(NamingCzar.cache, file, cw.toByteArray());372 ByteCodeWriter.writeJarredClass(jos, file, cw.toByteArray()); 359 373 debug( "Writing class ", file); 360 374 } … … 637 651 638 652 dumpClass( packageAndClassName ); 653 654 try { 655 jos.close(); 656 } catch (IOException e) { 657 throw new RuntimeException(e); 658 } 639 659 } 640 660 -
trunk/bin/run
r4230 r4315 29 29 fi 30 30 31 CP="$FORTRESS_HOME/default_repository/caches/bytecode_cache${SEP}$FORTRESS_HOME/default_repository/caches/ nativewrapper_cache${SEP}$FORTRESS_HOME/ProjectFortress/build${SEP}$FORTRESS_HOME/ProjectFortress/third_party/junit/junit.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/asm/asm-all-3.1.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/xtc/xtc.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/jsr166y/jsr166y.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/plt/plt.jar${SEP}$JAVA_HOME/lib/tools.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/unsigned/unsigned.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/astgen/astgen.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/scala/scala-compiler-2.7.5.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/scala/scala-library-2.7.5.jar${SEP}$CP"32 31 CP="$FORTRESS_HOME/default_repository/caches/bytecode_cache${SEP}$FORTRESS_HOME/default_repository/caches/bytecode_cache/*${SEP}$FORTRESS_HOME/default_repository/caches/nativewrapper_cache${SEP}$FORTRESS_HOME/ProjectFortress/build${SEP}$FORTRESS_HOME/ProjectFortress/third_party/junit/junit.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/asm/asm-all-3.1.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/xtc/xtc.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/jsr166y/jsr166y.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/plt/plt.jar${SEP}$JAVA_HOME/lib/tools.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/unsigned/unsigned.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/astgen/astgen.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/scala/scala-compiler-2.7.5.jar${SEP}$FORTRESS_HOME/ProjectFortress/third_party/scala/scala-library-2.7.5.jar${SEP}$CP" 32 # echo $CP 33 33 if [ -z "$JAVA_HOME" ] ; then 34 34 JAVACMD=java

