[DEV] review methodologie of build

This commit is contained in:
Edouard DUPIN 2015-09-09 21:53:22 +02:00
parent 10c0f98cef
commit 22965f5a57
20 changed files with 440 additions and 400 deletions

View File

@ -21,7 +21,7 @@ is_init = False
if is_init == False: if is_init == False:
debug.verbose("Use Make as a make stadard") debug.verbose("Use Make as a make stadard")
sys.path.append(tools.get_run_folder()) sys.path.append(tools.get_run_path())
builder.import_path(tools.get_current_path(__file__)) builder.import_path(tools.get_current_path(__file__))
module.import_path(tools.get_current_path(__file__)) module.import_path(tools.get_current_path(__file__))
system.import_path(tools.get_current_path(__file__)) system.import_path(tools.get_current_path(__file__))
@ -29,16 +29,16 @@ if is_init == False:
debug.debug("missing file lutinBase.py ==> loading subPath..."); debug.debug("missing file lutinBase.py ==> loading subPath...");
# Import all sub path without out and archive # Import all sub path without out and archive
for folder in os.listdir("."): for path in os.listdir("."):
if os.path.isdir(folder)==True: if os.path.isdir(path)==True:
if folder.lower()!="android" \ if path.lower()!="android" \
and folder.lower()!="archive" \ and path.lower()!="archive" \
and folder.lower()!="out" : and path.lower()!="out" :
debug.debug("Automatic load path: '" + folder + "'") debug.debug("Automatic load path: '" + path + "'")
builder.import_path(folder) builder.import_path(path)
module.import_path(folder) module.import_path(path)
system.import_path(folder) system.import_path(path)
target.import_path(folder) target.import_path(path)
builder.init() builder.init()

View File

@ -75,7 +75,7 @@ def resize(srcFile, destFile, x, y, cmd_file=None):
else: else:
debug.error(" can not manage extention ... : " + destFile) debug.error(" can not manage extention ... : " + destFile)
else: else:
# open an image file (.bmp,.jpg,.png,.gif) you have in the working folder # open an image file (.bmp,.jpg,.png,.gif) you have in the working path
im1 = Image.open(srcFile) im1 = Image.open(srcFile)
if im1.size[0] <= x: if im1.size[0] <= x:
# for small image just copy: # for small image just copy:

View File

@ -34,7 +34,7 @@ class Module:
## Remove all variable to prevent error of multiple deffinition of the module ... ## Remove all variable to prevent error of multiple deffinition of the module ...
debug.verbose("Create a new module : '" + moduleName + "' TYPE=" + moduleType) debug.verbose("Create a new module : '" + moduleName + "' TYPE=" + moduleType)
self.origin_file='' self.origin_file=''
self.origin_folder='' self.origin_path=''
# type of the module: # type of the module:
self.type='LIBRARY' self.type='LIBRARY'
# Name of the module # Name of the module
@ -56,10 +56,10 @@ class Module:
self.extention_order_build = ["java", "javah"] # all is not set here is done in the provided order ... self.extention_order_build = ["java", "javah"] # all is not set here is done in the provided order ...
# sources list: # sources list:
self.src = [] self.src = []
# copy files and folders: # copy files and paths:
self.image_to_copy = [] self.image_to_copy = []
self.files = [] self.files = []
self.folders = [] self.paths = []
self.isbuild = False self.isbuild = False
## end of basic INIT ... ## end of basic INIT ...
@ -73,7 +73,7 @@ class Module:
debug.error(' ==> error : "%s" ' %moduleType) debug.error(' ==> error : "%s" ' %moduleType)
raise 'Input value error' raise 'Input value error'
self.origin_file = file; self.origin_file = file;
self.origin_folder = tools.get_current_path(self.origin_file) self.origin_path = tools.get_current_path(self.origin_file)
self.local_heritage = heritage.heritage(self) self.local_heritage = heritage.heritage(self)
self.package_prop = { "COMPAGNY_TYPE" : set(""), self.package_prop = { "COMPAGNY_TYPE" : set(""),
@ -134,14 +134,14 @@ class Module:
and sizeX > 0: and sizeX > 0:
debug.error("Can not manage image other than .png and jpg to resize : " + source); debug.error("Can not manage image other than .png and jpg to resize : " + source);
displaySource = source displaySource = source
source = self.origin_folder + "/" + source source = self.origin_path + "/" + source
if destination == "": if destination == "":
destination = source[source.rfind('/')+1:] destination = source[source.rfind('/')+1:]
debug.verbose("Regenerate Destination : '" + destination + "'") debug.verbose("Regenerate Destination : '" + destination + "'")
file_cmd = target.generate_file(binary_name, self.name, self.origin_folder, destination, "image")[0] file_cmd = target.generate_file(binary_name, self.name, self.origin_path, destination, "image")[0]
if sizeX > 0: if sizeX > 0:
debug.verbose("Image file : " + displaySource + " ==> " + destination + " resize=(" + str(sizeX) + "," + str(sizeY) + ")") debug.verbose("Image file : " + displaySource + " ==> " + destination + " resize=(" + str(sizeX) + "," + str(sizeY) + ")")
fileName, fileExtension = os.path.splitext(self.origin_folder+"/" + source) fileName, fileExtension = os.path.splitext(self.origin_path+"/" + source)
target.add_image_staging(source, destination, sizeX, sizeY, file_cmd) target.add_image_staging(source, destination, sizeX, sizeY, file_cmd)
else: else:
debug.verbose("Might copy file : " + displaySource + " ==> " + destination) debug.verbose("Might copy file : " + displaySource + " ==> " + destination)
@ -153,11 +153,11 @@ class Module:
def files_to_staging(self, binary_name, target): def files_to_staging(self, binary_name, target):
for source, destination in self.files: for source, destination in self.files:
displaySource = source displaySource = source
source = self.origin_folder + "/" + source source = self.origin_path + "/" + source
if destination == "": if destination == "":
destination = source[source.rfind('/')+1:] destination = source[source.rfind('/')+1:]
debug.verbose("Regenerate Destination : '" + destination + "'") debug.verbose("Regenerate Destination : '" + destination + "'")
file_cmd = target.generate_file(binary_name, self.name, self.origin_folder, destination, "image")[0] file_cmd = target.generate_file(binary_name, self.name, self.origin_path, destination, "image")[0]
# TODO : when destination is missing ... # TODO : when destination is missing ...
debug.verbose("Might copy file : " + displaySource + " ==> " + destination) debug.verbose("Might copy file : " + displaySource + " ==> " + destination)
target.add_file_staging(source, destination, file_cmd) target.add_file_staging(source, destination, file_cmd)
@ -165,10 +165,10 @@ class Module:
## ##
## @brief Commands for copying files ## @brief Commands for copying files
## ##
def folders_to_staging(self, binary_name, target): def paths_to_staging(self, binary_name, target):
for source, destination in self.folders: for source, destination in self.paths:
debug.debug("Might copy folder : " + source + "==>" + destination) debug.debug("Might copy path : " + source + "==>" + destination)
tools.copy_anything_target(target, self.origin_folder + "/" + source, destination) tools.copy_anything_target(target, self.origin_path + "/" + source, destination)
def gcov(self, target, generate_output=False): def gcov(self, target, generate_output=False):
if self.type == 'PREBUILD': if self.type == 'PREBUILD':
@ -179,7 +179,7 @@ class Module:
global_list_file = "" global_list_file = ""
for file in list_file: for file in list_file:
debug.verbose(" gcov : " + self.name + " <== " + file); debug.verbose(" gcov : " + self.name + " <== " + file);
file_dst = target.get_full_name_destination(self.name, self.origin_folder, file, "o") file_dst = target.get_full_name_destination(self.name, self.origin_path, file, "o")
global_list_file += file_dst + " " global_list_file += file_dst + " "
cmd = "gcov" cmd = "gcov"
# specify the version of gcov we need to use # specify the version of gcov we need to use
@ -209,11 +209,11 @@ class Module:
remove_next = True remove_next = True
continue continue
if elem[:6] == "File '" \ if elem[:6] == "File '" \
and self.origin_folder != elem[6:len(self.origin_folder)+6]: and self.origin_path != elem[6:len(self.origin_path)+6]:
remove_next = True remove_next = True
continue continue
if elem[:6] == "File '": if elem[:6] == "File '":
last_file = elem[6+len(self.origin_folder)+1:-1] last_file = elem[6+len(self.origin_path)+1:-1]
continue continue
start_with = "Lines executed:" start_with = "Lines executed:"
if elem[:len(start_with)] != start_with: if elem[:len(start_with)] != start_with:
@ -245,7 +245,7 @@ class Module:
debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0])); debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
pourcent = 100.0*float(executed_lines)/float(executable_lines) pourcent = 100.0*float(executed_lines)/float(executable_lines)
# generate json file: # generate json file:
json_file_name = target.get_build_folder(self.name) + "/" + self.name + "_coverage.json" json_file_name = target.get_build_path(self.name) + "/" + self.name + "_coverage.json"
debug.debug("generate json file : " + json_file_name) debug.debug("generate json file : " + json_file_name)
tmp_file = open(json_file_name, 'w') tmp_file = open(json_file_name, 'w')
tmp_file.write('{\n') tmp_file.write('{\n')
@ -336,7 +336,7 @@ class Module:
flags = self.flags, flags = self.flags,
path = self.path, path = self.path,
name = self.name, name = self.name,
basic_folder = self.origin_folder) basic_path = self.origin_path)
if res_file["action"] == "add": if res_file["action"] == "add":
list_sub_file_needed_to_build.append(res_file["file"]) list_sub_file_needed_to_build.append(res_file["file"])
elif res_file["action"] == "path": elif res_file["action"] == "path":
@ -344,7 +344,7 @@ class Module:
else: else:
debug.error("an not do action for : " + str(res_file)) debug.error("an not do action for : " + str(res_file))
except ValueError: except ValueError:
debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'") debug.warning(" UN-SUPPORTED file format: '" + self.origin_path + "/" + file + "'")
# now build the other : # now build the other :
list_file = tools.filter_extention(self.src, self.extention_order_build, invert=True) list_file = tools.filter_extention(self.src, self.extention_order_build, invert=True)
for file in list_file: for file in list_file:
@ -359,7 +359,7 @@ class Module:
flags = self.flags, flags = self.flags,
path = self.path, path = self.path,
name = self.name, name = self.name,
basic_folder = self.origin_folder) basic_path = self.origin_path)
if res_file["action"] == "add": if res_file["action"] == "add":
list_sub_file_needed_to_build.append(res_file["file"]) list_sub_file_needed_to_build.append(res_file["file"])
elif res_file["action"] == "path": elif res_file["action"] == "path":
@ -367,7 +367,7 @@ class Module:
else: else:
debug.error("an not do action for : " + str(res_file)) debug.error("an not do action for : " + str(res_file))
except ValueError: except ValueError:
debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'") debug.warning(" UN-SUPPORTED file format: '" + self.origin_path + "/" + file + "'")
# when multiprocess availlable, we need to synchronize here ... # when multiprocess availlable, we need to synchronize here ...
multiprocess.pool_synchrosize() multiprocess.pool_synchrosize()
@ -385,8 +385,18 @@ class Module:
target, target,
self.sub_heritage_list, self.sub_heritage_list,
name = self.name, name = self.name,
basic_folder = self.origin_folder) basic_path = self.origin_path)
self.local_heritage.add_sources(res_file) self.local_heritage.add_sources(res_file)
tmp_builder = builder.get_builder_with_output("so");
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
if len(list_file) > 0:
res_file = tmp_builder.link(list_file,
package_name,
target,
self.sub_heritage_list,
name = self.name,
basic_path = self.origin_path)
# TODO : self.local_heritage.add_sources(res_file)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.a'") debug.error(" UN-SUPPORTED link format: '.a'")
try: try:
@ -398,7 +408,7 @@ class Module:
target, target,
self.sub_heritage_list, self.sub_heritage_list,
name = self.name, name = self.name,
basic_folder = self.origin_folder) basic_path = self.origin_path)
self.local_heritage.add_sources(res_file) self.local_heritage.add_sources(res_file)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.jar'") debug.error(" UN-SUPPORTED link format: '.jar'")
@ -410,7 +420,7 @@ class Module:
target, target,
self.sub_heritage_list, self.sub_heritage_list,
name = self.name, name = self.name,
basic_folder = self.origin_folder) basic_path = self.origin_path)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.bin'") debug.error(" UN-SUPPORTED link format: '.bin'")
# generate tree for this special binary # generate tree for this special binary
@ -428,7 +438,7 @@ class Module:
target, target,
self.sub_heritage_list, self.sub_heritage_list,
name = "lib" + self.name, name = "lib" + self.name,
basic_folder = self.origin_folder) basic_path = self.origin_path)
self.local_heritage.add_sources(res_file) self.local_heritage.add_sources(res_file)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.so'") debug.error(" UN-SUPPORTED link format: '.so'")
@ -441,7 +451,7 @@ class Module:
target, target,
self.sub_heritage_list, self.sub_heritage_list,
name = self.name, name = self.name,
basic_folder = self.origin_folder) basic_path = self.origin_path)
self.local_heritage.add_sources(res_file) self.local_heritage.add_sources(res_file)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.jar'") debug.error(" UN-SUPPORTED link format: '.jar'")
@ -453,7 +463,7 @@ class Module:
target, target,
self.sub_heritage_list, self.sub_heritage_list,
name = self.name, name = self.name,
basic_folder = self.origin_folder) basic_path = self.origin_path)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: 'binary'") debug.error(" UN-SUPPORTED link format: 'binary'")
target.clean_module_tree() target.clean_module_tree()
@ -464,9 +474,9 @@ class Module:
# generate the package with his properties ... # generate the package with his properties ...
if target.name=="Android": if target.name=="Android":
self.sub_heritage_list.add_heritage(self.local_heritage) self.sub_heritage_list.add_heritage(self.local_heritage)
target.make_package(self.name, self.package_prop, self.origin_folder + "/..", self.sub_heritage_list) target.make_package(self.name, self.package_prop, self.origin_path + "/..", self.sub_heritage_list)
else: else:
target.make_package(self.name, self.package_prop, self.origin_folder + "/..") target.make_package(self.name, self.package_prop, self.origin_path + "/..")
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)
@ -483,7 +493,7 @@ class Module:
# add all the elements (first added only one keep ==> permit to everload sublib element) # add all the elements (first added only one keep ==> permit to everload sublib element)
self.image_to_staging(package_name, target) self.image_to_staging(package_name, target)
self.files_to_staging(package_name, target) self.files_to_staging(package_name, target)
self.folders_to_staging(package_name, target) self.paths_to_staging(package_name, target)
#build tree of all submodules #build tree of all submodules
for dep in self.depends: for dep in self.depends:
inherit = target.build_tree(dep, package_name) inherit = target.build_tree(dep, package_name)
@ -495,19 +505,19 @@ class Module:
# nothing to add ==> just dependence # nothing to add ==> just dependence
None None
elif self.type=='LIBRARY': elif self.type=='LIBRARY':
# remove folder of the lib ... for this targer # remove path of the lib ... for this targer
folderbuild = target.get_build_folder(self.name) pathbuild = target.get_build_path(self.name)
debug.info("remove folder : '" + folderbuild + "'") debug.info("remove path : '" + pathbuild + "'")
tools.remove_folder_and_sub_folder(folderbuild) tools.remove_path_and_sub_path(pathbuild)
elif self.type=='BINARY' \ elif self.type=='BINARY' \
or self.type=='PACKAGE': or self.type=='PACKAGE':
# remove folder of the lib ... for this targer # remove path of the lib ... for this targer
folderbuild = target.get_build_folder(self.name) pathbuild = target.get_build_path(self.name)
debug.info("remove folder : '" + folderbuild + "'") debug.info("remove path : '" + pathbuild + "'")
tools.remove_folder_and_sub_folder(folderbuild) tools.remove_path_and_sub_path(pathbuild)
folderStaging = target.get_staging_folder(self.name) pathStaging = target.get_staging_path(self.name)
debug.info("remove folder : '" + folderStaging + "'") debug.info("remove path : '" + pathStaging + "'")
tools.remove_folder_and_sub_folder(folderStaging) tools.remove_path_and_sub_path(pathStaging)
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)
@ -592,8 +602,8 @@ class Module:
def copy_file(self, source, destination=''): def copy_file(self, source, destination=''):
self.files.append([source, destination]) self.files.append([source, destination])
def copy_folder(self, source, destination=''): def copy_path(self, source, destination=''):
self.folders.append([source, destination]) self.paths.append([source, destination])
def print_list(self, description, list): def print_list(self, description, list):
if len(list) > 0: if len(list) > 0:
@ -607,7 +617,7 @@ class Module:
print('-----------------------------------------------') print('-----------------------------------------------')
print(' type:"' + str(self.type) + "'") print(' type:"' + str(self.type) + "'")
print(' file:"' + str(self.origin_file) + "'") print(' file:"' + str(self.origin_file) + "'")
print(' folder:"' + str(self.origin_folder) + "'") print(' path:"' + str(self.origin_path) + "'")
self.print_list('depends',self.depends) self.print_list('depends',self.depends)
self.print_list('depends_optionnal', self.depends_optionnal) self.print_list('depends_optionnal', self.depends_optionnal)
@ -622,7 +632,7 @@ class Module:
self.print_list('src',self.src) self.print_list('src',self.src)
self.print_list('files',self.files) self.print_list('files',self.files)
self.print_list('folders',self.folders) self.print_list('paths',self.paths)
for element in self.path["local"]: for element in self.path["local"]:
value = self.path["local"][element] value = self.path["local"][element]
self.print_list('local path ' + element, value) self.print_list('local path ' + element, value)
@ -717,10 +727,10 @@ class Module:
return return
added_module.append(self.name) added_module.append(self.name)
debug.verbose("add a module to the project generator :" + self.name) debug.verbose("add a module to the project generator :" + self.name)
debug.verbose("local path :" + self.origin_folder) debug.verbose("local path :" + self.origin_path)
projectMng.add_files(self.name, self.origin_folder, self.src) projectMng.add_files(self.name, self.origin_path, self.src)
#projectMng.add_data_file(self.origin_folder, self.files) #projectMng.add_data_file(self.origin_path, self.files)
#projectMng.add_data_folder(self.origin_folder, self.folders) #projectMng.add_data_path(self.origin_path, self.paths)
""" """
for depend in self.depends: for depend in self.depends:
target.project_add_module(depend, projectMng, added_module) target.project_add_module(depend, projectMng, added_module)

