Removed BUILD_VERSION from python translation
Add. new version.h, which included now the build version. Adapted build.sh - to extract the build version from versioh.h and sends it to translation script.
This commit is contained in:
@@ -8,12 +8,6 @@ from datetime import datetime
|
|||||||
import sys
|
import sys
|
||||||
import fontTables
|
import fontTables
|
||||||
|
|
||||||
# To cause no confusion with the original firmware version of TS100,
|
|
||||||
# which actually has the latest firmware version 2.18
|
|
||||||
# Lets go ahead start with version 2.20.0001 BETA
|
|
||||||
# Version String: xx.yy.zzzz TAG --> x:Major y:Minor z:Build TAG: REL | BETA | ALPHA
|
|
||||||
BUILD_VERSION = 'V2.20.0001 BETA'
|
|
||||||
|
|
||||||
TRANSLATION_CPP = "Translation.cpp"
|
TRANSLATION_CPP = "Translation.cpp"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -101,7 +95,7 @@ def getConstants():
|
|||||||
consants.append(('SymbolVolts', 'V'))
|
consants.append(('SymbolVolts', 'V'))
|
||||||
consants.append(('SymbolDC', 'DC'))
|
consants.append(('SymbolDC', 'DC'))
|
||||||
consants.append(('SymbolCellCount', 'S'))
|
consants.append(('SymbolCellCount', 'S'))
|
||||||
consants.append(('SymbolVersionNumber', BUILD_VERSION))
|
consants.append(('SymbolVersionNumber', buildVersion))
|
||||||
return consants
|
return consants
|
||||||
|
|
||||||
|
|
||||||
@@ -460,24 +454,26 @@ def writeLanguage(languageCode, defs, f):
|
|||||||
|
|
||||||
def read_opts():
|
def read_opts():
|
||||||
""" Reading input parameters
|
""" Reading input parameters
|
||||||
First parameter = json directory
|
First parameter = build version
|
||||||
Second parameter = target directory
|
Second parameter = json directory
|
||||||
|
Third parameter = target directory
|
||||||
"""
|
"""
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
jsonDir = sys.argv[1]
|
buildVersion = sys.argv[1]
|
||||||
|
else:
|
||||||
|
raise Exception("Could not get build version")
|
||||||
|
if len(sys.argv) > 2:
|
||||||
|
jsonDir = sys.argv[2]
|
||||||
else:
|
else:
|
||||||
jsonDir = "."
|
jsonDir = "."
|
||||||
|
if len(sys.argv) > 3:
|
||||||
if len(sys.argv) > 2:
|
outFile = sys.argv[3]
|
||||||
outFile = sys.argv[2]
|
|
||||||
else:
|
else:
|
||||||
outDir = os.path.relpath(jsonDir + "/../workspace/TS100/Core/Src")
|
outDir = os.path.relpath(jsonDir + "/../workspace/TS100/Core/Src")
|
||||||
outFile = os.path.join(outDir, TRANSLATION_CPP)
|
outFile = os.path.join(outDir, TRANSLATION_CPP)
|
||||||
|
if len(sys.argv) > 4:
|
||||||
if len(sys.argv) > 3:
|
|
||||||
raise Exception("Too many parameters!")
|
raise Exception("Too many parameters!")
|
||||||
|
return jsonDir, outFile, buildVersion
|
||||||
return jsonDir, outFile
|
|
||||||
|
|
||||||
|
|
||||||
def orderOutput(langDict):
|
def orderOutput(langDict):
|
||||||
@@ -506,11 +502,12 @@ def writeTarget(outFile, defs, langCodes):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
jsonDir, outFile = read_opts()
|
jsonDir, outFile, buildVersion = read_opts()
|
||||||
except:
|
except:
|
||||||
print("usage: make_translation.py {json dir} {cpp dir}")
|
print("usage: make_translation.py {build version} {json dir} {cpp dir}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
print("Build version string: " + buildVersion)
|
||||||
print("Making " + outFile + " from " + jsonDir)
|
print("Making " + outFile + " from " + jsonDir)
|
||||||
|
|
||||||
langDict = readTranslations(jsonDir)
|
langDict = readTranslations(jsonDir)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ AVAILABLE_LANGUAGES=()
|
|||||||
BUILD_LANGUAGES=()
|
BUILD_LANGUAGES=()
|
||||||
AVAILABLE_MODELS=("TS100" "TS80")
|
AVAILABLE_MODELS=("TS100" "TS80")
|
||||||
BUILD_MODELS=()
|
BUILD_MODELS=()
|
||||||
|
BUILD_VERSION=()
|
||||||
|
|
||||||
usage ()
|
usage ()
|
||||||
{
|
{
|
||||||
@@ -22,6 +23,14 @@ INFO : By default, without parameters, the build is for all platforms and all la
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildVersion ()
|
||||||
|
{
|
||||||
|
GIT_HASH="$(git describe --always)"
|
||||||
|
VERSION="$(grep '#define BUILD_VERSION' 'version.h' | awk '{print $3}' | sed 's/"//g')"
|
||||||
|
BUILD_VERSION=$VERSION'.'$GIT_HASH
|
||||||
|
echo "Building version: $BUILD_VERSION"
|
||||||
|
}
|
||||||
|
|
||||||
checkLastCommand ()
|
checkLastCommand ()
|
||||||
{
|
{
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
@@ -78,6 +87,11 @@ echo " Builder for the"
|
|||||||
echo " Alternate Open Source Firmware"
|
echo " Alternate Open Source Firmware"
|
||||||
echo " for Miniware TS100 or TS80"
|
echo " for Miniware TS100 or TS80"
|
||||||
echo " by Ralim"
|
echo " by Ralim"
|
||||||
|
echo " "
|
||||||
|
echo "*********************************************"
|
||||||
|
|
||||||
|
#Get and show build version
|
||||||
|
buildVersion
|
||||||
echo "*********************************************"
|
echo "*********************************************"
|
||||||
|
|
||||||
# Calculate available languages
|
# Calculate available languages
|
||||||
@@ -129,7 +143,7 @@ echo "*********************************************"
|
|||||||
if [ ${#BUILD_LANGUAGES[@]} -gt 0 ] && [ ${#BUILD_MODELS[@]} -gt 0 ]
|
if [ ${#BUILD_LANGUAGES[@]} -gt 0 ] && [ ${#BUILD_MODELS[@]} -gt 0 ]
|
||||||
then
|
then
|
||||||
echo "Generating Translation.cpp"
|
echo "Generating Translation.cpp"
|
||||||
python3 "$TRANSLATION_DIR/$TRANSLATION_SCRIPT" "$TRANSLATION_DIR"
|
python3 "$TRANSLATION_DIR/$TRANSLATION_SCRIPT" "$BUILD_VERSION" "$TRANSLATION_DIR"
|
||||||
checkLastCommand
|
checkLastCommand
|
||||||
|
|
||||||
echo "Cleaning previous builds"
|
echo "Cleaning previous builds"
|
||||||
|
|||||||
7
workspace/TS100/version.h
Normal file
7
workspace/TS100/version.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* Firmware build version - format: xx.yy.zzzzzz
|
||||||
|
* x: Major - y: Minor - z: git short hash generated automaticaly from git
|
||||||
|
* i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4'
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BUILD_VERSION "v2.08"
|
||||||
Reference in New Issue
Block a user