Skip to content

Commit

Permalink
Use Base.@kwdef to automatically provide a kwarg constructor for th…
Browse files Browse the repository at this point in the history
…e `GitVersionInfo` struct with default values
  • Loading branch information
DilumAluthge authored Jan 8, 2022
1 parent acb6e16 commit 677df48
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions base/version_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
# This file collects git info and create a julia file with the GIT_VERSION_INFO struct

echo "# This file was autogenerated in base/version_git.sh"
echo "struct GitVersionInfo"
echo " commit::String"
echo " commit_short::String"
echo " branch::String"
echo " build_number::Int"
echo " date_string::String"
echo " tagged_commit::Bool"
echo " fork_master_distance::Int"
echo " fork_master_timestamp::Float64"
echo " build_system_commit::String"
echo " build_system_commit_short::String"
echo "Base.@kwdef struct GitVersionInfo"
echo " commit::String = \"\""
echo " commit_short::String = \"\""
echo " branch::String = \"\""
echo " build_number::Int = 0"
echo " date_string::String = \"\""
echo " tagged_commit::Bool = true"
echo " fork_master_distance::Int = 0"
echo " fork_master_timestamp::Float64 = 0"
echo " build_system_commit::String = \"\""
echo " build_system_commit_short::String = \"\""
echo "end"
echo ""

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

0 comments on commit 677df48

Please sign in to comment.