View File

@ -83,8 +83,8 @@ class Target:
self.suffix_binary='' self.suffix_binary=''
self.suffix_package='.deb' self.suffix_package='.deb'
self.folder_generate_code="/generate_header" self.path_generate_code="/generate_header"
self.folder_arch="/" + self.name self.path_arch="/" + self.name
if "debug" == self.config["mode"]: if "debug" == self.config["mode"]:
self.global_flags_cc.append("-g") self.global_flags_cc.append("-g")
@ -101,17 +101,18 @@ class Target:
self.global_flags_ld.append("-fprofile-arcs") self.global_flags_ld.append("-fprofile-arcs")
self.global_flags_ld.append("-ftest-coverage") self.global_flags_ld.append("-ftest-coverage")
self.update_folder_tree() self.update_path_tree()
""" """
self.folder_bin="/usr/bin" self.path_bin="usr/bin"
self.folder_lib="/usr/lib" self.path_lib="usr/lib"
self.folder_data="/usr/share" self.path_data="usr/share"
self.folder_doc="/usr/share/doc" self.path_doc="usr/share/doc"
""" """
self.folder_bin="/bin" self.path_bin="bin"
self.folder_lib="/lib" self.path_lib="lib"
self.folder_data="/share" self.path_data="share"
self.folder_doc="/doc" self.path_doc="doc"
self.path_doc="include"
self.build_done=[] self.build_done=[]
@ -124,11 +125,11 @@ class Target:
self.action_on_state={} self.action_on_state={}
def update_folder_tree(self): def update_path_tree(self):
self.folder_out="/out/" + self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"] + "/" + self.config["mode"] self.path_out = os.path.join("out", self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"], self.config["mode"])
self.folder_final="/final/" + self.config["compilator"] self.path_final = os.path.join("final", self.config["compilator"])
self.folder_staging="/staging/" + self.config["compilator"] self.path_staging = os.path.join("staging", self.config["compilator"])
self.folder_build="/build/" + self.config["compilator"] self.path_build = os.path.join("build", self.config["compilator"])
def create_number_from_version_string(self, data): def create_number_from_version_string(self, data):
list = data.split(".") list = data.split(".")
@ -179,7 +180,7 @@ class Target:
self.nm = self.cross + "nm" self.nm = self.cross + "nm"
self.strip = self.cross + "strip" self.strip = self.cross + "strip"
self.dlltool = self.cross + "dlltool" self.dlltool = self.cross + "dlltool"
self.update_folder_tree() self.update_path_tree()
def get_build_mode(self): def get_build_mode(self):
return self.config["mode"] return self.config["mode"]
@ -200,46 +201,40 @@ class Target:
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'"); debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'");
self.list_final_file.append([inputFile, outputFile, -1, -1, cmdFile]) self.list_final_file.append([inputFile, outputFile, -1, -1, cmdFile])
def copy_to_staging(self, binaryName): def copy_to_staging(self, binary_name):
baseFolder = self.get_staging_folder_data(binaryName) base_path = self.get_staging_path_data(binary_name)
for source, dst, x, y, cmdFile in self.list_final_file: for source, dst, x, y, cmdFile in self.list_final_file:
if cmdFile != None \ if cmdFile != None \
and cmdFile != "": and cmdFile != "":
debug.verbose("cmd file " + cmdFile) debug.verbose("cmd file " + cmdFile)
if x == -1: if x == -1:
debug.verbose("must copy file : '" + source + "' ==> '" + dst + "'"); debug.verbose("must copy file : '" + source + "' ==> '" + dst + "'");
tools.copy_file(source, baseFolder+"/"+dst, cmdFile) tools.copy_file(source, os.path.join(base_path, dst), cmdFile)
else: else:
debug.verbose("resize image : '" + source + "' ==> '" + dst + "' size=(" + str(x) + "," + str(y) + ")"); debug.verbose("resize image : '" + source + "' ==> '" + dst + "' size=(" + str(x) + "," + str(y) + ")");
image.resize(source, baseFolder+"/"+dst, x, y, cmdFile) image.resize(source, os.path.join(base_path, dst), x, y, cmdFile)
def clean_module_tree(self): def clean_module_tree(self):
self.build_tree_done = [] self.build_tree_done = []
self.list_final_file = [] self.list_final_file = []
# TODO : Remove this hack ... ==> really bad ... but usefull
def set_ewol_folder(self, folder):
self.folder_ewol = folder
def get_full_name_source(self, basePath, file): def get_full_name_source(self, basePath, file):
if file[0] == '/': if file[0] == '/':
if tools.os.path.isfile(file): if tools.os.path.isfile(file):
return file return file
return basePath + "/" + file return basePath + "/" + file
def get_full_name_cmd(self, moduleName, basePath, file): def get_full_name_cmd(self, module_name, basePath, file):
if file[0] == '/': if file[0] == '/':
if tools.os.path.isfile(file): if tools.os.path.isfile(file):
return file + self.suffix_cmd_line return file + self.suffix_cmd_line
return self.get_build_folder(moduleName) + "/" + file + self.suffix_cmd_line return self.get_build_path(module_name) + "/" + file + self.suffix_cmd_line
def get_full_name_warning(self, moduleName, basePath, file): def get_full_name_warning(self, module_name, basePath, file):
return self.get_build_folder(moduleName) + "/" + file + self.suffix_warning; return self.get_build_path(module_name) + "/" + file + self.suffix_warning;
def get_full_name_destination(self, moduleName, basePath, file, suffix, remove_suffix=False): def get_full_name_destination(self, module_name, basePath, file, suffix, remove_suffix=False):
# special patch for java file: # special patch for java file:
if file[-4:] == "java": if file[-4:] == "java":
for elem in ["org/", "com/"]: for elem in ["org/", "com/"]:
@ -254,10 +249,10 @@ class Target:
suffix = suffix[0] suffix = suffix[0]
else: else:
suffix = "" suffix = ""
return self.get_build_folder(moduleName) + "/" + file + suffix return self.get_build_path(module_name) + "/" + file + suffix
def get_full_dependency(self, moduleName, basePath, file): def get_full_dependency(self, module_name, basePath, file):
return self.get_build_folder(moduleName) + "/" + file + self.suffix_dependence return self.get_build_path(module_name) + "/" + file + self.suffix_dependence
""" """
return a list of 3 elements : return a list of 3 elements :
@ -265,52 +260,87 @@ class Target:
1 : destination file 1 : destination file
2 : dependence files module (*.d) 2 : dependence files module (*.d)
""" """
def generate_file(self,binaryName,moduleName,basePath,file,type): def generate_file(self,
binary_name,
module_name,
basePath,
file,
type):
list=[] list=[]
if (type=="bin"): if (type=="bin"):
list.append(file) list.append(file)
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary) list.append(os.path.join(self.get_build_path(binary_name), self.path_bin, module_name + self.suffix_binary))
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence) list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_dependence))
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_cmd_line) list.append(os.path.join(self.get_build_path(binary_name), self.path_bin, module_name + self.suffix_binary + self.suffix_cmd_line))
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_warning) list.append(os.path.join(self.get_build_path(binary_name), self.path_bin, module_name + self.suffix_binary + self.suffix_warning))
elif (type=="lib-shared"): elif (type=="lib-shared"):
list.append(file) list.append(file)
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic) list.append(os.path.join(self.get_build_path(binary_name), self.path_lib, module_name + self.suffix_lib_dynamic))
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence) list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_dependence))
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_cmd_line) list.append(os.path.join(self.get_build_path(binary_name), self.path_lib, module_name + self.suffix_lib_dynamic + self.suffix_cmd_line))
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_warning) list.append(os.path.join(self.get_build_path(binary_name), self.path_lib, module_name + self.suffix_lib_dynamic + self.suffix_warning))
elif (type=="lib-static"): elif (type=="lib-static"):
list.append(file) list.append(file)
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static) list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_lib_static))
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence) list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_dependence))
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_cmd_line) list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_lib_static + self.suffix_cmd_line))
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_warning) list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_lib_static + self.suffix_warning))
elif (type=="jar"): elif (type=="jar"):
list.append(file) list.append(file)
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar") list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar"))
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_dependence) list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar" + self.suffix_dependence))
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_cmd_line) list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar" + self.suffix_cmd_line))
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_warning) list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar" + self.suffix_warning))
elif (type=="image"): elif (type=="image"):
list.append(self.get_build_folder(binaryName) + "/data/" + file + self.suffix_cmd_line) list.append(os.path.join(self.get_build_path(binary_name), "data", file + self.suffix_cmd_line))
else: else:
debug.error("unknow type : " + type) debug.error("unknow type : " + type)
return list return list
def get_final_folder(self): ##
return tools.get_run_folder() + self.folder_out + self.folder_final ## @brief Get the fianal path ==> contain all the generated packages
## @return The path of the pa
##
def get_final_path(self):
return os.path.join(tools.get_run_path(), self.path_out, self.path_final)
def get_staging_folder(self, binaryName): def get_staging_path(self, binary_name):
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName return os.path.join(tools.get_run_path(), self.path_out, self.path_staging, binary_name)
def get_staging_folder_data(self, binaryName): def get_build_path(self, module_name):
return self.get_staging_folder(binaryName) + self.folder_data + "/" + binaryName debug.warning("A=" + str(tools.get_run_path()) + " " + str(self.path_out) + " " + str(self.path_build) + " " + str(module_name))
return os.path.join(tools.get_run_path(), self.path_out, self.path_build, module_name)
def get_build_folder(self, moduleName):
return tools.get_run_folder() + self.folder_out + self.folder_build + "/" + moduleName
def get_doc_folder(self, moduleName): def get_build_path_bin(self, binary_name):
return tools.get_run_folder() + self.folder_out + self.folder_doc + "/" + moduleName return os.path.join(self.get_staging_path(binary_name), self.path_bin, binary_name)
def get_build_path_lib(self, binary_name):
return os.path.join(self.get_staging_path(binary_name), self.path_lib, binary_name)
def get_build_path_data(self, binary_name):
return os.path.join(self.get_staging_path(binary_name), self.path_data, binary_name)
def get_build_path_include(self, binary_name):
return os.path.join(self.get_staging_path(binary_name), self.path_include, binary_name)
def get_staging_path_bin(self, binary_name):
return os.path.join(self.get_staging_path(binary_name), self.path_bin, binary_name)
def get_staging_path_lib(self, binary_name):
return os.path.join(self.get_staging_path(binary_name), self.path_lib, binary_name)
def get_staging_path_data(self, binary_name):
return os.path.join(self.get_staging_path(binary_name), self.path_data, binary_name)
def get_staging_path_include(self, binary_name):
return os.path.join(self.get_staging_path(binary_name), self.path_include, binary_name)
def get_doc_path(self, module_name):
return os.path.join(tools.get_run_path(), self.path_out, self.path_doc, module_name)
def is_module_build(self, my_module): def is_module_build(self, my_module):
for mod in self.build_done: for mod in self.build_done:
@ -418,7 +448,7 @@ class Target:
else: else:
# get the action an the module .... # get the action an the module ....
gettedElement = name.split("?") gettedElement = name.split("?")
moduleName = gettedElement[0] module_name = gettedElement[0]
if len(gettedElement)>=3: if len(gettedElement)>=3:
sub_action_name = gettedElement[2] sub_action_name = gettedElement[2]
else: else:
@ -427,41 +457,41 @@ class Target:
actionName = gettedElement[1] actionName = gettedElement[1]
else : else :
actionName = "build" actionName = "build"
debug.verbose("requested : " + moduleName + "?" + actionName) debug.verbose("requested : " + module_name + "?" + actionName)
if actionName == "install": if actionName == "install":
self.build(moduleName + "?build") self.build(module_name + "?build")
self.install_package(moduleName) self.install_package(module_name)
elif actionName == "uninstall": elif actionName == "uninstall":
self.un_install_package(moduleName) self.un_install_package(module_name)
elif actionName == "log": elif actionName == "log":
self.Log(moduleName) self.Log(module_name)
else: else:
present = self.load_if_needed(moduleName, optionnal=optionnal) present = self.load_if_needed(module_name, optionnal=optionnal)
if present == False \ if present == False \
and optionnal == True: and optionnal == True:
return [heritage.HeritageList(), False] return [heritage.HeritageList(), False]
# clean requested # clean requested
for mod in self.module_list: for mod in self.module_list:
if mod.name == moduleName: if mod.name == module_name:
if actionName == "dump": if actionName == "dump":
debug.info("dump module '" + moduleName + "'") debug.info("dump module '" + module_name + "'")
return mod.display(self) return mod.display(self)
elif actionName == "clean": elif actionName == "clean":
debug.info("clean module '" + moduleName + "'") debug.info("clean module '" + module_name + "'")
return mod.clean(self) return mod.clean(self)
elif actionName == "gcov": elif actionName == "gcov":
debug.debug("gcov on module '" + moduleName + "'") debug.debug("gcov on module '" + module_name + "'")
if sub_action_name == "output": if sub_action_name == "output":
return mod.gcov(self, generate_output=True) return mod.gcov(self, generate_output=True)
return mod.gcov(self, generate_output=False) return mod.gcov(self, generate_output=False)
elif actionName == "build": elif actionName == "build":
debug.debug("build module '" + moduleName + "'") debug.debug("build module '" + module_name + "'")
if optionnal == True: if optionnal == True:
return [mod.build(self, None), True] return [mod.build(self, None), True]
return mod.build(self, None) return mod.build(self, None)
if optionnal == True: if optionnal == True:
return [heritage.HeritageList(), False] return [heritage.HeritageList(), False]
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it") debug.error("not know module name : '" + module_name + "' to '" + actionName + "' it")
def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None): def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None):
debug.verbose("add action : " + name) debug.verbose("add action : " + name)

