@Override public void execute() throws NullPointerException { getProject().log(this, msg, Project.MSG_INFO); PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(getProject()); if (qtjambiConfig == null) { String thisQtjambiConfig = AntUtil.getPropertyAsString(propertyHelper, Constants.CONFIG); if (thisQtjambiConfig != null) { if (Constants.CONFIG_RELEASE.equals(thisQtjambiConfig)) qtjambiConfig = thisQtjambiConfig; else if (Constants.CONFIG_DEBUG.equals(thisQtjambiConfig)) qtjambiConfig = thisQtjambiConfig; else if (Constants.CONFIG_TEST.equals(thisQtjambiConfig)) qtjambiConfig = thisQtjambiConfig; else getProject() .log( this, "WARNING: QTJAMBI_CONFIG will not be exported as value " + thisQtjambiConfig + " is not recognised (from " + Constants.CONFIG + ")", Project.MSG_INFO); if (thisQtjambiConfig != null) getProject() .log( this, "QTJAMBI_CONFIG will be exported as " + qtjambiConfig + " (from " + Constants.CONFIG + ")", Project.MSG_INFO); } } String proFile = ""; if (!pro.equals("")) proFile = Util.makeCanonical(pro).getAbsolutePath(); final List<String> command = new ArrayList<String>(); command.add(resolveExecutableAbsolutePath()); command.add(proFile); List<String> arguments = parseArguments(); if (!arguments.isEmpty()) command.addAll(arguments); List<String> parameters = parseParameters(); if (!parameters.isEmpty()) command.addAll(parameters); File dirExecute = null; if (dir != null) dirExecute = new File(dir); String binpath = AntUtil.getPropertyAsString(propertyHelper, Constants.BINDIR); Exec.execute(command, dirExecute, getProject(), binpath, null); }
public static void expand(File source, File destination) { Expand expand = new Expand(); expand.setProject(AntUtil.getProject()); expand.setSrc(source); expand.setDest(destination); expand.execute(); }
public void execute() throws BuildException { CommandLineBuilder builder = null; try { builder = new CommandLineBuilder(); if (dataFile != null) builder.addArg("--datafile", dataFile); if (toDir != null) builder.addArg("--destination", toDir.getAbsolutePath()); for (int i = 0; i < ignoreRegexs.size(); i++) { Ignore ignoreRegex = (Ignore) ignoreRegexs.get(i); builder.addArg("--ignore", ignoreRegex.getRegex()); } for (int i = 0; i < ignoreBranchesRegexs.size(); i++) { IgnoreBranches ignoreBranchesRegex = (IgnoreBranches) ignoreBranchesRegexs.get(i); builder.addArg("--ignoreBranches", ignoreBranchesRegex.getRegex()); } for (int i = 0; i < ignoreMethodAnnotations.size(); i++) { IgnoreMethodAnnotation ignoreMethodAnn = (IgnoreMethodAnnotation) ignoreMethodAnnotations.get(i); builder.addArg("--ignoreMethodAnnotation", ignoreMethodAnn.getAnnotationName()); } for (int i = 0; i < includeClassesRegexs.size(); i++) { IncludeClasses includeClassesRegex = (IncludeClasses) includeClassesRegexs.get(i); builder.addArg("--includeClasses", includeClassesRegex.getRegex()); } for (int i = 0; i < excludeClassesRegexs.size(); i++) { ExcludeClasses excludeClassesRegex = (ExcludeClasses) excludeClassesRegexs.get(i); builder.addArg("--excludeClasses", excludeClassesRegex.getRegex()); } if (ignoreTrivial) builder.addArg("--ignoreTrivial"); if (threadsafeRigorous) builder.addArg("--threadsafeRigorous"); if (failOnError) builder.addArg("--failOnError"); if (instrumentationClasspath != null) { processInstrumentationClasspath(); } createArgumentsForFilesets(builder); builder.saveArgs(); } catch (IOException ioe) { getProject().log("Error creating commands file.", Project.MSG_ERR); throw new BuildException("Unable to create the commands file.", ioe); } // Execute GPL licensed code in separate virtual machine getJava().createArg().setValue("--commandsfile"); getJava().createArg().setValue(builder.getCommandLineFile()); if (forkedJVMDebugPort != null && forkedJVMDebugPort.intValue() > 0) { getJava().createJvmarg().setValue("-Xdebug"); getJava() .createJvmarg() .setValue( "-Xrunjdwp:transport=dt_socket,address=" + forkedJVMDebugPort + ",server=y,suspend=y"); } AntUtil.transferCoberturaDataFileProperty(getJava()); if (getJava().executeJava() != 0) { throw new BuildException("Error instrumenting classes. See messages above."); } builder.dispose(); }