GNOME Bugzilla – Bug 773036
runner: Discover build targets after the build completes
Last modified: 2016-10-17 00:51:49 UTC
This just makes the run button work for new projects that haven't been built before.
Created attachment 337792 [details] [review] runner: Discover build targets after the build completes When the user creates a new project and hasn't done a build yet the run button fails because it tries to discover the build targets (by running make) before doing a build but the ~/.cache/gnome-builder/builds/... folder hasn't been created yet. This commit moves that operation to after the build so that it succeeds on first run.
Review of attachment 337792 [details] [review]: I like the idea. Just a few things to fix. ::: libide/runner/ide-run-manager.c @@ -273,2 +255,3 @@ context = ide_object_get_context (IDE_OBJECT (self)); + g_assert (IDE_IS_BUILD_TARGET (build_target)); Because the build_target could be changed programatically between the async operations, this is not safe. Instead, store it as the task data so we can access it without querying self->build_target. @@ -310,2 +294,24 @@ -failure: - IDE_EXIT; +static void +ide_run_manager_run_discover_cb (GObject *object, + GAsyncResult *result, ... 21 more ... g_steal_pointer (&task) @@ +353,3 @@ + cancellable, + ide_run_manager_run_discover_cb, + g_object_ref (task)); g_steal_pointer (&task) @@ +357,3 @@ + } + + do_run_async (self, g_object_ref (task)); g_steal_pointer (&task) @@ -606,0 +616,8 @@ +void +ide_run_manager_set_build_target (IdeRunManager *self, + IdeBuildTarget *build_target) ... 5 more ... This is unsafe, you need to take a reference. Use something like: if (g_set_object (&self->build_target, build_target)) g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_BUILD_TARGET]);
Created attachment 337800 [details] [review] runner: Discover build targets after the build completes When the user creates a new project and hasn't done a build yet the run button fails because it tries to discover the build targets (by running make) before doing a build but the ~/.cache/gnome-builder/builds/... folder hasn't been created yet. This commit moves that operation to after the build so that it succeeds on first run.
Created attachment 337801 [details] [review] runner: Fix documentation error
Pushed with follow up commit 16c53ef4e1068f5276fdab2b446ee27e25ae4432 to fix transfer of task ownership. Attachment 337800 [details] pushed as f5f0ddf - runner: Discover build targets after the build completes Attachment 337801 [details] pushed as 5fabfc1 - runner: Fix documentation error