3499: Use the workspace inheritance r=Kerollmops a=irevoire

Use the workspace inheritance [introduced in rust 1.64](https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds).

It allows us to define the version of meilisearch once in the main `Cargo.toml` and let all the other `Cargo.toml` uses this version.

`@curquiza` I added you as a reviewer because I had to patch some CI scripts

And `@Kerollmops,` I had to bump the `cargo_toml` crates because our version was getting old and didn't support the feature yet.

Also, in another PR, I would like to unify some of our dependencies to ensure we always stay in sync between all our crates.

Co-authored-by: Tamo <tamo@meilisearch.com>
This commit is contained in:
bors[bot] 2023-02-17 09:52:29 +00:00 committed by GitHub
commit 28961b2ad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 131 additions and 41 deletions

View File

@ -3,7 +3,7 @@
# check_tag $current_tag $file_tag $file_name # check_tag $current_tag $file_tag $file_name
function check_tag { function check_tag {
if [[ "$1" != "$2" ]]; then if [[ "$1" != "$2" ]]; then
echo "Error: the current tag does not match the version in $3: found $2 - expected $1" echo "Error: the current tag does not match the version in Cargo.toml: found $2 - expected $1"
ret=1 ret=1
fi fi
} }
@ -11,12 +11,8 @@ function check_tag {
ret=0 ret=0
current_tag=${GITHUB_REF#'refs/tags/v'} current_tag=${GITHUB_REF#'refs/tags/v'}
toml_files='*/Cargo.toml' file_tag="$(grep '^version = ' Cargo.toml | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')"
for toml_file in $toml_files; check_tag $current_tag $file_tag
do
file_tag="$(grep '^version = ' $toml_file | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')"
check_tag $current_tag $file_tag $toml_file
done
lock_file='Cargo.lock' lock_file='Cargo.lock'
lock_tag=$(grep -A 1 'name = "meilisearch-auth"' $lock_file | grep version | cut -d '=' -f 2 | tr -d '"' | tr -d ' ') lock_tag=$(grep -A 1 'name = "meilisearch-auth"' $lock_file | grep version | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')

View File

@ -29,7 +29,7 @@ jobs:
run: | run: |
raw_new_version=$(echo $NEW_VERSION | cut -d 'v' -f 2) raw_new_version=$(echo $NEW_VERSION | cut -d 'v' -f 2)
new_string="version = \"$raw_new_version\"" new_string="version = \"$raw_new_version\""
sd '^version = "\d+.\d+.\w+"$' "$new_string" */Cargo.toml sd '^version = "\d+.\d+.\w+"$' "$new_string" Cargo.toml
- name: Build Meilisearch to update Cargo.lock - name: Build Meilisearch to update Cargo.lock
run: cargo build run: cargo build
- name: Commit and push the changes to the ${{ env.NEW_BRANCH }} branch - name: Commit and push the changes to the ${{ env.NEW_BRANCH }} branch

4
Cargo.lock generated
View File

@ -609,9 +609,9 @@ dependencies = [
[[package]] [[package]]
name = "cargo_toml" name = "cargo_toml"
version = "0.13.3" version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497049e9477329f8f6a559972ee42e117487d01d1e8c2cc9f836ea6fa23a9e1a" checksum = "2bfbc36312494041e2cdd5f06697b7e89d4b76f42773a0b5556ac290ff22acc2"
dependencies = [ dependencies = [
"serde", "serde",
"toml", "toml",

View File

@ -16,6 +16,15 @@ members = [
"benchmarks" "benchmarks"
] ]
[workspace.package]
version = "1.0.0"
authors = ["Quentin de Quelen <quentin@dequelen.me>", "Clément Renault <clement@meilisearch.com>"]
description = "Meilisearch HTTP server"
homepage = "https://meilisearch.com"
readme = "README.md"
edition = "2021"
license = "MIT"
[profile.release] [profile.release]
codegen-units = 1 codegen-units = 1

View File

@ -1,9 +1,15 @@
[package] [package]
name = "benchmarks" name = "benchmarks"
version = "1.0.0"
edition = "2018"
publish = false publish = false
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
anyhow = "1.0.65" anyhow = "1.0.65"
csv = "1.1.6" csv = "1.1.6"

View File

@ -1,7 +1,14 @@
[package] [package]
name = "dump" name = "dump"
version = "1.0.0" publish = false
edition = "2021"
version.workspace = true
authors.workspace = true
description.workspace = true
edition.workspace = true
homepage.workspace = true
readme.workspace = true
license.workspace = true
[dependencies] [dependencies]
anyhow = "1.0.65" anyhow = "1.0.65"

View File

@ -1,7 +1,14 @@
[package] [package]
name = "file-store" name = "file-store"
version = "1.0.0" publish = false
edition = "2021"
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
tempfile = "3.3.0" tempfile = "3.3.0"

View File

@ -1,10 +1,16 @@
[package] [package]
name = "filter-parser" name = "filter-parser"
version = "1.0.0"
edition = "2021"
description = "The parser for the Meilisearch filter syntax" description = "The parser for the Meilisearch filter syntax"
publish = false publish = false
version.workspace = true
authors.workspace = true
# description.workspace = true
homepage.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
nom = "7.1.1" nom = "7.1.1"
nom_locate = "4.0.0" nom_locate = "4.0.0"

View File

@ -1,11 +1,17 @@
[package] [package]
name = "flatten-serde-json" name = "flatten-serde-json"
version = "1.0.0"
edition = "2021"
description = "Flatten serde-json objects like elastic search" description = "Flatten serde-json objects like elastic search"
readme = "README.md" readme = "README.md"
publish = false publish = false
version.workspace = true
authors.workspace = true
# description.workspace = true
homepage.workspace = true
# readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"

View File

@ -1,7 +1,14 @@
[package] [package]
name = "index-scheduler" name = "index-scheduler"
version = "1.0.0" publish = false
edition = "2021"
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
anyhow = "1.0.64" anyhow = "1.0.64"

View File

@ -1,10 +1,16 @@
[package] [package]
name = "json-depth-checker" name = "json-depth-checker"
version = "1.0.0"
edition = "2021"
description = "A library that indicates if a JSON must be flattened" description = "A library that indicates if a JSON must be flattened"
publish = false publish = false
version.workspace = true
authors.workspace = true
# description.workspace = true
homepage.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"

View File

@ -1,7 +1,14 @@
[package] [package]
name = "meili-snap" name = "meili-snap"
version = "1.0.0" publish = false
edition = "2021"
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
insta = { version = "^1.19.1", features = ["json", "redactions"] } insta = { version = "^1.19.1", features = ["json", "redactions"] }

View File

@ -1,7 +1,14 @@
[package] [package]
name = "meilisearch-auth" name = "meilisearch-auth"
version = "1.0.0" publish = false
edition = "2021"
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
base64 = "0.13.1" base64 = "0.13.1"

View File

@ -1,8 +1,14 @@
[package] [package]
name = "meilisearch-types" name = "meilisearch-types"
version = "1.0.0" publish = false
authors = ["marin <postma.marin@protonmail.com>"]
edition = "2021" version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
actix-web = { version = "4.2.1", default-features = false } actix-web = { version = "4.2.1", default-features = false }

View File

@ -1,10 +1,16 @@
[package] [package]
authors = ["Quentin de Quelen <quentin@dequelen.me>", "Clément Renault <clement@meilisearch.com>"]
description = "Meilisearch HTTP server"
edition = "2021"
license = "MIT"
name = "meilisearch" name = "meilisearch"
version = "1.0.0" publish = false
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
readme.workspace = true
edition.workspace = true
license.workspace = true
default-run = "meilisearch"
[dependencies] [dependencies]
actix-cors = "0.6.3" actix-cors = "0.6.3"
@ -90,7 +96,7 @@ yaup = "0.2.1"
[build-dependencies] [build-dependencies]
anyhow = { version = "1.0.65", optional = true } anyhow = { version = "1.0.65", optional = true }
cargo_toml = { version = "0.13.0", optional = true } cargo_toml = { version = "0.14.0", optional = true }
hex = { version = "0.4.3", optional = true } hex = { version = "0.4.3", optional = true }
reqwest = { version = "0.11.12", features = ["blocking", "rustls-tls"], default-features = false, optional = true } reqwest = { version = "0.11.12", features = ["blocking", "rustls-tls"], default-features = false, optional = true }
sha-1 = { version = "0.10.0", optional = true } sha-1 = { version = "0.10.0", optional = true }

View File

@ -1,8 +1,15 @@
[package] [package]
name = "milli" name = "milli"
version = "1.0.0"
authors = ["Kerollmops <clement@meilisearch.com>"]
edition = "2018" edition = "2018"
publish = false
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
readme.workspace = true
# edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
bimap = { version = "0.6.2", features = ["serde"] } bimap = { version = "0.6.2", features = ["serde"] }

View File

@ -1,9 +1,16 @@
[package] [package]
name = "permissive-json-pointer" name = "permissive-json-pointer"
version = "1.0.0"
edition = "2021"
description = "A permissive json pointer" description = "A permissive json pointer"
readme = "README.md" readme = "README.md"
publish = false
version.workspace = true
authors.workspace = true
# description.workspace = true
homepage.workspace = true
# readme.workspace = true
edition.workspace = true
license.workspace = true
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"