From 8edb3c25e1c800a0a09e00931d4c04101214f4ff Mon Sep 17 00:00:00 2001 From: mh-northlander Date: Mon, 3 Jun 2024 17:13:11 +0900 Subject: [PATCH 1/2] use workspace.package to aggregaate package data --- Cargo.toml | 20 ++++++++++++------- .../input_text/default_input_text/Cargo.toml | 9 +++++---- plugin/oov/simple_oov/Cargo.toml | 9 +++++---- .../path_rewrite/join_katakana_oov/Cargo.toml | 9 +++++---- plugin/path_rewrite/join_numeric/Cargo.toml | 9 +++++---- python/Cargo.toml | 14 +++++++------ sudachi-cli/Cargo.toml | 19 +++++++++--------- sudachi-fuzz/Cargo.toml | 10 ++++++---- sudachi/Cargo.toml | 19 +++++++++--------- 9 files changed, 67 insertions(+), 51 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d9c81a59..ef063507 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "sudachi", "sudachi-cli", @@ -6,12 +7,17 @@ members = [ "plugin/input_text/*", "plugin/oov/*", "plugin/path_rewrite/*", - "python" + "python", ] +default-members = ["sudachi", "sudachi-cli"] -default-members = [ - "sudachi", - "sudachi-cli" -] - -resolver = "2" \ No newline at end of file +[workspace.package] +version = "0.6.9-a1" +authors = ["Works Applications "] +edition = "2021" +rust-version = "1.74.1" +description = "Rust version of Sudachi, the Japanese Morphological Analyzer" +readme = "README.md" +homepage = "https://github.com/WorksApplications/sudachi.rs" +repository = "https://github.com/WorksApplications/sudachi.rs" +license = "Apache-2.0" diff --git a/plugin/input_text/default_input_text/Cargo.toml b/plugin/input_text/default_input_text/Cargo.toml index 08605d14..2f0a8f08 100644 --- a/plugin/input_text/default_input_text/Cargo.toml +++ b/plugin/input_text/default_input_text/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "default_input_text" -version = "0.6.9-a1" -authors = ["Works Applications "] -edition = "2018" -license = "Apache-2.0" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true [lib] crate-type = ["cdylib"] diff --git a/plugin/oov/simple_oov/Cargo.toml b/plugin/oov/simple_oov/Cargo.toml index da5ec548..cb7ee383 100644 --- a/plugin/oov/simple_oov/Cargo.toml +++ b/plugin/oov/simple_oov/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "simple_oov" -version = "0.6.9-a1" -authors = ["Works Applications "] -edition = "2018" -license = "Apache-2.0" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true [lib] crate-type = ["cdylib"] diff --git a/plugin/path_rewrite/join_katakana_oov/Cargo.toml b/plugin/path_rewrite/join_katakana_oov/Cargo.toml index 04ba2af0..95bd9f36 100644 --- a/plugin/path_rewrite/join_katakana_oov/Cargo.toml +++ b/plugin/path_rewrite/join_katakana_oov/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "join_katakana_oov" -version = "0.6.9-a1" -authors = ["Works Applications "] -edition = "2018" -license = "Apache-2.0" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true [lib] crate-type = ["cdylib"] diff --git a/plugin/path_rewrite/join_numeric/Cargo.toml b/plugin/path_rewrite/join_numeric/Cargo.toml index 591ae2c2..0c9cd128 100644 --- a/plugin/path_rewrite/join_numeric/Cargo.toml +++ b/plugin/path_rewrite/join_numeric/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "join_numeric" -version = "0.6.9-a1" -authors = ["Works Applications "] -edition = "2018" -license = "Apache-2.0" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true [lib] crate-type = ["cdylib"] diff --git a/python/Cargo.toml b/python/Cargo.toml index ae321108..e1143743 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -1,12 +1,14 @@ [package] name = "sudachipy" -version = "0.6.9-a1" -edition = "2018" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true description = "Python bindings of sudachi.rs, the Japanese Morphological Analyzer" -homepage = "https://github.com/WorksApplications/sudachi.rs" -repository = "https://github.com/WorksApplications/sudachi.rs" -license = "Apache-2.0" - +readme = "README.md" +homepage.workspace = true +repository.workspace = true +license.workspace = true [lib] name = "sudachipy" diff --git a/sudachi-cli/Cargo.toml b/sudachi-cli/Cargo.toml index 370da063..c5070424 100644 --- a/sudachi-cli/Cargo.toml +++ b/sudachi-cli/Cargo.toml @@ -1,13 +1,14 @@ [package] name = "sudachi-cli" -version = "0.6.9-a1" -authors = ["Works Applications "] -edition = "2018" -description = "Rust version of Sudachi, the Japanese Morphological Analyzer" -readme = "../README.md" -homepage = "https://github.com/WorksApplications/sudachi.rs" -repository = "https://github.com/WorksApplications/sudachi.rs" -license = "Apache-2.0" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +description.workspace = true +readme.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true [dependencies] sudachi = { path = "../sudachi" } @@ -22,4 +23,4 @@ path = "src/main.rs" [features] # Compile dictionary into executable (specifying dictionary becomes optional) -bake_dictionary = [] \ No newline at end of file +bake_dictionary = [] diff --git a/sudachi-fuzz/Cargo.toml b/sudachi-fuzz/Cargo.toml index 5bd294e5..0a293fb6 100644 --- a/sudachi-fuzz/Cargo.toml +++ b/sudachi-fuzz/Cargo.toml @@ -1,9 +1,11 @@ [package] name = "sudachi-fuzz" version = "0.0.1" -authors = ["Works Applications "] -edition = "2021" -description = "Rust version of Sudachi, the Japanese Morphological Analyzer" +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +description.workspace = true +license.workspace = true [dependencies] sudachi = { path = "../sudachi" } @@ -11,4 +13,4 @@ criterion = "0.5" arbitrary = "1" [target.'cfg(unix)'.dependencies] -honggfuzz = "0.5" \ No newline at end of file +honggfuzz = "0.5" diff --git a/sudachi/Cargo.toml b/sudachi/Cargo.toml index 80e7154f..76b4cfe4 100644 --- a/sudachi/Cargo.toml +++ b/sudachi/Cargo.toml @@ -1,13 +1,14 @@ [package] name = "sudachi" -version = "0.6.9-a1" -authors = ["Works Applications "] -edition = "2018" -description = "Rust version of Sudachi, the Japanese Morphological Analyzer" -readme = "README.md" -homepage = "https://github.com/WorksApplications/sudachi.rs" -repository = "https://github.com/WorksApplications/sudachi.rs" -license = "Apache-2.0" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +description.workspace = true +readme.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true [dependencies] # this should be sorted aho-corasick = "1" # MIT/Apache 2.0 @@ -38,4 +39,4 @@ join_numeric = { path = "../plugin/path_rewrite/join_numeric" } join_katakana_oov = { path = "../plugin/path_rewrite/join_katakana_oov" } [lib] -crate-type = ["rlib"] \ No newline at end of file +crate-type = ["rlib"] From d75d43d0de9f960255d2670216b8abaa438a046c Mon Sep 17 00:00:00 2001 From: mh-northlander Date: Mon, 3 Jun 2024 17:22:02 +0900 Subject: [PATCH 2/2] update version-update script --- update_version.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/update_version.sh b/update_version.sh index 3e3b8d27..e882a3ed 100755 --- a/update_version.sh +++ b/update_version.sh @@ -2,12 +2,12 @@ set -eu -if [ $# -lt 2 ] && [ "$1" != "show" ] ; then +if [ $# -lt 1 ] || ( [ $# -lt 2 ] && [ "$1" != "show" ] ) ; then echo "Provide 2 arguments [from] and [to] to update version, or 'show' to print current one." exit 1 fi -VERSION_CRR=$(cat ./sudachi/Cargo.toml | grep -m1 "version \?=" | sed -r 's/^.*"(.*)".*$/\1/') +VERSION_CRR=$(cat ./Cargo.toml | grep -m1 "version \?=" | sed -r 's/^.*"(.*)".*$/\1/') if [ $1 = "show" ] ; then echo ${VERSION_CRR} @@ -25,13 +25,9 @@ fi # update echo "Update version from ${VERSION_FROM} to ${VERSION_TO}" -CARGO_FILES="$(find . -name Cargo.toml)" - -for FILE in $CARGO_FILES ; do - echo $FILE - # replace the first occurrence of `^version = ""$` - sed -i -r "1,/^version = / s/^version = \"${VERSION_FROM}\"$/version = \"${VERSION_TO}\"/" $FILE -done +WORKSPACE_CARGO_FILE="./Cargo.toml" +echo $WORKSPACE_CARGO_FILE +sed -i -r "1,/^version = / s/^version = \"${VERSION_FROM}\"$/version = \"${VERSION_TO}\"/" $WORKSPACE_CARGO_FILE PY_SETUP_FILE="./python/setup.py" echo $PY_SETUP_FILE