File: CONTRIBUTING.md

package info (click to toggle)
gnome-builder 49.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 49,412 kB
  • sloc: ansic: 270,495; xml: 3,485; python: 1,863; javascript: 82; makefile: 65; sh: 21; cpp: 14
file content (166 lines) | stat: -rw-r--r-- 5,977 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Contributing to GNOME Builder

We would love for you to contribute to GNOME Builder!

GNOME Builder is a new IDE focusing on the GNOME desktop environment. It is
primarily written in C, but allows for plugins in C, C++, Python or Vala.
Additional compiled languages can also be supported with some work.

Remember that the GNOME community is largely made up of part-time contributors
that do this for fun. Be respectful and assume the best of each other.

Here you can find [documentation for libide](https://devsuite.app/docs/libide/).

## Filing a bug

Please file issues for bugs on our
[our issue tracker](https://gitlab.gnome.org/GNOME/gnome-builder/issues)
after you have tested a Nightly release to verify the bug has not already
been fixed.

You can install Nightly from Flatpak using `flatpak --user install gnome-nightly org.gnome.Builder.Devel`.

__Please do not file issues for feature requests.__
Features must go through the design process first.
File an issue at [Teams/Design/Whiteboards](https://gitlab.gnome.org/Teams/Design/whiteboards/) to begin that process.
In the end you should have a mockup, implementation specification, and breakdown of how that will change the existing code-base.

Create a
[Merge Request](https://gitlab.gnome.org/GNOME/gnome-builder/merge_requests)
and we'd be happy to review your patch and help you get it merged.

## Asking for Help

You can often find Builder contributors on our IRC channel at
[irc://irc.libera.chat/#gnome-builder](irc://irc.libera.chat/#gnome-builder) or the
Matrix channel at [#gnome-builder:gnome.org](https://matrix.to/#/!owVIjvsVrBaEdelYem:matrix.org).
If you have any questions, we'd be happy to help you.

If you'd like to start on a new plugin or feature, stop by our IRC/Matrix channel and we'd be happy get you oriented.
The IRC and Matrix channels are bridged so you will be part of the same conversation regardless of which you join.

## Portability

Builder is primarily focused on **GNU/Linux** with the **GNOME desktop**.

However, we do often accept patches for various BSD-based operating systems and alternate desktops.
It is important that you help us by keep things working for your platform as the Builder team cannot test all possible configurations.

## Testing

We use meson for our build system.
It provides support for running unit tests with the `ninja test` command.
We run these tests often so it is important that you check nothing was broken by your changes.

## Licensing

Contributions should be licensed under the **LGPL-2.1+** or **GPL-3**. 
Permissively licensed contributions will also be accepted, but we prefer that original contributions are either **LGPL-2.1+** or **GPL-3** licensed.

## Coding Style

Our coding style matches that of GTK.
We consider the GTK project an upstream, and often push features into GTK.
This might feel unfamiliar at first, but it works well for us.
Builder's default C mode matches our style guide relatively close.

We use the recent GNU GCC '18 mode, such as -std=gnu18.

```c
static GtkWidget *
example_object_get_widget (ExampleObject  *object,
                           GError        **error)
{
  g_return_val_if_fail (EXAMPLE_IS_OBJECT (object), NULL);

  if (object->widget == NULL)
    {
      object->widget = g_object_new (GTK_TYPE_LABEL,
                                     "visible", TRUE,
                                     NULL);
    }

  return object->widget;
}
```

You may omit curly-braces for single-line conditionals.

Please use new-style Object declarations such as `G_DECLARE_FINAL_TYPE()` or `G_DECLARE_DERIVABLE_TYPE()`.
Unless you intend to subclass the object, make the object final.

```c
#define EXAMPLE_TYPE_OBJECT (example_object_get_type())

G_DECLARE_FINAL_TYPE (ExampleObject, example_object, EXAMPLE, OBJECT, GObject)
```

### Includes

The top of your source files should have defines and includes grouped well.
Generally, they should be in the style of the following, but please omit the comments.

```c
/* G_LOG_DOMAIN always first */
#define G_LOG_DOMAIN "file-name-without-suffix"

/* include "config.h" always second */
#include "config.h"

/* Includes that are system related, sorted if possible */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

/* GLib/GTK and other dependency includes, sorted if possible */
#include <adwaita.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>

/* Includes from Builder's platform libraries */
#include <libide-core.h>
#include <libide-gui.h>

/* Includes from the module directory within builder */
#include "my-widget.h"
#include "my-widget-settings.h"
#include "my-widget-private.h"
```

### Be explicit about ownership transfers

Since `GLib 2.44`, we've had helpful macros and functions to be explicit about
ownership transfers. Please use them as it drastically saves time when tracking
down memory leaks.

These include:

 * `g_autoptr()`, `g_auto()`, and `g_autofree`.
 * `g_steal_pointer()`
 * `g_clear_object()` and `g_clear_pointer()`

We prefer that you zero fields in structures when freeing the contents.

## Documentation

Most functions should be obvious what they do from the object type, name, and
parameters. Add additional documentation when it makes sense.

If you find you come across something particularly tricky, or are being clever,
please add a comment denoting such.

## Making a Release

 - Update NEWS for release notes
 - Update meson.build for the new version number
 - Update doc/conf.py to reflect the updated version number
 - Update any necessary tags in org.gnome.Builder.Devel.json for Flatpak
 - Make sure documentation builds, tests pass
 - Make sure flatpak bundle builds
 - Commit release changes, add a signed tag (git tag -s -u $keyid)
 - Configure meson as normal, ensure docs are built
 - From the build directory, run `ninja dist` to generate the tarball
 - Push changes to master (or branch), push tag
 - scp the tarball to master.gnome.org
 - Run `ftpadmin install gnome-builder-*.tar.xz`.