#!/bin/sh

set -e

OUTPUT_FILE=$1

GIT_HASH=$(git describe --exclude '*' --always --dirty=-modified 2>/dev/null || echo "unknown")

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
