[DEV] compile again for Android
This commit is contained in:
parent
512651e746
commit
95b2206da6
2
lutin.py
2
lutin.py
@ -21,7 +21,7 @@ import lutinArg
|
|||||||
myLutinArg = lutinArg.LutinArg()
|
myLutinArg = lutinArg.LutinArg()
|
||||||
myLutinArg.add(lutinArg.ArgDefine("h", "help", desc="display this help"))
|
myLutinArg.add(lutinArg.ArgDefine("h", "help", desc="display this help"))
|
||||||
myLutinArg.add_section("option", "Can be set one time in all case")
|
myLutinArg.add_section("option", "Can be set one time in all case")
|
||||||
myLutinArg.add(lutinArg.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"]], desc="display makefile debug level (verbose) default =2"))
|
myLutinArg.add(lutinArg.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2"))
|
||||||
myLutinArg.add(lutinArg.ArgDefine("C", "color", desc="display makefile output in color"))
|
myLutinArg.add(lutinArg.ArgDefine("C", "color", desc="display makefile output in color"))
|
||||||
myLutinArg.add(lutinArg.ArgDefine("f", "force", desc="Force the rebuild without checking the dependency"))
|
myLutinArg.add(lutinArg.ArgDefine("f", "force", desc="Force the rebuild without checking the dependency"))
|
||||||
myLutinArg.add(lutinArg.ArgDefine("P", "pretty", desc="print the debug has pretty display"))
|
myLutinArg.add(lutinArg.ArgDefine("P", "pretty", desc="print the debug has pretty display"))
|
||||||
|
@ -32,6 +32,10 @@ def set_level(id):
|
|||||||
debugLevel = id
|
debugLevel = id
|
||||||
#print "SetDebug level at " + str(debugLevel)
|
#print "SetDebug level at " + str(debugLevel)
|
||||||
|
|
||||||
|
def get_level():
|
||||||
|
global debugLevel
|
||||||
|
return debugLevel
|
||||||
|
|
||||||
def enable_color():
|
def enable_color():
|
||||||
global debugColor
|
global debugColor
|
||||||
debugColor = True
|
debugColor = True
|
||||||
@ -50,6 +54,15 @@ def enable_color():
|
|||||||
global color_cyan
|
global color_cyan
|
||||||
color_cyan = "\033[36m"
|
color_cyan = "\033[36m"
|
||||||
|
|
||||||
|
def extreme_verbose(input, force=False):
|
||||||
|
global debugLock
|
||||||
|
global debugLevel
|
||||||
|
if debugLevel >= 6 \
|
||||||
|
or force == True:
|
||||||
|
debugLock.acquire()
|
||||||
|
print(color_blue + input + color_default)
|
||||||
|
debugLock.release()
|
||||||
|
|
||||||
def verbose(input, force=False):
|
def verbose(input, force=False):
|
||||||
global debugLock
|
global debugLock
|
||||||
global debugLevel
|
global debugLevel
|
||||||
|
@ -13,21 +13,21 @@ import lutinEnv as environement
|
|||||||
|
|
||||||
|
|
||||||
def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
||||||
debug.verbose("Resuest check of dependency of :")
|
debug.extreme_verbose("Resuest check of dependency of :")
|
||||||
debug.verbose(" dst='" + str(dst) + "'")
|
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
||||||
debug.verbose(" str='" + str(src) + "'")
|
debug.extreme_verbose(" str='" + str(src) + "'")
|
||||||
debug.verbose(" dept='" + str(dependFile) + "'")
|
debug.extreme_verbose(" dept='" + str(dependFile) + "'")
|
||||||
debug.verbose(" cmd='" + str(file_cmd) + "'")
|
debug.extreme_verbose(" cmd='" + str(file_cmd) + "'")
|
||||||
# if force mode selected ==> just force rebuild ...
|
# if force mode selected ==> just force rebuild ...
|
||||||
if environement.get_force_mode():
|
if environement.get_force_mode():
|
||||||
debug.verbose(" ==> must rebuild (force mode)")
|
debug.extreme_verbose(" ==> must rebuild (force mode)")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# check if the destination existed:
|
# check if the destination existed:
|
||||||
if dst != "" \
|
if dst != "" \
|
||||||
and dst != None \
|
and dst != None \
|
||||||
and os.path.exists(dst) == False:
|
and os.path.exists(dst) == False:
|
||||||
debug.verbose(" ==> must rebuild (dst does not exist)")
|
debug.extreme_verbose(" ==> must rebuild (dst does not exist)")
|
||||||
return True
|
return True
|
||||||
if dst != "" \
|
if dst != "" \
|
||||||
and dst != None \
|
and dst != None \
|
||||||
@ -38,27 +38,27 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
|||||||
if dst != "" \
|
if dst != "" \
|
||||||
and dst != None \
|
and dst != None \
|
||||||
and os.path.getmtime(src) > os.path.getmtime(dst):
|
and os.path.getmtime(src) > os.path.getmtime(dst):
|
||||||
debug.verbose(" ==> must rebuild (source time greater)")
|
debug.extreme_verbose(" ==> must rebuild (source time greater)")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if dependFile != "" \
|
if dependFile != "" \
|
||||||
and dependFile != None \
|
and dependFile != None \
|
||||||
and os.path.exists(dependFile) == False:
|
and os.path.exists(dependFile) == False:
|
||||||
debug.verbose(" ==> must rebuild (no depending file)")
|
debug.extreme_verbose(" ==> must rebuild (no depending file)")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if file_cmd != "" \
|
if file_cmd != "" \
|
||||||
and file_cmd != None:
|
and file_cmd != None:
|
||||||
if os.path.exists(file_cmd) == False:
|
if os.path.exists(file_cmd) == False:
|
||||||
debug.verbose(" ==> must rebuild (no commandLine file)")
|
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
||||||
return True
|
return True
|
||||||
# check if the 2 cmdline are similar :
|
# check if the 2 cmdline are similar :
|
||||||
file2 = open(file_cmd, "r")
|
file2 = open(file_cmd, "r")
|
||||||
firstAndUniqueLine = file2.read()
|
firstAndUniqueLine = file2.read()
|
||||||
if firstAndUniqueLine != cmdLine:
|
if firstAndUniqueLine != cmdLine:
|
||||||
debug.verbose(" ==> must rebuild (cmdLines are not identical)")
|
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
|
||||||
debug.verbose(" ==> '" + cmdLine + "'")
|
debug.extreme_verbose(" ==> '" + cmdLine + "'")
|
||||||
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
|
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
|
||||||
file2.close()
|
file2.close()
|
||||||
return True
|
return True
|
||||||
# the cmdfile is correct ...
|
# the cmdfile is correct ...
|
||||||
@ -66,7 +66,7 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
|||||||
|
|
||||||
if dependFile != "" \
|
if dependFile != "" \
|
||||||
and dependFile != None:
|
and dependFile != None:
|
||||||
debug.verbose(" start parsing dependency file : '" + dependFile + "'")
|
debug.extreme_verbose(" start parsing dependency file : '" + dependFile + "'")
|
||||||
file = open(dependFile, "r")
|
file = open(dependFile, "r")
|
||||||
for curLine in file.readlines():
|
for curLine in file.readlines():
|
||||||
# normal file : end with : ": \\n"
|
# normal file : end with : ": \\n"
|
||||||
@ -81,36 +81,36 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
|||||||
|
|
||||||
testFile=""
|
testFile=""
|
||||||
if curLine[len(curLine)-1:] == ':':
|
if curLine[len(curLine)-1:] == ':':
|
||||||
debug.verbose(" Line (no check (already done) : '" + curLine + "'");
|
debug.extreme_verbose(" Line (no check (already done) : '" + curLine + "'");
|
||||||
elif len(curLine) == 0 \
|
elif len(curLine) == 0 \
|
||||||
or curLine == '\\':
|
or curLine == '\\':
|
||||||
debug.verbose(" Line (Not parsed) : '" + curLine + "'");
|
debug.extreme_verbose(" Line (Not parsed) : '" + curLine + "'");
|
||||||
else:
|
else:
|
||||||
testFile = curLine
|
testFile = curLine
|
||||||
debug.verbose(" Line (might check) : '" + testFile + "'");
|
debug.extreme_verbose(" Line (might check) : '" + testFile + "'");
|
||||||
# really check files:
|
# really check files:
|
||||||
if testFile!="":
|
if testFile!="":
|
||||||
debug.verbose(" ==> test");
|
debug.extreme_verbose(" ==> test");
|
||||||
if False==os.path.exists(testFile):
|
if False==os.path.exists(testFile):
|
||||||
debug.verbose(" ==> must rebuild (a dependency file does not exist)")
|
debug.extreme_verbose(" ==> must rebuild (a dependency file does not exist)")
|
||||||
file.close()
|
file.close()
|
||||||
return True
|
return True
|
||||||
if os.path.getmtime(testFile) > os.path.getmtime(dst):
|
if os.path.getmtime(testFile) > os.path.getmtime(dst):
|
||||||
debug.verbose(" ==> must rebuild (a dependency file time is newer)")
|
debug.extreme_verbose(" ==> must rebuild (a dependency file time is newer)")
|
||||||
file.close()
|
file.close()
|
||||||
return True
|
return True
|
||||||
# close the current file :
|
# close the current file :
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
debug.verbose(" ==> Not rebuild (all dependency is OK)")
|
debug.extreme_verbose(" ==> Not rebuild (all dependency is OK)")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
||||||
debug.verbose("Resuest check of dependency of :")
|
debug.extreme_verbose("Resuest check of dependency of :")
|
||||||
debug.verbose(" dst='" + dst + "'")
|
debug.extreme_verbose(" dst='" + dst + "'")
|
||||||
debug.verbose(" src()=")
|
debug.extreme_verbose(" src()=")
|
||||||
for src in srcList:
|
for src in srcList:
|
||||||
debug.verbose(" '" + src + "'")
|
debug.verbose(" '" + src + "'")
|
||||||
|
|
||||||
@ -119,39 +119,39 @@ def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
|||||||
|
|
||||||
# if force mode selected ==> just force rebuild ...
|
# if force mode selected ==> just force rebuild ...
|
||||||
if environement.get_force_mode():
|
if environement.get_force_mode():
|
||||||
debug.verbose(" ==> must re-package (force mode)")
|
debug.extreme_verbose(" ==> must re-package (force mode)")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# check if the destination existed:
|
# check if the destination existed:
|
||||||
if False==os.path.exists(dst):
|
if False==os.path.exists(dst):
|
||||||
debug.verbose(" ==> must re-package (dst does not exist)")
|
debug.extreme_verbose(" ==> must re-package (dst does not exist)")
|
||||||
return True
|
return True
|
||||||
# chek the basic date if the 2 files
|
# chek the basic date if the 2 files
|
||||||
if len(srcList)==0:
|
if len(srcList)==0:
|
||||||
debug.verbose(" ==> must re-package (no source ???)")
|
debug.extreme_verbose(" ==> must re-package (no source ???)")
|
||||||
return True
|
return True
|
||||||
for src in srcList:
|
for src in srcList:
|
||||||
if os.path.getmtime(src) > os.path.getmtime(dst):
|
if os.path.getmtime(src) > os.path.getmtime(dst):
|
||||||
debug.verbose(" ==> must re-package (source time greater) : '" + src + "'")
|
debug.extreme_verbose(" ==> must re-package (source time greater) : '" + src + "'")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if ""!=file_cmd:
|
if ""!=file_cmd:
|
||||||
if False==os.path.exists(file_cmd):
|
if False==os.path.exists(file_cmd):
|
||||||
debug.verbose(" ==> must rebuild (no commandLine file)")
|
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
||||||
return True
|
return True
|
||||||
# check if the 2 cmdline are similar :
|
# check if the 2 cmdline are similar :
|
||||||
file2 = open(file_cmd, "r")
|
file2 = open(file_cmd, "r")
|
||||||
firstAndUniqueLine = file2.read()
|
firstAndUniqueLine = file2.read()
|
||||||
if firstAndUniqueLine != cmdLine:
|
if firstAndUniqueLine != cmdLine:
|
||||||
debug.verbose(" ==> must rebuild (cmdLines are not identical)")
|
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
|
||||||
debug.verbose(" ==> '" + cmdLine + "'")
|
debug.extreme_verbose(" ==> '" + cmdLine + "'")
|
||||||
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
|
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
|
||||||
file2.close()
|
file2.close()
|
||||||
return True
|
return True
|
||||||
# the cmdfile is correct ...
|
# the cmdfile is correct ...
|
||||||
file2.close()
|
file2.close()
|
||||||
|
|
||||||
debug.verbose(" ==> Not re-package (all dependency is OK)")
|
debug.extreme_verbose(" ==> Not re-package (all dependency is OK)")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
22
lutinEnv.py
22
lutinEnv.py
@ -50,7 +50,27 @@ def print_pretty(myString, force=False):
|
|||||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||||
baseElementList = ["-o", "-D", "-I", "-L", "g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib", "-framework", "-isysroot", "-arch"]
|
baseElementList = ["-o",
|
||||||
|
"-D",
|
||||||
|
"-I",
|
||||||
|
"-L",
|
||||||
|
"g++",
|
||||||
|
"gcc",
|
||||||
|
"clang",
|
||||||
|
"clang++",
|
||||||
|
"ar",
|
||||||
|
"ld",
|
||||||
|
"ranlib",
|
||||||
|
"-framework",
|
||||||
|
"-isysroot",
|
||||||
|
"-arch",
|
||||||
|
"-keystore",
|
||||||
|
"-sigalg",
|
||||||
|
"-digestalg",
|
||||||
|
"<",
|
||||||
|
"<<",
|
||||||
|
">",
|
||||||
|
">>"]
|
||||||
for element in baseElementList:
|
for element in baseElementList:
|
||||||
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
||||||
baseElementList = ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]
|
baseElementList = ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]
|
||||||
|
@ -56,14 +56,16 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
|||||||
global currentIdExecution
|
global currentIdExecution
|
||||||
# prepare command line:
|
# prepare command line:
|
||||||
args = shlex.split(cmdLine)
|
args = shlex.split(cmdLine)
|
||||||
#debug.verbose("cmd = " + str(args))
|
debug.verbose("cmd = " + str(args))
|
||||||
try:
|
try:
|
||||||
# create the subprocess
|
# create the subprocess
|
||||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
debug.error("subprocess.CalledProcessError : TODO ...")
|
debug.error("subprocess.CalledProcessError : TODO ...")
|
||||||
|
debug.verbose("done 1")
|
||||||
# launch the subprocess:
|
# launch the subprocess:
|
||||||
output, err = p.communicate()
|
output, err = p.communicate()
|
||||||
|
debug.verbose("done 2")
|
||||||
# Check error :
|
# Check error :
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
debug.debug(lutinEnv.print_pretty(cmdLine))
|
debug.debug(lutinEnv.print_pretty(cmdLine))
|
||||||
@ -104,6 +106,7 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
|||||||
queueLock.release()
|
queueLock.release()
|
||||||
# not write the command file...
|
# not write the command file...
|
||||||
return
|
return
|
||||||
|
debug.verbose("done 3")
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
store_command(cmdLine, storeCmdLine)
|
store_command(cmdLine, storeCmdLine)
|
||||||
|
|
||||||
|
@ -35,6 +35,11 @@ def create_directory_of_file(file):
|
|||||||
except:
|
except:
|
||||||
os.makedirs(folder)
|
os.makedirs(folder)
|
||||||
|
|
||||||
|
def get_list_sub_folder(path):
|
||||||
|
# TODO : os.listdir(path)
|
||||||
|
for dirname, dirnames, filenames in os.walk(path):
|
||||||
|
return dirnames
|
||||||
|
return []
|
||||||
|
|
||||||
def remove_folder_and_sub_folder(path):
|
def remove_folder_and_sub_folder(path):
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
import lutinDebug as debug
|
import lutinDebug as debug
|
||||||
import lutinTarget
|
import lutinTarget
|
||||||
import lutinTools
|
import lutinTools as tools
|
||||||
import lutinHost
|
import lutinHost
|
||||||
import lutinImage
|
import lutinImage
|
||||||
import lutinMultiprocess
|
import lutinMultiprocess
|
||||||
@ -39,7 +39,7 @@ class Target(lutinTarget.Target):
|
|||||||
if folder=="android":
|
if folder=="android":
|
||||||
self.folder_ndk = folder + "/ndk"
|
self.folder_ndk = folder + "/ndk"
|
||||||
if self.folder_ndk == "AUTO":
|
if self.folder_ndk == "AUTO":
|
||||||
self.folder_ndk = lutinTools.get_run_folder() + "/../android/ndk"
|
self.folder_ndk = tools.get_run_folder() + "/../android/ndk"
|
||||||
# auto search SDK
|
# auto search SDK
|
||||||
if self.folder_sdk == "AUTO":
|
if self.folder_sdk == "AUTO":
|
||||||
for folder in os.listdir("."):
|
for folder in os.listdir("."):
|
||||||
@ -47,7 +47,7 @@ class Target(lutinTarget.Target):
|
|||||||
if folder=="android":
|
if folder=="android":
|
||||||
self.folder_sdk = folder + "/sdk"
|
self.folder_sdk = folder + "/sdk"
|
||||||
if self.folder_sdk == "AUTO":
|
if self.folder_sdk == "AUTO":
|
||||||
self.folder_sdk = lutinTools.get_run_folder() + "/../android/sdk"
|
self.folder_sdk = tools.get_run_folder() + "/../android/sdk"
|
||||||
|
|
||||||
if not os.path.isdir(self.folder_ndk):
|
if not os.path.isdir(self.folder_ndk):
|
||||||
debug.error("NDK path not set !!! set env : PROJECT_NDK on the NDK path")
|
debug.error("NDK path not set !!! set env : PROJECT_NDK on the NDK path")
|
||||||
@ -219,7 +219,7 @@ class Target(lutinTarget.Target):
|
|||||||
|
|
||||||
debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
|
debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
|
||||||
# Create folder :
|
# Create folder :
|
||||||
lutinTools.create_directory_of_file(self.file_finalAbstraction)
|
tools.create_directory_of_file(self.file_finalAbstraction)
|
||||||
# Create file :
|
# Create file :
|
||||||
tmpFile = open(self.file_finalAbstraction, 'w')
|
tmpFile = open(self.file_finalAbstraction, 'w')
|
||||||
if pkgProperties["ANDROID_APPL_TYPE"]=="APPL":
|
if pkgProperties["ANDROID_APPL_TYPE"]=="APPL":
|
||||||
@ -331,7 +331,7 @@ class Target(lutinTarget.Target):
|
|||||||
tmpFile.flush()
|
tmpFile.flush()
|
||||||
tmpFile.close()
|
tmpFile.close()
|
||||||
|
|
||||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png");
|
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png");
|
||||||
if "ICON" in pkgProperties.keys() \
|
if "ICON" in pkgProperties.keys() \
|
||||||
and pkgProperties["ICON"] != "":
|
and pkgProperties["ICON"] != "":
|
||||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/res/drawable/icon.png", 256, 256)
|
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/res/drawable/icon.png", 256, 256)
|
||||||
@ -344,7 +344,7 @@ class Target(lutinTarget.Target):
|
|||||||
|
|
||||||
if pkgProperties["ANDROID_MANIFEST"]!="":
|
if pkgProperties["ANDROID_MANIFEST"]!="":
|
||||||
debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"])
|
debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"])
|
||||||
lutinTools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True)
|
tools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True)
|
||||||
else:
|
else:
|
||||||
if "VERSION_CODE" not in pkgProperties:
|
if "VERSION_CODE" not in pkgProperties:
|
||||||
pkgProperties["VERSION_CODE"] = "1"
|
pkgProperties["VERSION_CODE"] = "1"
|
||||||
@ -470,7 +470,7 @@ class Target(lutinTarget.Target):
|
|||||||
if pkgProperties["ANDROID_APPL_TYPE"]!="APPL":
|
if pkgProperties["ANDROID_APPL_TYPE"]!="APPL":
|
||||||
#create the Wallpaper sub files : (main element for the application
|
#create the Wallpaper sub files : (main element for the application
|
||||||
debug.print_element("pkg", pkgNameApplicationName + "_resource.xml", "<==", "package configurations")
|
debug.print_element("pkg", pkgNameApplicationName + "_resource.xml", "<==", "package configurations")
|
||||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml")
|
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml")
|
||||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml", 'w')
|
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml", 'w')
|
||||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||||
tmpFile.write( "<wallpaper xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
|
tmpFile.write( "<wallpaper xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
|
||||||
@ -483,7 +483,7 @@ class Target(lutinTarget.Target):
|
|||||||
tmpFile.close()
|
tmpFile.close()
|
||||||
# create wallpaper setting if needed (class and config file)
|
# create wallpaper setting if needed (class and config file)
|
||||||
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
|
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
|
||||||
lutinTools.create_directory_of_file(self.folder_javaProject + pkgNameApplicationName + "Settings.java")
|
tools.create_directory_of_file(self.folder_javaProject + pkgNameApplicationName + "Settings.java")
|
||||||
debug.print_element("pkg", self.folder_javaProject + pkgNameApplicationName + "Settings.java", "<==", "package configurations")
|
debug.print_element("pkg", self.folder_javaProject + pkgNameApplicationName + "Settings.java", "<==", "package configurations")
|
||||||
tmpFile = open(self.folder_javaProject + pkgNameApplicationName + "Settings.java", 'w');
|
tmpFile = open(self.folder_javaProject + pkgNameApplicationName + "Settings.java", 'w');
|
||||||
tmpFile.write( "package " + compleatePackageName + ";\n")
|
tmpFile.write( "package " + compleatePackageName + ";\n")
|
||||||
@ -515,7 +515,7 @@ class Target(lutinTarget.Target):
|
|||||||
tmpFile.close()
|
tmpFile.close()
|
||||||
|
|
||||||
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", "<==", "package configurations")
|
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", "<==", "package configurations")
|
||||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml")
|
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml")
|
||||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", 'w');
|
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", 'w');
|
||||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||||
tmpFile.write( "<PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
|
tmpFile.write( "<PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
|
||||||
@ -546,7 +546,7 @@ class Target(lutinTarget.Target):
|
|||||||
for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in pkgProperties["ANDROID_WALLPAPER_PROPERTIES"]:
|
for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in pkgProperties["ANDROID_WALLPAPER_PROPERTIES"]:
|
||||||
if WALL_type == "list":
|
if WALL_type == "list":
|
||||||
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", "<==", "package configurations")
|
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", "<==", "package configurations")
|
||||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml")
|
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml")
|
||||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", 'w');
|
tmpFile = open(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", 'w');
|
||||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||||
tmpFile.write( "<resources xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\">\n")
|
tmpFile.write( "<resources xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\">\n")
|
||||||
@ -572,14 +572,20 @@ class Target(lutinTarget.Target):
|
|||||||
for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]:
|
for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]:
|
||||||
if res_source == "":
|
if res_source == "":
|
||||||
continue
|
continue
|
||||||
lutinTools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
|
tools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
|
||||||
|
|
||||||
|
|
||||||
# Doc :
|
# Doc :
|
||||||
# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
|
# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
|
||||||
debug.print_element("pkg", "R.java", "<==", "Resources files")
|
debug.print_element("pkg", "R.java", "<==", "Resources files")
|
||||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
|
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
|
||||||
androidToolPath = self.folder_sdk + "/build-tools/20.0.0/"
|
androidToolPath = self.folder_sdk + "/build-tools/"
|
||||||
|
# find android tool version
|
||||||
|
dirnames = tools.get_list_sub_folder(androidToolPath)
|
||||||
|
if len(dirnames) != 1:
|
||||||
|
debug.error("an error occured when getting the tools for android")
|
||||||
|
androidToolPath += dirnames[0] + "/"
|
||||||
|
|
||||||
adModResouceFolder = ""
|
adModResouceFolder = ""
|
||||||
if "ADMOD_ID" in pkgProperties:
|
if "ADMOD_ID" in pkgProperties:
|
||||||
adModResouceFolder = " -S " + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
|
adModResouceFolder = " -S " + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
|
||||||
@ -594,7 +600,7 @@ class Target(lutinTarget.Target):
|
|||||||
#aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library}
|
#aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library}
|
||||||
# -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]
|
# -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]
|
||||||
|
|
||||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
|
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
|
||||||
debug.print_element("pkg", "*.class", "<==", "*.java")
|
debug.print_element("pkg", "*.class", "<==", "*.java")
|
||||||
# more information with : -Xlint
|
# more information with : -Xlint
|
||||||
# + self.file_finalAbstraction + " "\ # this generate ex: out/Android/debug/staging/tethys/src/com/edouarddupin/tethys/edn.java
|
# + self.file_finalAbstraction + " "\ # this generate ex: out/Android/debug/staging/tethys/src/com/edouarddupin/tethys/edn.java
|
||||||
@ -676,7 +682,7 @@ class Target(lutinTarget.Target):
|
|||||||
debugOption = ""
|
debugOption = ""
|
||||||
cmdLine = "jarsigner " \
|
cmdLine = "jarsigner " \
|
||||||
+ debugOption \
|
+ debugOption \
|
||||||
+ "-keystore " + lutinTools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
|
+ "-keystore " + tools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
|
||||||
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
|
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
|
||||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||||
+ " alias__AndroidDebugKey < tmpPass.boo"
|
+ " alias__AndroidDebugKey < tmpPass.boo"
|
||||||
@ -701,7 +707,7 @@ class Target(lutinTarget.Target):
|
|||||||
lutinMultiprocess.run_command(cmdLine)
|
lutinMultiprocess.run_command(cmdLine)
|
||||||
|
|
||||||
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
|
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
|
||||||
lutinTools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
|
tools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
|
||||||
# verbose mode : -v
|
# verbose mode : -v
|
||||||
cmdLine = androidToolPath + "zipalign 4 " \
|
cmdLine = androidToolPath + "zipalign 4 " \
|
||||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||||
@ -709,9 +715,9 @@ class Target(lutinTarget.Target):
|
|||||||
lutinMultiprocess.run_command(cmdLine)
|
lutinMultiprocess.run_command(cmdLine)
|
||||||
|
|
||||||
# copy file in the final stage :
|
# copy file in the final stage :
|
||||||
lutinTools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
|
tools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
|
||||||
self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
|
self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
|
||||||
force=True)
|
force=True)
|
||||||
|
|
||||||
def install_package(self, pkgName):
|
def install_package(self, pkgName):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user