Package org.apache.tools.ant.types.Commandline

Examples of org.apache.tools.ant.types.Commandline.Argument


      task.setProject(project);
      task.setDir(project.getBaseDir());
      task.setMaxmemory("256M"); //MXMLC needs to eat
      task.setErrorProperty("MXMLC_ERROR");
     
      Argument flexLibArgument = task.createArg();
      flexLibArgument.setLine("+flexlib \"" + frameworksPath + "\"");
     
      if(configuration.getPlayer().equals("air"))
      {
         Argument airConfigArgument = task.createArg();
         airConfigArgument.setValue("+configname=air");
      }
     
      Argument outputFile = task.createArg();
      outputFile.setLine("-output \"" + finalFile.getAbsolutePath() + "\"");
     
      Argument sourcePath = task.createArg();
      sourcePath.setLine("-source-path " + configuration.getSources().getPathElements(" ") + " " + configuration.getTestSources().getPathElements(" "));
     
      determineLibraryPath( task );
    
      determineLoadConfigArgument( task );
      
      Argument debug = task.createArg();
      debug.setLine( "-debug=" + configuration.getDebug() );

      Argument headlessServer = task.createArg();
      headlessServer.setLine("-headless-server=true");
     
     
      Argument mainFile = task.createArg();
      mainFile.setValue(runnerFile.getAbsolutePath());
     
      return task;
   }
View Full Code Here


  
   private void determineLoadConfigArgument(Java java)
   {
       if(configuration.getLoadConfig() != null)
       {
           Argument argument = java.createArg();
           argument.setLine(configuration.getLoadConfig().getCommandLineArgument());
       }
   }
View Full Code Here

   private void determineLibraryPath(Java java)
   {
       if(!configuration.getLibraries().getPathElements(" -library-path+=").isEmpty())
       {
           Argument libraryPath = java.createArg();
           libraryPath.setLine("-library-path+=" + configuration.getLibraries().getPathElements(" -library-path+="));
       }
   }
View Full Code Here

      task.setJar(new File(getProject().getProperty("FLEX_HOME") + File.separatorChar + ADT_JAR_PATH));
      task.setProject(getProject());
      task.setDir(getProject().getBaseDir());
      task.setOutputproperty(outputProperty);

      Argument versionArgument = task.createArg();
      versionArgument.setValue("-version");

      task.execute();
      double version = parseAdtVersionNumber( getProject().getProperty(outputProperty) );
      LoggingUtil.log("Found AIR version: " + version);
      return version;
View Full Code Here

        Path classPath = new Path(codeGenProject, datadir) ;
        classPath.addExisting(classPath.concatSystemClasspath(), false);
        java.setClasspath(classPath);
       
        // add binding definition as argument
        Argument arg = java.createArg();
        arg.setValue(binding);

        // execute the binding compiler
        java.execute();
    }
View Full Code Here

   * Copy the classpath to the command line with access rules included.
   * @param cmd the given command line
   * @param classpath the given classpath entry
   */
  private void createClasspathArgument(Commandline cmd, Path classpath) {
    Argument arg = cmd.createArgument();
    final String[] pathElements = classpath.list();

    // empty path return empty string
    if (pathElements.length == 0) {
      arg.setValue(Util.EMPTY_STRING);
      return;
    }

    // no access rules, can set the path directly
    if (this.accessRules == null) {
      arg.setPath(classpath);
      return;
    }

    int rulesLength = this.accessRules.size();
    String[] rules = (String[]) this.accessRules.toArray(new String[rulesLength]);
    int nextRule = 0;
    final StringBuffer result = new StringBuffer();

    //access rules are expected in the same order as the classpath, but there could
    //be elements in the classpath not in the access rules or access rules not in the classpath
    for (int i = 0, max = pathElements.length; i < max; i++) {
      if (i > 0)
        result.append(File.pathSeparatorChar);
      String pathElement = pathElements[i];
      result.append(pathElement);
      //the rules list is [path, rule, path, rule, ...]
      for (int j = nextRule; j < rulesLength; j += 2) {
        String rule = rules[j];
        if (pathElement.endsWith(rule)) {
          result.append(rules[j + 1]);
          nextRule = j + 2;
          break;
        }
        // if the path doesn't match, it could be due to a trailing file separatorChar in the rule
        if (rule.endsWith(File.separator)) {
          // rule ends with the File.separator, but pathElement might not
          // otherwise it would match on the first endsWith
          int ruleLength = rule.length();
          if (pathElement.regionMatches(false, pathElement.length() - ruleLength + 1, rule, 0, ruleLength - 1)) {
            result.append(rules[j + 1]);
            nextRule = j + 2;
            break;
          }
        } else if (pathElement.endsWith(File.separator)) {
          // rule doesn't end with the File.separator, but pathElement might
          int ruleLength = rule.length();
          if (pathElement.regionMatches(false, pathElement.length() - ruleLength - 1, rule, 0, ruleLength)) {
            result.append(rules[j + 1]);
            nextRule = j + 2;
            break;
          }
        }
      }
    }

    arg.setValue(result.toString());
  }
