anki/rslib/Cargo.toml
Damien Elmes c2e8d89fc6
Colpkg fixes (#1722)
* Fix legacy colpkg import; disable v3 import/export; add roundtrip test

The test has revealed we weren't decompressing the media files on v3
import. That's easy to fix, but means all files need decompressing
even when they already exist, which is not ideal - it would be better
to store size/checksum in the metadata instead.

* Switch media and meta to protobuf; re-enable v3 import/export

- Fixed media not being decompressed on import
- The uncompressed size and checksum is now included for each media
entry, so that we can quickly check if a given file needs to be extracted.
We're still just doing a naive size comparison on colpkg import at the
moment, but we may want to use a checksum in the future, and will need
a checksum for apkg imports.
- Checksums can't be efficiently encoded in JSON, so the media list
has been switched to protobuf to reduce the the space requirements.
- The meta file has been switched to protobuf as well, for consistency.
This will mean any colpkg files exported with beta7 will be
unreadable.

* Avoid integer version comparisons

* Re-enable v3 test

* Apply suggestions from code review

Co-authored-by: RumovZ <gp5glkw78@relay.firefox.com>

* Add export_colpkg() method to Collection

More discoverable, and easier to call from unit tests

* Split import/export code out into separate folders

Currently colpkg/*.rs contain some routines that will be useful for
apkg import/export as well; in the future we can refactor them into a
separate file in the parent module.

* Return a proper error when media import fails

This tripped me up when writing the earlier unit test - I had called
the equivalent of import_colpkg()?, and it was returning a string error
that I didn't notice. In practice this should result in the same text
being shown in the UI, but just skips the tooltip.

* Automatically create media folder on import

* Move roundtrip test into separate file; check collection too

* Remove zstd version suffix

Prevents a warning shown each time Rust Analyzer is used to check the
code.

Co-authored-by: RumovZ <gp5glkw78@relay.firefox.com>
2022-03-17 15:11:23 +10:00

103 lines
2.6 KiB
TOML

[package]
name = "anki"
version = "0.0.0"
edition = "2021"
authors = ["Ankitects Pty Ltd and contributors"]
license = "AGPL-3.0-or-later"
description = "Anki's Rust library code"
build = "build/main.rs"
[lib]
name = "anki"
path = "src/lib.rs"
[features]
bench = ["criterion"]
[[bench]]
name = "benchmark"
harness = false
required-features = ["bench"]
# After updating anything below, run ../cargo/update.py
[build-dependencies]
prost-build = "0.9.0"
[dev-dependencies]
env_logger = "0.9.0"
tokio = { version = "1.17", features = ["macros"] }
[dependencies]
# pinned as any changes could invalidate sqlite indexes
unicase = "=2.6.0"
tokio = { version = "1.17", features = ["fs", "rt-multi-thread"] }
anki_i18n = { path="i18n" }
criterion = { version = "0.3.5", optional = true }
nom = "7.0.0"
proc-macro-nested = "0.1.7"
slog-term = "2.8.0"
blake3 = "1.0.0"
bytes = "1.1.0"
chrono = "0.4.19"
coarsetime = "0.1.19"
flate2 = "1.0.22"
fluent = "0.16.0"
fluent-bundle = "0.15.1"
futures = "0.3.17"
hex = "0.4.3"
htmlescape = "0.3.1"
intl-memoizer = "0.5.1"
itertools = "0.10.1"
lazy_static = "1.4.0"
num_enum = "0.5.4"
num-integer = "0.1.44"
once_cell = "1.8.0"
pin-project = "1.0.8"
prost = "0.9.0"
rand = "0.8.4"
regex = "1.5.4"
reqwest = { git="https://github.com/ankitects/reqwest.git", rev="7591444614de02b658ddab125efba7b2bb4e2335", default-features=false, features=[
"json",
"socks",
"stream",
"multipart",
# the Bazel build scripts separate these out by platform
"native-tls",
"rustls-tls",
"rustls-tls-webpki-roots",
"rustls-tls-native-roots",
] }
rusqlite = { version = "0.26.1", features = ["trace", "functions", "collation", "bundled"] }
scopeguard = "1.1.0"
serde = "1.0.130"
serde_derive = "1.0.130"
serde_json = "1.0.68"
serde_repr = "0.1.7"
serde_tuple = "0.5.0"
serde-aux = "3.0.1"
sha1 = "0.6.0"
slog = { version = "2.7.0", features = ["max_level_trace", "release_max_level_debug"] }
slog-async = "2.7.0"
slog-envlogger = "2.2.0"
tempfile = "3.2.0"
unic-langid = { version = "0.9.0", features = ["macros"] }
unicode-normalization = "0.1.19"
utime = "0.3.1"
zip = { version = "0.5.13", default-features = false, features = ["deflate", "time"] }
async-trait = "0.1.51"
ammonia = "3.1.2"
pulldown-cmark = "0.8.0"
fnv = "1.0.7"
strum = { version = "0.23.0", features = ["derive"] }
tokio-util = { version = "0.6.8", features = ["io"] }
pct-str = { git="https://github.com/timothee-haudebourg/pct-str.git", rev="4adccd8d4a222ab2672350a102f06ae832a0572d" }
unic-ucd-category = "0.9.0"
id_tree = "1.8.0"
zstd = { version="0.10.0", features=["zstdmt"] }
num_cpus = "1.13.1"