View File

@ -20,7 +20,7 @@ from . import env
""" """
""" """
def get_run_folder(): def get_run_path():
return os.getcwd() return os.getcwd()
""" """
@ -30,21 +30,21 @@ def get_current_path(file):
return os.path.dirname(os.path.realpath(file)) return os.path.dirname(os.path.realpath(file))
def create_directory_of_file(file): def create_directory_of_file(file):
folder = os.path.dirname(file) path = os.path.dirname(file)
try: try:
os.stat(folder) os.stat(path)
except: except:
os.makedirs(folder) os.makedirs(path)
def get_list_sub_folder(path): def get_list_sub_path(path):
# TODO : os.listdir(path) # TODO : os.listdir(path)
for dirname, dirnames, filenames in os.walk(path): for dirname, dirnames, filenames in os.walk(path):
return dirnames return dirnames
return [] return []
def remove_folder_and_sub_folder(path): def remove_path_and_sub_path(path):
if os.path.isdir(path): if os.path.isdir(path):
debug.verbose("remove folder : '" + path + "'") debug.verbose("remove path : '" + path + "'")
shutil.rmtree(path) shutil.rmtree(path)
def remove_file(path): def remove_file(path):

View File

@ -40,8 +40,8 @@ def get_output_type():
## ##
## @brief Commands for running gcc to link an executable. ## @brief Commands for running gcc to link an executable.
## ##
def link(file, binary, target, depancy, name, basic_folder): def link(file, binary, target, depancy, name, basic_path):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "bin") file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "bin")
#create comdLine : #create comdLine :
cmd = [ cmd = [
target.xx target.xx

View File

@ -40,12 +40,12 @@ def get_output_type():
## ##
## @brief Commands for running gcc to compile a C file in object file. ## @brief Commands for running gcc to compile a C file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_path):
file_src = target.get_full_name_source(basic_folder, file) file_src = target.get_full_name_source(basic_path, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file) file_cmd = target.get_full_name_cmd(name, basic_path, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type()) file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_folder, file) file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_folder, file) file_warning = target.get_full_name_warning(name, basic_path, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [

View File

@ -39,12 +39,12 @@ def get_output_type():
## ##
## @brief Commands for running gcc to compile a C++ file in object file. ## @brief Commands for running gcc to compile a C++ file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_path):
file_src = target.get_full_name_source(basic_folder, file) file_src = target.get_full_name_source(basic_path, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file) file_cmd = target.get_full_name_cmd(name, basic_path, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type()) file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_folder, file) file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_folder, file) file_warning = target.get_full_name_warning(name, basic_path, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [
target.xx, target.xx,

View File

@ -38,8 +38,8 @@ def get_output_type():
## ##
## @brief Commands for running gcc to link a shared library. ## @brief Commands for running gcc to link a shared library.
## ##
def link(file, binary, target, depancy, name, basic_folder): def link(file, binary, target, depancy, name, basic_path):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "jar") file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "jar")
#create command Line #create command Line
cmd = [ cmd = [
target.jar, target.jar,

View File

@ -36,16 +36,16 @@ def get_output_type():
## ##
## @brief Commands for running gcc to compile a C++ file in object file. ## @brief Commands for running gcc to compile a C++ file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_path):
file_src = target.get_full_name_source(basic_folder, file) file_src = target.get_full_name_source(basic_path, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file) file_cmd = target.get_full_name_cmd(name, basic_path, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type(), remove_suffix=True) file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type(), remove_suffix=True)
file_depend = target.get_full_dependency(name, basic_folder, file) file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_folder, file) file_warning = target.get_full_name_warning(name, basic_path, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [
target.java, target.java,
"-d", target.get_build_folder(name) "-d", target.get_build_path(name)
] ]
# add source dependency: # add source dependency:
list_sources_path = [] list_sources_path = []