View Full Code Here

   * Copy the classpath to the command line with access rules included.
   * @param cmd the given command line
   * @param classpath the given classpath entry
   */
  private void createClasspathArgument(Commandline cmd, Path classpath) {
    Argument arg = cmd.createArgument();
    final String[] pathElements = classpath.list();

    // empty path return empty string
    if (pathElements.length == 0) {
      arg.setValue(Util.EMPTY_STRING);
      return;
    }

    // no access rules, can set the path directly
    if (this.accessRules == null) {
      arg.setPath(classpath);
      return;
    }

    int rulesLength = this.accessRules.size();
    String[] rules = (String[]) this.accessRules.toArray(new String[rulesLength]);
    int nextRule = 0;
    final StringBuffer result = new StringBuffer();

    //access rules are expected in the same order as the classpath, but there could
    //be elements in the classpath not in the access rules or access rules not in the classpath
    for (int i = 0, max = pathElements.length; i < max; i++) {
      if (i > 0)
        result.append(File.pathSeparatorChar);
      String pathElement = pathElements[i];
      result.append(pathElement);
      //the rules list is [path, rule, path, rule, ...]
      for (int j = nextRule; j < rulesLength; j += 2) {
        String rule = rules[j];
        if (pathElement.endsWith(rule)) {
          result.append(rules[j + 1]);
          nextRule = j + 2;
          break;
        }
        // if the path doesn't match, it could be due to a trailing file separatorChar in the rule
        if (rule.endsWith(File.separator)) {
          // rule ends with the File.separator, but pathElement might not
          // otherwise it would match on the first endsWith
          int ruleLength = rule.length();
          if (pathElement.regionMatches(false, pathElement.length() - ruleLength + 1, rule, 0, ruleLength - 1)) {
            result.append(rules[j + 1]);
            nextRule = j + 2;
            break;
          }
        } else if (pathElement.endsWith(File.separator)) {
          // rule doesn't end with the File.separator, but pathElement might
          int ruleLength = rule.length();
          if (pathElement.regionMatches(false, pathElement.length() - ruleLength - 1, rule, 0, ruleLength)) {
            result.append(rules[j + 1]);
            nextRule = j + 2;
            break;
          }
        }
      }
    }

    arg.setValue(result.toString());
  }
