Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The version number on WebUI includes git sha such as 0.1.0-26-1-gd529… #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CazYokoyama
Copy link
Contributor

@CazYokoyama CazYokoyama commented Jan 22, 2022

…363.

You need to run the following commands.

cat <<EOF >make-git-version
#!/bin/bash

Go to the source directory.

[ -n "\$1" ] && cd "$1" || exit 1

Build a version string with git.

version=\$(git describe --tags --always --dirty 2> /dev/null)

If this is not a git repository, fallback to the compilation date.

[ -n "\$version" ] || version=\$(date -I)

Save this in git-version.h.

echo "#define GIT_VERSION \"\$version\"" > \$2/sketch/git-version.h
EOF
chmod +x make-git-version
sudo mv make-git-version /usr/local/bin/
echo recipe.hooks.sketch.prebuild.1.pattern=make-git-version "{build.source.path}" "{build.path}" >~/.arduino15/packages/esp32/hardware/esp32/1.0.6/platform.local.txt
touch software/firmware/source/SoftRF/git-version.h

By above commands, arduino runs /usr/local/bin/make-git-version on compile.
It creates /tmp/arduino_build_XXXXXX/sketch/git-version.h which has

define GIT_VERSION "0.1.0-26-1-gd529363"

for example.

…363.

You need to run the following commands.

cat <<EOF >make-git-version
#!/bin/bash

# Go to the source directory.
[ -n "\$1" ] && cd "$1" || exit 1

# Build a version string with git.
version=\$(git describe --tags --always --dirty 2> /dev/null)

# If this is not a git repository, fallback to the compilation date.
[ -n "\$version" ] || version=\$(date -I)

# Save this in git-version.h.
echo "#define GIT_VERSION \"\$version\"" > \$2/sketch/git-version.h
EOF
chmod +x make-git-version
sudo mv make-git-version /usr/local/bin/
echo recipe.hooks.sketch.prebuild.1.pattern=make-git-version "{build.source.path}" "{build.path}" >~/.arduino15/packages/esp32/hardware/esp32/1.0.6/platform.local.txt
touch software/firmware/source/SoftRF/git-version.h

By above commands, arduino runs /usr/local/bin/make-git-version on compile.
It creates /tmp/arduino_build_XXXXXX/sketch/git-version.h which has

define GIT_VERSION "0.1.0-26-1-gd529363"

for example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant