[DEV] add remove of generating end package when requested by the user (usefull in debug mode)

This commit is contained in:
Edouard DUPIN 2013-05-08 12:17:45 +02:00
parent a51dda4879
commit d699557711
8 changed files with 37 additions and 22 deletions

View File

@ -40,6 +40,8 @@ def usage():
print " (clang/gcc) Compile with clang or Gcc mode (by default gcc will be used)" print " (clang/gcc) Compile with clang or Gcc mode (by default gcc will be used)"
print " -m=... / --mode=..." print " -m=... / --mode=..."
print " (debug/release) Compile in release or debug mode (default release)" print " (debug/release) Compile in release or debug mode (default release)"
print " -p / --package"
print " disable the package generation (usefull when just compile for test on linux ...)"
print " [cible] : generate in order set" print " [cible] : generate in order set"
print " all" print " all"
print " Build all (only for the current selected board) (bynary and packages)" print " Build all (only for the current selected board) (bynary and packages)"
@ -131,6 +133,8 @@ def Start():
compilator="gcc" compilator="gcc"
# build mode # build mode
mode="release" mode="release"
# package generationMode
generatePackage=True
# load the default target : # load the default target :
target = None target = None
actionDone=False actionDone=False
@ -138,14 +142,19 @@ def Start():
for argument in sys.argv[1:]: for argument in sys.argv[1:]:
if True==parseGenericArg(argument, False): if True==parseGenericArg(argument, False):
None # nothing to do ... None # nothing to do ...
elif argument[:13] == "--compilator=" or argument[:3] == "-C=": elif argument == "--package" \
or argument == "-p":
generatePackage=False
elif argument[:13] == "--compilator=" \
or argument[:3] == "-C=":
tmpArg="" tmpArg=""
if argument[:3] == "-C=": if argument[:3] == "-C=":
tmpArg=argument[3:] tmpArg=argument[3:]
else: else:
tmpArg=argument[13:] tmpArg=argument[13:]
# check input ... # check input ...
if tmpArg=="gcc" or tmpArg=="clang": if tmpArg=="gcc" \
or tmpArg=="clang":
if compilator!=tmpArg: if compilator!=tmpArg:
debug.debug("change compilator ==> " + tmpArg) debug.debug("change compilator ==> " + tmpArg)
compilator=tmpArg compilator=tmpArg
@ -153,7 +162,8 @@ def Start():
target = None target = None
else: else:
debug.error("Set --compilator/-C: '" + tmpArg + "' but only availlable : [gcc/clang]") debug.error("Set --compilator/-C: '" + tmpArg + "' but only availlable : [gcc/clang]")
elif argument[:9] == "--target=" or argument[:3] == "-t=": elif argument[:9] == "--target=" \
or argument[:3] == "-t=":
tmpArg="" tmpArg=""
if argument[:3] == "-t=": if argument[:3] == "-t=":
tmpArg=argument[3:] tmpArg=argument[3:]
@ -166,9 +176,11 @@ def Start():
#reset properties by defauult: #reset properties by defauult:
compilator="gcc" compilator="gcc"
mode="release" mode="release"
generatePackage=True
#remove previous target #remove previous target
target = None target = None
elif argument[:7] == "--mode=" or argument[:3] == "-m=": elif argument[:7] == "--mode=" \
or argument[:3] == "-m=":
tmpArg="" tmpArg=""
if argument[:3] == "-m=": if argument[:3] == "-m=":
tmpArg=argument[3:] tmpArg=argument[3:]
@ -185,14 +197,14 @@ def Start():
else: else:
#load the target if needed : #load the target if needed :
if target == None: if target == None:
target = lutinTarget.TargetLoad(targetName, compilator, mode) target = lutinTarget.TargetLoad(targetName, compilator, mode, generatePackage)
target.Build(argument) target.Build(argument)
actionDone=True actionDone=True
# if no action done : we do "all" ... # if no action done : we do "all" ...
if actionDone==False: if actionDone==False:
#load the target if needed : #load the target if needed :
if target == None: if target == None:
target = lutinTarget.TargetLoad(targetName, compilator, mode) target = lutinTarget.TargetLoad(targetName, compilator, mode, generatePackage)
target.Build("all") target.Build("all")
# stop all started threads # stop all started threads
lutinMultiprocess.UnInit() lutinMultiprocess.UnInit()

View File

@ -73,7 +73,7 @@ def warning(input):
print(color_purple + "[WARNING] " + input + color_default) print(color_purple + "[WARNING] " + input + color_default)
debugLock.release() debugLock.release()
def error(input): def error(input, threadID=-1):
global debugLock global debugLock
global debugLevel global debugLevel
if debugLevel >= 1: if debugLevel >= 1:
@ -81,7 +81,8 @@ def error(input):
print(color_red + "[ERROR] " + input + color_default) print(color_red + "[ERROR] " + input + color_default)
debugLock.release() debugLock.release()
lutinMultiprocess.ErrorOccured() lutinMultiprocess.ErrorOccured()
thread.interrupt_main() if threadID != -1:
thread.interrupt_main()
exit(-1) exit(-1)
#os_exit(-1) #os_exit(-1)
#raise "error happend" #raise "error happend"

View File

