예제 #1
0
 /** @see #compile(String, String, String, boolean) */
 public static boolean compile(
     String jarFile, String mainClass, String javaFiles[], boolean allErrors) {
   try {
     String buildDir = ".build";
     JarManager.rmDir(new File(buildDir));
     new File(buildDir).mkdirs();
     JarManager.jarExtract(Core.javascoolJar(), buildDir, "org/javascool");
     for (int i = 0; i < javaFiles.length; i++) {
       String file = javaFiles[i];
       javaFiles[i] = buildDir + File.separator + file;
       JarManager.copyFiles(file, javaFiles[i]);
     }
     if (!Java2Class.compile(javaFiles, allErrors)) {
       return false;
     }
     String mfFile = buildDir + File.separator + "manifest.jmf";
     Pml manifest =
         new Pml()
             .set("Main-Class", mainClass)
             .set("Implementation-URL", "http://javascool.gforge.inria.fr")
             .save(mfFile);
     JarManager.jarCreate(jarFile, mfFile, buildDir);
     JarManager.rmDir(new File(buildDir));
     return true;
   } catch (IOException e) {
     throw new RuntimeException("Erreur d'entrées-sorties à la compilation : " + e);
   }
 }
예제 #2
0
 /**
  * Copie un répertoire/fichier dans un autre en oubliant les svn.
  *
  * @param srcDir Dossier source.
  * @param dstDir Dossier cible.
  */
 public static void copyFiles(String srcDir, String dstDir) throws IOException {
   if (new File(srcDir).isDirectory()) {
     if (!new File(srcDir).getName().equals(".svn")) {
       for (String s : FileManager.list(srcDir)) {
         String d = dstDir + File.separator + new File(s).getAbsoluteFile().getName();
         JarManager.copyFiles(s, d);
       }
     }
   } else {
     new File(dstDir).getParentFile().mkdirs();
     JarManager.copyStream(new FileInputStream(srcDir), new FileOutputStream(dstDir));
   }
 }