Skip to content

Commit 677df48

Browse files
authored
Use Base.@kwdef to automatically provide a kwarg constructor for the GitVersionInfo struct with default values
1 parent acb6e16 commit 677df48

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

base/version_git.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
# This file collects git info and create a julia file with the GIT_VERSION_INFO struct
55

66
echo "# This file was autogenerated in base/version_git.sh"
7-
echo "struct GitVersionInfo"
8-
echo " commit::String"
9-
echo " commit_short::String"
10-
echo " branch::String"
11-
echo " build_number::Int"
12-
echo " date_string::String"
13-
echo " tagged_commit::Bool"
14-
echo " fork_master_distance::Int"
15-
echo " fork_master_timestamp::Float64"
16-
echo " build_system_commit::String"
17-
echo " build_system_commit_short::String"
7+
echo "Base.@kwdef struct GitVersionInfo"
8+
echo " commit::String = \"\""
9+
echo " commit_short::String = \"\""
10+
echo " branch::String = \"\""
11+
echo " build_number::Int = 0"
12+
echo " date_string::String = \"\""
13+
echo " tagged_commit::Bool = true"
14+
echo " fork_master_distance::Int = 0"
15+
echo " fork_master_timestamp::Float64 = 0"
16+
echo " build_system_commit::String = \"\""
17+
echo " build_system_commit_short::String = \"\""
1818
echo "end"
1919
echo ""
2020

@@ -24,7 +24,7 @@ cd $1
2424
if [ "$#" = "2" -a "$2" = "NO_GIT" ]; then
2525
# this comment is used in base/Makefile to distinguish boilerplate
2626
echo "# Default output if git is not available."
27-
echo "const GIT_VERSION_INFO = GitVersionInfo(\"\" ,\"\" ,\"\" ,0 ,\"\" ,true ,0 ,0.)"
27+
echo "const GIT_VERSION_INFO = GitVersionInfo()"
2828
exit 0
2929
fi
3030
# Collect temporary variables

0 commit comments

Comments
 (0)