Commit 902db41f authored by Lionel Seinturier's avatar Lionel Seinturier
Browse files

Remove unused genclassjar feature.

parent 8b2bdb37
......@@ -63,12 +63,6 @@ public enum CmdLineOptions {
/** Directory where compiled generated source code is to be dumped. */
GENCLASS(null),
/**
* Jar file where compiled generated source code is to be packaged.
* @since 2.2.4
*/
GENCLASSJAR(null),
/**
* Source code compatibility level.
* @since 2.2.2
......
......@@ -25,11 +25,8 @@
package org.objectweb.fractal.juliac;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
......@@ -39,8 +36,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
......@@ -607,81 +602,6 @@ public class Juliac {
return round;
}
/**
* Package the compiled generated files.
*
* @since 2.2.4
*/
public void packGeneratedFiles() throws IOException {
JuliacConfig jconf = getJuliacConfig();
Logger logger = jconf.getLogger();
CompilationRounds rounds = jconf.getCompilationRounds();
List<CompilationRound> rds = rounds.getCompilationRounds();
// Check that some files have been generated
boolean generated = false;
for (CompilationRound round : rds) {
List<String> outputFileNames = round.getOutputFileNames();
if( outputFileNames.size() != 0 ) {
generated = true;
break;
}
}
if( ! generated ) {
final String msg =
"No compiled generated file. Cannot create the jar file.";
logger.warning(msg);
return;
}
// Create the jar file
File jarFile = jconf.getClassJarFile();
OutputStream os = new FileOutputStream(jarFile);
JarOutputStream jos = new JarOutputStream(os);
int total = 0;
// Iterate on each compilation round
for (CompilationRound round : rds) {
File classDir = round.getClassDir();
// Iterate on each generated compiled file contained in the round
List<String> outputFileNames = round.getOutputFileNames();
for (String outputFileName : outputFileNames) {
// Retrieve the output file
File f = new File(classDir,outputFileName);
FileInputStream fis = new FileInputStream(f);
long size = fis.available();
// Create a new entry in the jar file
JarEntry je = new JarEntry(outputFileName);
je.setSize(size);
jos.putNextEntry(je);
// Dump the content of the output file in the jar file
byte[] b = new byte[(int)size];
fis.read(b);
jos.write(b);
// Close the entry in the jar file and the generated file
jos.closeEntry();
fis.close();
total++;
}
}
// Close the jar file
jos.close();
os.close();
// Report
final String msg =
total+" file(s) packaged to "+ jarFile.getAbsolutePath();
logger.info(msg);
}
// ----------------------------------------------------------------------
// Class loading
......
......@@ -132,16 +132,6 @@ public class JuliacCmdLine {
jconf.setSourceEncoding(sourceEncoding);
}
String classJarFileName = cla.getOptionValue(CmdLineOptions.GENCLASSJAR);
if( classJarFileName != null ) {
if( ! cla.isFlagSet(CmdLineFlags.COMPILEGENERATED) ) {
final String msg =
"--genclassjar cannot be used without --compileGenerated";
throw new IllegalArgumentException(msg);
}
jconf.setClassJarFileName(classJarFileName);
}
boolean debug = cla.isFlagSet(CmdLineFlags.DEBUG);
if(debug) {
JuliacConfig.setLevel(logger,Level.FINE);
......@@ -246,13 +236,6 @@ public class JuliacCmdLine {
jconf.setCompilationWarnings(compilationWarnings);
}
/*
* If requested, package the compiled generated code.
*/
if( classJarFileName != null ) {
jc.packGeneratedFiles();
}
/*
* Close Juliac.
*/
......@@ -276,7 +259,6 @@ public class JuliacCmdLine {
logger.info("");
logger.info(" --gensrc <dir> : directory for generated source code (default: "+JuliacConfig.DEFAULT_GEN_DIR_NAME+")");
logger.info(" --genclass <dir> : directory for compiled code (default: "+JuliacConfig.DEFAULT_CLASS_DIR_NAME+")");
logger.info(" --genclassjar <file> : package compiled generate code in file");
logger.info(" --iclassgs <generators> : interceptor class generators");
logger.info(" --icodegs <generators> : interceptor source code generators");
logger.info(" --juliaCfgFiles <files> : comma-separated list of Julia configuration files");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment