Add a way to simply update sources and document it
authorThibault Saunier <tsaunier@igalia.com>
Mon, 29 Jan 2018 21:03:40 +0000 (18:03 -0300)
committerThibault Saunier <tsaunier@igalia.com>
Mon, 29 Jan 2018 21:39:32 +0000 (18:39 -0300)
README.md
meson.build
update_sources.py [new file with mode: 0644]

index f91c616..52013e6 100644 (file)
--- a/README.md
+++ b/README.md
@@ -16,13 +16,28 @@ These libraries are needed for clutter-sharp to compile:
 
 Building & Installing
 ----
-With meson:
 
     meson build && ninja -C build/
+    I
+HACKING
+-------
 
-With Autotools:
+While hacking on the code generator or the `.metadata` files, you will
+need to force code regeneration with `ninja update-code`, a full rebuild
+is triggered right after.
 
-    ./autogen.sh --prefix=/usr && make install
+Updating to new GStreamer version
+--------------------------------
+
+* Make sure [bindinator] is installed on the system
+
+Make sure you are in an environement where latest `.gir` files are available (either install
+or through the `$GI_TYPELIB_PATH` env var).
+
+    ninja -C update-all
+
+* Verify newly generated code and `git add` files in `sources/generated/` and `ges/generated`
+* Commit
 
 Supported Platforms
 ----
@@ -49,6 +64,6 @@ License
 ----
 gstreamer-sharp is licensed under the [LGPL 2.1](https://www.gnu.org/licenses/lgpl-2.1.html)
 
-[bindinator]:https://github.com/gtk-sharp/bindinator
-[gtk-sharp]:https://github.com/gtk-sharp/gtk-sharp
+[bindinator]:https://github.com/GLibSharp/bindinator
+[gtk-sharp]:https://github.com/GLibSharp/GtlSharp
 [gstreamer]: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/
index b08a157..774470a 100644 (file)
@@ -159,19 +159,21 @@ custom_target('GstSharp-nuget',
 subdir('samples')
 
 bindinate = find_program('bindinate', required: false)
-
 if bindinate.found()
-  run_target('update-bindings',
+  run_target('bindinate_gstreamer',
     command: [bindinate,
       '--name=gstreamer', '--regenerate=true',
       '--merge-with=GstApp-1.0,GstAudio-1.0,GstBase-1.0,GstController-1.0,GstFft-1.0,GstNet-1.0,GstPbutils-1.0,GstRiff-1.0,GstRtp-1.0,GstRtsp-1.0,GstSdp-1.0,GstTag-1.0,GstVideo-1.0',
       '--gir=Gst-1.0']
     )
-  python3 = import('python3').find_python()
-  run_target('update-ges-bindings',
+  run_target('bindinate_ges',
     command: ['sh', '-c',
       '''bindinate --name=gst-editing-services --regenerate=true --gir=GES-1.0 && mv @0@/sources/gst-editing-services-sharp-api.raw @0@/ges/gst-editing-services-api.raw '''.format(
         meson.current_source_dir())
     ]
   )
+  python3 = import('python3').find_python()
+  run_target('update-code', command: [find_program('update_sources.py')])
+  run_target('update-all', command: [find_program('update_sources.py'), 'bindinate'])
 endif
+
diff --git a/update_sources.py b/update_sources.py
new file mode 100644 (file)
index 0000000..12c9617
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+
+import subprocess
+import os
+import sys
+import shutil
+
+def accept_command(commands):
+    """Search @commands and returns the first found absolute path."""
+    for command in commands:
+        command = shutil.which(command)
+        if command:
+            return command
+
+    return None
+
+if __name__ == "__main__":
+    ninja = accept_command(["ninja", "ninja-build"])
+    buildroot = os.environ["MESON_BUILD_ROOT"]
+
+    bindinate  = False
+    if len(sys.argv) > 1 and sys.argv[1] == "bindinate":
+        bindinate  = True
+
+    print("Building all code")
+    subprocess.check_call([ninja, "-C", buildroot])
+
+    if bindinate:
+        print("Bindinate GStreamer")
+        subprocess.check_call([ninja, "-C", buildroot, "bindinate_gstreamer"])
+
+    print("Update GStreamer bindings")
+    subprocess.check_call([ninja, "-C", buildroot, "update_gstreamer_code"])
+
+    if bindinate:
+        print("Bindinate GES")
+        subprocess.check_call([ninja, "-C", buildroot, "bindinate_ges"])
+    print("Update GES bindings")
+    subprocess.check_call([ninja, "-C", buildroot, "update_ges_code"])
+
+    print("Building all code")
+    subprocess.check_call([ninja, "-C", buildroot])
\ No newline at end of file