diff --git a/Cargo.lock b/Cargo.lock index eed114e..25755c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -567,6 +567,15 @@ name = "pylyzer" version = "0.0.60" dependencies = [ "els", + "erg_common", + "erg_compiler", + "pylyzer_core", +] + +[[package]] +name = "pylyzer_core" +version = "0.0.60" +dependencies = [ "erg_common", "erg_compiler", "py2erg", diff --git a/Cargo.toml b/Cargo.toml index e0781a3..3c91f0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ repository.workspace = true [workspace] members = [ "crates/py2erg", + "crates/pylyzer_core", ] [workspace.package] @@ -37,19 +38,16 @@ rustpython-ast = { git = "https://github.com/RustPython/Parser", version = "0.4. # els = { path = "../erg/crates/els", features = ["py_compat"] } [features] -debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"] -large_thread = ["erg_compiler/large_thread", "erg_common/large_thread", "els/large_thread"] -pretty = ["erg_compiler/pretty", "erg_common/pretty"] -backtrace = ["erg_common/backtrace"] -experimental = ["els/experimental", "erg_compiler/experimental", "erg_common/experimental"] +debug = ["erg_common/debug", "pylyzer_core/debug"] +large_thread = ["erg_common/large_thread", "els/large_thread", "pylyzer_core/large_thread"] +pretty = ["erg_common/pretty", "pylyzer_core/pretty"] +backtrace = ["erg_common/backtrace", "els/backtrace", "pylyzer_core/backtrace"] +experimental = ["erg_common/experimental", "els/experimental", "pylyzer_core/experimental"] [dependencies] -erg_compiler = { workspace = true } +pylyzer_core = { version = "0.0.60", path = "./crates/pylyzer_core" } erg_common = { workspace = true } els = { workspace = true } -rustpython-parser = { workspace = true } -rustpython-ast = { workspace = true } -py2erg = { version = "0.0.60", path = "./crates/py2erg" } -[lib] -path = "src/lib.rs" +[dev-dependencies] +erg_compiler = { workspace = true } diff --git a/cargo_publish.sh b/cargo_publish.sh index 625af9f..c96eeee 100755 --- a/cargo_publish.sh +++ b/cargo_publish.sh @@ -3,6 +3,9 @@ if [[ "$PWD" == */pylyzer ]]; then cd crates/py2erg echo "publish py2erg ..." cargo publish + cd ../pylyzer_core + echo "publish pylyzer_core ..." + cargo publish cd ../../ cargo publish if [ "$1" = "--cargo-only" ]; then diff --git a/crates/pylyzer_core/Cargo.toml b/crates/pylyzer_core/Cargo.toml new file mode 100644 index 0000000..80c5299 --- /dev/null +++ b/crates/pylyzer_core/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "pylyzer_core" +version.workspace = true +authors.workspace = true +license.workspace = true +edition.workspace = true +repository.workspace = true + +[features] +debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"] +large_thread = ["erg_compiler/large_thread", "erg_common/large_thread"] +pretty = ["erg_compiler/pretty", "erg_common/pretty"] +backtrace = ["erg_common/backtrace"] +experimental = ["erg_compiler/experimental", "erg_common/experimental"] + +[dependencies] +erg_common = { workspace = true } +erg_compiler = { workspace = true } +rustpython-parser = { workspace = true } +rustpython-ast = { workspace = true } +py2erg = { version = "0.0.60", path = "../py2erg" } + +[lib] +path = "lib.rs" diff --git a/src/analyze.rs b/crates/pylyzer_core/analyze.rs similarity index 100% rename from src/analyze.rs rename to crates/pylyzer_core/analyze.rs diff --git a/src/handle_err.rs b/crates/pylyzer_core/handle_err.rs similarity index 100% rename from src/handle_err.rs rename to crates/pylyzer_core/handle_err.rs diff --git a/crates/pylyzer_core/lib.rs b/crates/pylyzer_core/lib.rs new file mode 100644 index 0000000..089c42e --- /dev/null +++ b/crates/pylyzer_core/lib.rs @@ -0,0 +1,4 @@ +mod analyze; +mod handle_err; + +pub use analyze::{PythonAnalyzer, SimplePythonParser}; diff --git a/src/copy.rs b/src/copy.rs index bb7145d..5443299 100644 --- a/src/copy.rs +++ b/src/copy.rs @@ -23,7 +23,6 @@ fn copy_dir(from: impl AsRef, to: impl AsRef) -> std::io::Result<()> Ok(()) } -#[allow(unused)] pub(crate) fn copy_dot_erg() { if erg_path().exists() { return; diff --git a/src/lib.rs b/src/lib.rs deleted file mode 100644 index 67e4046..0000000 --- a/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -mod analyze; -mod config; -mod copy; -mod handle_err; - -pub use analyze::PythonAnalyzer; diff --git a/src/main.rs b/src/main.rs index 24fb89f..0e91c63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,10 @@ -mod analyze; mod config; mod copy; -mod handle_err; -use analyze::{PythonAnalyzer, SimplePythonParser}; use els::Server; use erg_common::config::ErgMode; use erg_common::spawn::exec_new_thread; +use pylyzer_core::{PythonAnalyzer, SimplePythonParser}; use crate::copy::copy_dot_erg; diff --git a/tests/test.rs b/tests/test.rs index f518b14..a91c124 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -4,7 +4,7 @@ use erg_common::config::ErgConfig; use erg_common::io::Input; use erg_common::spawn::exec_new_thread; use erg_compiler::artifact::{CompleteArtifact, IncompleteArtifact}; -use pylyzer::PythonAnalyzer; +use pylyzer_core::PythonAnalyzer; pub fn exec_analyzer(file_path: &'static str) -> Result { let cfg = ErgConfig {