View Full Code Here

      getPreferences().getArrayValue(project, "org.eclim.java.junit.jvmargs");
    for(String vmarg : vmargs){
      if (!vmarg.startsWith("-")){
        continue;
      }
      Argument a = junit.createJvmarg();
      a.setValue(vmarg);
    }

    String[] props =
      getPreferences().getArrayValue(project, "org.eclim.java.junit.sysprops");
    for(String prop : props){
View Full Code Here

      getPreferences().getArrayValue(project, "org.eclim.java.run.jvmargs");
    for(String vmarg : defaultArgs){
      if (!vmarg.startsWith("-")){
        continue;
      }
      Argument a = java.createJvmarg();
      a.setValue(vmarg);
    }

    // add any supplied vm args
    String[] vmargs = commandLine.getValues(VMARGS_OPTION);
    if (vmargs != null && vmargs.length > 0){
      for(String vmarg : vmargs){
        if (!vmarg.startsWith("-")){
          continue;
        }
        Argument a = java.createJvmarg();
        a.setValue(vmarg);
      }
    }

    // add any supplied system properties
    String[] props = commandLine.getValues(SYSPROPS_OPTION);
    if (props != null && props.length > 0){
      for(String prop : props){
        String[] sysprop = StringUtils.split(prop, "=", 2);
        if (sysprop.length != 2){
          continue;
        }
        if (sysprop[0].startsWith("-D")){
          sysprop[0] = sysprop[0].substring(2);
        }
        Variable var = new Variable();
        var.setKey(sysprop[0]);
        var.setValue(sysprop[1]);
        java.addSysproperty(var);
      }
    }

    // add any env vars
    String[] envs = commandLine.getValues(ENVARGS_OPTION);
    if (envs != null && envs.length > 0){
      for(String env : envs){
        String[] envvar = StringUtils.split(env, "=", 2);
        if (envvar.length != 2){
          continue;
        }
        Variable var = new Variable();
        var.setKey(envvar[0]);
        var.setValue(envvar[1]);
        java.addEnv(var);
      }
    }

    // add any supplied command line args
    String[] args = commandLine.getValues(Options.ARGS_OPTION);
    if (args != null && args.length > 0){
      for(String arg : args){
        Argument a = java.createArg();
        a.setValue(arg);
      }
    }

    java.execute();
View Full Code Here

   * Copy the classpath to the command line with access rules included.
   * @param cmd the given command line
   * @param classpath the given classpath entry
   */
  private void createClasspathArgument(Commandline cmd, Path classpath) {
    Argument arg = cmd.createArgument();
    final String[] pathElements = classpath.list();

    // empty path return empty string
    if (pathElements.length == 0) {
      arg.setValue(Util.EMPTY_STRING);
      return;
    }

    // no access rules, can set the path directly
    if (this.accessRules == null) {
      arg.setPath(classpath);
      return;
    }

    int rulesLength = this.accessRules.size();
    String[] rules = (String[]) this.accessRules.toArray(new String[rulesLength]);
    int nextRule = 0;
    final StringBuffer result = new StringBuffer();

    //access rules are expected in the same order as the classpath, but there could
    //be elements in the classpath not in the access rules or access rules not in the classpath
    for (int i = 0, max = pathElements.length; i < max; i++) {
      if (i > 0)
        result.append(File.pathSeparatorChar);
      String pathElement = pathElements[i];
      result.append(pathElement);
      //the rules list is [path, rule, path, rule, ...]
      for (int j = nextRule; j < rulesLength; j += 2) {
        String rule = rules[j];
        if (pathElement.endsWith(rule)) {
          result.append(rules[j + 1]);
          nextRule = j + 2;
          break;
        }
        // if the path doesn't match, it could be due to a trailing file separatorChar in the rule
        if (rule.endsWith(File.separator)) {
          // rule ends with the File.separator, but pathElement might not
          // otherwise it would match on the first endsWith
          int ruleLength = rule.length();
          if (pathElement.regionMatches(false, pathElement.length() - ruleLength + 1, rule, 0, ruleLength - 1)) {
            result.append(rules[j + 1]);
            nextRule = j + 2;
            break;
          }
        } else if (pathElement.endsWith(File.separator)) {
          // rule doesn't end with the File.separator, but pathElement might
          int ruleLength = rule.length();
          if (pathElement.regionMatches(false, pathElement.length() - ruleLength - 1, rule, 0, ruleLength)) {
            result.append(rules[j + 1]);
            nextRule = j + 2;
            break;
          }
        }
      }
    }

    arg.setValue(result.toString());
  }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.types.Commandline.Argument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.