Merge lp:~dobey/couchdb-glib/vapi-build into lp:couchdb-glib

Proposed by dobey on 2011-02-10
Status: Rejected
Rejected by: dobey on 2011-03-18
Proposed branch: lp:~dobey/couchdb-glib/vapi-build
Merge into: lp:couchdb-glib
Diff against target: 353 lines (+236/-6)
8 files modified
.gitignore (+13/-2)
configure.ac (+42/-0)
couchdb-glib/Makefile.am (+35/-2)
couchdb-glib/couchdb-glib-vala.deps (+3/-0)
couchdb-glib/test-couchdb-glib-vapi.vala (+51/-0)
desktopcouch-glib/Makefile.am (+37/-2)
desktopcouch-glib/desktopcouch-glib-vala.deps (+4/-0)
desktopcouch-glib/test-desktopcouch-glib-vapi.vala (+51/-0)
To merge this branch: bzr merge lp:~dobey/couchdb-glib/vapi-build
Reviewer Review Type Date Requested Status
dobey Disapprove on 2011-03-18
Rodrigo Moya (community) 2011-02-10 Needs Information on 2011-02-14
Review via email: mp+49281@code.launchpad.net
To post a comment you must log in.
Rodrigo Moya (rodrigo-moya) wrote :

Can't the test*vala* programs be in the tests/ directory? Apart from that, seems to look ok

review: Needs Information
Rodrigo Moya (rodrigo-moya) wrote :

This branch just needs the move of the test programs to tests/, so can you please do it Rodney?

dobey (dobey) wrote :

I talked with the vala devs some more, and I've decided we shouldn't go this route, and simply rely on the gir files all being correct. There are some issues there that need to be fixed as well, so I will propose a branch that includes those fixes instead.

review: Disapprove

Unmerged revisions

266. By dobey on 2011-02-10