View File

@ -36,29 +36,29 @@ def get_output_type():
## ##
## @brief Commands for running gcc to compile a C++ file in object file. ## @brief Commands for running gcc to compile a C++ file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_path):
# file_src = target.get_full_name_source(basic_folder, file) # file_src = target.get_full_name_source(basic_path, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file) file_cmd = target.get_full_name_cmd(name, basic_path, file)
# file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type()) # file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_folder, file) file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_folder, file) file_warning = target.get_full_name_warning(name, basic_path, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [
target.javah, target.javah,
"-d", target.get_build_folder(name) + target.folder_generate_code "-d", target.get_build_path(name) + target.path_generate_code
] ]
if debug.get_level() >= 5: if debug.get_level() >= 5:
cmd.append("-verbose") cmd.append("-verbose")
cmd.append("-classpath") cmd.append("-classpath")
cmd.append(target.get_build_folder(name)) cmd.append(target.get_build_path(name))
class_to_build = file[:-6] class_to_build = file[:-6]
cmd.append(class_to_build) cmd.append(class_to_build)
# Create cmd line # Create cmd line
cmdLine=tools.list_to_str(cmd) cmdLine=tools.list_to_str(cmd)
file_dst = target.get_build_folder(name) + "/tmp_header/" + class_to_build.replace(".", "_") + ".h" file_dst = target.get_build_path(name) + "/tmp_header/" + class_to_build.replace(".", "_") + ".h"
# check the dependency for this file : # check the dependency for this file :
#if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False: #if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
# return file_dst # return file_dst
@ -68,5 +68,5 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning) multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
debug.verbose("file= " + file_dst) debug.verbose("file= " + file_dst)
#return file_dst #return file_dst
return {"action":"path", "path":target.get_build_folder(name) + target.folder_generate_code} return {"action":"path", "path":target.get_build_path(name) + target.path_generate_code}

View File

