Community
Participate
Working Groups
Created attachment 111458 [details] Patch to make build directory present as property and possibility to override properties from a file. There's always being two things which haven't quite worked for me in the Eclipse generated Ant build.xml 1) No possibility to override properties set in the generated build.xml, for this I propose fix #1 2) Not possible to change output/build/bin directory with property because all the bin/build paths are not present as property but rather a direct directory name, for this I propose fix #2 Fix #1 // <property environment="env"/> Element env = doc.createElement("property"); //$NON-NLS-1$ env.setAttribute("environment", "env"); //$NON-NLS-1$ //$NON-NLS-2$ root.insertBefore(env, root.getFirstChild()); // <propertyfile file="override.properties"/> Element override = doc.createElement("propertyfile"); //$NON-NLS-1$ env.setAttribute("file", "override.properties"); //$NON-NLS-1$ //$NON-NLS-2$ root.insertBefore(override, root.getFirstChild()); Fix #2 Add a method private String convertToProperty(String param) { String pathPropertyName = "path." + param; //$NON-NLS-1$ this.variable2valueMap.put(pathPropertyName, param); String classDirProperty = "${" + pathPropertyName + "}"; return classDirProperty; } Then call this method from places where build/bin path is being applied, like createBuild: String classDirProperty = convertToProperty(classDir); javacElement.setAttribute("destdir", classDirProperty); //$NON-NLS-1$ createClasspaths createClean String classDirProperty = convertToProperty(classDir); deleteElement.setAttribute("dir", classDirProperty); //$NON-NLS-1$ element.appendChild(deleteElement); createCopyResources if (!EclipseClasspath.isReference(classDir)) { String pathPropertyValue = convertToProperty(classDir); Element copyElement = doc.createElement("copy"); //$NON-NLS-1$ copyElement.setAttribute("todir", pathPropertyValue); //$NON-NLS-1$ createInit String classDirProperty = convertToProperty(classDir); pathElement.setAttribute("dir", classDirProperty); //$NON-NLS-1$ element.appendChild(pathElement); Add the same kind of logic where ever build/bin path is being handled. Sorry for the patch being in bad format, is there a code format rules used by Eclipse project available somewhere so that I can get cleaner patch?
Created attachment 111459 [details] BuildFileCreator.java
Created attachment 111461 [details] New java source file with a little bug fixed
Created attachment 111462 [details] BuildFileCreator.java Handle pathelement's elements location attribute differently. 1) Lookup if variable2map contains a property for a path 2) If it does output that 3) If it doesn't output path (original behaviour) This fixes the situtation when location is already ${..} property.
Created attachment 111463 [details] eclipse-export-build-xml-patch.txt Now a more tested version of the patch
Created attachment 111464 [details] BuildFileCreator.java Now a more tested version.
Created attachment 111467 [details] BuildFileCreator.java Typo in createProperty() was env.setAttribute("file", "override.properties"); supposed to be override.setAttribute("file", "override.properties");
Created attachment 111468 [details] eclipse-export-build-xml-patch.txt
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.