[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[higgins-dev] preliminary proposed change to BuildFileCreator.java
|
All,
The change outlined in this patch will add a target to build.xml called "fetch-subprojects". If your build.properties file contains a line like this:
ensure.dependencies.version = HEAD
(where HEAD can be any cvs tag), then the fetch-subprojects target will use cvs to pull down all dependency projects (recursively) using the version specified in build.properties.
If ensure.dependencies.version is not set, then nothing happens for the fetch-subprojects target.
Anyone have issues with me adding this?
Jim
### Eclipse Workspace Patch 1.0
#P higgins2ant
Index: src/org/eclipse/higgins/ant/internal/ui/BuildFileCreator.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.higgins/builds/higgins2ant/src/org/eclipse/higgins/ant/internal/ui/BuildFileCreator.java,v
retrieving revision 1.2
diff -u -r1.2 BuildFileCreator.java
--- src/org/eclipse/higgins/ant/internal/ui/BuildFileCreator.java 2 Aug 2007 10:23:23 -0000 1.2
+++ src/org/eclipse/higgins/ant/internal/ui/BuildFileCreator.java 22 Oct 2007 05:47:13 -0000
@@ -40,6 +40,7 @@
import javax.xml.transform.TransformerFactoryConfigurationError;
import org.eclipse.ant.internal.ui.AntUIPlugin;
+import org.eclipse.ant.internal.ui.datatransfer.DataTransferMessages;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -189,8 +190,12 @@
instance.createInit(classpath.srcDirs, classpath.classDirs);
instance.createClean(classpath.classDirs);
instance.createCleanAll();
- instance.createBuild(classpath.srcDirs, classpath.classDirs,
- classpath.inclusionLists, classpath.exclusionLists);
+ instance.createBuild();
+ instance.createBuildSubprojects();
+ instance.createFetchSubprojects();
+ instance.createBuildProject(classpath.srcDirs, classpath.classDirs,
+ classpath.inclusionLists, classpath.exclusionLists);
+
if (CREATE_BUILD_REF_PROJECTS) {
instance.createBuildRef();
}
@@ -289,6 +294,11 @@
Element env = doc.createElement("property"); //$NON-NLS-1$
env.setAttribute("environment", "env"); //$NON-NLS-1$ //$NON-NLS-2$
root.insertBefore(env, root.getFirstChild());
+
+ // <property file="build.properties"/>
+ Element file = doc.createElement("property");
+ file.setAttribute("file", "build.properties");
+ root.insertBefore(file, root.getFirstChild());
}
/**
@@ -691,19 +701,31 @@
* @param inclusionLists inclusion filters of mainproject
* @param exclusionLists exclusion filters of mainproject
*/
- public void createBuild(List srcDirs, List classDirs, List inclusionLists, List exclusionLists) throws JavaModelException
+ public void createBuild() throws JavaModelException
{
// <target name="build" depends="build-subprojects,build-project"/>
Element element = doc.createElement("target"); //$NON-NLS-1$
element.setAttribute("name", "build"); //$NON-NLS-1$ //$NON-NLS-2$
element.setAttribute("depends", "build-subprojects,build-project"); //$NON-NLS-1$ //$NON-NLS-2$
root.appendChild(element);
-
+ }
+
+ private void createBuildSubprojects () throws JavaModelException {
// <target name="build-subprojects">
// <ant antfile="${hello.location}/build.xml" inheritAll="false" target="build-project"/>
// </target>
- element = doc.createElement("target"); //$NON-NLS-1$
+ Element element = doc.createElement("target"); //$NON-NLS-1$
element.setAttribute("name", "build-subprojects"); //$NON-NLS-1$ //$NON-NLS-2$
+ // <antcall target="fetch-subprojects">
+ // <param name="basedir" value="../"/>
+ // </antcall>
+ Element antcallElement = doc.createElement("antcall");
+ antcallElement.setAttribute("target", "fetch-subprojects");
+ Element paramElement = doc.createElement("param");
+ paramElement.setAttribute("name", "basedir");
+ paramElement.setAttribute("value", "../");
+ antcallElement.appendChild(paramElement);
+ element.appendChild(antcallElement);
List subProjects = ExportUtil.getClasspathProjectsRecursive(project);
for (Iterator iterator = subProjects.iterator(); iterator.hasNext();)
{
@@ -722,7 +744,34 @@
element.appendChild(antElement);
}
root.appendChild(element);
-
+ }
+
+ private void createFetchSubprojects () throws JavaModelException {
+ // <target name="fetch-subprojects" if="ensure.dependencies.version">
+ // <cvs cvsRoot=":pserver:anonymous@xxxxxxxxxxxxxxx/cvsroot/technology/"
+ // package="org.eclipse.higgins/plugins/${hello}"
+ // command="checkout -d ${hello} -f"
+ // tag="${ensure.dependencies.version}"
+ // />
+ // </target>
+ Element element = doc.createElement("target");
+ element.setAttribute("name", "fetch-subprojects");
+ element.setAttribute("if", "ensure.dependencies.version");
+ List subProjects = ExportUtil.getClasspathProjectsRecursive(project);
+ for (Iterator iterator = subProjects.iterator(); iterator.hasNext();)
+ {
+ IJavaProject subProject = (IJavaProject) iterator.next();
+ Element antElement = doc.createElement("cvs");
+ antElement.setAttribute("cvsRoot", ":pserver:anonymous@xxxxxxxxxxxxxxx/cvsroot/technology/");
+ antElement.setAttribute("package", "org.eclipse.higgins/plugins/" + subProject.getProject().getName());
+ antElement.setAttribute("command", "checkout -d " + subProject.getProject().getName() + " -f");
+ antElement.setAttribute("tag", "${ensure.dependencies.version}");
+ element.appendChild(antElement);
+ }
+ root.appendChild(element);
+ }
+
+ private void createBuildProject(List srcDirs, List classDirs, List inclusionLists, List exclusionLists) {
// <target name="build-project" depends="init">
// <echo message="${ant.project.name}: ${ant.file}"/>
// <javac destdir="classes">
@@ -732,7 +781,7 @@
// <classpath refid="project.classpath"/>
// </javac>
// </target>
- element = doc.createElement("target"); //$NON-NLS-1$
+ Element element = doc.createElement("target"); //$NON-NLS-1$
element.setAttribute("name", "build-project"); //$NON-NLS-1$ //$NON-NLS-2$
element.setAttribute("depends", "init"); //$NON-NLS-1$ //$NON-NLS-2$
Element echoElement = doc.createElement("echo"); //$NON-NLS-1$
@@ -780,6 +829,7 @@
}
}
root.appendChild(element);
+
}
/**