From 98d92d370d946cfaa693b3a5f9830b23456a733f Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 9 Feb 2026 14:44:14 +0900 Subject: [PATCH] {flake.lock,pubspec.lock}: bump, source libsqlite via hooks --- flake.lock | 12 +++---- lib/_data_ingestion/open_local_db.dart | 19 +--------- nix/database_tool.nix | 2 ++ pubspec.lock | 48 +++++++++++++------------- pubspec.yaml | 5 +++ test/models/create_empty_db_test.dart | 13 ++----- 6 files changed, 40 insertions(+), 59 deletions(-) diff --git a/flake.lock b/flake.lock index 5c49241..7891b13 100644 --- a/flake.lock +++ b/flake.lock @@ -3,7 +3,7 @@ "jmdict-src": { "flake": false, "locked": { - "narHash": "sha256-coRi0AIx02GIrVms4C1GMCjgtdIVRpS7WEpN2UdUX1E=", + "narHash": "sha256-bBVI8dQtb6kXKkF838hBmCDofdP3tk3HOBbFJ4o08IQ=", "type": "file", "url": "http://ftp.edrdg.org/pub/Nihongo/JMdict_e.gz" }, @@ -15,7 +15,7 @@ "jmdict-with-examples-src": { "flake": false, "locked": { - "narHash": "sha256-UD9QVy9dtPeExN/yvvR8Mi4r+3PvxlbGJA+oRNIGUGk=", + "narHash": "sha256-H3MXUsfsNU8bXf7qID62HC5S11+lYRL4AED1OVCHfrM=", "type": "file", "url": "http://ftp.edrdg.org/pub/Nihongo/JMdict_e_examp.gz" }, @@ -27,7 +27,7 @@ "kanjidic2-src": { "flake": false, "locked": { - "narHash": "sha256-NwQ9SmlwxyXXxSS8cVh1PL17m/LKXdIhyyitTIbB2DI=", + "narHash": "sha256-EopCxnv/p84tc/BJEyiQPYuxwRbZTmmSpyJ85P3hdo0=", "type": "file", "url": "https://www.edrdg.org/kanjidic/kanjidic2.xml.gz" }, @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1765779637, - "narHash": "sha256-KJ2wa/BLSrTqDjbfyNx70ov/HdgNBCBBSQP3BIzKnv4=", + "lastModified": 1770562336, + "narHash": "sha256-ub1gpAONMFsT/GU2hV6ZWJjur8rJ6kKxdm9IlCT0j84=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1306659b587dc277866c7b69eb97e5f07864d8c4", + "rev": "d6c71932130818840fc8fe9509cf50be8c64634f", "type": "github" }, "original": { diff --git a/lib/_data_ingestion/open_local_db.dart b/lib/_data_ingestion/open_local_db.dart index 0623b4a..f9c7dff 100644 --- a/lib/_data_ingestion/open_local_db.dart +++ b/lib/_data_ingestion/open_local_db.dart @@ -1,9 +1,7 @@ -import 'dart:ffi'; import 'dart:io'; import 'package:jadb/search.dart'; import 'package:sqflite_common_ffi/sqflite_ffi.dart'; -import 'package:sqlite3/open.dart'; Future openLocalDb({ String? libsqlitePath, @@ -12,32 +10,17 @@ Future openLocalDb({ bool verifyTablesExist = true, bool walMode = false, }) async { - libsqlitePath ??= Platform.environment['LIBSQLITE_PATH']; jadbPath ??= Platform.environment['JADB_PATH']; jadbPath ??= Directory.current.uri.resolve('jadb.sqlite').path; - libsqlitePath = (libsqlitePath == null) - ? null - : File(libsqlitePath).resolveSymbolicLinksSync(); jadbPath = File(jadbPath).resolveSymbolicLinksSync(); - if (libsqlitePath == null) { - throw Exception('LIBSQLITE_PATH is not set'); - } - - if (!File(libsqlitePath).existsSync()) { - throw Exception('LIBSQLITE_PATH does not exist: $libsqlitePath'); - } - if (!File(jadbPath).existsSync()) { throw Exception('JADB_PATH does not exist: $jadbPath'); } final db = - await createDatabaseFactoryFfi( - ffiInit: () => - open.overrideForAll(() => DynamicLibrary.open(libsqlitePath!)), - ).openDatabase( + await createDatabaseFactoryFfi().openDatabase( jadbPath, options: OpenDatabaseOptions( onConfigure: (db) async { diff --git a/nix/database_tool.nix b/nix/database_tool.nix index 3b9bcfd..0f840ea 100644 --- a/nix/database_tool.nix +++ b/nix/database_tool.nix @@ -7,6 +7,8 @@ buildDartApplication { version = "1.0.0"; inherit src; + dartEntryPoints."bin/jadb" = "bin/jadb.dart"; + autoPubspecLock = ../pubspec.lock; meta.mainProgram = "jadb"; diff --git a/pubspec.lock b/pubspec.lock index 2dd740d..9171378 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "5b7468c326d2f8a4f630056404ca0d291ade42918f4a3c6233618e724f39da8e" + sha256: "796d97d925add7ffcdf5595f33a2066a6e3cee97971e6dbef09b76b7880fd760" url: "https://pub.dev" source: hosted - version: "92.0.0" + version: "94.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "70e4b1ef8003c64793a9e268a551a82869a8a96f39deb73dea28084b0e8bf75e" + sha256: "9c8ebb304d72c0a0c8764344627529d9503fc83d7d73e43ed727dc532f822e4b" url: "https://pub.dev" source: hosted - version: "9.0.0" + version: "10.0.2" args: dependency: "direct main" description: @@ -93,18 +93,18 @@ packages: dependency: "direct main" description: name: equatable - sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7" + sha256: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b" url: "https://pub.dev" source: hosted - version: "2.0.7" + version: "2.0.8" ffi: dependency: transitive description: name: ffi - sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + sha256: d07d37192dbf97461359c1518788f203b0c9102cfd2c35a716b823741219542c url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.5" file: dependency: transitive description: @@ -157,10 +157,10 @@ packages: dependency: "direct dev" description: name: lints - sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "6.1.0" logging: dependency: transitive description: @@ -181,10 +181,10 @@ packages: dependency: transitive description: name: meta - sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + sha256: "9f29b9bcc8ee287b1a31e0d01be0eae99a930dbffdaecf04b3f3d82a969f296f" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.18.1" mime: dependency: transitive description: @@ -293,10 +293,10 @@ packages: dependency: transitive description: name: source_span - sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" url: "https://pub.dev" source: hosted - version: "1.10.1" + version: "1.10.2" sqflite_common: dependency: "direct main" description: @@ -309,10 +309,10 @@ packages: dependency: "direct main" description: name: sqflite_common_ffi - sha256: "9faa2fedc5385ef238ce772589f7718c24cdddd27419b609bb9c6f703ea27988" + sha256: "8d7b8749a516cbf6e9057f9b480b716ad14fc4f3d3873ca6938919cc626d9025" url: "https://pub.dev" source: hosted - version: "2.3.6" + version: "2.3.7+1" sqlite3: dependency: "direct main" description: @@ -365,26 +365,26 @@ packages: dependency: "direct dev" description: name: test - sha256: "77cc98ea27006c84e71a7356cf3daf9ddbde2d91d84f77dbfe64cf0e4d9611ae" + sha256: "54c516bbb7cee2754d327ad4fca637f78abfc3cbcc5ace83b3eda117e42cd71a" url: "https://pub.dev" source: hosted - version: "1.28.0" + version: "1.29.0" test_api: dependency: transitive description: name: test_api - sha256: "19a78f63e83d3a61f00826d09bc2f60e191bf3504183c001262be6ac75589fb8" + sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636" url: "https://pub.dev" source: hosted - version: "0.7.8" + version: "0.7.9" test_core: dependency: transitive description: name: test_core - sha256: f1072617a6657e5fc09662e721307f7fb009b4ed89b19f47175d11d5254a62d4 + sha256: "394f07d21f0f2255ec9e3989f21e54d3c7dc0e6e9dbce160e5a9c1a6be0e2943" url: "https://pub.dev" source: hosted - version: "0.6.14" + version: "0.6.15" typed_data: dependency: transitive description: @@ -405,10 +405,10 @@ packages: dependency: transitive description: name: watcher - sha256: f52385d4f73589977c80797e60fe51014f7f2b957b5e9a62c3f6ada439889249 + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" web: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0070933..7e018c4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,6 +24,11 @@ dev_dependencies: executables: jadb: jadb +hooks: + user_defines: + sqlite3: + source: system + topics: - database - dictionary diff --git a/test/models/create_empty_db_test.dart b/test/models/create_empty_db_test.dart index 516fad2..099d4d0 100644 --- a/test/models/create_empty_db_test.dart +++ b/test/models/create_empty_db_test.dart @@ -4,20 +4,11 @@ import 'dart:io'; import 'package:jadb/models/create_empty_db.dart'; import 'package:jadb/search.dart'; import 'package:sqflite_common_ffi/sqflite_ffi.dart'; -import 'package:sqlite3/open.dart'; +// import 'package:sqlite3/open.dart'; import 'package:test/test.dart'; Future setup_inmemory_database() async { - final libsqlitePath = Platform.environment['LIBSQLITE_PATH']; - - if (libsqlitePath == null) { - throw Exception('LIBSQLITE_PATH is not set'); - } - - final dbConnection = await createDatabaseFactoryFfi( - ffiInit: () => - open.overrideForAll(() => DynamicLibrary.open(libsqlitePath)), - ).openDatabase(':memory:'); + final dbConnection = await createDatabaseFactoryFfi().openDatabase(':memory:'); return dbConnection; }