Ejemplo n.º 1
0
 public static void main(String[] args) {
   MiniMaven.ensureIJDirIsSet();
   if (runPrecompiledFakeIfNewer(args)) return;
   try {
     new Fake().make(null, null, args);
   } catch (FakeException e) {
     System.err.println("Could not instantiate Fiji Build:");
     e.printStackTrace();
   }
 }
Ejemplo n.º 2
0
 public static void main(String[] args) {
   checkObsoleteLauncher();
   if (runPrecompiledFakeIfNewer(args)) return;
   try {
     new Fake().make(null, null, args);
   } catch (FakeException e) {
     System.err.println("Could not instantiate Fiji Build:");
     e.printStackTrace();
   }
 }
Ejemplo n.º 3
0
 public void deleteRecursively(File dir) {
   try {
     File[] list = dir.listFiles();
     if (list != null)
       for (int i = 0; i < list.length; i++) {
         if (list[i].isDirectory()) deleteRecursively(list[i]);
         else Util.delete(list[i]);
       }
     Util.delete(dir);
   } catch (FakeException e) {
     out.println("Error: " + e.getMessage());
   }
 }
Ejemplo n.º 4
0
  // this function handles the javac singleton
  protected void callJavac(String[] arguments, boolean verbose) throws FakeException {
    synchronized (this) {
      try {
        if (javac == null) {
          discoverJavac();
          JarClassLoader loader = (JarClassLoader) getClassLoader(toolsPath);
          String className = "com.sun.tools.javac.Main";
          Class<?> main = loader.forceLoadClass(className);
          Class<?>[] argsType = new Class[] {arguments.getClass(), PrintWriter.class};
          javac = main.getMethod("compile", argsType);
        }

        Object result = javac.invoke(null, new Object[] {arguments, new PrintWriter(err)});
        if (!result.equals(new Integer(0))) {
          FakeException e = new FakeException("Compile error");
          e.printStackTrace();
          throw e;
        }
        return;
      } catch (FakeException e) {
        /* was compile error */
        throw e;
      } catch (Exception e) {
        e.printStackTrace(err);
        err.println(
            "Could not find javac "
                + e
                + " (tools path = "
                + toolsPath
                + "), "
                + "falling back to system javac");
      }
    }

    // fall back to calling javac
    String[] newArguments = new String[arguments.length + 1];
    newArguments[0] = "javac";
    System.arraycopy(arguments, 0, newArguments, 1, arguments.length);
    try {
      execute(newArguments, new File("."), verbose);
    } catch (Exception e) {
      throw new FakeException("Could not even fall back " + " to javac in the PATH");
    }
  }