@ -38,8 +38,8 @@ def get_output_type():
## ##
## @brief Commands for running gcc to link a shared library. ## @brief Commands for running gcc to link a shared library.
## ##
def link(file, binary, target, depancy, name, basic_folder): def link(file, binary, target, depancy, name, basic_path):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "lib-shared") file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-shared")
#create command Line #create command Line
cmd = [ cmd = [
target.xx, target.xx,

View File

@ -38,8 +38,8 @@ def get_output_type():
## ##
## @brief Commands for running ar. ## @brief Commands for running ar.
## ##
def link(file, binary, target, depancy, name, basic_folder): def link(file, binary, target, depancy, name, basic_path):
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "lib-static") file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-static")
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS) #$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
cmd = [ cmd = [
target.ar target.ar

View File

@ -41,12 +41,12 @@ def get_output_type():
## ##
## @brief Commands for running gcc to compile a m file in object file. ## @brief Commands for running gcc to compile a m file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_path):
file_src = target.get_full_name_source(basic_folder, file) file_src = target.get_full_name_source(basic_path, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file) file_cmd = target.get_full_name_cmd(name, basic_path, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type()) file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_folder, file) file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_folder, file) file_warning = target.get_full_name_warning(name, basic_path, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [
target.cc, target.cc,

View File

@ -41,12 +41,12 @@ def get_output_type():
## ##
## @brief Commands for running gcc to compile a m++ file in object file. ## @brief Commands for running gcc to compile a m++ file in object file.
## ##
def compile(file, binary, target, depancy, flags, path, name, basic_folder): def compile(file, binary, target, depancy, flags, path, name, basic_path):
file_src = target.get_full_name_source(basic_folder, file) file_src = target.get_full_name_source(basic_path, file)
file_cmd = target.get_full_name_cmd(name, basic_folder, file) file_cmd = target.get_full_name_cmd(name, basic_path, file)
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type()) file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_folder, file) file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_folder, file) file_warning = target.get_full_name_warning(name, basic_path, file)
# create the command line befor requesting start: # create the command line befor requesting start:
cmd = [ cmd = [
target.xx, target.xx,

View File

@ -33,28 +33,28 @@ class Target(target.Target):
else: else:
arch="arm64" arch="arm64"
self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO") self.path_ndk = os.getenv('PROJECT_NDK', "AUTO")
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO") self.path_sdk = os.getenv('PROJECT_SDK', "AUTO")
# auto search NDK # auto search NDK
if self.folder_ndk == "AUTO": if self.path_ndk == "AUTO":
for folder in os.listdir("."): for path in os.listdir("."):
if os.path.isdir(folder)==True: if os.path.isdir(path)==True:
if folder=="android": if path=="android":
self.folder_ndk = folder + "/ndk" self.path_ndk = path + "/ndk"
if self.folder_ndk == "AUTO": if self.path_ndk == "AUTO":
self.folder_ndk = tools.get_run_folder() + "/../android/ndk" self.path_ndk = tools.get_run_path() + "/../android/ndk"
# auto search SDK # auto search SDK
if self.folder_sdk == "AUTO": if self.path_sdk == "AUTO":
for folder in os.listdir("."): for path in os.listdir("."):
if os.path.isdir(folder)==True: if os.path.isdir(path)==True:
if folder=="android": if path=="android":
self.folder_sdk = folder + "/sdk" self.path_sdk = path + "/sdk"
if self.folder_sdk == "AUTO": if self.path_sdk == "AUTO":
self.folder_sdk = tools.get_run_folder() + "/../android/sdk" self.path_sdk = tools.get_run_path() + "/../android/sdk"
if not os.path.isdir(self.folder_ndk): if not os.path.isdir(self.path_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")
if not os.path.isdir(self.folder_sdk): if not os.path.isdir(self.path_sdk):
debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path") debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path")
@ -63,34 +63,34 @@ class Target(target.Target):
if host.BUS_SIZE==64: if host.BUS_SIZE==64:
tmpOsVal = "_64" tmpOsVal = "_64"
if self.config["compilator"] == "clang": if self.config["compilator"] == "clang":
self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.6/prebuilt/linux-x86" + tmpOsVal + "/bin/") self.set_cross_base(self.path_ndk + "/toolchains/llvm-3.6/prebuilt/linux-x86" + tmpOsVal + "/bin/")
else: else:
baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/" basepathArm = self.path_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
baseFolderMips = self.folder_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/" basepathMips = self.path_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
baseFolderX86 = self.folder_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/" basepathX86 = self.path_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
self.set_cross_base(baseFolderArm + "arm-linux-androideabi-") self.set_cross_base(basepathArm + "arm-linux-androideabi-")
if not os.path.isdir(baseFolderArm): if not os.path.isdir(basepathArm):
debug.error("Gcc Arm path does not exist !!!") debug.error("Gcc Arm path does not exist !!!")
if not os.path.isdir(baseFolderMips): if not os.path.isdir(basepathMips):
debug.info("Gcc Mips path does not exist !!!") debug.info("Gcc Mips path does not exist !!!")
if not os.path.isdir(baseFolderX86): if not os.path.isdir(basepathX86):
debug.info("Gcc x86 path does not exist !!!") debug.info("Gcc x86 path does not exist !!!")
self.folder_bin="/mustNotCreateBinary" self.path_bin="/mustNotCreateBinary"
self.folder_lib="/data/lib/armeabi" self.path_lib="/data/lib/armeabi"
self.folder_data="/data/assets" self.path_data="/data/assets"
self.folder_doc="/doc" self.path_doc="/doc"
self.suffix_package='.pkg' self.suffix_package='.pkg'
# board id at 14 is for android 4.0 and more ... # board id at 14 is for android 4.0 and more ...
self.boardId = 14 self.boardId = 14
self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.boardId)) self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.boardId))
if arch == "armv5" or arch == "armv7": if arch == "armv5" or arch == "armv7":
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/") self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
elif arch == "mips": elif arch == "mips":
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/") self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
elif arch == "x86": elif arch == "x86":
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/") self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/")
if True: if True:
if self.config["compilator"] == "clang": if self.config["compilator"] == "clang":
@ -98,11 +98,11 @@ class Target(target.Target):
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x") debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
self.global_flags_cc.append("-D__STDCPP_LLVM__") self.global_flags_cc.append("-D__STDCPP_LLVM__")
# llvm-libc++ : BSD | MIT # llvm-libc++ : BSD | MIT
self.global_include_cc.append("-gcc-toolchain " + self.folder_ndk +"/sources/android/support/include") self.global_include_cc.append("-gcc-toolchain " + self.path_ndk +"/sources/android/support/include")
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/android/support/include") self.global_include_cc.append("-I" + self.path_ndk +"/sources/android/support/include")
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/") self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
if arch == "armv5": if arch == "armv5":
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/" stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
self.global_include_cc.append("-I" + stdCppBasePath + "include/") self.global_include_cc.append("-I" + stdCppBasePath + "include/")
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a") self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
elif arch == "armv7": elif arch == "armv7":
@ -111,51 +111,51 @@ class Target(target.Target):
self.global_flags_cc.append("-march=armv7-a") self.global_flags_cc.append("-march=armv7-a")
self.global_flags_cc.append("-mfpu=vfpv3-d16") self.global_flags_cc.append("-mfpu=vfpv3-d16")
self.global_flags_cc.append("-mhard-float") self.global_flags_cc.append("-mhard-float")
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/" stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/"
self.global_flags_ld.append( stdCppBasePath + "thumb/libc++_static.a") self.global_flags_ld.append( stdCppBasePath + "thumb/libc++_static.a")
self.global_flags_ld.append("-target armv7-none-linux-androideabi") self.global_flags_ld.append("-target armv7-none-linux-androideabi")
self.global_flags_ld.append("-Wl,--fix-cortex-a8") self.global_flags_ld.append("-Wl,--fix-cortex-a8")
self.global_flags_ld.append("-Wl,--no-warn-mismatch") self.global_flags_ld.append("-Wl,--no-warn-mismatch")
self.global_flags_ld.append("-lm_hard") self.global_flags_ld.append("-lm_hard")
elif arch == "mips": elif arch == "mips":
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/" stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/"
self.global_include_cc.append("-I" + stdCppBasePath + "include/") self.global_include_cc.append("-I" + stdCppBasePath + "include/")
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a") self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
elif arch == "x86": elif arch == "x86":
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/x86/" stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/x86/"
self.global_include_cc.append("-I" + stdCppBasePath + "include/") self.global_include_cc.append("-I" + stdCppBasePath + "include/")
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a") self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
else: else:
self.global_flags_cc.append("-D__STDCPP_GNU__") self.global_flags_cc.append("-D__STDCPP_GNU__")
# GPL v3 (+ exception link for gcc compilator) # GPL v3 (+ exception link for gcc compilator)
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/") self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/android/support/include/") self.global_include_cc.append("-I" + self.path_ndk +"/sources/android/support/include/")
if arch == "armv5": if arch == "armv5":
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/" stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/"
self.global_include_cc.append("-I" + stdCppBasePath + "include/") self.global_include_cc.append("-I" + stdCppBasePath + "include/")
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a") self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a") self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
elif arch == "armv7": elif arch == "armv7":
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi-v7a/" stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi-v7a/"
self.global_include_cc.append("-I" + stdCppBasePath + "include/") self.global_include_cc.append("-I" + stdCppBasePath + "include/")
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a") self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a") self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
elif arch == "mips": elif arch == "mips":
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/mips/" stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/mips/"
self.global_include_cc.append("-I" + stdCppBasePath + "include/") self.global_include_cc.append("-I" + stdCppBasePath + "include/")
self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a") self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a") self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
elif arch == "x86": elif arch == "x86":
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/x86/" stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/x86/"
self.global_include_cc.append("-I" + stdCppBasePath + "include/") self.global_include_cc.append("-I" + stdCppBasePath + "include/")
self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a") self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a") self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
else : else :
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/system/include/") self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/system/include/")
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/stlport/stlport/") self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/stlport/stlport/")
self.global_flags_ld.append(self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/lib/libstdc++.a") self.global_flags_ld.append(self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/lib/libstdc++.a")
self.global_sysroot = "--sysroot=" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm" self.global_sysroot = "--sysroot=" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm"
self.global_flags_cc.append("-D__ARM_ARCH_5__") self.global_flags_cc.append("-D__ARM_ARCH_5__")
self.global_flags_cc.append("-D__ARM_ARCH_5T__") self.global_flags_cc.append("-D__ARM_ARCH_5T__")
@ -203,8 +203,8 @@ class Target(target.Target):
return True return True
return False return False
def get_staging_folder_data(self, binaryName): def get_staging_path_data(self, binaryName):
return self.get_staging_folder(binaryName) + self.folder_data return self.get_staging_path(binaryName) + self.path_data
def make_package(self, pkgName, pkgProperties, basePkgPath, heritage): def make_package(self, pkgName, pkgProperties, basePkgPath, heritage):
# http://alp.developpez.com/tutoriels/debian/creer-paquet/ # http://alp.developpez.com/tutoriels/debian/creer-paquet/
@ -214,14 +214,14 @@ class Target(target.Target):
pkgNameApplicationName = pkgName pkgNameApplicationName = pkgName
if self.config["mode"] == "debug": if self.config["mode"] == "debug":
pkgNameApplicationName += "debug" pkgNameApplicationName += "debug"
# FINAL_FOLDER_JAVA_PROJECT # FINAL_path_JAVA_PROJECT
self.folder_javaProject= self.get_staging_folder(pkgName) \ self.path_javaProject= self.get_staging_path(pkgName) \
+ "/src/" \ + "/src/" \
+ pkgProperties["COMPAGNY_TYPE"] \ + pkgProperties["COMPAGNY_TYPE"] \
+ "/" + pkgProperties["COMPAGNY_NAME2"] \ + "/" + pkgProperties["COMPAGNY_NAME2"] \
+ "/" + pkgNameApplicationName + "/" + "/" + pkgNameApplicationName + "/"
#FINAL_FILE_ABSTRACTION #FINAL_FILE_ABSTRACTION
self.file_finalAbstraction = self.folder_javaProject + "/" + pkgNameApplicationName + ".java" self.file_finalAbstraction = self.path_javaProject + "/" + pkgNameApplicationName + ".java"
compleatePackageName = pkgProperties["COMPAGNY_TYPE"]+"."+pkgProperties["COMPAGNY_NAME2"]+"." + pkgNameApplicationName compleatePackageName = pkgProperties["COMPAGNY_TYPE"]+"."+pkgProperties["COMPAGNY_NAME2"]+"." + pkgNameApplicationName
@ -231,25 +231,25 @@ class Target(target.Target):
debug.print_element("pkg", "absractionFile", "<==", "dynamic file") debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
# Create folder : # Create path :
tools.create_directory_of_file(self.file_finalAbstraction) tools.create_directory_of_file(self.file_finalAbstraction)
# Create file : # Create file :
# java ==> done by ewol wrapper ... (and compiled in the normal compilation system ==> must be find in the dependency list of jar ... # java ==> done by ewol wrapper ... (and compiled in the normal compilation system ==> must be find in the dependency list of jar ...
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png"); tools.create_directory_of_file(self.get_staging_path(pkgName) + "/res/drawable/icon.png");
if "ICON" in pkgProperties.keys() \ if "ICON" in pkgProperties.keys() \
and pkgProperties["ICON"] != "": and pkgProperties["ICON"] != "":
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/res/drawable/icon.png", 256, 256) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/res/drawable/icon.png", 256, 256)
else: else:
# to be sure that we have all time a resource ... # to be sure that we have all time a resource ...
tmpFile = open(self.get_staging_folder(pkgName) + "/res/drawable/plop.txt", 'w') tmpFile = open(self.get_staging_path(pkgName) + "/res/drawable/plop.txt", 'w')
tmpFile.write('plop\n') tmpFile.write('plop\n')
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
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"])
tools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True) tools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_path(pkgName) + "/AndroidManifest.xml", force=True)
else: else:
debug.error("missing parameter 'ANDROID_MANIFEST' in the properties ... ") debug.error("missing parameter 'ANDROID_MANIFEST' in the properties ... ")
@ -262,34 +262,34 @@ class Target(target.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
tools.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_path(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")
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile") tools.create_directory_of_file(self.get_staging_path(pkgName) + "/src/noFile")
androidToolPath = self.folder_sdk + "/build-tools/" androidToolPath = self.path_sdk + "/build-tools/"
# find android tool version # find android tool version
dirnames = tools.get_list_sub_folder(androidToolPath) dirnames = tools.get_list_sub_path(androidToolPath)
if len(dirnames) != 1: if len(dirnames) != 1:
debug.error("an error occured when getting the tools for android") debug.error("an error occured when getting the tools for android")
androidToolPath += dirnames[0] + "/" androidToolPath += dirnames[0] + "/"
# this is to create resource file for android ... (we did not use aset in jar with ewol ... # this is to create resource file for android ... (we did not use aset in jar with ewol ...
adModResouceFolder = "" adModResoucepath = ""
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/ " adModResoucepath = " -S " + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
cmdLine = androidToolPath + "aapt p -f " \ cmdLine = androidToolPath + "aapt p -f " \
+ "-M " + self.get_staging_folder(pkgName) + "/AndroidManifest.xml " \ + "-M " + self.get_staging_path(pkgName) + "/AndroidManifest.xml " \
+ "-F " + self.get_staging_folder(pkgName) + "/resources.res " \ + "-F " + self.get_staging_path(pkgName) + "/resources.res " \
+ "-I " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\ + "-I " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
+ "-S " + self.get_staging_folder(pkgName) + "/res/ " \ + "-S " + self.get_staging_path(pkgName) + "/res/ " \
+ adModResouceFolder \ + adModResoucepath \
+ "-J " + self.get_staging_folder(pkgName) + "/src/ " + "-J " + self.get_staging_path(pkgName) + "/src/ "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile") tools.create_directory_of_file(self.get_staging_path(pkgName) + "/build/classes/noFile")
debug.print_element("pkg", "*.class", "<==", "*.java") debug.print_element("pkg", "*.class", "<==", "*.java")
#generate android java files: #generate android java files:
filesString="" filesString=""
@ -298,21 +298,21 @@ class Target(target.Target):
old : old :
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkgProperties:
# TODO : check this I do not think it is really usefull ... ==> write for IDE only ... # TODO : check this I do not think it is really usefull ... ==> write for IDE only ...
filesString += self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java " filesString += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java "
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0: if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
filesString += self.folder_javaProject + pkgNameApplicationName + "Settings.java " filesString += self.path_javaProject + pkgNameApplicationName + "Settings.java "
adModJarFile = "" adModJarFile = ""
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkgProperties:
adModJarFile = ":" + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar" adModJarFile = ":" + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
cmdLine = "javac " \ cmdLine = "javac " \
+ "-d " + self.get_staging_folder(pkgName) + "/build/classes " \ + "-d " + self.get_staging_path(pkgName) + "/build/classes " \
+ "-classpath " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \ + "-classpath " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
+ adModJarFile + " " \ + adModJarFile + " " \
+ filesString \ + filesString \
+ self.file_finalAbstraction + " " \ + self.file_finalAbstraction + " " \
+ self.get_staging_folder(pkgName) + "/src/R.java " + self.get_staging_path(pkgName) + "/src/R.java "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
""" """
debug.verbose("heritage .so=" + str(tools.filter_extention(heritage.src, ["so"]))) debug.verbose("heritage .so=" + str(tools.filter_extention(heritage.src, ["so"])))
@ -327,19 +327,19 @@ class Target(target.Target):
class_extern += elem class_extern += elem
# create enpoint element : # create enpoint element :
cmdLine = "javac " \ cmdLine = "javac " \
+ "-d " + self.get_staging_folder(pkgName) + "/build/classes " \ + "-d " + self.get_staging_path(pkgName) + "/build/classes " \
+ "-classpath " + class_extern + " " \ + "-classpath " + class_extern + " " \
+ self.get_staging_folder(pkgName) + "/src/R.java " + self.get_staging_path(pkgName) + "/src/R.java "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
debug.print_element("pkg", ".dex", "<==", "*.class") debug.print_element("pkg", ".dex", "<==", "*.class")
cmdLine = androidToolPath + "dx " \ cmdLine = androidToolPath + "dx " \
+ "--dex --no-strict " \ + "--dex --no-strict " \
+ "--output=" + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \ + "--output=" + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
+ self.get_staging_folder(pkgName) + "/build/classes/ " + self.get_staging_path(pkgName) + "/build/classes/ "
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkgProperties:
cmdLine += self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar " cmdLine += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
# add element to dexification: # add element to dexification:
for elem in upper_jar: for elem in upper_jar:
# remove android sdk: # remove android sdk:
@ -352,16 +352,16 @@ class Target(target.Target):
#builderDebug="-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y " #builderDebug="-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y "
builderDebug="" builderDebug=""
# note : set -u not signed application... # note : set -u not signed application...
#+ ":" + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar " #+ ":" + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
cmdLine = "java -Xmx128M " \ cmdLine = "java -Xmx128M " \
+ " -classpath " + self.folder_sdk + "/tools/lib/sdklib.jar " \ + " -classpath " + self.path_sdk + "/tools/lib/sdklib.jar " \
+ builderDebug \ + builderDebug \
+ " com.android.sdklib.build.ApkBuilderMain " \ + " com.android.sdklib.build.ApkBuilderMain " \
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
+ " -u " \ + " -u " \
+ " -z " + self.get_staging_folder(pkgName) + "/resources.res " \ + " -z " + self.get_staging_path(pkgName) + "/resources.res " \
+ " -f " + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \ + " -f " + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
+ " -rf " + self.get_staging_folder(pkgName) + "/data " + " -rf " + self.get_staging_path(pkgName) + "/data "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
# doc : # doc :
@ -379,7 +379,7 @@ class Target(target.Target):
+ " -sigalg SHA1withRSA -digestalg SHA1 " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \
+ " -storepass Pass__AndroidDebugKey " \ + " -storepass Pass__AndroidDebugKey " \
+ " -keypass PassKey__AndroidDebugKey " \ + " -keypass PassKey__AndroidDebugKey " \
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
+ " alias__AndroidDebugKey" + " alias__AndroidDebugKey"
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
tmpFile = open("tmpPass.boo", 'w') tmpFile = open("tmpPass.boo", 'w')
@ -392,26 +392,26 @@ class Target(target.Target):
cmdLine = "jarsigner " \ cmdLine = "jarsigner " \
+ " -keystore " + basePkgPath + "/AndroidKey.jks " \ + " -keystore " + basePkgPath + "/AndroidKey.jks " \
+ " -sigalg SHA1withRSA -digestalg SHA1 " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
+ " " + pkgNameApplicationName + " " + pkgNameApplicationName
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
cmdLine = "jarsigner " \ cmdLine = "jarsigner " \
+ " -verify -verbose -certs " \ + " -verify -verbose -certs " \
+ " -sigalg SHA1withRSA -digestalg SHA1 " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)") debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
tools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk") tools.remove_file(self.get_staging_path(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_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk " + self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
# copy file in the final stage : # copy file in the final stage :
tools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk", tools.copy_file(self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk",
self.get_final_folder() + "/" + pkgNameApplicationName + ".apk", self.get_final_path() + "/" + pkgNameApplicationName + ".apk",
force=True) force=True)
def install_package(self, pkgName): def install_package(self, pkgName):
@ -421,8 +421,8 @@ class Target(target.Target):
pkgNameApplicationName = pkgName pkgNameApplicationName = pkgName
if self.config["mode"] == "debug": if self.config["mode"] == "debug":
pkgNameApplicationName += "debug" pkgNameApplicationName += "debug"
cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \ cmdLine = self.path_sdk + "/platform-tools/adb install -r " \
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk " + self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
def un_install_package(self, pkgName): def un_install_package(self, pkgName):
@ -432,15 +432,15 @@ class Target(target.Target):
pkgNameApplicationName = pkgName pkgNameApplicationName = pkgName
if self.config["mode"] == "debug": if self.config["mode"] == "debug":
pkgNameApplicationName += "debug" pkgNameApplicationName += "debug"
cmdLine = self.folder_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName cmdLine = self.path_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName
Rmultiprocess.run_command(cmdLine) Rmultiprocess.run_command(cmdLine)
def Log(self, pkgName): def Log(self, pkgName):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("logcat of android board") debug.info("logcat of android board")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("cmd: " + self.folder_sdk + "/platform-tools/adb shell logcat ") debug.info("cmd: " + self.path_sdk + "/platform-tools/adb shell logcat ")
cmdLine = self.folder_sdk + "/platform-tools/adb shell logcat " cmdLine = self.path_sdk + "/platform-tools/adb shell logcat "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)

