Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
parity
Mirrored projects
polkadot-sdk
Commits
7e5424dd
Commit
7e5424dd
authored
5 years ago
by
Bastian Köcher
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Don't fail the build when no git is found (#5589)
parent
7cdfaff1
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/utils/build-script-utils/src/version.rs
+14
-7
14 additions, 7 deletions
substrate/utils/build-script-utils/src/version.rs
with
14 additions
and
7 deletions
substrate/utils/build-script-utils/src/version.rs
+
14
−
7
View file @
7e5424dd
...
...
@@ -15,7 +15,7 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use
platforms
::
*
;
use
std
::
process
::
Command
;
use
std
::
{
borrow
::
Cow
,
process
::
Command
}
;
/// Generate the `cargo:` key output
pub
fn
generate_cargo_keys
()
{
...
...
@@ -23,15 +23,22 @@ pub fn generate_cargo_keys() {
.args
(
&
[
"rev-parse"
,
"--short"
,
"HEAD"
])
.output
();
match
output
{
let
commit
=
match
output
{
Ok
(
o
)
if
o
.status
.success
()
=>
{
let
sha
=
String
::
from_utf8_lossy
(
&
o
.stdout
)
.trim
()
.to_owned
();
println!
(
"cargo:rustc-env=SUBSTRATE_CLI_IMPL_VERSION={}"
,
get_version
(
sha
.as_str
()))
Cow
::
from
(
sha
)
}
Ok
(
o
)
=>
eprintln!
(
"cargo:warning=Git command failed with status: {}"
,
o
.status
),
Err
(
err
)
=>
eprintln!
(
"cargo:warning=Failed to execute git command: {}"
,
err
),
}
Ok
(
o
)
=>
{
println!
(
"cargo:warning=Git command failed with status: {}"
,
o
.status
);
Cow
::
from
(
"unknown-commit"
)
},
Err
(
err
)
=>
{
println!
(
"cargo:warning=Failed to execute git command: {}"
,
err
);
Cow
::
from
(
"unknown-commit"
)
},
};
println!
(
"cargo:rustc-env=SUBSTRATE_CLI_IMPL_VERSION={}"
,
get_version
(
&
commit
))
}
fn
get_platform
()
->
String
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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