version: 让即便不执行 version.sh 也可以编译通过
如何让已经纳入版本控制的 version.h 忽略脚本对其的修改? 参考: https://segmentfault.com/q/1010000000430426
This commit is contained in:
parent
43971fef2b
commit
cb19750a96
|
@ -1 +0,0 @@
|
|||
static const char *versionNumber = "$FULL_VERSION";
|
|
@ -1 +0,0 @@
|
|||
git_version.h
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
// Please generate git_version.h with version.sh
|
||||
|
||||
#include "git_version.h"
|
||||
|
||||
#endif // VERSION_H
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
// Please generate this file with version.sh
|
||||
|
||||
static const char *versionNumber = "Unknown";
|
||||
|
||||
#endif /* VERSION_H */
|
|
@ -0,0 +1,12 @@
|
|||
/****************************************************************************
|
||||
* Created by: version.sh
|
||||
*
|
||||
* WARNING! All changes made in this file will be lost!
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
static const char *versionNumber = "$FULL_VERSION";
|
||||
|
||||
#endif /* VERSION_H */
|
|
@ -35,6 +35,7 @@ SOURCES += \
|
|||
HEADERS += \
|
||||
include/config.h \
|
||||
include/version.h \
|
||||
include/version.h.template \
|
||||
src/HashNode.h \
|
||||
src/MemoryPool.h \
|
||||
src/MemoryPool.tcc \
|
||||
|
@ -66,7 +67,8 @@ DISTFILES += \
|
|||
../Readme.md \
|
||||
../Sample.txt \
|
||||
../History.txt \
|
||||
../Licence.txt
|
||||
../Licence.txt \
|
||||
version.sh
|
||||
|
||||
RC_FILE += NineChess.rc
|
||||
|
||||
|
|
|
@ -536,7 +536,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Readme.md" />
|
||||
<None Include="git_version.h.template" />
|
||||
<None Include="include\version.h.template" />
|
||||
<None Include="ninechess.pro" />
|
||||
<None Include="Resources\icon\ActualSizeHS.png" />
|
||||
<None Include="Resources\icon\Black.png" />
|
||||
|
|
|
@ -272,7 +272,7 @@
|
|||
<None Include="src\MemoryPool.tcc">
|
||||
<Filter>Model</Filter>
|
||||
</None>
|
||||
<None Include="git_version.h.template">
|
||||
<None Include="include\version.h.template">
|
||||
<Filter>Header Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
VERSION_H=include/git_version.h
|
||||
TEMPLATE_FILE=git_version.h.template
|
||||
VERSION_H=include/version.h
|
||||
TEMPLATE_FILE=include/version.h.template
|
||||
GIT_BRANCH=master
|
||||
|
||||
rm -f $VERSION_H
|
||||
|
@ -29,6 +29,8 @@ rm -f config.git-hash
|
|||
|
||||
cat $TEMPLATE_FILE | sed "s/\$FULL_VERSION/$GIT_VERSION/g" > $VERSION_H
|
||||
|
||||
git update-index --assume-unchanged $VERSION_H
|
||||
|
||||
echo "Generated $VERSION_H"
|
||||
echo
|
||||
cat $VERSION_H
|
||||
|
|
Loading…
Reference in New Issue