View File

@ -45,9 +45,9 @@ class Target(target.Target):
# remove unneeded ranlib ... # remove unneeded ranlib ...
self.ranlib="" self.ranlib=""
self.folder_bin="" self.path_bin=""
self.folder_data="/share" self.path_data="share"
self.folder_doc="/doc" self.path_doc="doc"
self.suffix_lib_static='.a' self.suffix_lib_static='.a'
self.suffix_lib_dynamic='.dylib' self.suffix_lib_dynamic='.dylib'
@ -76,11 +76,11 @@ class Target(target.Target):
self.global_flags_m.append("-fobjc-arc") self.global_flags_m.append("-fobjc-arc")
#self.global_flags_m.append("-fmodules") #self.global_flags_m.append("-fmodules")
def get_staging_folder(self, binaryName): def get_staging_path(self, binaryName):
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/" return tools.get_run_path() + self.path_out + self.path_staging + "/" + binaryName + ".app/"
def get_staging_folder_data(self, binaryName): def get_staging_path_data(self, binaryName):
return self.get_staging_folder(binaryName) + self.folder_data + "/" return self.get_staging_path(binaryName) + self.path_data + "/"
def make_package(self, pkgName, pkgProperties, basePkgPath): def make_package(self, pkgName, pkgProperties, basePkgPath):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
@ -93,26 +93,26 @@ class Target(target.Target):
# TODO : Do not regenerate if source resource is not availlable # TODO : Do not regenerate if source resource is not availlable
# TODO : Add a colored background ... # TODO : Add a colored background ...
debug.print_element("pkg", "iTunesArtwork.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "iTunesArtwork.png", "<==", pkgProperties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/iTunesArtwork.png", 512, 512) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/iTunesArtwork.png", 512, 512)
debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkgProperties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/iTunesArtwork@2x.png", 1024, 1024) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/iTunesArtwork@2x.png", 1024, 1024)
debug.print_element("pkg", "Icon-60@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-60@2x.png", "<==", pkgProperties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-60@2x.png", 120, 120) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-60@2x.png", 120, 120)
debug.print_element("pkg", "Icon-76.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-76.png", "<==", pkgProperties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-76.png", 76, 76) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-76.png", 76, 76)
debug.print_element("pkg", "Icon-76@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-76@2x.png", "<==", pkgProperties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-76@2x.png", 152, 152) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-76@2x.png", 152, 152)
debug.print_element("pkg", "Icon-Small-40.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-Small-40.png", "<==", pkgProperties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small-40.png", 40, 40) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small-40.png", 40, 40)
debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkgProperties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small-40@2x.png", 80, 80) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small-40@2x.png", 80, 80)
debug.print_element("pkg", "Icon-Small.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-Small.png", "<==", pkgProperties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small.png", 29, 29) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small.png", 29, 29)
debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkgProperties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small@2x.png", 58, 58) image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small@2x.png", 58, 58)
debug.print_element("pkg", "PkgInfo", "<==", "APPL????") debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
infoFile = self.get_staging_folder(pkgName) + "/PkgInfo" infoFile = self.get_staging_path(pkgName) + "/PkgInfo"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write("APPL????") tmpFile.write("APPL????")
@ -205,29 +205,29 @@ class Target(target.Target):
dataFile += "</plist>\n" dataFile += "</plist>\n"
dataFile += "\n\n" dataFile += "\n\n"
infoFile = self.get_staging_folder(pkgName) + "/Info.plist" infoFile = self.get_staging_path(pkgName) + "/Info.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
""" """
infoFile = self.get_staging_folder(pkgName) + "/" + pkgName + "-Info.plist" infoFile = self.get_staging_path(pkgName) + "/" + pkgName + "-Info.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
cmdLine = "builtin-infoPlistUtility " cmdLine = "builtin-infoPlistUtility "
cmdLine += " " + self.get_staging_folder(pkgName) + "/" + pkgName + "-Info.plist " cmdLine += " " + self.get_staging_path(pkgName) + "/" + pkgName + "-Info.plist "
cmdLine += " -genpkginfo " + self.get_staging_folder(pkgName) + "/PkgInfo" cmdLine += " -genpkginfo " + self.get_staging_path(pkgName) + "/PkgInfo"
cmdLine += " -expandbuildsettings " cmdLine += " -expandbuildsettings "
cmdLine += " -format binary " cmdLine += " -format binary "
if self.sumulator == False: if self.sumulator == False:
cmdLine += " -platform iphonesimulator " cmdLine += " -platform iphonesimulator "
else: else:
cmdLine += " -platform iphoneos " cmdLine += " -platform iphoneos "
cmdLine += " -o " + self.get_staging_folder(pkgName) + "/" + "Info.plist" cmdLine += " -o " + self.get_staging_path(pkgName) + "/" + "Info.plist"
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
""" """
""" """
@ -273,7 +273,7 @@ class Target(target.Target):
dataFile += "</plist>\n" dataFile += "</plist>\n"
dataFile += "\n\n" dataFile += "\n\n"
infoFile = self.get_staging_folder(pkgName) + "/ResourceRules.plist" infoFile = self.get_staging_path(pkgName) + "/ResourceRules.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
@ -291,14 +291,14 @@ class Target(target.Target):
dataFile += "</plist>\n" dataFile += "</plist>\n"
dataFile += "\n\n" dataFile += "\n\n"
infoFile = self.get_staging_folder(pkgName) + "/Entitlements.plist" infoFile = self.get_staging_path(pkgName) + "/Entitlements.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
# Simulateur folder : # Simulateur path :
#~/Library/Application\ Support/iPhone\ Simulator/7.0.3/Applications/ #~/Library/Application\ Support/iPhone\ Simulator/7.0.3/Applications/
# must have a 'uuidgen' UID generate value with this elemennt ... # must have a 'uuidgen' UID generate value with this elemennt ...
# get the bundle path : ==> maybe usefull in MocOS ... # get the bundle path : ==> maybe usefull in MocOS ...
@ -310,7 +310,7 @@ class Target(target.Target):
if self.sumulator == False: if self.sumulator == False:
# Create the info file # Create the info file
tmpFile = open(self.get_build_folder(pkgName) + "/worddown.xcent", 'w') tmpFile = open(self.get_build_path(pkgName) + "/worddown.xcent", 'w')
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n") tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n")
tmpFile.write("<plist version=\"1.0\">\n") tmpFile.write("<plist version=\"1.0\">\n")
@ -340,8 +340,8 @@ class Target(target.Target):
cmdLine = 'codesign --force --sign ' cmdLine = 'codesign --force --sign '
# to get this key ; certtool y | grep "Developer" # to get this key ; certtool y | grep "Developer"
cmdLine += ' "' + signatureKey + '" ' cmdLine += ' "' + signatureKey + '" '
cmdLine += ' --entitlements ' + self.get_build_folder(pkgName) + '/worddown.xcent' cmdLine += ' --entitlements ' + self.get_build_path(pkgName) + '/worddown.xcent'
cmdLine += ' ' + self.get_staging_folder(pkgName) cmdLine += ' ' + self.get_staging_path(pkgName)
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
# --force --sign "iPhone Developer: Edouard DUPIN (SDFGSDFGSDFG)" # --force --sign "iPhone Developer: Edouard DUPIN (SDFGSDFGSDFG)"
@ -368,7 +368,7 @@ class Target(target.Target):
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0: if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
debug.error("Can not create ios-deploy external software ...") debug.error("Can not create ios-deploy external software ...")
debug.print_element("deploy", "iphone/ipad", "<==", "aplication") debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
cmdLine = './ewol/ios-deploy/ios-deploy --bundle ' + self.get_staging_folder(pkgName) cmdLine = './ewol/ios-deploy/ios-deploy --bundle ' + self.get_staging_path(pkgName)
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
else: else:
simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt" simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt"
@ -388,14 +388,14 @@ class Target(target.Target):
tmpFile.close() tmpFile.close()
simulatorId = tools.file_read_data(simulatorIdFile) simulatorId = tools.file_read_data(simulatorIdFile)
home = os.path.expanduser("~") home = os.path.expanduser("~")
destinationFolderBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId destinationpathBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId
destinationFolder = home + "/Library/Application Support/iPhone Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app" destinationpath = home + "/Library/Application Support/iPhone Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app"
destinationFolder2 = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app" destinationpath2 = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app"
debug.info("install in simulator : " + destinationFolder) debug.info("install in simulator : " + destinationpath)
tools.create_directory_of_file(destinationFolder + "/plop.txt") tools.create_directory_of_file(destinationpath + "/plop.txt")
cmdLine = "cp -rf " + self.get_staging_folder(pkgName) + " " + destinationFolder2 cmdLine = "cp -rf " + self.get_staging_path(pkgName) + " " + destinationpath2
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
cmdLine = "touch " + destinationFolderBase cmdLine = "touch " + destinationpathBase
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package #sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
@ -425,7 +425,7 @@ class Target(target.Target):
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0: if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
debug.error("Can not create ios-deploy external software ...") debug.error("Can not create ios-deploy external software ...")
debug.print_element("deploy", "iphone/ipad", "<==", "aplication") debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
cmdLine = './ewol/ios-deploy/ios-deploy --debug --bundle ' + self.get_staging_folder(pkgName) cmdLine = './ewol/ios-deploy/ios-deploy --debug --bundle ' + self.get_staging_path(pkgName)
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
else: else:
cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log" cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log"

