Browse Source

split package into bin and lib

Mokhtar Naamani 5 years ago
parent
commit
3fb0d32c52
3 changed files with 15 additions and 10 deletions
  1. 9 4
      Cargo.toml
  2. 1 6
      bin/main.rs
  3. 5 0
      src/lib.rs

+ 9 - 4
Cargo.toml

@@ -1,13 +1,18 @@
-[[bin]]
-name = 'joystream-node'
-path = 'src/main.rs'
-
 [package]
 authors = ['Joystream']
 build = 'build.rs'
 edition = '2018'
 name = 'joystream-node'
 version = '2.1.2'
+default-run = "joystream-node"
+
+[[bin]]
+# is there a name conflict with package name?
+name = 'joystream-node'
+path = 'bin/main.rs'
+
+[lib]
+crate-type = ["cdylib", "rlib"]
 
 [dependencies]
 hex-literal = '0.2.1'

+ 1 - 6
src/main.rs → bin/main.rs

@@ -19,12 +19,7 @@
 #![warn(missing_docs)]
 #![warn(unused_extern_crates)]
 
-mod chain_spec;
-mod cli;
-mod forum_config;
-mod members_config;
-mod service;
-
+use joystream_node::cli;
 pub use substrate_cli::{error, IntoExit, VersionInfo};
 
 fn main() {

+ 5 - 0
src/lib.rs

@@ -0,0 +1,5 @@
+pub mod chain_spec;
+pub mod cli;
+pub mod forum_config;
+pub mod members_config;
+pub mod service;