Update deps, better arg parsing
This commit is contained in:
parent
599b7016d5
commit
b45e57dfa1
@ -1,6 +1,7 @@
|
||||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:args/args.dart';
|
||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||
import 'package:sqlite3/open.dart';
|
||||
|
||||
@ -8,13 +9,32 @@ import 'jmdict/parser.dart';
|
||||
import 'kanjidic/parser.dart';
|
||||
import 'radkfile/parser.dart';
|
||||
|
||||
ArgParser argParser() {
|
||||
final parser = ArgParser();
|
||||
parser.addOption(
|
||||
'libsqlite',
|
||||
help:
|
||||
'Path to the SQLite library. This is used to load the SQLite library dynamically.',
|
||||
valueHelp: 'PATH',
|
||||
mandatory: true,
|
||||
);
|
||||
return parser;
|
||||
}
|
||||
|
||||
Future<void> main(List<String> arguments) async {
|
||||
final parser = argParser();
|
||||
final ArgResults args = parser.parse(arguments);
|
||||
|
||||
if (!args.wasParsed('libsqlite')) {
|
||||
print(parser.usage);
|
||||
exit(64);
|
||||
}
|
||||
|
||||
final db = await createDatabaseFactoryFfi(ffiInit: () {
|
||||
open.overrideForAll(() => DynamicLibrary.open(arguments[0]));
|
||||
})
|
||||
.openDatabase(Directory.current.uri.resolve('jadb.sqlite').path);
|
||||
open.overrideForAll(() => DynamicLibrary.open(args.option('libsqlite')!));
|
||||
}).openDatabase(Directory.current.uri.resolve('jadb.sqlite').path);
|
||||
|
||||
await addDataFromJMdict(db);
|
||||
await addDataFromRADKFILE(db);
|
||||
await addDataFromKANJIDIC(db);
|
||||
}
|
||||
|
||||
|
@ -20,15 +20,15 @@ stdenvNoCC.mkDerivation {
|
||||
runHook preBuild
|
||||
|
||||
mkdir -p data
|
||||
ln -s ${jmdict}/* data
|
||||
ln -s ${radkfile}/* data
|
||||
ln -s ${kanjidic2}/* data
|
||||
ln -s "${jmdict}"/* data
|
||||
ln -s "${radkfile}"/* data
|
||||
ln -s "${kanjidic2}"/* data
|
||||
|
||||
for migration in migrations/*.sql; do
|
||||
sqlite3 jadb.sqlite < $migration
|
||||
sqlite3 jadb.sqlite < "$migration"
|
||||
done
|
||||
|
||||
${lib.getExe database-tool} ${sqlite.out}/lib/libsqlite3.so
|
||||
"${lib.getExe database-tool}" --libsqlite "${sqlite.out}/lib/libsqlite3.so"
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
@ -36,8 +36,8 @@ stdenvNoCC.mkDerivation {
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm644 -t $out jadb.sqlite
|
||||
install -Dm644 -t "$out" jadb.sqlite
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
}
|
||||
|
42
pubspec.lock
42
pubspec.lock
@ -1,6 +1,14 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
args:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: args
|
||||
sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.7.0"
|
||||
collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -13,18 +21,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6"
|
||||
sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
version: "2.1.4"
|
||||
lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: lints
|
||||
sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413"
|
||||
sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
version: "5.1.1"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -45,42 +53,42 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
|
||||
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.2"
|
||||
version: "6.1.0"
|
||||
sqflite_common:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite_common
|
||||
sha256: "4468b24876d673418a7b7147e5a08a715b4998a7ae69227acafaab762e0e5490"
|
||||
sha256: "84731e8bfd8303a3389903e01fb2141b6e59b5973cacbb0929021df08dddbe8b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.4+5"
|
||||
version: "2.5.5"
|
||||
sqflite_common_ffi:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: sqflite_common_ffi
|
||||
sha256: d316908f1537725427ff2827a5c5f3b2c1bc311caed985fe3c9b10939c9e11ca
|
||||
sha256: "1f3ef3888d3bfbb47785cc1dda0dc7dd7ebd8c1955d32a9e8e9dae1e38d1c4c1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.4"
|
||||
version: "2.3.5"
|
||||
sqlite3:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqlite3
|
||||
sha256: bb174b3ec2527f9c5f680f73a89af8149dd99782fbb56ea88ad0807c5638f2ed
|
||||
sha256: "310af39c40dd0bb2058538333c9d9840a2725ae0b9f77e4fd09ad6696aa8f66e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.7"
|
||||
version: "2.7.5"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: synchronized
|
||||
sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225"
|
||||
sha256: "0669c70faae6270521ee4f05bffd2919892d42d1276e6c495be80174b6bc0ef6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.3.0+3"
|
||||
version: "3.3.1"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -93,10 +101,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
|
||||
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
xml:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -106,4 +114,4 @@ packages:
|
||||
source: hosted
|
||||
version: "6.5.0"
|
||||
sdks:
|
||||
dart: ">=3.5.0 <4.0.0"
|
||||
dart: ">=3.7.0 <4.0.0"
|
||||
|
@ -1,14 +1,15 @@
|
||||
name: jadb
|
||||
description: A SQLite database containing open source japanese language translation data
|
||||
version: 1.0.0
|
||||
homepage: https://git.nani.wtf/h7x4/jadb
|
||||
homepage: https://git.pvv.ntnu.no/oysteikt/jadb
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
|
||||
dependencies:
|
||||
args: ^2.7.0
|
||||
collection: ^1.19.1
|
||||
sqflite_common_ffi: ^2.3.4
|
||||
sqflite_common_ffi: ^2.3.5
|
||||
xml: ^6.5.0
|
||||
|
||||
dev_dependencies:
|
||||
|
Loading…
x
Reference in New Issue
Block a user