aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2012-02-16 09:53:53 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-02-16 09:53:53 -0800
commit7c65c6065057425170d5c37ecfc2f7f288889a64 (patch)
treed00aed3f5e3eef7edd59b0a6184d7b4345590ef9 /eclipse
parent7025e67f8ef685c29e6853a1fffe92861a1b1a35 (diff)
parent282120bcc8fdabb43de8a2add39d3750430ed1df (diff)
downloadsdk-7c65c6065057425170d5c37ecfc2f7f288889a64.zip
sdk-7c65c6065057425170d5c37ecfc2f7f288889a64.tar.gz
sdk-7c65c6065057425170d5c37ecfc2f7f288889a64.tar.bz2
Merge "Delayed builds from the builder."
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/ResourceManagerBuilder.java36
2 files changed, 40 insertions, 2 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java
index 6f75665..fde0a1c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java
@@ -38,6 +38,7 @@ import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.IJavaProject;
import org.xml.sax.SAXException;
@@ -386,4 +387,9 @@ public abstract class BaseBuilder extends IncrementalProjectBuilder {
}
}
}
+
+ protected void launchJob(Job newJob) {
+ newJob.setPriority(Job.BUILD);
+ newJob.schedule();
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/ResourceManagerBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/ResourceManagerBuilder.java
index 34fd53d..905cf34 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/ResourceManagerBuilder.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/ResourceManagerBuilder.java
@@ -38,7 +38,10 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -75,7 +78,7 @@ public class ResourceManagerBuilder extends BaseBuilder {
protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
throws CoreException {
// Get the project.
- IProject project = getProject();
+ final IProject project = getProject();
IJavaProject javaProject = JavaCore.create(project);
// Clear the project of the generic markers
@@ -210,6 +213,23 @@ public class ResourceManagerBuilder extends BaseBuilder {
// if it doesn't arrive in time then refresh the whole project as usual.
genFolder.refreshLocal(IResource.DEPTH_ZERO, new SubProgressMonitor(monitor, 10));
project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 10));
+
+ // it seems like doing this fails to properly rebuild the project. the Java builder
+ // running right after this builder will not see the gen folder, and will not be
+ // restarted after this build. Therefore in this particular case, we start another
+ // build asynchronously so that it's rebuilt after this build.
+ launchJob(new Job("rebuild") {
+ @Override
+ protected IStatus run(IProgressMonitor m) {
+ try {
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, m);
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ });
+
}
// convert older projects which use bin as the eclipse output folder into projects
@@ -232,7 +252,19 @@ public class ResourceManagerBuilder extends BaseBuilder {
// set the java output to this project.
javaProject.setOutputLocation(newJavaOutput.getFullPath(), monitor);
- project.build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
+ // need to do a full build. Can't build while we're already building, so launch a
+ // job to build it right after this build
+ launchJob(new Job("rebuild") {
+ @Override
+ protected IStatus run(IProgressMonitor jobMonitor) {
+ try {
+ project.build(IncrementalProjectBuilder.CLEAN_BUILD, jobMonitor);
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ });
}
// check that we have bin/res/