Browse Source

ci: Sort Cargo.toml and add a check for it

merge-requests/1327/merge
Kévin Commaille 3 years ago
parent
commit
960c74c21d
No known key found for this signature in database
GPG Key ID: DD507DAE96E8245C
  1. 84
      Cargo.toml
  2. 61
      scripts/checks.sh

84
Cargo.toml

@ -16,69 +16,62 @@ overflow-checks = false
incremental = false incremental = false
codegen-units = 16 codegen-units = 16
# Please keep dependencies sorted.
[dependencies] [dependencies]
async-stream = "0.3"
log = "0.4"
mime = "0.3.16"
tracing-subscriber = "0.3"
gettext-rs = { version = "0.7", features = ["gettext-system"] }
once_cell = "1.5"
serde = "1.0.130"
serde_json = "1.0"
tokio = { version = "1.15", features = ["rt", "rt-multi-thread", "sync"] }
url = "2.2"
oo7 = { version = "0.1.0-beta.3", default-features = false, features = [
"native_crypto",
"tokio",
"tracing",
] }
html2pango = "0.5.0"
futures = "0.3"
rand = "0.8"
indexmap = "1.6.2"
qrcode = "0.12.0"
ashpd = { version = "0.4.0-alpha.4", default-features = false, features = [ ashpd = { version = "0.4.0-alpha.4", default-features = false, features = [
"gtk4", "gtk4",
"pipewire", "pipewire",
"tracing", "tracing",
"tokio", "tokio",
] } ] }
async-stream = "0.3"
djb_hash = "0.1.3"
futures = "0.3"
futures-signals = { version = "0.3.30", default-features = false }
geo-uri = "0.2.0"
gettext-rs = { version = "0.7", features = ["gettext-system"] }
gst = { version = "0.20.2", package = "gstreamer" } gst = { version = "0.20.2", package = "gstreamer" }
gst_base = { version = "0.20.0", package = "gstreamer-base" } gst_base = { version = "0.20.0", package = "gstreamer-base" }
gst_video = { version = "0.20.2", package = "gstreamer-video" }
gst_play = { version = "0.20.2", package = "gstreamer-play" }
gst_gtk = { version = "0.10.3", package = "gst-plugin-gtk4" } gst_gtk = { version = "0.10.3", package = "gst-plugin-gtk4" }
gst_pbutils = { version = "0.20.0", package = "gstreamer-pbutils" } gst_pbutils = { version = "0.20.0", package = "gstreamer-pbutils" }
gst_play = { version = "0.20.2", package = "gstreamer-play" }
gst_video = { version = "0.20.2", package = "gstreamer-video" }
html-escape = "0.2.11"
html2pango = "0.5.0"
image = "0.24" image = "0.24"
regex = "1.5.4" indexmap = "1.6.2"
log = "0.4"
mime = "0.3.16"
mime_guess = "2.0.3" mime_guess = "2.0.3"
num_enum = "0.5.6" num_enum = "0.5.6"
thiserror = "1.0.25" once_cell = "1.5"
oo7 = { version = "0.1.0-beta.3", default-features = false, features = [
"native_crypto",
"tokio",
"tracing",
] }
pulldown-cmark = "0.9.2"
qrcode = "0.12.0"
rand = "0.8"
regex = "1.5.4"
rqrr = "0.5" rqrr = "0.5"
secular = { version = "1.0.1", features = ["bmp", "normalization"] } secular = { version = "1.0.1", features = ["bmp", "normalization"] }
pulldown-cmark = "0.9.2" serde = "1.0.130"
geo-uri = "0.2.0" serde_json = "1.0"
html-escape = "0.2.11" thiserror = "1.0.25"
djb_hash = "0.1.3" tokio = { version = "1.15", features = ["rt", "rt-multi-thread", "sync"] }
futures-signals = { version = "0.3.30", default-features = false } tracing-subscriber = "0.3"
url = "2.2"
[dependencies.sourceview]
package = "sourceview5"
version = "0.6.0"
[dependencies.gtk]
package = "gtk4"
version = "0.6.2"
features = ["v4_6"]
[dependencies.adw] [dependencies.adw]
package = "libadwaita" package = "libadwaita"
version = "0.3.1" version = "0.3.1"
features = ["v1_3"] features = ["v1_3"]
[dependencies.shumate] [dependencies.gtk]
package = "libshumate" package = "gtk4"
version = "0.3.0" version = "0.6.2"
features = ["v4_6"]
[dependencies.matrix-sdk] [dependencies.matrix-sdk]
git = "https://github.com/matrix-org/matrix-rust-sdk.git" git = "https://github.com/matrix-org/matrix-rust-sdk.git"
@ -101,6 +94,15 @@ features = ["crypto-store"]
version = "0.8.1" version = "0.8.1"
features = ["unstable-unspecified", "client-api-c", "unstable-sanitize"] features = ["unstable-unspecified", "client-api-c", "unstable-sanitize"]
[dependencies.shumate]
package = "libshumate"
version = "0.3.0"
[dependencies.sourceview]
package = "sourceview5"
version = "0.6.0"
# FIXME: Remove when matrix-sdk dependencies don't pin zeroize (conflict with oo7)
[patch.crates-io.x25519-dalek] [patch.crates-io.x25519-dalek]
git = "https://github.com/A6GibKm/x25519-dalek" git = "https://github.com/A6GibKm/x25519-dalek"
rev = "9f19028c34107eea87d37bcee2eb2b350ec34cfe" rev = "9f19028c34107eea87d37bcee2eb2b350ec34cfe"

