#!/usr/bin/env bash

if [[ "$OSTYPE" == "win32" ]]; then
    python.exe build/gen.py --no-last-commit-position
else
    python build/gen.py --no-last-commit-position
fi

# Create `out/last_commit_position.h` only using shell built-in commands
echo "// Generated by @rules_foreign_cc_examples_third_party//gn:generate_ninja.sh"  >> out/last_commit_position.h
echo ""                                                                              >> out/last_commit_position.h
echo "#ifndef OUT_LAST_COMMIT_POSITION_H_"                                           >> out/last_commit_position.h
echo "#define OUT_LAST_COMMIT_POSITION_H_"                                           >> out/last_commit_position.h
echo ""                                                                              >> out/last_commit_position.h
echo "#define LAST_COMMIT_POSITION_NUM 1891"                                         >> out/last_commit_position.h
echo "#define LAST_COMMIT_POSITION \"1891 (dfcbc6fe)\""                              >> out/last_commit_position.h
echo ""                                                                              >> out/last_commit_position.h
echo "#endif  // OUT_LAST_COMMIT_POSITION_H_"                                        >> out/last_commit_position.h
echo ""                                                                              >> out/last_commit_position.h