View File

@ -59,11 +59,11 @@ class Target(target.Target):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + debianPkgName + "' v"+pkgProperties["VERSION"]) debug.info("Generate package '" + debianPkgName + "' v"+pkgProperties["VERSION"])
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
self.get_staging_folder(pkgName) self.get_staging_path(pkgName)
targetOutFolderDebian = self.get_staging_folder(pkgName) + "/DEBIAN/" targetOutpathDebian = self.get_staging_path(pkgName) + "/DEBIAN/"
finalFileControl = targetOutFolderDebian + "control" finalFileControl = targetOutpathDebian + "control"
finalFilepostRm = targetOutFolderDebian + "postrm" finalFilepostRm = targetOutpathDebian + "postrm"
# create the folders : # create the paths :
tools.create_directory_of_file(finalFileControl) tools.create_directory_of_file(finalFileControl)
tools.create_directory_of_file(finalFilepostRm) tools.create_directory_of_file(finalFilepostRm)
## Create the control file ## Create the control file
@ -93,7 +93,7 @@ class Target(target.Target):
## Enable Execution in script ## Enable Execution in script
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH); os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
## Readme donumentation ## Readme donumentation
readmeFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ debianPkgName + "/README" readmeFileDest = self.get_staging_path(pkgName) + "/usr/share/doc/"+ debianPkgName + "/README"
tools.create_directory_of_file(readmeFileDest) tools.create_directory_of_file(readmeFileDest)
if os.path.exists(basePkgPath + "/os-Linux/README")==True: if os.path.exists(basePkgPath + "/os-Linux/README")==True:
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest) tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
@ -108,7 +108,7 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## licence file ## licence file
licenseFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ debianPkgName + "/copyright" licenseFileDest = self.get_staging_path(pkgName) + "/usr/share/doc/"+ debianPkgName + "/copyright"
tools.create_directory_of_file(licenseFileDest) tools.create_directory_of_file(licenseFileDest)
if os.path.exists(basePkgPath + "/license.txt")==True: if os.path.exists(basePkgPath + "/license.txt")==True:
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest) tools.copy_file(basePkgPath + "/license.txt", licenseFileDest)
@ -119,7 +119,7 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
##changeLog file ##changeLog file
changeLogFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ debianPkgName + "/changelog" changeLogFileDest = self.get_staging_path(pkgName) + "/usr/share/doc/"+ debianPkgName + "/changelog"
tools.create_directory_of_file(changeLogFileDest) tools.create_directory_of_file(changeLogFileDest)
if os.path.exists(basePkgPath + "/changelog")==True: if os.path.exists(basePkgPath + "/changelog")==True:
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest) tools.copy_file(basePkgPath + "/changelog", changeLogFileDest)
@ -130,22 +130,22 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## create the package : ## create the package :
debug.debug("package : " + self.get_staging_folder(pkgName) + "/" + debianPkgName + ".deb") debug.debug("package : " + self.get_staging_path(pkgName) + "/" + debianPkgName + ".deb")
os.system("cd " + self.get_staging_folder("") + " ; dpkg-deb --build " + pkgName) os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkgName)
tools.create_directory_of_file(self.get_final_folder()) tools.create_directory_of_file(self.get_final_path())
tools.copy_file(self.get_staging_folder("") + "/" + pkgName + self.suffix_package, self.get_final_folder() + "/" + pkgName + self.suffix_package) tools.copy_file(self.get_staging_path("") + "/" + pkgName + self.suffix_package, self.get_final_path() + "/" + pkgName + self.suffix_package)
def install_package(self, pkgName): def install_package(self, pkgName):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'") debug.info("Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
os.system("sudo dpkg -i " + self.get_final_folder() + "/" + pkgName + self.suffix_package) os.system("sudo dpkg -i " + self.get_final_path() + "/" + pkgName + self.suffix_package)
def un_install_package(self, pkgName): def un_install_package(self, pkgName):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'") debug.info("Un-Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
os.system("sudo dpkg -r " + self.get_final_folder() + "/" + pkgName + self.suffix_package) os.system("sudo dpkg -r " + self.get_final_path() + "/" + pkgName + self.suffix_package)
""" """
.local/application .local/application
@ -182,30 +182,30 @@ class Target(target.Target):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate generic '" + debianPkgName + "' v"+pkgProperties["VERSION"]) debug.info("Generate generic '" + debianPkgName + "' v"+pkgProperties["VERSION"])
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
targetOutFolder = self.get_staging_folder(pkgName) + "/edn.app/" targetOutpath = self.get_staging_path(pkgName) + "/edn.app/"
tools.create_directory_of_file(targetOutFolder) tools.create_directory_of_file(targetOutpath)
## Create version file ## Create version file
tmpFile = open(targetOutFolder + "/version.txt", 'w') tmpFile = open(targetOutpath + "/version.txt", 'w')
tmpFile.write(pkgProperties["VERSION"]) tmpFile.write(pkgProperties["VERSION"])
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create maintainer file ## Create maintainer file
tmpFile = open(targetOutFolder + "/maintainer.txt", 'w') tmpFile = open(targetOutpath + "/maintainer.txt", 'w')
tmpFile.write(self.generate_list_separate_coma(pkgProperties["MAINTAINER"])) tmpFile.write(self.generate_list_separate_coma(pkgProperties["MAINTAINER"]))
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create appl_name file ## Create appl_name file
tmpFile = open(targetOutFolder + "/appl_name.txt", 'w') tmpFile = open(targetOutpath + "/appl_name.txt", 'w')
tmpFile.write("en_EN:" + pkgProperties["NAME"]) tmpFile.write("en_EN:" + pkgProperties["NAME"])
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create appl_description file ## Create appl_description file
tmpFile = open(targetOutFolder + "/appl_description.txt", 'w') tmpFile = open(targetOutpath + "/appl_description.txt", 'w')
tmpFile.write("en_EN:" + pkgProperties["DESCRIPTION"]) tmpFile.write("en_EN:" + pkgProperties["DESCRIPTION"])
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create Readme file ## Create Readme file
readmeFileDest = targetOutFolder + "/readme.txt" readmeFileDest = targetOutpath + "/readme.txt"
if os.path.exists(basePkgPath + "/os-Linux/README")==True: if os.path.exists(basePkgPath + "/os-Linux/README")==True:
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest) tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
elif os.path.exists(basePkgPath + "/README")==True: elif os.path.exists(basePkgPath + "/README")==True:
@ -219,7 +219,7 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create licence file ## Create licence file
licenseFileDest = targetOutFolder + "/license/"+ debianPkgName + ".txt" licenseFileDest = targetOutpath + "/license/"+ debianPkgName + ".txt"
tools.create_directory_of_file(licenseFileDest) tools.create_directory_of_file(licenseFileDest)
if os.path.exists(basePkgPath + "/license.txt")==True: if os.path.exists(basePkgPath + "/license.txt")==True:
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest) tools.copy_file(basePkgPath + "/license.txt", licenseFileDest)
@ -230,7 +230,7 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create changeLog file ## Create changeLog file
changeLogFileDest = targetOutFolder + "/changelog.txt" changeLogFileDest = targetOutpath + "/changelog.txt"
if os.path.exists(basePkgPath + "/changelog") == True: if os.path.exists(basePkgPath + "/changelog") == True:
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest) tools.copy_file(basePkgPath + "/changelog", changeLogFileDest)
else: else:
@ -239,24 +239,24 @@ class Target(target.Target):
tmpFile.write("No changelog data " + pkgName + "\n") tmpFile.write("No changelog data " + pkgName + "\n")
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## copy share folder ## copy share path
#debug.info("plop:" + self.get_staging_folder(pkgName) + self.folder_data) #debug.info("plop:" + self.get_staging_path(pkgName) + self.path_data)
if os.path.exists(self.get_staging_folder(pkgName) + self.folder_data) == True: if os.path.exists(self.get_staging_path(pkgName) + self.path_data) == True:
tools.copy_anything(self.get_staging_folder(pkgName) + self.folder_data + "/*", targetOutFolder + self.folder_data, recursive=True) tools.copy_anything(self.get_staging_path(pkgName) + self.path_data + "/*", targetOutpath + self.path_data, recursive=True)
## Create binary folder: ## Create binary path:
bin_folder = targetOutFolder + self.folder_bin bin_path = targetOutpath + self.path_bin
#tools.create_directory_of_file(bin_folder) #tools.create_directory_of_file(bin_path)
tools.copy_anything(self.get_staging_folder(pkgName) + self.folder_bin + "/*", tools.copy_anything(self.get_staging_path(pkgName) + self.path_bin + "/*",
bin_folder, bin_path,
executable=True) executable=True)
## create the package: ## create the package:
debug.debug("package : " + self.get_staging_folder(pkgName) + "/" + debianPkgName + ".app.pkg") debug.debug("package : " + self.get_staging_path(pkgName) + "/" + debianPkgName + ".app.pkg")
os.system("cd " + self.get_staging_folder(pkgName) + " ; tar -czf " + pkgName + ".app.tar.gz " + pkgName + ".app") os.system("cd " + self.get_staging_path(pkgName) + " ; tar -czf " + pkgName + ".app.tar.gz " + pkgName + ".app")
#multiprocess.run_command("cd " + self.get_staging_folder(pkgName) + " ; tar -czf " + pkgName + ".app.tar.gz " + pkgName + ".app") #multiprocess.run_command("cd " + self.get_staging_path(pkgName) + " ; tar -czf " + pkgName + ".app.tar.gz " + pkgName + ".app")
tools.create_directory_of_file(self.get_final_folder()) tools.create_directory_of_file(self.get_final_path())
tools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgName + ".app.tar.gz", self.get_final_folder() + "/" + pkgName + ".app.gpkg") tools.copy_file(self.get_staging_path(pkgName) + "/" + pkgName + ".app.tar.gz", self.get_final_path() + "/" + pkgName + ".app.gpkg")