61
scripts/checks.sh

@ -498,6 +498,65 @@ check_resources() {
fi fi
} }
# Install cargo-sort with cargo.
install_cargo_sort() {
echo -e "$Installing cargo-sort…"
cargo install cargo-sort
if ! cargo-sort --version >/dev/null 2>&1; then
echo -e "$Failed to install cargo-sort"
exit 2
fi
}
# Run cargo-sort to check if Cargo.toml is sorted.
run_cargo_sort() {
if ! cargo-sort --version >/dev/null 2>&1; then
if [[ $force_install -eq 1 ]]; then
install_cargo_sort
elif [ ! -t 1 ]; then
echo "Unable to check Cargo.toml sorting, because cargo-sort could not be run"
exit 2
else
echo "Cargo-sort is needed to check the sorting in Cargo.toml, but it isn’t available"
echo ""
echo "y: Install cargo-sort via cargo"
echo "N: Don't install cargo-sort and abort checks"
echo ""
while true; do
echo -n "Install cargo-sort? [y/N]: "; read yn < /dev/tty
case $yn in
[Yy]* )
install_cargo_sort
break
;;
[Nn]* | "" )
exit 2
;;
* )
echo $invalid
;;
esac
done
fi
fi
echo -e "$Checking Cargo.toml sorting…"
if [[ $verbose -eq 1 ]]; then
echo ""
cargo-sort --version
echo ""
fi
if ! cargo-sort --check --grouped --order package,lib,profile,features,dependencies,target,dev-dependencies,build-dependencies; then
echo -e " Cargo.toml sorting result: $fail"
echo "Please fix the Cargo.toml file, either manually or by running: cargo-sort --grouped --order package,lib,profile,features,dependencies,target,dev-dependencies,build-dependencies"
exit 1
else
echo -e " Cargo.toml sorting result: $ok"
fi
}
# Check arguments # Check arguments
while [[ "$1" ]]; do case $1 in while [[ "$1" ]]; do case $1 in
-s | --git-staged ) -s | --git-staged )
@ -547,3 +606,5 @@ else
check_resources check_resources
fi fi
echo "" echo ""
run_cargo_sort
echo ""

Loading…
Cancel
Save