Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dunitrust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
rust
Dunitrust
Commits
4de69b54
Commit
4de69b54
authored
6 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[fix] durs+core: cargo env vars must be call in binary crate
parent
787825ff
No related branches found
No related tags found
1 merge request
!144
Elois/fix gt sync
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/durs-server/src/main.rs
+21
-27
21 additions, 27 deletions
bin/durs-server/src/main.rs
lib/core/core/src/commands/mod.rs
+15
-5
15 additions, 5 deletions
lib/core/core/src/commands/mod.rs
lib/core/core/src/lib.rs
+0
-15
0 additions, 15 deletions
lib/core/core/src/lib.rs
with
36 additions
and
47 deletions
bin/durs-server/src/main.rs
+
21
−
27
View file @
4de69b54
...
...
@@ -42,42 +42,36 @@ pub use durs_tui::TuiModule;
pub
use
durs_ws2p_v1_legacy
::{
WS2PModule
,
WS2POpt
};
//pub use durs_ws2p::WS2Pv2Module;
/// Durs cli main macro
macro_rules!
durs_cli_main
{
(
$closure_plug:expr
)
=>
{{
init
();
if
let
Err
(
err
)
=
DursCliOpt
::
from_args
()
.into_durs_command
()
.execute
(
env!
(
"CARGO_PKG_NAME"
),
env!
(
"CARGO_PKG_VERSION"
),
$closure_plug
,
)
{
println!
(
"{}"
,
err
);
error!
(
"{}"
,
err
);
}
}};
}
/// Durs command line edition, main function
#[cfg(unix)]
#[cfg(not(target_arch
=
"arm"
))]
fn
main
()
{
init
();
if
let
Err
(
err
)
=
DursCliOpt
::
from_args
()
.into_durs_command
()
.execute
(
durs_plug!
(
durs_cli_main!
(
durs_plug!
(
[
WS2PModule
],
[
TuiModule
/*, SkeletonModule ,DasaModule*/
]
))
{
println!
(
"{}"
,
err
);
error!
(
"{}"
,
err
);
}
}
#[cfg(unix)]
#[cfg(target_arch
=
"arm"
)]
fn
main
()
{
init
();
if
let
Err
(
err
)
=
DursCliOpt
::
from_args
()
.into_durs_command
()
.execute
(
durs_plug!
([
WS2PModule
],
[
TuiModule
/*, SkeletonModule*/
]))
{
println!
(
"{}"
,
err
);
error!
(
"{}"
,
err
);
}
durs_cli_main!
(
durs_plug!
([
WS2PModule
],
[
TuiModule
/*, SkeletonModule*/
]))
}
#[cfg(windows)]
fn
main
()
{
init
();
if
let
Err
(
err
)
=
DursCliOpt
::
from_args
()
.into_durs_command
()
.execute
(
durs_plug!
([
WS2PModule
],
[]))
{
println!
(
"{}"
,
err
);
error!
(
"{}"
,
err
);
}
durs_cli_main!
(
durs_plug!
([
WS2PModule
],
[]))
}
This diff is collapsed.
Click to expand it.
lib/core/core/src/commands/mod.rs
+
15
−
5
View file @
4de69b54
...
...
@@ -22,7 +22,7 @@ pub mod reset;
pub
mod
start
;
use
crate
::
errors
::
DursCoreError
;
use
crate
::
{
durs_exec_core_cmd
,
DursCore
}
;
use
crate
::
DursCore
;
pub
use
dbex
::
*
;
pub
use
duniter_network
::
cli
::
sync
::
SyncOpt
;
use
durs_conf
::
DuRsConf
;
...
...
@@ -77,14 +77,24 @@ pub enum DursCommandEnum<T: ExecutableModuleCommand> {
impl
<
T
:
ExecutableModuleCommand
>
DursCommand
<
T
>
{
/// Execute Durs command
pub
fn
execute
<
PlugFunc
>
(
self
,
plug_modules
:
PlugFunc
)
->
Result
<
(),
DursCoreError
>
pub
fn
execute
<
PlugFunc
>
(
self
,
soft_name
:
&
'static
str
,
soft_version
:
&
'static
str
,
plug_modules
:
PlugFunc
,
)
->
Result
<
(),
DursCoreError
>
where
PlugFunc
:
FnMut
(
&
mut
DursCore
<
DuRsConf
>
)
->
Result
<
(),
DursCoreError
>
,
{
match
self
.command
{
DursCommandEnum
::
Core
(
core_cmd
)
=>
{
durs_exec_core_cmd!
(
core_cmd
,
self
.options
,
plug_modules
,)
}
DursCommandEnum
::
Core
(
core_cmd
)
=>
DursCore
::
execute_core_command
(
core_cmd
,
self
.options
,
vec!
[],
plug_modules
,
soft_name
,
soft_version
,
),
DursCommandEnum
::
Other
(
cmd
)
=>
cmd
.execute_module_command
(
self
.options
),
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/core/core/src/lib.rs
+
0
−
15
View file @
4de69b54
...
...
@@ -56,21 +56,6 @@ use std::path::PathBuf;
use
std
::
sync
::
mpsc
;
use
std
::
thread
;
#[macro_export]
/// Durs execute core command
macro_rules!
durs_exec_core_cmd
{
(
$core_command:expr
,
$options:expr
,
$closure_plug:expr
,
)
=>
{{
DursCore
::
execute_core_command
(
$core_command
,
$options
,
vec!
[],
$closure_plug
,
env!
(
"CARGO_PKG_NAME"
),
env!
(
"CARGO_PKG_VERSION"
),
)
}};
}
#[macro_export]
/// Plug modules in durs core
macro_rules!
durs_plug
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment