/** * Factory method to create a property processor. Users can provide their own or replace it using * "ant.PropertyHelper" reference. User tasks can also add themselves to the chain, and provide * dynamic properties. * * @param project the project fro which the property helper is required. * @return the project's property helper. */ public static synchronized PropertyHelper getPropertyHelper(Project project) { PropertyHelper helper = (PropertyHelper) project.getReference("ant.PropertyHelper"); if (helper != null) { return helper; } helper = new PropertyHelper(); helper.setProject(project); project.addReference("ant.PropertyHelper", helper); return helper; }
@Override protected void executeCustom(Git git) throws Exception { StatusCommand sc = git.status(); Status status = sc.call(); if (isclean != null && status.isClean()) { PropertyHelper.getPropertyHelper(getProject()).setNewProperty(isclean, "true"); } if (isdirty != null && !status.isClean()) { PropertyHelper.getPropertyHelper(getProject()).setNewProperty(isdirty, "true"); } if (untracked != null) { ResourceCollection resources = buildResourcesCollection(status.getUntracked()); getProject().addReference(untracked, resources); } if (added != null) { ResourceCollection resources = buildResourcesCollection(status.getAdded()); getProject().addReference(added, resources); } if (modified != null) { ResourceCollection resources = buildResourcesCollection(status.getModified()); getProject().addReference(modified, resources); } if (changed != null) { ResourceCollection resources = buildResourcesCollection(status.getChanged()); getProject().addReference(changed, resources); } if (missing != null) { ResourceCollection resources = buildResourcesCollection(status.getMissing()); getProject().addReference(missing, resources); } if (removed != null) { ResourceCollection resources = buildResourcesCollection(status.getRemoved()); getProject().addReference(removed, resources); } }
@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); }