After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 773036 - runner: Discover build targets after the build completes
runner: Discover build targets after the build completes
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-10-16 15:20 UTC by Matthew Leeds
Modified: 2016-10-17 00:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
runner: Discover build targets after the build completes (8.79 KB, patch)
2016-10-16 15:20 UTC, Matthew Leeds
none Details | Review
runner: Discover build targets after the build completes (10.92 KB, patch)
2016-10-16 22:59 UTC, Matthew Leeds
committed Details | Review
runner: Fix documentation error (898 bytes, patch)
2016-10-16 22:59 UTC, Matthew Leeds
committed Details | Review

Description Matthew Leeds 2016-10-16 15:20:06 UTC
This just makes the run button work for new projects that haven't been
built before.
Comment 1 Matthew Leeds 2016-10-16 15:20:10 UTC
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.
Comment 2 Christian Hergert 2016-10-16 21:25:30 UTC
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]);
Comment 3 Matthew Leeds 2016-10-16 22:59:37 UTC
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.
Comment 4 Matthew Leeds 2016-10-16 22:59:41 UTC
Created attachment 337801 [details] [review]
runner: Fix documentation error
Comment 5 Christian Hergert 2016-10-17 00:51:39 UTC
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