@ -431,8 +431,9 @@ class module:
resFile = self.Link_to_bin(listSubFileNeededToBuild, packageName, target, subHeritage) resFile = self.Link_to_bin(listSubFileNeededToBuild, packageName, target, subHeritage)
# generate tree for this special binary # generate tree for this special binary
self.BuildTree(target, self.name) self.BuildTree(target, self.name)
# generate the package with his properties ... if target.endGeneratePackage==True:
target.MakePackage(self.name, self.packageProp) # generate the package with his properties ...
target.MakePackage(self.name, self.packageProp)
else: else:
debug.error("Dit not know the element type ... (impossible case) type=" + self.type) debug.error("Dit not know the element type ... (impossible case) type=" + self.type)
@ -492,7 +493,7 @@ class module:
self.AppendAndCheck(listout, elem, order) self.AppendAndCheck(listout, elem, order)
def AddModuleDepend(self, list): def AddModuleDepend(self, list):
self.AppendToInternalList(self.depends, list) self.AppendToInternalList(self.depends, list, True)
def AddExportPath(self, list): def AddExportPath(self, list):
self.AppendToInternalList(self.export_path, list) self.AppendToInternalList(self.export_path, list)

View File

@ -5,10 +5,11 @@ import lutinTools
import lutinModule import lutinModule
class Target: class Target:
def __init__(self, name, typeCompilator, debugMode, arch, cross): def __init__(self, name, typeCompilator, debugMode, generatePackage, arch, cross):
self.arch = arch self.arch = arch
self.cross = cross self.cross = cross
self.name=name self.name=name
self.endGeneratePackage = generatePackage
debug.info("create board target : "+self.name); debug.info("create board target : "+self.name);
if "clang"==typeCompilator: if "clang"==typeCompilator:
self.cc=self.cross + "clang" self.cc=self.cross + "clang"
@ -219,10 +220,10 @@ class Target:
__startTargetName="lutinTarget" __startTargetName="lutinTarget"
def TargetLoad(targetName, compilator, mode): def TargetLoad(targetName, compilator, mode, generatePackage):
theTarget = __import__(__startTargetName + targetName) theTarget = __import__(__startTargetName + targetName)
#try: #try:
tmpTarget = theTarget.Target(compilator, mode) tmpTarget = theTarget.Target(compilator, mode, generatePackage)
return tmpTarget return tmpTarget
#except: #except:
# debug.error("Can not create the Target : '" + targetName + "'") # debug.error("Can not create the Target : '" + targetName + "'")

View File

@ -17,7 +17,7 @@ def RunCommand(cmdLine):
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode): def __init__(self, typeCompilator, debugMode, generatePackage):
self.folder_ndk = os.getenv('PROJECT_NDK', lutinTools.GetRunFolder() + "/../android/ndk/") self.folder_ndk = os.getenv('PROJECT_NDK', lutinTools.GetRunFolder() + "/../android/ndk/")
self.folder_sdk = os.getenv('PROJECT_SDK', lutinTools.GetRunFolder() + "/../android/sdk/") self.folder_sdk = os.getenv('PROJECT_SDK', lutinTools.GetRunFolder() + "/../android/sdk/")
@ -27,7 +27,7 @@ class Target(lutinTarget.Target):
if typeCompilator!="gcc": if typeCompilator!="gcc":
debug.error("Android does not support '" + typeCompilator + "' compilator ... availlable : [gcc]") debug.error("Android does not support '" + typeCompilator + "' compilator ... availlable : [gcc]")
lutinTarget.Target.__init__(self, "Android", "gcc", debugMode, arch, cross) lutinTarget.Target.__init__(self, "Android", "gcc", debugMode, generatePackage, arch, cross)
self.folder_bin="/mustNotCreateBinary" self.folder_bin="/mustNotCreateBinary"

View File

@ -6,8 +6,8 @@ import os
import stat import stat
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode): def __init__(self, typeCompilator, debugMode, generatePackage):
lutinTarget.Target.__init__(self, "Linux", typeCompilator, debugMode, "", "") lutinTarget.Target.__init__(self, "Linux", typeCompilator, debugMode, generatePackage, "", "")
def generateListSeparateComa(self, list): def generateListSeparateComa(self, list):
result = "" result = ""

View File

@ -6,12 +6,12 @@ import os
import stat import stat
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode): def __init__(self, typeCompilator, debugMode, generatePackage):
cross = "" cross = ""
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/ # http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt # http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
lutinTarget.Target.__init__(self, "MacOs", typeCompilator, debugMode, "", cross) lutinTarget.Target.__init__(self, "MacOs", typeCompilator, debugMode, generatePackage, "", cross)
self.folder_bin="/MacOS" self.folder_bin="/MacOS"
self.folder_lib="/lib" self.folder_lib="/lib"

View File

@ -8,7 +8,7 @@ import lutinHost
import sys import sys
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode): def __init__(self, typeCompilator, debugMode, generatePackage):
# on windows board the basic path is not correct # on windows board the basic path is not correct
# TODO : get external PATH for the minGW path # TODO : get external PATH for the minGW path
# TODO : Set the cyngwin path ... # TODO : Set the cyngwin path ...
@ -22,7 +22,7 @@ class Target(lutinTarget.Target):
if typeCompilator!="gcc": if typeCompilator!="gcc":
debug.error("Android does not support '" + typeCompilator + "' compilator ... availlable : [gcc]") debug.error("Android does not support '" + typeCompilator + "' compilator ... availlable : [gcc]")
lutinTarget.Target.__init__(self, "Windows", typeCompilator, debugMode, "", cross) lutinTarget.Target.__init__(self, "Windows", typeCompilator, debugMode, generatePackage, "", cross)
self.folder_bin="" self.folder_bin=""
self.folder_lib="/lib" self.folder_lib="/lib"