View File

@ -28,10 +28,10 @@ class Target(target.Target):
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt # http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
target.Target.__init__(self, "MacOs", config, "") target.Target.__init__(self, "MacOs", config, "")
self.folder_bin="/MacOS" self.path_bin="MacOS"
self.folder_lib="/lib" self.path_lib="lib"
self.folder_data="/Resources" self.path_data="Resources"
self.folder_doc="/doc" self.path_doc="doc"
self.suffix_lib_static='.a' self.suffix_lib_static='.a'
self.suffix_lib_dynamic='.dylib' self.suffix_lib_dynamic='.dylib'
@ -41,11 +41,11 @@ class Target(target.Target):
self.global_flags_cc.append("-D__STDCPP_LLVM__") self.global_flags_cc.append("-D__STDCPP_LLVM__")
def get_staging_folder(self, binaryName): def get_staging_path(self, binaryName):
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/" return tools.get_run_path() + self.path_out + self.path_staging + "/" + binaryName + ".app/Contents/"
def get_staging_folder_data(self, binaryName): def get_staging_path_data(self, binaryName):
return self.get_staging_folder(binaryName) + self.folder_data + "/" return self.get_staging_path(binaryName) + self.path_data + "/"
def make_package(self, pkgName, pkgProperties, basePkgPath): def make_package(self, pkgName, pkgProperties, basePkgPath):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
@ -54,10 +54,10 @@ class Target(target.Target):
if "ICON" in pkgProperties.keys() \ if "ICON" in pkgProperties.keys() \
and pkgProperties["ICON"] != "": and pkgProperties["ICON"] != "":
tools.copy_file(pkgProperties["ICON"], self.get_staging_folder_data(pkgName) + "/icon.icns", force=True) tools.copy_file(pkgProperties["ICON"], self.get_staging_path_data(pkgName) + "/icon.icns", force=True)
# http://www.sandroid.org/imcross/#Deployment # http://www.sandroid.org/imcross/#Deployment
infoFile=self.get_staging_folder(pkgName) + "/Info.plist" infoFile=self.get_staging_path(pkgName) + "/Info.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
@ -79,7 +79,7 @@ class Target(target.Target):
tmpFile.write("\n\n") tmpFile.write("\n\n")
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
infoFile=self.get_staging_folder(pkgName) + "/PkgInfo" infoFile=self.get_staging_path(pkgName) + "/PkgInfo"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write("APPL????") tmpFile.write("APPL????")
@ -87,7 +87,7 @@ class Target(target.Target):
tmpFile.close() tmpFile.close()
# Create a simple interface to localy install the aplication for the shell (a shell command line interface) # Create a simple interface to localy install the aplication for the shell (a shell command line interface)
shell_file_name=self.get_staging_folder(pkgName) + "/shell/" + pkgName shell_file_name=self.get_staging_path(pkgName) + "/shell/" + pkgName
# Create the info file # Create the info file
tools.create_directory_of_file(shell_file_name) tools.create_directory_of_file(shell_file_name)
tmpFile = open(shell_file_name, 'w') tmpFile = open(shell_file_name, 'w')
@ -101,10 +101,10 @@ class Target(target.Target):
# Must create the disk image of the application # Must create the disk image of the application
debug.info("Generate disk image for '" + pkgName + "'") debug.info("Generate disk image for '" + pkgName + "'")
output_file_name = self.get_final_folder() + "/" + pkgName + ".dmg" output_file_name = self.get_final_path() + "/" + pkgName + ".dmg"
cmd = "hdiutil create -volname " cmd = "hdiutil create -volname "
cmd += pkgName + " -srcfolder " cmd += pkgName + " -srcpath "
cmd += tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app" cmd += tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app"
cmd += " -ov -format UDZO " cmd += " -ov -format UDZO "
cmd += output_file_name cmd += output_file_name
tools.create_directory_of_file(output_file_name) tools.create_directory_of_file(output_file_name)
@ -118,18 +118,18 @@ class Target(target.Target):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'") debug.info("Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("copy " + tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app in /Applications/") debug.info("copy " + tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app in /Applications/")
if os.path.exists("/Applications/" + pkgName + ".app") == True: if os.path.exists("/Applications/" + pkgName + ".app") == True:
shutil.rmtree("/Applications/" + pkgName + ".app") shutil.rmtree("/Applications/" + pkgName + ".app")
# copy the application in the basic application folder : /Applications/xxx.app # copy the application in the basic application path : /Applications/xxx.app
shutil.copytree(tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app", "/Applications/" + pkgName + ".app") shutil.copytree(tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app", "/Applications/" + pkgName + ".app")
def un_install_package(self, pkgName): def un_install_package(self, pkgName):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'") debug.info("Un-Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("remove OLD application /Applications/" + pkgName + ".app") debug.info("remove OLD application /Applications/" + pkgName + ".app")
# Remove the application in the basic application folder : /Applications/xxx.app # Remove the application in the basic application path : /Applications/xxx.app
if os.path.exists("/Applications/" + pkgName + ".app") == True: if os.path.exists("/Applications/" + pkgName + ".app") == True:
shutil.rmtree("/Applications/" + pkgName + ".app") shutil.rmtree("/Applications/" + pkgName + ".app")

View File

@ -50,10 +50,10 @@ class Target(target.Target):
"-static-libstdc++", "-static-libstdc++",
"-static"]) "-static"])
self.folder_bin="" self.path_bin=""
self.folder_lib="/lib" self.path_lib="lib"
self.folder_data="/data" self.path_data="data"
self.folder_doc="/doc" self.path_doc="doc"
self.suffix_lib_static='.a' self.suffix_lib_static='.a'
self.suffix_lib_dynamic='.dll' self.suffix_lib_dynamic='.dll'
@ -62,24 +62,24 @@ class Target(target.Target):
self.global_flags_cc.append("-D__STDCPP_GNU__") self.global_flags_cc.append("-D__STDCPP_GNU__")
def get_staging_folder_data(self, binaryName): def get_staging_path_data(self, binaryName):
return self.get_staging_folder(binaryName) + self.folder_data return self.get_staging_path(binaryName) + self.path_data
def make_package(self, pkgName, pkgProperties, basePkgPath): def make_package(self, pkgName, pkgProperties, basePkgPath):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkgName + "'") debug.info("Generate package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.print_element("zip", "data.zip", "<==", "data/*") debug.print_element("zip", "data.zip", "<==", "data/*")
zipPath = self.get_staging_folder(pkgName) + "/data.zip" zipPath = self.get_staging_path(pkgName) + "/data.zip"
zip.create_zip(self.get_staging_folder_data(pkgName), zipPath) zip.create_zip(self.get_staging_path_data(pkgName), zipPath)
binPath = self.get_staging_folder(pkgName) + "/" + self.folder_bin + "/" + pkgName + self.suffix_binary binPath = self.get_staging_path(pkgName) + "/" + self.path_bin + "/" + pkgName + self.suffix_binary
binSize = tools.file_size(binPath) binSize = tools.file_size(binPath)
debug.info("binarysize : " + str(binSize/1024) + " ko ==> " + str(binSize) + " octets") debug.info("binarysize : " + str(binSize/1024) + " ko ==> " + str(binSize) + " octets")
#now we create a simple bundle binary ==> all file is stored in one file ... #now we create a simple bundle binary ==> all file is stored in one file ...
self.get_staging_folder(pkgName) self.get_staging_path(pkgName)
finalBin = self.get_final_folder() + "/" + pkgName + self.suffix_binary finalBin = self.get_final_path() + "/" + pkgName + self.suffix_binary
tools.create_directory_of_file(finalBin); tools.create_directory_of_file(finalBin);
debug.print_element("pkg", finalBin, "<==", pkgName + self.suffix_binary) debug.print_element("pkg", finalBin, "<==", pkgName + self.suffix_binary)
#open output file #open output file