Exemplo n.º 1
0
 /**
  * Add "groovyc" parameters to the commandLineList, based on the ant configuration.
  *
  * @param commandLineList
  * @param jointOptions
  * @param classpath
  */
 private void doNormalCommandLineList(
     List<String> commandLineList, List<String> jointOptions, Path classpath) {
   commandLineList.add("--classpath");
   commandLineList.add(classpath.toString());
   if (jointCompilation) {
     commandLineList.add("-j");
     commandLineList.addAll(jointOptions);
   }
   if (destDir != null) {
     commandLineList.add("-d");
     commandLineList.add(destDir.getPath());
   }
   if (encoding != null) {
     commandLineList.add("--encoding");
     commandLineList.add(encoding);
   }
   if (stacktrace) {
     commandLineList.add("-e");
   }
   if (parameters) {
     commandLineList.add("--parameters");
   }
   if (useIndy) {
     commandLineList.add("--indy");
   }
   if (scriptBaseClass != null) {
     commandLineList.add("-b");
     commandLineList.add(scriptBaseClass);
   }
   if (configscript != null) {
     commandLineList.add("--configscript");
     commandLineList.add(configscript);
   }
 }
Exemplo n.º 2
0
 @Override
 public boolean matches(final Object argument) {
   final Path argPath = (Path) argument;
   final String[] paths = argPath.toString().split(File.pathSeparator);
   final boolean matches = paths.length == this.expectedPaths.length;
   if (matches) {
     for (final String expectedPathElement : this.expectedPaths) {
       if (isNotPresent(paths, expectedPathElement)) {
         return false;
       }
     }
   }
   return matches;
 }
Exemplo n.º 3
0
  private void doForkCommandLineList(
      List<String> commandLineList, Path classpath, String separator) {
    if (!fork) return;

    if (includeAntRuntime) {
      classpath.addExisting((new Path(getProject())).concatSystemClasspath("last"));
    }
    if (includeJavaRuntime) {
      classpath.addJavaRuntime();
    }

    if (forkedExecutable != null && !forkedExecutable.equals("")) {
      commandLineList.add(forkedExecutable);
    } else {
      String javaHome;
      if (forkJavaHome != null) {
        javaHome = forkJavaHome.getPath();
      } else {
        javaHome = System.getProperty("java.home");
      }
      commandLineList.add(javaHome + separator + "bin" + separator + "java");
    }
    commandLineList.add("-classpath");
    commandLineList.add(classpath.toString());

    final String fileEncodingProp = System.getProperty("file.encoding");
    if ((fileEncodingProp != null) && !fileEncodingProp.equals("")) {
      commandLineList.add("-Dfile.encoding=" + fileEncodingProp);
    }
    if (targetBytecode != null) {
      commandLineList.add("-Dgroovy.target.bytecode=" + targetBytecode);
    }

    if ((memoryInitialSize != null) && !memoryInitialSize.equals("")) {
      commandLineList.add("-Xms" + memoryInitialSize);
    }
    if ((memoryMaximumSize != null) && !memoryMaximumSize.equals("")) {
      commandLineList.add("-Xmx" + memoryMaximumSize);
    }
    if (!"*.groovy".equals(getScriptExtension())) {
      String tmpExtension = getScriptExtension();
      if (tmpExtension.startsWith("*.")) tmpExtension = tmpExtension.substring(1);
      commandLineList.add("-Dgroovy.default.scriptExtension=" + tmpExtension);
    }
    commandLineList.add(FileSystemCompilerFacade.class.getName());
    if (forceLookupUnnamedFiles) {
      commandLineList.add("--forceLookupUnnamedFiles");
    }
  }
Exemplo n.º 4
0
 /**
  * stringify path and assign to the value. The value will contain all path elements separated by
  * the appropriate separator
  *
  * @param path path
  */
 public void setPath(Path path) {
   this.value = path.toString();
 }