Separate the code generator to dedicated project

This commit is contained in:
moznion
2020-11-28 17:51:57 +09:00
parent a529b5f0a6
commit 9aa39d584a
8 changed files with 111 additions and 8 deletions

View File

@@ -5,8 +5,6 @@ authors = ["moznion <moznion@gmail.com>"]
edition = "2018"
license-file = "LICENSE"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
md5 = "0.7.0"
chrono = "0.4"
@@ -15,8 +13,7 @@ num_enum = "0.5.1"
tokio = { version = "0.3.4", features = ["full"] }
log = "0.4.11"
thiserror = "1.0"
regex = "1"
async-trait = "0.1.42"
getopts = "0.2" # TODO for dev
Inflector = "0.11" # TODO for dev
env_logger = "0.8.2" # TODO for dev
[dev-dependencies]
env_logger = "0.8.2"

2
code_generator/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/target

83
code_generator/Cargo.lock generated Normal file
View File

@@ -0,0 +1,83 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "Inflector"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
dependencies = [
"lazy_static",
"regex",
]
[[package]]
name = "aho-corasick"
version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
dependencies = [
"memchr",
]
[[package]]
name = "code_generator"
version = "0.1.0"
dependencies = [
"Inflector",
"getopts",
"regex",
]
[[package]]
name = "getopts"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
dependencies = [
"unicode-width",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "memchr"
version = "2.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
[[package]]
name = "regex"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"thread_local",
]
[[package]]
name = "regex-syntax"
version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
[[package]]
name = "thread_local"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
dependencies = [
"lazy_static",
]
[[package]]
name = "unicode-width"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"

13
code_generator/Cargo.toml Normal file
View File

@@ -0,0 +1,13 @@
[package]
name = "code_generator"
version = "0.1.0"
authors = ["moznion <moznion@gmail.com>"]
edition = "2018"
license-file = "LICENSE"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
regex = "1"
getopts = "0.2"
Inflector = "0.11"

9
code_generator/Makefile Normal file
View File

@@ -0,0 +1,9 @@
test:
cargo test
build:
cargo build
lint:
cargo clippy

View File

@@ -17,7 +17,7 @@ done
# shellcheck disable=SC2068
for DICT in ${DICTS[@]}; do
DICT_NAME="${DICT##*.}"
cargo run --bin code_gen "${DICTS_DIR}/dictionary.${DICT_NAME}" "${SRC_DIR}/${DICT_NAME}.rs"
(cd "${REPO_ROOT}/code_generator"; cargo run "${DICTS_DIR}/dictionary.${DICT_NAME}" "${SRC_DIR}/${DICT_NAME}.rs")
done
cargo fix --allow-dirty --allow-staged

View File

@@ -1,4 +1,3 @@
extern crate inflector;
#[macro_use]
extern crate log;