mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
7c05eed487
This is done by generating a Kernel/Version.h header with major version, minor version, and git hash.
38 lines
777 B
Bash
Executable File
38 lines
777 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
OUTPUT_FILE=$1
|
|
|
|
if command -v git >/dev/null; then
|
|
if git status >/dev/null 2>&1; then
|
|
GIT_HASH=$( (git log --pretty=format:'%h' -n 1 | cut -c1-7) || true )
|
|
# There is at least one modified file as reported by git.
|
|
if git status --porcelain=v2 | head | grep -Ei '^1' >/dev/null; then
|
|
GIT_HASH="${GIT_HASH}-modified"
|
|
fi
|
|
else
|
|
GIT_HASH=unknown
|
|
fi
|
|
else
|
|
GIT_HASH=unknown
|
|
fi
|
|
|
|
|
|
cat << EOF > "$OUTPUT_FILE"
|
|
/*
|
|
* Automatically generated by Kernel/generate-version-file.sh
|
|
*/
|
|
|
|
#pragma once
|
|
#include <AK/StringView.h>
|
|
|
|
namespace Kernel {
|
|
|
|
constexpr unsigned SERENITY_MAJOR_REVISION = 1;
|
|
constexpr unsigned SERENITY_MINOR_REVISION = 0;
|
|
constexpr StringView SERENITY_VERSION = "${GIT_HASH}"sv;
|
|
|
|
}
|
|
EOF
|