Commit 23bca073 authored by Christian Hergert's avatar Christian Hergert
Browse files

doc: import Gio, match spacing with other rst

Sort of annoying, but first tab stop is 3, then 4 after that for python.
parent 65c70c76
......@@ -10,42 +10,42 @@ Builder has support for many build systems such as autotools, meson, cmake, etc.
import gi
from gi.repository import Ide
class BasicBuildSystem(Ide.Object, Ide.BuildSystem, Gio.AsyncInitable):
def do_init_async(self, priority, cancel, callback, data=None):
task = Gio.Task.new(self, cancel, callback)
task.set_priority(priority)
# do something, like check if a build file exists
task.return_boolean(True)
def do_init_finish(self, result):
return result.propagate_boolean()
def do_get_priority(self):
return 0 # Choose a priority based on other build systems' priority
def do_get_build_flags_async(self, ifile, cancellable, callback, data=None):
task = Gio.Task.new(self, cancellable, callback)
task.ifile = ifile
task.build_flags = []
# get the build flags
task.return_boolean(True)
def do_get_build_flags_finish(self, result):
if result.propagate_boolean():
return result.build_flags
def do_get_build_targets_async(self, cancellable, callback, data=None):
task = Gio.Task.new(self, cancellable, callback)
task.build_targets = []
# get the build targets
task.return_boolean(True)
def do_get_build_targets_finish(self, result):
if result.propagate_boolean():
return result.build_targets
from gi.repository import Gio, Ide
class BasicBuildSystem(Ide.Object, Ide.BuildSystem, Gio.AsyncInitable):
def do_init_async(self, priority, cancel, callback, data=None):
task = Gio.Task.new(self, cancel, callback)
task.set_priority(priority)
# do something, like check if a build file exists
task.return_boolean(True)
def do_init_finish(self, result):
return result.propagate_boolean()
def do_get_priority(self):
return 0 # Choose a priority based on other build systems' priority
def do_get_build_flags_async(self, ifile, cancellable, callback, data=None):
task = Gio.Task.new(self, cancellable, callback)
task.ifile = ifile
task.build_flags = []
# get the build flags
task.return_boolean(True)
def do_get_build_flags_finish(self, result):
if result.propagate_boolean():
return result.build_flags
def do_get_build_targets_async(self, cancellable, callback, data=None):
task = Gio.Task.new(self, cancellable, callback)
task.build_targets = []
# get the build targets
task.return_boolean(True)
def do_get_build_targets_finish(self, result):
if result.propagate_boolean():
return result.build_targets
How does Builder know which build system to use for a project? Each has an associated "project file" (configure.ac for autotools) that has to exist in the source directory for the build system to be used. If a project has multiple project files, the priorities of each are used to decide which to use. You can see where the priority is defined in the code above. The project file is defined in the ``.plugin`` file with these lines (in the case of the make plugin):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment