diff options
author | Josiah Gaskin <josiahgaskin@google.com> | 2011-07-15 15:15:14 -0700 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-07-15 15:15:14 -0700 |
commit | 55ebbe1723a8dd0e904f385ff307ce175f339b8f (patch) | |
tree | 569b00cf0c9dbe7c7809f4cbaab608395e792546 | |
parent | ea5c9aead265d081c3af3705ac7b19e243fa183f (diff) | |
parent | d45f7f6410f02f884fd640cb218c511835c0130b (diff) | |
download | sdk-55ebbe1723a8dd0e904f385ff307ce175f339b8f.zip sdk-55ebbe1723a8dd0e904f385ff307ce175f339b8f.tar.gz sdk-55ebbe1723a8dd0e904f385ff307ce175f339b8f.tar.bz2 |
Merge "Fix to build dependencies during delayed PostComp"
3 files changed, 35 insertions, 12 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchConfigDelegate.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchConfigDelegate.java index 54b827f..da764a8 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchConfigDelegate.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchConfigDelegate.java @@ -139,10 +139,11 @@ public class LaunchConfigDelegate extends LaunchConfigurationDelegate { return; } - // make sure the project is built and PostCompilerBuilder runs. + // make sure the project and its dependencies are built + // and PostCompilerBuilder runs. // This is a synchronous call which returns when the // build is done. - ProjectHelper.build(project, monitor, true); + ProjectHelper.build(project, monitor, true, true); // check if the project has errors, and abort in this case. if (ProjectHelper.hasError(project, true)) { diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ExportHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ExportHelper.java index 0312900..f531667 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ExportHelper.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ExportHelper.java @@ -83,8 +83,8 @@ public final class ExportHelper { // the export, takes the output of the precompiler & Java builders so it's // important to call build in case the auto-build option of the workspace is disabled. - // Also enable post compilation - ProjectHelper.build(project, monitor, true); + // Also enable post compilation and dependency building + ProjectHelper.build(project, monitor, true, true); // if either key or certificate is null, ensure the other is null. if (key == null) { diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ProjectHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ProjectHelper.java index b1f3eb9..97dd68e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ProjectHelper.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ProjectHelper.java @@ -817,23 +817,43 @@ public final class ProjectHelper { /** * Build project incrementally. If fullBuild is not set, then the packaging steps in * the post compiler are skipped. (Though resource deltas are still processed). + * * @param project The project to be built. * @param monitor A eclipse runtime progress monitor to be updated by the builders. - * @param fullBuild Set whether to run the packaging (dexing and building apk) steps of - * the post compiler. + * @param fullBuild Set whether to + * run the packaging (dexing and building apk) steps of the + * post compiler. + * @param buildDeps Set whether to run builders on the dependencies of the project * @throws CoreException */ - public static void build(IProject project, IProgressMonitor monitor, boolean fullBuild) + public static void build(IProject project, IProgressMonitor monitor, + boolean fullBuild, boolean buildDeps) throws CoreException { + // Get list of projects that we depend on + List<IJavaProject> androidProjectList = new ArrayList<IJavaProject>(); + if (buildDeps) { + try { + androidProjectList = getAndroidProjectDependencies( + BaseProjectHelper.getJavaProject(project)); + } catch (JavaModelException e) { + AdtPlugin.printErrorToConsole(project, e); + } + // Recursively build dependencies + for (IJavaProject dependency : androidProjectList) { + build(dependency.getProject(), monitor, fullBuild, true); + } + } + // Do an incremental build to pick up all the deltas project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor); - // If the preferences indicate not to use post compiler optimization then the - // incremental build will have done everything necessary + + // If the preferences indicate not to use post compiler optimization + // then the incremental build will have done everything necessary if (fullBuild && AdtPrefs.getPrefs().getBuildSkipPostCompileOnFileSave()) { // Create the map to pass to the PostC builder Map<String, String> args = new TreeMap<String, String>(); args.put(PostCompilerBuilder.POST_C_REQUESTED, ""); //$NON-NLS-1$ - // Get Post Compiler to do packaging + // Get Post Compiler for this project project.build(IncrementalProjectBuilder.FULL_BUILD, PostCompilerBuilder.ID, args, monitor); } @@ -841,8 +861,10 @@ public final class ProjectHelper { /** * Build the project incrementally. Post compilation step will not occur. + * Projects that this project depends on will not be built. * This is equivalent to calling - * <code>build(project, monitor, false)</code> + * <code>build(project, monitor, false, false)</code> + * * @param project The project to be built. * @param monitor A eclipse runtime progress monitor to be updated by the builders. * @throws CoreException @@ -851,6 +873,6 @@ public final class ProjectHelper { public static void build(IProject project, IProgressMonitor monitor) throws CoreException { // Disable full building by default - build(project, monitor, false); + build(project, monitor, false, false); } } |