Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(glib): add Vala VAPI for GADBC #1152

Merged
merged 8 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ repos:
hooks:
- id: isort
types_or: [python]
# TODO: Change this to vala-lang/vala-lint after
# https://github.com/vala-lang/vala-lint/pull/179 is merged.
- repo: https://github.com/kou/vala-lint
rev: pre-commit-hook
hooks:
- id: vala-lint
- repo: local
hooks:
- id: apache-rat
Expand Down
3 changes: 1 addition & 2 deletions ci/linux-packages/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ Multi-Arch: same
Depends:
${misc:Depends},
gir1.2-adbc-1.0 (= ${binary:Version}),
libadbc-driver-manager-dev (= ${binary:Version}),
libarrow-glib-dev
libadbc-driver-manager-dev (= ${binary:Version})
Description: Apache Arrow Database Connectivity (ADBC) driver manager
.
This package provides GLib based header files.
Expand Down
2 changes: 2 additions & 0 deletions ci/linux-packages/debian/libadbc-glib-dev.install
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
usr/include/adbc-glib/
usr/lib/*/libadbc-glib.so
usr/lib/*/pkgconfig/adbc-glib.pc
usr/share/adbc-glib/example/
usr/share/gir-1.0/ADBC-*.gir
usr/share/vala/vapi/*
29 changes: 15 additions & 14 deletions ci/linux-packages/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,32 @@ export DEB_BUILD_MAINT_OPTIONS=reproducible=-timeless
CMAKE_BUILD_TYPE = RelWithDebInfo

override_dh_auto_configure:
env \
env \
PATH=/usr/lib/go-1.20/bin:$${PATH} \
dh_auto_configure \
--sourcedirectory=c/ \
--builddirectory=c.build \
--sourcedirectory=c/ \
--builddirectory=c.build \
--buildsystem=cmake+ninja \
-- \
-DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
-DADBC_DRIVER_MANAGER=ON \
-DADBC_DRIVER_POSTGRESQL=ON \
-DADBC_DRIVER_SQLITE=ON \
-DADBC_DRIVER_FLIGHTSQL=ON \
-DADBC_DRIVER_SNOWFLAKE=ON
-DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
-DADBC_DRIVER_FLIGHTSQL=ON \
-DADBC_DRIVER_MANAGER=ON \
-DADBC_DRIVER_POSTGRESQL=ON \
-DADBC_DRIVER_SNOWFLAKE=ON \
-DADBC_DRIVER_SQLITE=ON

override_dh_auto_build:
dh_auto_build \
--sourcedirectory=c \
dh_auto_build \
--sourcedirectory=c \
--builddirectory=c.build
dh_auto_configure \
--sourcedirectory=glib \
--builddirectory=glib.build \
--buildsystem=meson+ninja \
-- \
--buildtype=debugoptimized \
-Dadbc_build_dir=../c.build/driver_manager
-Dadbc_build_dir=../c.build/driver_manager \
-Dvapi=true
env \
LD_LIBRARY_PATH=$(CURDIR)/c.build/driver_manager \
dh_auto_build \
Expand All @@ -64,8 +65,8 @@ override_dh_auto_build:
--buildsystem=meson+ninja

override_dh_auto_install:
dh_auto_install \
--sourcedirectory=c \
dh_auto_install \
--sourcedirectory=c \
--builddirectory=c.build
dh_auto_install \
--sourcedirectory=glib \
Expand Down
3 changes: 2 additions & 1 deletion ci/linux-packages/yum/almalinux-8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ RUN \
python3-pip \
rpmdevtools \
sqlite-devel \
tar && \
tar \
vala && \
yum clean ${quiet} all
3 changes: 2 additions & 1 deletion ci/linux-packages/yum/almalinux-9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ RUN \
python3-pip \
rpmdevtools \
sqlite-devel \
tar && \
tar \
vala && \
dnf clean ${quiet} all
16 changes: 10 additions & 6 deletions ci/linux-packages/yum/apache-arrow-adbc.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ BuildRequires: libpq-devel
BuildRequires: ninja-build
BuildRequires: pkgconfig
BuildRequires: sqlite-devel
BuildRequires: vala

%description
Apache Arrow Database Connectivity (ADBC) is an Apache Arrow based database access API
Expand All @@ -63,11 +64,11 @@ cd c
%adbc_cmake \
-DCMAKE_BUILD_TYPE=${cmake_build_type} \
-G"Unix Makefiles" \
-DADBC_DRIVER_FLIGHTSQL=ON \
-DADBC_DRIVER_MANAGER=ON \
-DADBC_DRIVER_POSTGRESQL=ON \
-DADBC_DRIVER_SQLITE=ON \
-DADBC_DRIVER_FLIGHTSQL=ON \
-DADBC_DRIVER_SNOWFLAKE=ON
-DADBC_DRIVER_SNOWFLAKE=ON \
-DADBC_DRIVER_SQLITE=ON
%adbc_cmake_build
cd -

Expand All @@ -78,7 +79,8 @@ meson setup build \
--default-library=both \
--libdir=%{_libdir} \
--prefix=%{_prefix} \
-Dadbc_build_dir=$PWD/../c/%{adbc_cmake_builddir}/driver_manager
-Dadbc_build_dir=$PWD/../c/%{adbc_cmake_builddir}/driver_manager \
-Dvapi=true

LD_LIBRARY_PATH=$PWD/../c/%{adbc_cmake_builddir}/driver_manager \
meson compile -C build %{?_smp_mflags}
Expand Down Expand Up @@ -258,7 +260,7 @@ This package contains the libraries for ADBC GLib.
%defattr(-,root,root,-)
%doc README.md
%license LICENSE.txt NOTICE.txt
%{_libdir}/girepository-1.0/ADBC-*.typelib
%{_libdir}/girepository-1.0/
%{_libdir}/libadbc-glib.so.*

%package glib-devel
Expand All @@ -276,7 +278,8 @@ Libraries and header files for ADBC GLib.
%defattr(-,root,root,-)
%doc README.md
%license LICENSE.txt NOTICE.txt
%{_datadir}/gir-1.0/ADBC-*.gir
%{_datadir}/gir-1.0/
%{_datadir}/vala/vapi/
%{_includedir}/adbc-glib/
%{_libdir}/libadbc-glib.a
%{_libdir}/libadbc-glib.so
Expand All @@ -293,6 +296,7 @@ Documentation for ADBC GLib.
%defattr(-,root,root,-)
%doc README.md
%license LICENSE.txt NOTICE.txt
%{_datadir}/adbc-glib/example/
%{_docdir}/adbc-glib/

%changelog
Expand Down
11 changes: 11 additions & 0 deletions ci/scripts/glib_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,27 @@ build_subproject() {
cmake_prefix_path="${CONDA_PREFIX}:${cmake_prefix_path}"
pkg_config_path="${pkg_config_path}:${CONDA_PREFIX}/lib/pkgconfig"
fi
if type valac > /dev/null 2>&1; then
enable_vapi=true
else
enable_vapi=false
fi

meson setup \
--buildtype=debug \
--cmake-prefix-path="${cmake_prefix_path}" \
--libdir=lib \
--pkg-config-path="${pkg_config_path}" \
--prefix="${install_dir}" \
-Dexample=true \
-Dvapi="${enable_vapi}" \
"${build_dir}/glib" \
"${source_dir}/glib"
meson install -C "${build_dir}/glib"
"${build_dir}/glib/example/sqlite"
if [[ "${enable_vapi}" = "true" ]]; then
"${build_dir}/glib/example/vala/sqlite"
fi
}

main() {
Expand Down
1 change: 1 addition & 0 deletions dev/release/verify-apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ ${APT_INSTALL} libadbc-driver-manager-dev=${package_version}
required_packages=()
required_packages+=(cmake)
required_packages+=(gcc)
required_packages+=(libc6-dev)
required_packages+=(make)
required_packages+=(pkg-config)
${APT_INSTALL} ${required_packages[@]}
Expand Down
2 changes: 1 addition & 1 deletion glib/adbc-glib/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ G_BEGIN_DECLS
* given operation.
* May indicate a database-side error only.
*
* The error codes are used by all arrow-glib functions.
* The error codes are used by all adbc-glib functions.
*
* They are corresponding to `ADBC_STATUS_*` values.
*/
Expand Down
6 changes: 6 additions & 0 deletions glib/adbc-glib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,9 @@ adbc_glib_gir = gnome.generate_gir(libadbc_glib,
nsversion: api_version,
sources: sources + definition_headers + enums,
symbol_prefix: 'gadbc')
if generate_vapi
adbc_glib_vapi = gnome.generate_vapi('gadbc-1.0',
install: true,
packages: ['gobject-2.0'],
sources: [adbc_glib_gir[0]])
endif
33 changes: 33 additions & 0 deletions glib/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# ADBC GLib example

There are example codes in this directory.

C example codes exist in this directory. Language bindings example
codes exists in sub directories:

* `vala/`: Vala examples

## C example codes

Here are example codes in this directory:

* `sqlite.c`: It shows how to connect to a SQLite database.
34 changes: 34 additions & 0 deletions glib/example/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- indent-tabs-mode: nil -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

if build_example
arrow_glib = dependency('arrow-glib')
executable('sqlite', 'sqlite.c',
dependencies: [adbc_glib, arrow_glib],
link_language: 'c')
endif

files = [
'README.md',
'sqlite.c',
]
install_data(files,
install_dir: join_paths(data_dir, meson.project_name(), 'example'))

subdir('vala')
Loading
Loading