Skip to content

Commit

Permalink
Merge pull request #245 from JockeJarre/master
Browse files Browse the repository at this point in the history
Add build number and SHA7 to the file properties
  • Loading branch information
toxieainc committed Mar 11, 2024
2 parents a39c0e9 + 1285cc6 commit 048ac0b
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 28 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/libpinmame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
outputs:
version: ${{ steps.version.outputs.version }}
revision: ${{ steps.version.outputs.revision }}
sha: ${{ steps.version.outputs.sha }}
sha7: ${{ steps.version.outputs.sha7 }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: version
Expand All @@ -34,6 +34,7 @@ jobs:
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "revision=${REVISION}" >> $GITHUB_OUTPUT
echo "sha=${SHA}" >> $GITHUB_OUTPUT
echo "sha7=${SHA7}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
build:
Expand Down Expand Up @@ -81,14 +82,16 @@ jobs:
platform: android-arm64-v8a
libpinmame: libpinmame.${{ needs.version.outputs.version }}.so
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# - run: |
# if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
# curl -sL -H "Authorization: Token ${{ secrets.GH_PAT }}" https://api.github.com/repos/upx/upx/actions/artifacts/${{ env.UPX_ARTIFACT }}/zip -o upx.zip
# 7z x upx.zip -oupx
# rm upx.zip
# fi
- run: |
perl -i -pe"s/0/${{ needs.version.outputs.revision }}/g" src/git_version.h
perl -i -pe"s/unknown/${{ needs.version.outputs.sha7 }}/g" src/git_version.h
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
curl -L https://github.com/upx/upx/releases/download/v4.2.2/upx-4.2.2-win64.zip -o upx.zip
7z e upx.zip -oupx
Expand Down Expand Up @@ -126,7 +129,7 @@ jobs:
cp release/license.txt tmp
cp release/pinmame.txt tmp
cp release/whatsnew.txt tmp
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: libpinmame-${{ needs.version.outputs.tag }}-${{ matrix.platform }}
path: tmp
Expand All @@ -136,7 +139,7 @@ jobs:
needs: [ version, build ]
name: Build libpinmame-osx
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
- run: |
mkdir tmp
cp libpinmame-${{ needs.version.outputs.tag }}-osx-x64/license.txt tmp
Expand All @@ -146,7 +149,7 @@ jobs:
lipo -create -output tmp/pinmame_test \
libpinmame-${{ needs.version.outputs.tag }}-osx-x64/pinmame_test \
libpinmame-${{ needs.version.outputs.tag }}-osx-arm64/pinmame_test
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: libpinmame-${{ needs.version.outputs.tag }}-osx
path: tmp
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/pinmame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ jobs:
name: Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
revision: ${{ steps.version.outputs.revision }}
sha7: ${{ steps.version.outputs.sha7 }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: version
Expand All @@ -27,6 +30,9 @@ jobs:
REVISION=$(git rev-list ${{ env.VERSION_START_SHA }}..HEAD --count)
SHA7="${GITHUB_SHA::7}"
TAG="${VERSION}-${REVISION}-${SHA7}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "revision=${REVISION}" >> $GITHUB_OUTPUT
echo "sha7=${SHA7}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
build:
Expand All @@ -50,13 +56,15 @@ jobs:
artifact-suffix: -sc
extra-flags: -D CMAKE_CXX_FLAGS=//DSAM_INCLUDE_COLORED
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ilammy/setup-nasm@v1
# - run: |
# curl -sL -H "Authorization: Token ${{ secrets.GH_PAT }}" https://api.github.com/repos/upx/upx/actions/artifacts/${{ env.UPX_ARTIFACT }}/zip -o upx.zip
# 7z x upx.zip -oupx
# rm upx.zip
- run: |
perl -i -pe"s/0/${{ needs.version.outputs.revision }}/g" src/git_version.h
perl -i -pe"s/unknown/${{ needs.version.outputs.sha7 }}/g" src/git_version.h
curl -L https://github.com/upx/upx/releases/download/v4.2.2/upx-4.2.2-win64.zip -o upx.zip
7z e upx.zip -oupx
rm upx.zip
Expand All @@ -73,7 +81,7 @@ jobs:
cp release/license.txt tmp
cp release/pinmame.txt tmp
cp release/whatsnew.txt tmp
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: PinMAME${{ matrix.artifact-suffix }}-${{ needs.version.outputs.tag }}-${{ matrix.platform }}
path: tmp
14 changes: 11 additions & 3 deletions .github/workflows/pinmame32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ jobs:
name: Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
revision: ${{ steps.version.outputs.revision }}
sha7: ${{ steps.version.outputs.sha7 }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: version
Expand All @@ -27,6 +30,9 @@ jobs:
REVISION=$(git rev-list ${{ env.VERSION_START_SHA }}..HEAD --count)
SHA7="${GITHUB_SHA::7}"
TAG="${VERSION}-${REVISION}-${SHA7}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "revision=${REVISION}" >> $GITHUB_OUTPUT
echo "sha7=${SHA7}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
build:
Expand Down Expand Up @@ -58,13 +64,15 @@ jobs:
artifact-suffix: -md
extra-flags: -D CMAKE_CXX_FLAGS=//DMAME_DEBUG
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ilammy/setup-nasm@v1
# - run: |
# curl -sL -H "Authorization: Token ${{ secrets.GH_PAT }}" https://api.github.com/repos/upx/upx/actions/artifacts/${{ env.UPX_ARTIFACT }}/zip -o upx.zip
# 7z x upx.zip -oupx
# rm upx.zip
- run: |
perl -i -pe"s/0/${{ needs.version.outputs.revision }}/g" src/git_version.h
perl -i -pe"s/unknown/${{ needs.version.outputs.sha7 }}/g" src/git_version.h
curl -L https://github.com/upx/upx/releases/download/v4.2.2/upx-4.2.2-win64.zip -o upx.zip
7z e upx.zip -oupx
rm upx.zip
Expand All @@ -81,7 +89,7 @@ jobs:
cp release/license.txt tmp
cp release/pinmame.txt tmp
cp release/whatsnew.txt tmp
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: PinMAME32${{ matrix.artifact-suffix }}-${{ needs.version.outputs.tag }}-${{ matrix.platform }}
path: tmp
2 changes: 1 addition & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
SHA7="${SHA::7}"
echo "sha=${SHA}" >> $GITHUB_OUTPUT
echo "sha7=${SHA7}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ steps.sha.outputs.sha }}
fetch-depth: 0
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/vpinmame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ jobs:
name: Version
runs-on: ubuntu-latest
outputs:
revision: ${{ steps.version.outputs.revision }}
sha7: ${{ steps.version.outputs.sha7 }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: version
Expand All @@ -27,6 +29,8 @@ jobs:
REVISION=$(git rev-list ${{ env.VERSION_START_SHA }}..HEAD --count)
SHA7="${GITHUB_SHA::7}"
TAG="${VERSION}-${REVISION}-${SHA7}"
echo "revision=${REVISION}" >> $GITHUB_OUTPUT
echo "sha7=${SHA7}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
build:
Expand Down Expand Up @@ -62,7 +66,7 @@ jobs:
artifact-suffix: -sc
extra-flags: -D CMAKE_CXX_FLAGS=//DSAM_INCLUDE_COLORED
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ilammy/setup-nasm@v1
# - run: |
# curl -sL -H "Authorization: Token ${{ secrets.GH_PAT }}" https://api.github.com/repos/upx/upx/actions/artifacts/${{ env.UPX_ARTIFACT }}/zip -o upx.zip
Expand All @@ -72,6 +76,9 @@ jobs:
# curl -L https://github.com/upx/upx/releases/download/v4.2.2/upx-4.2.2-win64.zip -o upx.zip
# 7z e upx.zip -oupx
# rm upx.zip
- run: |
perl -i -pe"s/0/${{ needs.version.outputs.revision }}/g" src/git_version.h
perl -i -pe"s/unknown/${{ needs.version.outputs.sha7 }}/g" src/git_version.h
- name: Build VPinMAME${{ matrix.artifact-suffix }}-${{ matrix.platform }}
run: |
cp cmake/vpinmame/CMakeLists_${{ matrix.platform }}.txt CMakeLists.txt
Expand All @@ -93,7 +100,7 @@ jobs:
cp release/VPMAlias.txt tmp
cp release/whatsnew.txt tmp
cp release/whatsnewVPM.txt tmp
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: VPinMAME${{ matrix.artifact-suffix }}-${{ needs.version.outputs.tag }}-${{ matrix.platform }}
path: tmp
9 changes: 5 additions & 4 deletions .github/workflows/xpinmame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ jobs:
version: ${{ steps.version.outputs.version }}
revision: ${{ steps.version.outputs.revision }}
sha: ${{ steps.version.outputs.sha }}
sha7: ${{ steps.version.outputs.sha7 }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: version
Expand All @@ -32,7 +33,7 @@ jobs:
TAG="${VERSION}-${REVISION}-${SHA7}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "revision=${REVISION}" >> $GITHUB_OUTPUT
echo "sha=${SHA}" >> $GITHUB_OUTPUT
echo "sha7=${SHA7}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
build:
Expand All @@ -50,7 +51,7 @@ jobs:
platform: linux-x64
exe: xpinmame
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- if: matrix.os == 'macos-latest'
run: |
brew install xquartz
Expand All @@ -70,7 +71,7 @@ jobs:
cp release/license.txt tmp
cp release/pinmame.txt tmp
cp release/whatsnew.txt tmp
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: xpinmame-${{ needs.version.outputs.tag }}-${{ matrix.platform }}
path: tmp
6 changes: 3 additions & 3 deletions .github/workflows/xpinmame_lisy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
base_image: raspios_lite_arm64:latest
steps:
- name: Checkout pinmame
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout WiringPi
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: WiringPi/WiringPi
ref: master
Expand All @@ -51,7 +51,7 @@ jobs:
make -f makefile.lisy
- name: Upload xmpinmame binary artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: LISY xpinmame ${{ matrix.cpu_info }}
path: xpinmame.vid_lisy
2 changes: 2 additions & 0 deletions VPinMAME_VC2012.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,7 @@ echo regsvr32 exec. time > "$(OutDir)regsvr32.trg"
<ClInclude Include="src\fileio.h" />
<ClInclude Include="src\sound\filter.h" />
<ClInclude Include="src\gfxobj.h" />
<ClInclude Include="src\git_version.h" />
<ClInclude Include="src\harddisk.h" />
<ClInclude Include="src\hash.h" />
<ClInclude Include="src\hiscore.h" />
Expand All @@ -1654,6 +1655,7 @@ echo regsvr32 exec. time &gt; "$(OutDir)regsvr32.trg"
<ClInclude Include="src\unzip.h" />
<ClInclude Include="src\usrintrf.h" />
<ClInclude Include="src\window.h" />
<ClInclude Include="src\version.h" />
<ClInclude Include="src\cpu\adsp2100\adsp2100.h" />
<ClInclude Include="src\cpu\m6809\m6809.h" />
<ClInclude Include="src\cpu\m6800\m6800.h" />
Expand Down
6 changes: 6 additions & 0 deletions VPinMAME_VC2012.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,9 @@
<ClInclude Include="src\gfxobj.h">
<Filter>Source Files\MAME</Filter>
</ClInclude>
<ClInclude Include="src\git_version.h">
<Filter>Source Files\MAME</Filter>
</ClInclude>
<ClInclude Include="src\harddisk.h">
<Filter>Source Files\MAME</Filter>
</ClInclude>
Expand Down Expand Up @@ -1492,6 +1495,9 @@
<ClInclude Include="src\usrintrf.h">
<Filter>Source Files\MAME</Filter>
</ClInclude>
<ClInclude Include="src\version.h">
<Filter>Source Files\MAME</Filter>
</ClInclude>
<ClInclude Include="src\window.h">
<Filter>Source Files\MAME</Filter>
</ClInclude>
Expand Down
7 changes: 7 additions & 0 deletions src/git_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef _GIT_VERSION_H_
#define _GIT_VERSION_H_

#define GIT_REVISION 0
#define GIT_SHA "unknown"

#endif
23 changes: 23 additions & 0 deletions src/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include "git_version.h"

#define PM_VERSION_MAJOR 3 // X Digits
#define PM_VERSION_MINOR 6 // Max 2 Digits
#define PM_VERSION_REV 0 // Max 1 Digit

#define _STR(x) #x
#define STR(x) _STR(x)

#define PM_VERSION_DIGITS PM_VERSION_MAJOR,PM_VERSION_MINOR,PM_VERSION_REV,GIT_REVISION
#define PM_VERSION_STRING_DIGITS STR(PM_VERSION_MAJOR) STR(PM_VERSION_MINOR) STR(PM_VERSION_REV) STR(GIT_REVISION)
#define PM_VERSION_STRING_POINTS STR(PM_VERSION_MAJOR) "." STR(PM_VERSION_MINOR) "." STR(PM_VERSION_REV) "." STR(GIT_REVISION)
#define PM_VERSION_STRING_COMMAS STR(PM_VERSION_MAJOR) ", " STR(PM_VERSION_MINOR) ", " STR(PM_VERSION_REV) ", " STR(GIT_REVISION)
#define PM_VERSION_STRING_POINTS_FULL STR(PM_VERSION_MAJOR) "." STR(PM_VERSION_MINOR) "." STR(PM_VERSION_REV) "." STR(GIT_REVISION) "." GIT_SHA

// Complete version string for log, crash handler,...
#define PM_VERSION_STRING_FULL_LITERAL "v" STR(PM_VERSION_MAJOR) "." STR(PM_VERSION_MINOR) "." STR(PM_VERSION_REV) \
" Beta (Rev. " STR(GIT_REVISION) " (" GIT_SHA "), " GET_PLATFORM_OS " DirectX " GET_PLATFORM_BITS "bits)"

#define PASTE2(a,b) a##b
#define PASTE(a,b) PASTE2(a,b)
4 changes: 3 additions & 1 deletion src/win32com/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,9 @@ STDMETHODIMP CController::get_Version(BSTR *pVal)
GetProductVersion(&nVersionNo0, &nVersionNo1, &nVersionNo2, &nVersionNo3);

TCHAR szVersion[9];
wsprintf(szVersion, _T("%02i%02i%02i%02i"), nVersionNo0, nVersionNo1, nVersionNo2, nVersionNo3);
wsprintf(szVersion, _T("%02i%02i%02i00"), nVersionNo0, nVersionNo1, nVersionNo2);
//Should output the version number as 03060000 without build number
//the build number does not have enough room^^

CComBSTR bstrVersion(szVersion);

Expand Down

0 comments on commit 048ac0b

Please sign in to comment.