Add support for generating Vala bindings

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.gitignore'
2--- .gitignore 2010-07-16 11:41:54 +0000
3+++ .gitignore 2011-02-10 20:01:37 +0000
4@@ -9,14 +9,15 @@
5 config.status
6 config.sub
7 configure
8-*.deps
9-*.libs
10+.deps
11+.libs
12 *.lo
13 *.la
14 *.o
15 *.bak
16 *~
17 *.pc
18+*_vala.stamp
19 depcomp
20 install-sh
21 libtool
22@@ -27,8 +28,16 @@
23 couchdb-glib/Couchdb-1.0.typelib
24 couchdb-glib/couchdb-marshal.c
25 couchdb-glib/couchdb-marshal.h
26+couchdb-glib/couchdb-glib-1.0.deps
27+couchdb-glib/couchdb-glib-1.0.vapi
28+couchdb-glib/test-couchdb-glib-vapi
29+couchdb-glib/test-couchdb-glib-vapi.c
30 desktopcouch-glib/Desktopcouch-1.0.gir
31 desktopcouch-glib/Desktopcouch-1.0.typelib
32+desktopcouch-glib/desktopcouch-glib-1.0.deps
33+desktopcouch-glib/desktopcouch-glib-1.0.vapi
34+desktopcouch-glib/test-desktopcouch-glib-vapi
35+desktopcouch-glib/test-desktopcouch-glib-vapi.c
36 gtk-doc.make
37 m4/gtk-doc.m4
38 m4/libtool.m4
39@@ -81,6 +90,8 @@
40 bindings/mono/CouchdbDocumentInfo.cs
41 bindings/mono/CouchdbDocumentContact.cs
42 bindings/mono/CouchdbDocumentTask.cs
43+bindings/mono/CouchdbQuery.cs
44+bindings/mono/CouchdbResponse.cs
45 bindings/mono/CouchdbSession.cs
46 bindings/mono/CouchdbStructField.cs
47 bindings/mono/DatabaseCreatedHandler.cs
48
49=== modified file 'configure.ac'
50--- configure.ac 2010-11-24 15:37:50 +0000
51+++ configure.ac 2011-02-10 20:01:37 +0000
52@@ -97,6 +97,48 @@
53 # Check for introspection
54 ##################################################
55 GOBJECT_INTROSPECTION_CHECK([0.6.4])
56+AC_MSG_CHECKING([if gobject-introspection requires new options])
57+$PKG_CONFIG --atleast-version=0.9.4 gobject-introspection-1.0
58+new_introspection=$?
59+if test "x$new_introspection" = "x0"; then
60+ AC_MSG_RESULT([yes])
61+else
62+ AC_MSG_RESULT([no])
63+fi
64+AM_CONDITIONAL([HAVE_NEW_INTROSPECTION], [test "x$new_introspection" = "x0"])
65+
66+# Fix up some junk from GIR
67+if test "x$found_introspection" = "xyes"; then
68+ INTROSPECTION_GIRDIR_NAME="`basename ${INTROSPECTION_GIRDIR}`"
69+ INTROSPECTION_TYPELIBDIR_NAME="`basename ${INTROSPECTION_TYPELIBDIR}`"
70+ AC_SUBST(INTROSPECTION_GIRDIR_NAME)
71+ AC_SUBST(INTROSPECTION_TYPELIBDIR_NAME)
72+fi
73+
74+##################################################
75+# Check for Vala's vapigen
76+##################################################
77+VAPIGEN=""
78+AC_MSG_CHECKING([whether to enable vapi generation])
79+AC_ARG_ENABLE([vapigen],
80+ AC_HELP_STRING([--disable-vapigen],
81+ [Build the vapi for libsyncdaemon [default=enabled]]),
82+ [enable_vapigen=$enableval],
83+ [enable_vapigen=yes])
84+if test "x$enable_vapigen" = "xyes"; then
85+ if test "x$found_introspection" = "xyes"; then
86+ AC_MSG_RESULT([yes])
87+ AC_PATH_PROG([VAPIGEN], [vapigen], [])
88+ AM_PROG_VALAC()
89+ else
90+ AC_MSG_RESULT([no])
91+ AC_MSG_RESULT([gobject-introspection is required to generate a vapi])
92+ fi
93+else
94+ AC_MSG_RESULT([no])
95+fi
96+AC_SUBST(VAPIGEN)
97+AM_CONDITIONAL([HAVE_VAPIGEN], [test "x$VAPIGEN" != "x" -a "x$enable_vapigen" = "xyes"])
98
99 AC_OUTPUT([
100 Makefile
101
102=== modified file 'couchdb-glib/Makefile.am'
103--- couchdb-glib/Makefile.am 2010-11-24 15:25:47 +0000
104+++ couchdb-glib/Makefile.am 2011-02-10 20:01:37 +0000
105@@ -101,9 +101,15 @@
106
107 -include $(INTROSPECTION_MAKEFILE)
108 INTROSPECTION_GIRS =
109-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
110+INTROSPECTION_SCANNER_ARGS = \
111+ --add-include-path=$(srcdir) \
112+ --c-include="couchdb-glib.h"
113 INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
114
115+if HAVE_NEW_INTROSPECTION
116+INTROSPECTION_SCANNER_ARGS += --identifier-prefix=Couchdb --warn-all
117+endif
118+
119 if HAVE_INTROSPECTION
120 introspection_files = \
121 $(h_DATA) \
122@@ -113,6 +119,7 @@
123 Couchdb_1_0_gir_CFLAGS = -I$(top_srcdir)/couchdb-glib -I$(top_builddir)/couchdb-glib
124 Couchdb_1_0_gir_LIBS = libcouchdb-glib-1.0.la
125 Couchdb_1_0_gir_FILES = $(addprefix $(srcdir)/, $(introspection_files))
126+Couchdb_1_0_gir_EXPORT_PACKAGES = couchdb-glib-1.0
127 INTROSPECTION_GIRS += Couchdb-1.0.gir
128
129 girdir = $(datadir)/gir-1.0
130@@ -122,4 +129,30 @@
131 typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
132
133 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
134-endif
135+
136+if HAVE_VAPIGEN
137+vapidir = $(datadir)/vala/vapi
138+vapi_DATA = couchdb-glib-1.0.vapi couchdb-glib-1.0.deps
139+
140+couchdb-glib-1.0.vapi: Couchdb-1.0.gir Makefile
141+ $(VAPIGEN) --pkg gobject-2.0 --pkg json-glib-1.0 --library couchdb-glib-1.0 $<
142+
143+couchdb-glib-1.0.deps: couchdb-glib-vala.deps Makefile
144+ cp $< $@
145+
146+noinst_PROGRAMS = test-couchdb-glib-vapi
147+
148+test_couchdb_glib_vapi_SOURCES = \
149+ couchdb-glib-1.0.vapi \
150+ test-couchdb-glib-vapi.vala
151+
152+test_couchdb_glib_vapi_VALAFLAGS = \
153+ --pkg gobject-2.0 --pkg glib-2.0 --pkg json-glib-1.0
154+
155+test_couchdb_glib_vapi_LDADD = libcouchdb-glib-1.0.la $(COUCHDB_GLIB_LIBS)
156+
157+CLEANFILES += $(vapi_DATA) $(test_couchdb_glib_vapi_SOURCES:.vala=.c)
158+
159+endif # HAVE_VAPIGEN
160+
161+endif # HAVE_INTROSPECTION
162
163=== added file 'couchdb-glib/couchdb-glib-vala.deps'
164--- couchdb-glib/couchdb-glib-vala.deps 1970-01-01 00:00:00 +0000
165+++ couchdb-glib/couchdb-glib-vala.deps 2011-02-10 20:01:37 +0000
166@@ -0,0 +1,3 @@
167+gobject-2.0
168+json-glib-1.0
169+
170
171=== added file 'couchdb-glib/test-couchdb-glib-vapi.vala'
172--- couchdb-glib/test-couchdb-glib-vapi.vala 1970-01-01 00:00:00 +0000
173+++ couchdb-glib/test-couchdb-glib-vapi.vala 2011-02-10 20:01:37 +0000
174@@ -0,0 +1,51 @@
175+/*
176+ * Couchdb-GLib Vala API test binary
177+ *
178+ * Copyright 2011 Canonical Ltd.
179+ *
180+ * This library is free software; you can redistribute it and/or
181+ * modify it under the terms of version 2 of the GNU Lesser General Public
182+ * License as published by the Free Software Foundation.
183+ *
184+ * This program is distributed in the hope that it will be useful,
185+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
186+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
187+ * General Public License for more details.
188+ *
189+ * You should have received a copy of the GNU Lesser General Public
190+ * License along with this library; if not, write to the
191+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
192+ *
193+ */
194+using Couchdb;
195+using GLib;
196+
197+public class TestVapi {
198+ private MainLoop loop;
199+ private int status;
200+
201+ public TestVapi () {
202+ status = 0;
203+ }
204+
205+ private bool test_instantiation () {
206+ new Session ("http://test:test@127.0.0.1:5985");
207+
208+ loop.quit ();
209+ return false;
210+ }
211+
212+ public int main () {
213+ loop = new MainLoop ();
214+
215+ Idle.add ((SourceFunc) test_instantiation);
216+ loop.run ();
217+
218+ return status;
219+ }
220+}
221+
222+int main (string[] args) {
223+ var test = new TestVapi ();
224+ return test.main ();
225+}
226
227=== modified file 'desktopcouch-glib/Makefile.am'
228--- desktopcouch-glib/Makefile.am 2010-11-24 15:26:48 +0000
229+++ desktopcouch-glib/Makefile.am 2011-02-10 20:01:37 +0000
230@@ -30,9 +30,16 @@
231
232 -include $(INTROSPECTION_MAKEFILE)
233 INTROSPECTION_GIRS =
234-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --add-include-path=$(top_srcdir)/couchdb-glib
235+INTROSPECTION_SCANNER_ARGS = \
236+ --add-include-path=$(srcdir) \
237+ --add-include-path=$(top_srcdir)/couchdb-glib \
238+ --c-include="desktopcouch-glib.h"
239 INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) --includedir=$(top_builddir)/couchdb-glib
240
241+if HAVE_NEW_INTROSPECTION
242+INTROSPECTION_SCANNER_ARGS += --identifier-prefix=Desktopcouch --warn-all
243+endif
244+
245 if HAVE_INTROSPECTION
246 introspection_files = \
247 $(h_DATA) \
248@@ -42,6 +49,7 @@
249 Desktopcouch_1_0_gir_CFLAGS = -I$(top_srcdir)/desktopcouch-glib -I$(top_builddir)/desktopcouch-glib -I$(top_srcdir)/couchdb-glib -I$(top_builddir)/couchdb-glib
250 Desktopcouch_1_0_gir_LIBS = libdesktopcouch-glib-1.0.la
251 Desktopcouch_1_0_gir_FILES = $(addprefix $(srcdir)/, $(introspection_files))
252+Desktopcouch_1_0_gir_EXPORT_PACKAGES = desktopcouch-glib-1.0
253 INTROSPECTION_GIRS += Desktopcouch-1.0.gir
254
255 girdir = $(datadir)/gir-1.0
256@@ -51,4 +59,31 @@
257 typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
258
259 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
260-endif
261+
262+if HAVE_VAPIGEN
263+vapidir = $(datadir)/vala/vapi
264+vapi_DATA = desktopcouch-glib-1.0.vapi desktopcouch-glib-1.0.deps
265+
266+desktopcouch-glib-1.0.vapi: Desktopcouch-1.0.gir Makefile
267+ $(VAPIGEN) --vapidir=$(top_builddir)/couchdb-glib --pkg gobject-2.0 --pkg json-glib-1.0 --library desktopcouch-glib-1.0 $<
268+
269+desktopcouch-glib-1.0.deps: desktopcouch-glib-vala.deps Makefile
270+ cp $< $@
271+
272+noinst_PROGRAMS = test-desktopcouch-glib-vapi
273+
274+test_desktopcouch_glib_vapi_SOURCES = \
275+ desktopcouch-glib-1.0.vapi \
276+ test-desktopcouch-glib-vapi.vala
277+
278+test_desktopcouch_glib_vapi_VALAFLAGS = \
279+ --vapidir=$(top_builddir)/couchdb-glib \
280+ --pkg gobject-2.0 --pkg glib-2.0 --pkg json-glib-1.0 --pkg couchdb-glib-1.0
281+
282+test_desktopcouch_glib_vapi_LDADD = libdesktopcouch-glib-1.0.la $(COUCHDB_GLIB_LIBS)
283+
284+CLEANFILES += $(vapi_DATA) $(test_desktopcouch_glib_vapi_SOURCES:.vala=.c)
285+
286+endif # HAVE_VAPIGEN
287+
288+endif # HAVE_INTROSPECTION
289
290=== added file 'desktopcouch-glib/desktopcouch-glib-vala.deps'
291--- desktopcouch-glib/desktopcouch-glib-vala.deps 1970-01-01 00:00:00 +0000
292+++ desktopcouch-glib/desktopcouch-glib-vala.deps 2011-02-10 20:01:37 +0000
293@@ -0,0 +1,4 @@
294+gobject-2.0
295+couchdb-glib-1.0
296+json-glib-1.0
297+
298
299=== added file 'desktopcouch-glib/test-desktopcouch-glib-vapi.vala'
300--- desktopcouch-glib/test-desktopcouch-glib-vapi.vala 1970-01-01 00:00:00 +0000
301+++ desktopcouch-glib/test-desktopcouch-glib-vapi.vala 2011-02-10 20:01:37 +0000
302@@ -0,0 +1,51 @@
303+/*
304+ * Desktopcouch-GLib Vala API test binary
305+ *
306+ * Copyright 2011 Canonical Ltd.
307+ *
308+ * This library is free software; you can redistribute it and/or
309+ * modify it under the terms of version 2 of the GNU Lesser General Public
310+ * License as published by the Free Software Foundation.
311+ *
312+ * This program is distributed in the hope that it will be useful,
313+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
314+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
315+ * General Public License for more details.
316+ *
317+ * You should have received a copy of the GNU Lesser General Public
318+ * License along with this library; if not, write to the
319+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
320+ *
321+ */
322+using Desktopcouch;
323+using GLib;
324+
325+public class TestVapi {
326+ private MainLoop loop;
327+ private int status;
328+
329+ public TestVapi () {
330+ status = 0;
331+ }
332+
333+ private bool test_instantiation () {
334+ new Session ();
335+
336+ loop.quit ();
337+ return false;
338+ }
339+
340+ public int main () {
341+ loop = new MainLoop ();
342+
343+ Idle.add ((SourceFunc) test_instantiation);
344+ loop.run ();
345+
346+ return status;
347+ }
348+}
349+
350+int main (string[] args) {
351+ var test = new TestVapi ();
352+ return test.main ();
353+}

Subscribers

People subscribed via source and target branches

to all changes: