Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add support for launching as a sub-build

  • Loading branch information...
commit e0ad8e5df02ea6fad6df1e53d7102af346e593fd 1 parent b29491c
@isdal isdal authored
View
168 ant-custom/edu/washington/cs/oneswarm/ant/GWTRecompileCheck.java
@@ -1,4 +1,4 @@
-package edu.washington.cs.oneswarm.ant;
+package edu.washington.cs.oneswarm.ant;
import java.io.File;
import java.text.ParsePosition;
@@ -11,91 +11,99 @@
public class GWTRecompileCheck extends Task {
- String directory = null;
- String lastBuilt = null;
+ String directory = null;
+ String basedir = "";
+ String lastBuilt = null;
boolean done = false;
@Override
- public void execute() throws BuildException {
-
- if (directory == null) {
- throw new BuildException("Directory not specified.");
- }
-
- if (lastBuilt == null) {
- log("No prior built record, building...");
- doBuild(null);
- return;
- }
-
- // If the OSMessages.java file is missing, we definitely need to recompile.
- File osMessages = new File(
- "oneswarm_gwt_ui/src/edu/washington/cs/oneswarm/ui/gwt/client/i18n/OSMessages.java");
- if (osMessages.exists() == false) {
- log("OSMessages.java not found at: " + osMessages.getAbsolutePath() + " ... rebuilding");
- doBuild(null);
- return;
- }
-
- File dirFile = new File(directory);
- if (dirFile.isDirectory() == false) {
- throw new BuildException("Provided GWT source root is not a directory!");
- }
-
- log("Scanning directory: " + directory + " for changes since " + lastBuilt);
-
- Date last = new SimpleDateFormat("MM/dd/yyyy HH:mm").parse(lastBuilt, new ParsePosition(0));
-
- recursiveScan(new File(
- "oneswarm_gwt_ui/src/edu/washington/cs/oneswarm/ui/gwt/OneSwarmGWT.gwt.xml"), last);
- recursiveScan(dirFile, last);
+ public void execute() throws BuildException {
+
+ if (directory == null) {
+ throw new BuildException("Directory not specified.");
+ }
+
+ if (lastBuilt == null) {
+ log("No prior built record, building...");
+ doBuild(null);
+ return;
+ }
+
+ // If the OSMessages.java file is missing, we definitely need to
+ // recompile.
+ File osMessages = new File(
+ basedir
+ + "oneswarm_gwt_ui/src/edu/washington/cs/oneswarm/ui/gwt/client/i18n/OSMessages.java");
+ if (osMessages.exists() == false) {
+ log("OSMessages.java not found at: " + osMessages.getAbsolutePath() + " ... rebuilding");
+ doBuild(null);
+ return;
+ }
+
+ File dirFile = new File(basedir + directory);
+ if (dirFile.isDirectory() == false) {
+ throw new BuildException("Provided GWT source root is not a directory!");
+ }
+
+ log("Scanning directory: " + directory + " for changes since " + lastBuilt);
+
+ Date last = new SimpleDateFormat("MM/dd/yyyy HH:mm").parse(lastBuilt, new ParsePosition(0));
+
+ recursiveScan(new File(basedir
+ + "oneswarm_gwt_ui/src/edu/washington/cs/oneswarm/ui/gwt/OneSwarmGWT.gwt.xml"),
+ last);
+ recursiveScan(dirFile, last);
+ }
+
+ private void recursiveScan(File f, Date thresh) {
+
+ log(f.getAbsolutePath(), Project.MSG_DEBUG);
+
+ if (f.isFile()
+ && (f.getName().endsWith(".java") || f.getName().endsWith(".properties") || f
+ .getName().endsWith(".xml"))) {
+ if (thresh.before(new Date(f.lastModified()))) {
+ doBuild(f);
+ }
+ }
+
+ if (!done && f.isDirectory()) {
+
+ if (f.getName().startsWith(".svn")) {
+ return;
+ }
+
+ for (File kid : f.listFiles()) {
+ recursiveScan(kid, thresh);
+
+ if (done) {
+ break;
+ }
+ }
+ }
+ }
+
+ private void doBuild(File f) {
+ getProject().setProperty("gwt.recompile", "true");
+ done = true;
+ log("Performing build");
+ if (f != null) {
+ log(f.getName() + " modified " + (new Date(f.lastModified())));
+ }
}
- private void recursiveScan(File f, Date thresh) {
-
- log(f.getAbsolutePath(), Project.MSG_DEBUG);
-
- if (f.isFile()
- && (f.getName().endsWith(".java") || f.getName().endsWith(".properties") || f
- .getName().endsWith(".xml"))) {
- if (thresh.before(new Date(f.lastModified()))) {
- doBuild(f);
- }
- }
-
- if( !done && f.isDirectory()) {
-
- if (f.getName().startsWith(".svn")) {
- return;
- }
-
- for (File kid : f.listFiles()) {
- recursiveScan(kid, thresh);
-
- if (done) {
- break;
- }
- }
- }
- }
-
- private void doBuild(File f) {
- getProject().setProperty("gwt.recompile", "true");
- done = true;
- log("Performing build");
- if (f != null) {
- log(f.getName() + " modified " + (new Date(f.lastModified())));
- }
- }
-
public void setDirectory(String directory) {
- this.directory = directory;
+ this.directory = directory;
}
- public void setLastBuild(String lastBuilt) {
- if (lastBuilt.startsWith("${")) {
- return;
- }
- this.lastBuilt = lastBuilt;
- }
+ public void setBaseDir(String basedir) {
+ this.basedir = basedir;
+ }
+
+ public void setLastBuild(String lastBuilt) {
+ if (lastBuilt.startsWith("${")) {
+ return;
+ }
+ this.lastBuilt = lastBuilt;
+ }
}
View
10 build.xml
@@ -4,7 +4,7 @@
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
- <property name="root.dir" value="." />
+ <property name="root.dir" value="${basedir}" />
<property name="core-libs.dir" value="build/core-libs" />
<property name="core-dist.dir" value="core-dist" />
<property name="core-bin.dir" value="core-bin" />
@@ -122,7 +122,7 @@
<taskdef name="DiscoverTestClasses" classname="edu.washington.cs.oneswarm.ant.DiscoverTestClasses" classpath="${root.dir}/ant-custom-bin" />
<!-- Sets gwt.recompile, used by the gwt-webui target. -->
- <GWTRecompileCheck directory="oneswarm_gwt_ui/src/edu/washington/cs/oneswarm/ui/gwt/client" lastBuild="${build.timestamp}" />
+ <GWTRecompileCheck directory="oneswarm_gwt_ui/src/edu/washington/cs/oneswarm/ui/gwt/client" basedir="${basedir}/" lastBuild="${build.timestamp}" />
</target>
<target name="compile-core" depends="core-init" >
@@ -379,8 +379,8 @@
<src path="${root.dir}/oneswarm_gwt_ui/gwt_override"/>
<classpath refid="project.class.path.servlet" />
</javac>
-
- <java classname="com.google.gwt.i18n.tools.I18NSync" failonerror="true">
+ <echo>basedir=${basedir}</echo>
+ <java classname="com.google.gwt.i18n.tools.I18NSync" failonerror="true" fork="true">
<arg value="edu.washington.cs.oneswarm.ui.gwt.client.i18n.OSMessages" />
<arg value="-out" />
<arg value="oneswarm_gwt_ui/src" />
@@ -390,7 +390,7 @@
<pathelement location="oneswarm_gwt_ui/src/" />
<pathelement location="build/gwt-libs/gwt/gwt-dev.jar" />
<pathelement location="build/gwt-libs/gwt/gwt-user.jar" />
- </classpath>
+ </classpath>
</java>
</target>
Please sign in to comment.
Something went wrong with that request. Please try again.