Get hash also from git repository.
Because we use both hg and git (as mirror) we can get hash of current commit from git too. --HG-- branch : release
This commit is contained in:
parent
948eef41e6
commit
3f1b042d6c
34
common.pri
34
common.pri
|
@ -171,6 +171,40 @@ defineReplace(enable_ccache){
|
||||||
return(true)
|
return(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineReplace(FindBuildRevision){
|
||||||
|
CONFIG(debug, debug|release){
|
||||||
|
# Debug mode
|
||||||
|
return(\\\"unknown\\\")
|
||||||
|
}else{
|
||||||
|
# Release mode
|
||||||
|
|
||||||
|
macx{
|
||||||
|
HG = /usr/local/bin/hg # Can't defeat PATH variable on Mac OS.
|
||||||
|
}else {
|
||||||
|
HG = hg # All other platforms are OK.
|
||||||
|
}
|
||||||
|
|
||||||
|
#build revision number for using in version
|
||||||
|
unix {
|
||||||
|
DVCS_HESH=$$system("$${HG} log -r. --template '{node|short}'")
|
||||||
|
} else {
|
||||||
|
# Use escape character before "|" on Windows
|
||||||
|
DVCS_HESH=$$system($${HG} log -r. --template "{node^|short}")
|
||||||
|
}
|
||||||
|
isEmpty(DVCS_HESH){
|
||||||
|
DVCS_HESH=$$system("git rev-parse --short HEAD")
|
||||||
|
isEmpty(DVCS_HESH){
|
||||||
|
DVCS_HESH = "unknown" # if we can't find build revision left unknown.
|
||||||
|
} else {
|
||||||
|
DVCS_HESH=\\\"Git:$${DVCS_HESH}\\\"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DVCS_HESH=\\\"Hg:$${DVCS_HESH}\\\"
|
||||||
|
}
|
||||||
|
return($${DVCS_HESH})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Default prefix. Use for creation install path.
|
# Default prefix. Use for creation install path.
|
||||||
DEFAULT_PREFIX = /usr
|
DEFAULT_PREFIX = /usr
|
||||||
|
|
||||||
|
|
|
@ -282,10 +282,7 @@ $$enable_ccache()
|
||||||
|
|
||||||
include(warnings.pri)
|
include(warnings.pri)
|
||||||
|
|
||||||
CONFIG(debug, debug|release){
|
CONFIG(release, debug|release){
|
||||||
# Debug mode
|
|
||||||
DEFINES += "BUILD_REVISION=\\\"unknown\\\""
|
|
||||||
}else{
|
|
||||||
# Release mode
|
# Release mode
|
||||||
!win32-msvc*:CONFIG += silent
|
!win32-msvc*:CONFIG += silent
|
||||||
DEFINES += V_NO_ASSERT
|
DEFINES += V_NO_ASSERT
|
||||||
|
@ -307,26 +304,11 @@ CONFIG(debug, debug|release){
|
||||||
QMAKE_LFLAGS_RELEASE =
|
QMAKE_LFLAGS_RELEASE =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
macx{
|
|
||||||
HG = /usr/local/bin/hg # Can't defeat PATH variable on Mac OS.
|
|
||||||
}else {
|
|
||||||
HG = hg # All other platforms all OK.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#build revision number for using in version
|
DVCS_HESH=$$FindBuildRevision()
|
||||||
unix {
|
message("Build revision:" $${DVCS_HESH})
|
||||||
HG_HESH=$$system("$${HG} log -r. --template '{node|short}'")
|
DEFINES += "BUILD_REVISION=$${DVCS_HESH}" # Make available build revision number in sources.
|
||||||
} else {
|
|
||||||
# Use escape character before "|" on Windows
|
|
||||||
HG_HESH=$$system($${HG} log -r. --template "{node^|short}")
|
|
||||||
}
|
|
||||||
isEmpty(HG_HESH){
|
|
||||||
HG_HESH = "unknown" # if we can't find build revision left unknown.
|
|
||||||
}
|
|
||||||
message("Build revision:" $${HG_HESH})
|
|
||||||
DEFINES += "BUILD_REVISION=\\\"$${HG_HESH}\\\"" # Make available build revision number in sources.
|
|
||||||
}
|
|
||||||
|
|
||||||
# Path to recource file.
|
# Path to recource file.
|
||||||
win32:RC_FILE = share/resources/tape.rc
|
win32:RC_FILE = share/resources/tape.rc
|
||||||
|
|
|
@ -65,13 +65,7 @@ $$enable_ccache()
|
||||||
|
|
||||||
include(warnings.pri)
|
include(warnings.pri)
|
||||||
|
|
||||||
CONFIG(debug, debug|release){
|
CONFIG(release, debug|release){
|
||||||
# Debug mode
|
|
||||||
#Calculate latest tag distance and build revision only in release mode. Change number each time requare
|
|
||||||
#recompilation precompiled headers file.
|
|
||||||
DEFINES += "LATEST_TAG_DISTANCE=0"
|
|
||||||
DEFINES += "BUILD_REVISION=\\\"unknown\\\""
|
|
||||||
}else{
|
|
||||||
# Release mode
|
# Release mode
|
||||||
!win32-msvc*:CONFIG += silent
|
!win32-msvc*:CONFIG += silent
|
||||||
DEFINES += V_NO_ASSERT
|
DEFINES += V_NO_ASSERT
|
||||||
|
@ -93,33 +87,11 @@ CONFIG(debug, debug|release){
|
||||||
QMAKE_LFLAGS_RELEASE =
|
QMAKE_LFLAGS_RELEASE =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
macx{
|
DVCS_HESH=$$FindBuildRevision()
|
||||||
HG = /usr/local/bin/hg # Can't defeat PATH variable on Mac OS.
|
message("Build revision:" $${DVCS_HESH})
|
||||||
}else {
|
DEFINES += "BUILD_REVISION=$${DVCS_HESH}" # Make available build revision number in sources.
|
||||||
HG = hg # All other platforms all OK.
|
|
||||||
}
|
|
||||||
#latest tag distance number for using in version
|
|
||||||
HG_DISTANCE=$$system($${HG} log -r. --template '{latesttagdistance}')
|
|
||||||
isEmpty(HG_DISTANCE){
|
|
||||||
HG_DISTANCE = 0 # if we can't find local revision left 0.
|
|
||||||
}
|
|
||||||
message("Latest tag distance:" $${HG_DISTANCE})
|
|
||||||
DEFINES += "LATEST_TAG_DISTANCE=$${HG_DISTANCE}" # Make available latest tag distance number in sources.
|
|
||||||
|
|
||||||
#build revision number for using in version
|
|
||||||
unix {
|
|
||||||
HG_HESH=$$system("$${HG} log -r. --template '{node|short}'")
|
|
||||||
} else {
|
|
||||||
# Use escape character before "|" on Windows
|
|
||||||
HG_HESH=$$system($${HG} log -r. --template "{node^|short}")
|
|
||||||
}
|
|
||||||
isEmpty(HG_HESH){
|
|
||||||
HG_HESH = "unknown" # if we can't find build revision left unknown.
|
|
||||||
}
|
|
||||||
message("Build revision:" $${HG_HESH})
|
|
||||||
DEFINES += "BUILD_REVISION=\\\"$${HG_HESH}\\\"" # Make available build revision number in sources.
|
|
||||||
}
|
|
||||||
|
|
||||||
# Some extra information about Qt. Can be usefull.
|
# Some extra information about Qt. Can be usefull.
|
||||||
message(Qt version: $$[QT_VERSION])
|
message(Qt version: $$[QT_VERSION])
|
||||||
|
|
|
@ -55,7 +55,6 @@ CONFIG(debug, debug|release){
|
||||||
#Calculate latest tag distance and build revision only in release mode. Change number each time requare
|
#Calculate latest tag distance and build revision only in release mode. Change number each time requare
|
||||||
#recompilation precompiled headers file.
|
#recompilation precompiled headers file.
|
||||||
DEFINES += "LATEST_TAG_DISTANCE=0"
|
DEFINES += "LATEST_TAG_DISTANCE=0"
|
||||||
DEFINES += "BUILD_REVISION=\\\"unknown\\\""
|
|
||||||
}else{
|
}else{
|
||||||
# Release mode
|
# Release mode
|
||||||
!win32-msvc*:CONFIG += silent
|
!win32-msvc*:CONFIG += silent
|
||||||
|
@ -88,19 +87,6 @@ CONFIG(debug, debug|release){
|
||||||
}
|
}
|
||||||
message("Latest tag distance:" $${HG_DISTANCE})
|
message("Latest tag distance:" $${HG_DISTANCE})
|
||||||
DEFINES += "LATEST_TAG_DISTANCE=$${HG_DISTANCE}" # Make available latest tag distance number in sources.
|
DEFINES += "LATEST_TAG_DISTANCE=$${HG_DISTANCE}" # Make available latest tag distance number in sources.
|
||||||
|
|
||||||
#build revision number for using in version
|
|
||||||
unix {
|
|
||||||
HG_HESH=$$system("$${HG} log -r. --template '{node|short}'")
|
|
||||||
} else {
|
|
||||||
# Use escape character before "|" on Windows
|
|
||||||
HG_HESH=$$system($${HG} log -r. --template "{node^|short}")
|
|
||||||
}
|
|
||||||
isEmpty(HG_HESH){
|
|
||||||
HG_HESH = "unknown" # if we can't find build revision left unknown.
|
|
||||||
}
|
|
||||||
message("Build revision:" $${HG_HESH})
|
|
||||||
DEFINES += "BUILD_REVISION=\\\"$${HG_HESH}\\\"" # Make available build revision number in sources.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
include (../libs.pri)
|
include (../libs.pri)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user