Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
5c4c0524
Commit
5c4c0524
authored
4 months ago
by
Вартан Бабаян
Browse files
Options
Downloads
Patches
Plain Diff
fix: identify build type with cfg
parent
cfeb374a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1487
Follow-up from "Improve verbosity of picodata version output"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
build.rs
+4
-19
4 additions, 19 deletions
build.rs
src/cli/args.rs
+2
-2
2 additions, 2 deletions
src/cli/args.rs
src/info.rs
+30
-10
30 additions, 10 deletions
src/info.rs
with
36 additions
and
31 deletions
build.rs
+
4
−
19
View file @
5c4c0524
...
...
@@ -19,7 +19,7 @@ fn main() {
let
build_root
=
cargo
::
get_build_root
();
let
use_static_build
=
!
cargo
::
get_feature
(
"dynamic_build"
);
insert_build_metadata
(
use_static_build
);
insert_build_metadata
();
// Build and link all the relevant tarantool libraries.
// For more info, read the comments in tarantool-build.
...
...
@@ -36,24 +36,9 @@ fn main() {
}
}
fn
insert_build_metadata
(
use_static_build
:
bool
)
{
rustc
::
env
(
"BUILD_TYPE"
,
if
use_static_build
{
"static"
}
else
{
"dynamic"
},
);
rustc
::
env
(
"BUILD_MODE"
,
if
cfg!
(
debug_assertions
)
{
"debug"
}
else
{
"release"
},
);
fn
insert_build_metadata
()
{
let
build_mode
=
std
::
env
::
var
(
"PROFILE"
)
.expect
(
"always set"
);
rustc
::
env
(
"BUILD_MODE"
,
build_mode
);
let
os_version
=
std
::
process
::
Command
::
new
(
"uname"
)
.args
([
"-srmo"
])
...
...
This diff is collapsed.
Click to expand it.
src/cli/args.rs
+
2
−
2
View file @
5c4c0524
use
crate
::
address
::{
HttpAddress
,
IprotoAddress
};
use
crate
::
config
::{
ByteSize
,
DEFAULT_USERNAME
};
use
crate
::
info
::
FULL_PICODATA_VERSION
;
use
crate
::
info
::
version_for_help
;
use
crate
::
util
::
Uppercase
;
use
clap
::
Parser
;
use
std
::
borrow
::
Cow
;
...
...
@@ -11,7 +11,7 @@ use tarantool::log::SayLevel;
use
tarantool
::
tlua
;
#[derive(Debug,
Parser)]
#[clap(name
=
"picodata"
,
version
=
FULL_PICODATA_VERSION
)]
#[clap(name
=
"picodata"
,
version
=
version_for_help()
)]
pub
enum
Picodata
{
Run
(
Box
<
Run
>
),
#[clap(hide
=
true
)]
...
...
This diff is collapsed.
Click to expand it.
src/info.rs
+
30
−
10
View file @
5c4c0524
...
...
@@ -13,19 +13,39 @@ use std::borrow::Cow;
use
tarantool
::
proc
;
use
tarantool
::
tuple
::
RawByteBuf
;
pub
const
FULL_PICODATA_VERSION
:
&
'static
str
=
concat!
(
env!
(
"GIT_DESCRIBE"
),
", "
,
env!
(
"BUILD_TYPE"
),
", "
,
env!
(
"BUILD_MODE"
),
"
\n
"
,
env!
(
"OS_VERSION"
)
);
pub
const
PICODATA_VERSION
:
&
'static
str
=
std
::
env!
(
"GIT_DESCRIBE"
);
pub
const
RPC_API_VERSION
:
&
'static
str
=
"1.0.0"
;
/// Note: this returns a `&'static str` because of clap's requirements.
pub
fn
version_for_help
()
->
&
'static
str
{
static
VERSION_OUTPUT
:
std
::
sync
::
OnceLock
<
String
>
=
std
::
sync
::
OnceLock
::
new
();
const
BUILD_TYPE
:
&
str
=
{
#[cfg(feature
=
"dynamic_build"
)]
{
"dynamic"
}
#[cfg(not(feature
=
"dynamic_build"
))]
{
"static"
}
};
VERSION_OUTPUT
.get_or_init
(||
{
let
mut
result
=
PICODATA_VERSION
.to_string
();
result
.push_str
(
", "
);
result
.push_str
(
BUILD_TYPE
);
result
.push_str
(
", "
);
result
.push_str
(
env!
(
"BUILD_MODE"
));
result
.push
(
'\n'
);
result
.push_str
(
env!
(
"OS_VERSION"
));
result
})
}
////////////////////////////////////////////////////////////////////////////////
// VersionInfo
////////////////////////////////////////////////////////////////////////////////
...
...
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