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 795802 - gdbus-codegen doesn't accept --output-directory with --output for --body and --header
gdbus-codegen doesn't accept --output-directory with --output for --body and ...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
2.56.x
Other Linux
: Normal normal
: ---
Assigned To: Iñigo Martínez
gtkdev
Depends on:
Blocks:
 
 
Reported: 2018-05-04 12:30 UTC by Nirbheek Chauhan
Modified: 2018-05-04 16:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdbus-codegen: Fix header include in the body file (1.31 KB, patch)
2018-05-04 14:29 UTC, Iñigo Martínez
committed Details | Review

Description Nirbheek Chauhan 2018-05-04 12:30:07 UTC
See: https://github.com/mesonbuild/meson/issues/3488#issuecomment-386582140, pasting comment here:

Earlier we used to use --generate-c-code which would output both foo.c and foo.h in the same command. We used --output-directory to set the 'base directory' to set the correct #include line for foo.h in foo.c.

With 0.46.0 we started to use --body | --header to generate foo.c and foo.h in separate custom targets.

However, --body requires --output, and --output is incompatible with --output-directory. So this is a glib bug. CCing @inigomartinez

We need --output-directory subdir --output subdir/foo.c to mean that foo.c should #include "foo.h".
Comment 1 Iñigo Martínez 2018-05-04 13:32:48 UTC
(In reply to Nirbheek Chauhan from comment #0)
> However, --body requires --output, and --output is incompatible with
> --output-directory. So this is a glib bug. CCing @inigomartinez

This behaviour is correct. `--output` needs the full path while `--output-directory` needs only the directory where the files are going to be created, so they are mutally exclusive.

> We need --output-directory subdir --output subdir/foo.c to mean that foo.c
> should #include "foo.h".

`--output-directory subdir` is not necessary because `--output` already includes it.

[0] https://developer.gnome.org/gio/stable/gdbus-codegen.html
Comment 2 Iñigo Martínez 2018-05-04 14:29:05 UTC
Created attachment 371672 [details] [review]
gdbus-codegen: Fix header include in the body file

After having spoken with nirbheek in the IRC, I have figured out what was happening.

When body file is generated, the header name to be included is built by using the path passed by `--output` directory. If this includes the subdirectory where the file is generated, the include also uses the subdirectory, which is not correct.

This patch fixes this issue.
Comment 3 Nirbheek Chauhan 2018-05-04 15:14:20 UTC
Review of attachment 371672 [details] [review]:

lgtm thanks! Could we get this into the next glib stable release? A bunch of projects are broken, and Meson will have to disable --body/header till 2.28 otherwise.
Comment 4 Philip Withnall 2018-05-04 16:16:04 UTC
Review of attachment 371672 [details] [review]:

LGTM too.
Comment 5 Philip Withnall 2018-05-04 16:17:14 UTC
Pushed to master. I will backport to glib-2-56 shortly.

Attachment 371672 [details] pushed as 5faac84 - gdbus-codegen: Fix header include in the body file
Comment 6 Philip Withnall 2018-05-04 16:20:24 UTC
Pushed to glib-2-56 too:

cd1f82d8f (HEAD -> glib-2-56, origin/glib-2-56) gdbus-codegen: Fix header include in the body file