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
|
#ifndef VERSION_H
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
// Please generate git_version.h with version.sh
|
// Please generate this file with version.sh
|
||||||
|
|
||||||
#include "git_version.h"
|
static const char *versionNumber = "Unknown";
|
||||||
|
|
||||||
#endif // VERSION_H
|
#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 += \
|
HEADERS += \
|
||||||
include/config.h \
|
include/config.h \
|
||||||
include/version.h \
|
include/version.h \
|
||||||
|
include/version.h.template \
|
||||||
src/HashNode.h \
|
src/HashNode.h \
|
||||||
src/MemoryPool.h \
|
src/MemoryPool.h \
|
||||||
src/MemoryPool.tcc \
|
src/MemoryPool.tcc \
|
||||||
|
@ -66,7 +67,8 @@ DISTFILES += \
|
||||||
../Readme.md \
|
../Readme.md \
|
||||||
../Sample.txt \
|
../Sample.txt \
|
||||||
../History.txt \
|
../History.txt \
|
||||||
../Licence.txt
|
../Licence.txt \
|
||||||
|
version.sh
|
||||||
|
|
||||||
RC_FILE += NineChess.rc
|
RC_FILE += NineChess.rc
|
||||||
|
|
||||||
|
|
|
@ -536,7 +536,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\Readme.md" />
|
<None Include="..\Readme.md" />
|
||||||
<None Include="git_version.h.template" />
|
<None Include="include\version.h.template" />
|
||||||
<None Include="ninechess.pro" />
|
<None Include="ninechess.pro" />
|
||||||
<None Include="Resources\icon\ActualSizeHS.png" />
|
<None Include="Resources\icon\ActualSizeHS.png" />
|
||||||
<None Include="Resources\icon\Black.png" />
|
<None Include="Resources\icon\Black.png" />
|
||||||
|
|
|
@ -272,7 +272,7 @@
|
||||||
<None Include="src\MemoryPool.tcc">
|
<None Include="src\MemoryPool.tcc">
|
||||||
<Filter>Model</Filter>
|
<Filter>Model</Filter>
|
||||||
</None>
|
</None>
|
||||||
<None Include="git_version.h.template">
|
<None Include="include\version.h.template">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION_H=include/git_version.h
|
VERSION_H=include/version.h
|
||||||
TEMPLATE_FILE=git_version.h.template
|
TEMPLATE_FILE=include/version.h.template
|
||||||
GIT_BRANCH=master
|
GIT_BRANCH=master
|
||||||
|
|
||||||
rm -f $VERSION_H
|
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
|
cat $TEMPLATE_FILE | sed "s/\$FULL_VERSION/$GIT_VERSION/g" > $VERSION_H
|
||||||
|
|
||||||
|
git update-index --assume-unchanged $VERSION_H
|
||||||
|
|
||||||
echo "Generated $VERSION_H"
|
echo "Generated $VERSION_H"
|
||||||
echo
|
echo
|
||||||
cat $VERSION_H
|
cat $VERSION_H
|
||||||
|
|
Loading…
Reference in New Issue