Skip to content

Commit

Permalink
scripts: build version string based only on release tags
Browse files Browse the repository at this point in the history
  • Loading branch information
aureliendavid committed Feb 27, 2025
1 parent 915f9da commit 4accd59
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ config.mak:


GITREV_PATH:=$(SRC_PATH)/include/gpac/revision.h
TAG:=$(shell git --git-dir=$(SRC_PATH)/.git describe --tags --abbrev=0 2> /dev/null)
VERSION:=$(shell echo `git --git-dir=$(SRC_PATH)/.git describe --tags --long || echo "UNKNOWN"` | sed "s/^$(TAG)-//")
TAG:=$(shell git --git-dir=$(SRC_PATH)/.git describe --tags --abbrev=0 --match "v*" 2> /dev/null)
VERSION:=$(shell echo `git --git-dir=$(SRC_PATH)/.git describe --tags --long --match "v*" || echo "UNKNOWN"` | sed "s/^$(TAG)-//")
BRANCH:=$(shell git --git-dir=$(SRC_PATH)/.git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "UNKNOWN")

version:
Expand Down
4 changes: 2 additions & 2 deletions build/xcode/generate_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ cd "`dirname $0`"

echo "*** Set version within Info.plist application file ***"
version=`grep '#define GPAC_VERSION ' ../../include/gpac/version.h | cut -d '"' -f 2`
TAG=$(git describe --tags --abbrev=0 2> /dev/null)
REVISION=$(echo `git describe --tags --long 2> /dev/null || echo "UNKNOWN"` | sed "s/^$TAG-//")
TAG=$(git describe --tags --abbrev=0 --match "v*" 2> /dev/null)
REVISION=$(echo `git describe --tags --long --match "v*" 2> /dev/null || echo "UNKNOWN"` | sed "s/^$TAG-//")
BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "UNKNOWN")
rev="$REVISION-$BRANCH"
if [ "$rev" != "" ]
Expand Down
4 changes: 2 additions & 2 deletions check_revision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version="`grep '#define GPAC_VERSION ' \"./include/gpac/version.h\" | cut -d '"'

#check for .git - if so use nb commits till last tag for rev + commit id
if [ -d ".git" ]; then
TAG=$(git describe --tags --abbrev=0 2>>gtmp)
VERSION=$(echo `git describe --tags --long 2>>gtmp || echo "UNKNOWN"` | sed "s/^$TAG-//")
TAG=$(git describe --tags --abbrev=0 --match "v*" 2>>gtmp)
VERSION=$(echo `git describe --tags --long --match "v*" 2>>gtmp || echo "UNKNOWN"` | sed "s/^$TAG-//")
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>>gtmp || echo "UNKNOWN")
revision="$VERSION-$BRANCH"

Expand Down
4 changes: 2 additions & 2 deletions generate_installer.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ echo diff = %diff%
if not "%diff%"=="" echo Local and remote revisions not in sync, consider pushing or pulling changes

REM execute git and check if the result if found within revision.h
for /f "delims=" %%a in ('git describe --tags --long') do @set VERSION=%%a
for /f "delims=" %%a in ('git describe --tags --abbrev^=0') do @set TAG=%%a-
for /f "delims=" %%a in ('git describe --tags --long --match "v*" ') do @set VERSION=%%a
for /f "delims=" %%a in ('git describe --tags --abbrev^=0 --match "v*" ') do @set TAG=%%a-
for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do @set BRANCH=%%a
REM remove anotated tag from VERSION
setlocal enabledelayedexpansion
Expand Down
6 changes: 2 additions & 4 deletions mkdmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ version=`grep '#define GPAC_VERSION ' $source_path/include/gpac/version.h | cut

cur_dir=`pwd`
cd $source_path
TAG=$(git describe --tags --abbrev=0 2> /dev/null)
REVISION=$(echo `git describe --tags --long 2> /dev/null || echo "UNKNOWN"` | sed "s/^$TAG-//")
TAG=$(git describe --tags --abbrev=0 --match "v*" 2> /dev/null)
REVISION=$(echo `git describe --tags --long --match "v*" 2> /dev/null || echo "UNKNOWN"` | sed "s/^$TAG-//")
BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "UNKNOWN")
rev="$REVISION-$BRANCH"
cd $cur_dir
Expand Down Expand Up @@ -121,5 +121,3 @@ chmod 755 $pck_name
echo "$pck_name ready"
rm -rf tmpdmg
rm -rf tmppkg.pkg


7 changes: 3 additions & 4 deletions version.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ cd /d %~dp0

IF NOT EXIST .\.git\NUL GOTO not_git

for /f "delims=" %%a in ('git describe --tags --long') do @set VERSION=%%a
for /f "delims=" %%a in ('git describe --tags --abbrev^=0') do @set TAG=%%a-
for /f "delims=" %%a in ('git describe --tags --long --match "v*" ') do @set VERSION=%%a
for /f "delims=" %%a in ('git describe --tags --abbrev^=0 --match "v*" ') do @set TAG=%%a-
for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do @set BRANCH=%%a
REM remove anotated tag from VERSION
setlocal enabledelayedexpansion
Expand All @@ -26,7 +26,7 @@ goto done

:not_git
echo "not a git dir"
find /c "-DEV" include\gpac\version.h >nul
find /c "-DEV" include\gpac\version.h >nul
if %errorlevel% equ 1 goto rel_tag
echo "unknwon tag"
@echo off
Expand All @@ -43,4 +43,3 @@ goto write_file
:done
cd /d %OLDDIR%
exit/b

0 comments on commit 4accd59

Please sign in to comment.