# Invercargill-Sql library build configuration gio_dep = dependency('gio-2.0') dependencies = [ glib_dep, gobject_dep, gio_dep, invercargill_dep, sqlite_dep, libpq_dep ] # Interface sources sources = files('sql-error.vala') sources += files('connection-flags.vala') sources += files('interfaces/connection.vala') sources += files('interfaces/command.vala') sources += files('interfaces/transaction.vala') # Connection string factory sources += files('connection-string.vala') sources += files('connection-factory.vala') sources += files('dialect-factory.vala') sources += files('providers/connection-provider.vala') sources += files('providers/sqlite-provider.vala') sources += files('providers/postgres-provider.vala') # SQLite implementation sources sources += files('sqlite/sqlite-connection.vala') sources += files('sqlite/sqlite-command.vala') sources += files('sqlite/sqlite-result-enumerable.vala') sources += files('sqlite/sqlite-transaction.vala') sources += files('sqlite/sqlite-elements.vala') sources += files('sqlite/sqlite-drop-constraint.vala') # PostgreSQL implementation sources sources += files('postgres/postgres-connection.vala') sources += files('postgres/postgres-command.vala') sources += files('postgres/postgres-result-enumerable.vala') sources += files('postgres/postgres-transaction.vala') sources += files('postgres/postgres-elements.vala') # ORM sources sources += files('orm/column-type.vala') sources += files('orm/column-definition.vala') sources += files('orm/index-definition.vala') sources += files('orm/table-schema.vala') sources += files('orm/entity-mapper.vala') sources += files('orm/entity-mapper-builder.vala') sources += files('orm/type-provider.vala') sources += files('orm/type-registry.vala') sources += files('orm/query.vala') sources += files('orm/entity-query.vala') sources += files('orm/orm-session.vala') # Projection sources sources += files('orm/projections/projection-errors.vala') sources += files('orm/projections/projection-definition.vala') sources += files('orm/projections/selection-types.vala') sources += files('orm/projections/aggregate-analyzer.vala') sources += files('orm/projections/join-condition-analyzer.vala') sources += files('orm/projections/variable-translator.vala') sources += files('orm/projections/friendly-name-resolver.vala') sources += files('orm/projections/projection-builder.vala') sources += files('orm/projections/projection-sql-builder.vala') sources += files('orm/projections/projection-mapper.vala') sources += files('orm/projections/projection-query.vala') # Dialect sources sources += files('dialects/sql-dialect.vala') sources += files('dialects/sqlite-dialect.vala') sources += files('dialects/postgres-dialect.vala') # Expression sources sources += files('expressions/expression-to-sql-visitor.vala') # Migration sources sources += files('migrations/schema-operations.vala') sources += files('migrations/column-builder.vala') sources += files('migrations/foreign-key-builder.vala') sources += files('migrations/index-builder.vala') sources += files('migrations/table-builder.vala') sources += files('migrations/alter-table-builder.vala') sources += files('migrations/migration.vala') sources += files('migrations/migration-builder.vala') sources += files('migrations/migration-runner.vala') sources += files('migrations/dependency.vala') # Build shared library invercargill_sql = shared_library('invercargill-sql', sources, dependencies: dependencies, c_args: libpq_compat_args, install: true, vala_gir: 'invercargill_sql-1.0.gir', install_dir: [true, true, true, true] ) # Create dependency for downstream projects invercargill_sql_dep = declare_dependency( link_with: invercargill_sql, include_directories: include_directories('.') ) # Generate pkg-config file pkg = import('pkgconfig') pkg.generate(invercargill_sql, version: '0.1', name: 'invercargill-sql' ) # Generate GObject introspection typelib g_ir_compiler = find_program('g-ir-compiler') custom_target('invercargill-sql typelib', command: [g_ir_compiler, '--shared-library=libinvercargill-sql.so', '--output', '@OUTPUT@', meson.current_build_dir() / 'invercargill_sql-1.0.gir'], output: 'invercargill-sql-1.0.typelib', depends: invercargill_sql, install: true, install_dir: get_option('libdir') / 'girepository-1.0' ) # Test executable test_exe = executable('basic-test', 'tests/basic-test.vala', dependencies: [dependencies, invercargill_sql_dep], link_with: invercargill_sql ) test('Basic SQL tests', test_exe) # ORM test executable orm_test_exe = executable('orm-test', ['tests/orm-test.vala', 'tests/test-backend.vala'], dependencies: [dependencies, invercargill_sql_dep], link_with: invercargill_sql ) test('ORM tests', orm_test_exe) # SQLite integration test executable sqlite_test_exe = executable('sqlite-test', 'tests/sqlite-test.vala', dependencies: [dependencies, invercargill_sql_dep], link_with: invercargill_sql ) test('SQLite integration tests', sqlite_test_exe) # Migration test executable migration_test_exe = executable('migration-test', ['tests/migration-test.vala', 'tests/test-backend.vala'], dependencies: [dependencies, invercargill_sql_dep], link_with: invercargill_sql ) test('Migration tests', migration_test_exe) # Projection test executable projection_test_exe = executable('projection-test', ['tests/projection-test.vala', 'tests/test-backend.vala'], dependencies: [dependencies, invercargill_sql_dep], link_with: invercargill_sql ) test('Projection tests', projection_test_exe) # PostgreSQL live integration test executable postgres_test_exe = executable('postgres-test', 'tests/postgres-test.vala', dependencies: [dependencies, invercargill_sql_dep], link_with: invercargill_sql ) # Runs only against a reachable server; the wrapper exits 77 (skip) # when ensure-postgres.sh cannot bring a local server up. pg_test_runner = find_program('../scripts/run-postgres-tests.sh') test('PostgreSQL integration tests', pg_test_runner, is_parallel: false, args: postgres_test_exe ) # Dual-backend variants: the ORM, migration and projection suites run # unchanged over PostgreSQL when PG_TEST_CONN is set (see # scripts/run-postgres-tests.sh); the wrapper skips (exit 77) when no # server is reachable, so default builds stay green. test('PostgreSQL ORM tests', pg_test_runner, is_parallel: false, args: orm_test_exe ) test('PostgreSQL migration tests', pg_test_runner, is_parallel: false, args: migration_test_exe ) test('PostgreSQL projection tests', pg_test_runner, is_parallel: false, args: projection_test_exe )