[DEV] integrate PACKAGE generation and run binary inside
This commit is contained in:
parent
fad39e0bb9
commit
0e7458cc06
@ -163,6 +163,7 @@ def usage(full=False):
|
|||||||
for elem in mod["maintainer"]:
|
for elem in mod["maintainer"]:
|
||||||
print(" " + str(elem))
|
print(" " + str(elem))
|
||||||
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
|
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
|
||||||
|
print(" ex: " + sys.argv[0] + " -cclang -mdebug zeus-package-base?build?run%zeus-launcher:--srv=user:--elog-level=5")
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
def check_boolean(value):
|
def check_boolean(value):
|
||||||
|
@ -157,7 +157,10 @@ class HeritageList:
|
|||||||
## @return (string) string of str() convertion
|
## @return (string) string of str() convertion
|
||||||
##
|
##
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "{HeritageList:" + str(self.list_heritage) + "}"
|
dep = []
|
||||||
|
for elem in reversed(self.list_heritage):
|
||||||
|
dep.append(str(elem.name))
|
||||||
|
return "{HeritageList: " + str(dep) + "}"
|
||||||
|
|
||||||
class heritage:
|
class heritage:
|
||||||
def __init__(self, module, target):
|
def __init__(self, module, target):
|
||||||
@ -258,6 +261,6 @@ class heritage:
|
|||||||
## @return (string) string of str() convertion
|
## @return (string) string of str() convertion
|
||||||
##
|
##
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "{Heritage:" + str(self.name) + " ... }"
|
return "{Heritage:" + str(self.name) + " depend on: " + str(reversed(self.depends)) + " ... }"
|
||||||
|
|
||||||
|
|
||||||
|
@ -801,6 +801,8 @@ class Module:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
debug.error("UN-SUPPORTED link format: '.jar'")
|
debug.error("UN-SUPPORTED link format: '.jar'")
|
||||||
else:
|
else:
|
||||||
|
# try to build the binary with dependency of .so and the standalone binary (Not package dependent)
|
||||||
|
if target.support_dynamic_link == True:
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder_with_output("bin");
|
tmp_builder = builder.get_builder_with_output("bin");
|
||||||
res_file = tmp_builder.link(list_sub_file_needed_to_build,
|
res_file = tmp_builder.link(list_sub_file_needed_to_build,
|
||||||
@ -810,7 +812,21 @@ class Module:
|
|||||||
flags = self._flags,
|
flags = self._flags,
|
||||||
name = self._name,
|
name = self._name,
|
||||||
basic_path = self._origin_path,
|
basic_path = self._origin_path,
|
||||||
static = static_mode)
|
static = True)
|
||||||
|
#self._local_heritage.add_sources(res_file)
|
||||||
|
except ValueError:
|
||||||
|
debug.error("UN-SUPPORTED link format: '.bin'")
|
||||||
|
try:
|
||||||
|
tmp_builder = builder.get_builder_with_output("bin");
|
||||||
|
res_file = tmp_builder.link(list_sub_file_needed_to_build,
|
||||||
|
package_name,
|
||||||
|
target,
|
||||||
|
self._sub_heritage_list,
|
||||||
|
flags = self._flags,
|
||||||
|
name = self._name,
|
||||||
|
basic_path = self._origin_path,
|
||||||
|
static = False)
|
||||||
|
#self._local_heritage.add_sources(res_file)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.error("UN-SUPPORTED link format: '.bin'")
|
debug.error("UN-SUPPORTED link format: '.bin'")
|
||||||
elif self._type == "PACKAGE":
|
elif self._type == "PACKAGE":
|
||||||
@ -886,12 +902,16 @@ class Module:
|
|||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
if self._type[:6] == 'BINARY' \
|
if self._type[:6] == 'BINARY' \
|
||||||
or self._type == 'PACKAGE':
|
or self._type == 'PACKAGE':
|
||||||
|
debug.verbose("Request creating of package : " + str(self._name))
|
||||||
|
debug.extreme_verbose("Heritage : " + str(self._local_heritage))
|
||||||
|
# TODO : Do package for library ...
|
||||||
if target.end_generate_package == True:
|
if target.end_generate_package == True:
|
||||||
# generate the package with his properties ...
|
# generate the package with his properties ...
|
||||||
if "Android" in target.get_type():
|
if "Android" in target.get_type():
|
||||||
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, os.path.join(self._origin_path, ".."), self._sub_heritage_list)
|
elif self._type == 'PACKAGE':
|
||||||
else:
|
self._sub_heritage_list.add_heritage(self._local_heritage)
|
||||||
|
debug.extreme_verbose("HeritageList : " + str(self._sub_heritage_list))
|
||||||
target.make_package(self._name, self._package_prop, os.path.join(self._origin_path, ".."), self._sub_heritage_list)
|
target.make_package(self._name, self._package_prop, os.path.join(self._origin_path, ".."), self._sub_heritage_list)
|
||||||
# return local dependency ...
|
# return local dependency ...
|
||||||
return copy.deepcopy(self._sub_heritage_list)
|
return copy.deepcopy(self._sub_heritage_list)
|
||||||
|
@ -469,8 +469,10 @@ class Target:
|
|||||||
## @param[in] name (string) Name of the module
|
## @param[in] name (string) Name of the module
|
||||||
## @return (string) The path
|
## @return (string) The path
|
||||||
##
|
##
|
||||||
def get_build_file_bin(self, name):
|
def get_build_file_bin(self, name, static):
|
||||||
return os.path.join(self.get_build_path_bin(name), name + self.suffix_binary)
|
if static == True:
|
||||||
|
return os.path.join(self.get_build_path_bin(name), name + "_static" + self.suffix_binary)
|
||||||
|
return os.path.join(self.get_build_path_bin(name), name + "_dynamic" + self.suffix_binary)
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Get the path filename of the build static library name
|
## @brief Get the path filename of the build static library name
|
||||||
@ -721,11 +723,19 @@ class Target:
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
debug.error("target have no 'un_install_package' instruction")
|
debug.error("target have no 'un_install_package' instruction")
|
||||||
elif action_name[:3] == "run":
|
elif action_name[:3] == "run":
|
||||||
|
bin_name = None
|
||||||
if len(action_name) > 3:
|
if len(action_name) > 3:
|
||||||
|
if action_name[3] == '%':
|
||||||
|
bin_name = ""
|
||||||
|
for elem in action_name[4:]:
|
||||||
|
if elem == ":":
|
||||||
|
break;
|
||||||
|
bin_name += elem
|
||||||
# we have option:
|
# we have option:
|
||||||
action_name2 = action_name.replace("\:", "1234COLUMN4321")
|
action_name2 = action_name.replace("\:", "1234COLUMN4321")
|
||||||
option_list = action_name2.split(":")
|
option_list = action_name2.split(":")
|
||||||
if len(option_list) == 0:
|
if len(option_list) == 0:
|
||||||
|
if bin_name != None:
|
||||||
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
|
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
|
||||||
option_list = []
|
option_list = []
|
||||||
else:
|
else:
|
||||||
@ -736,7 +746,7 @@ class Target:
|
|||||||
else:
|
else:
|
||||||
option_list = []
|
option_list = []
|
||||||
#try:
|
#try:
|
||||||
self.run(module_name, option_list)
|
self.run(module_name, option_list, bin_name)
|
||||||
#except AttributeError:
|
#except AttributeError:
|
||||||
# debug.error("target have no 'run' instruction")
|
# debug.error("target have no 'run' instruction")
|
||||||
elif action_name == "log":
|
elif action_name == "log":
|
||||||
@ -843,19 +853,18 @@ class Target:
|
|||||||
if module.get_type() == 'PREBUILD':
|
if module.get_type() == 'PREBUILD':
|
||||||
#nothing to do ...
|
#nothing to do ...
|
||||||
return
|
return
|
||||||
if module.get_type() == 'LIBRARY' \
|
elif module.get_type() == 'LIBRARY' \
|
||||||
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
||||||
or module.get_type() == 'LIBRARY_STATIC':
|
or module.get_type() == 'LIBRARY_STATIC':
|
||||||
debug.info("Can not create package for library");
|
debug.info("Can not create package for library");
|
||||||
return
|
return
|
||||||
if module.get_type() == 'BINARY' \
|
elif module.get_type() == 'BINARY' \
|
||||||
or module.get_type() == 'BINARY_STAND_ALONE':
|
or module.get_type() == 'BINARY_STAND_ALONE':
|
||||||
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
|
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
|
||||||
if module.get_type() == 'BINARY_SHARED':
|
elif module.get_type() == 'BINARY_SHARED':
|
||||||
|
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
||||||
|
elif module.get_type() == 'PACKAGE':
|
||||||
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
||||||
if module.get_type() == 'PACKAGE':
|
|
||||||
debug.info("Can not create package for package");
|
|
||||||
return
|
|
||||||
debug.debug("make_package [STOP]")
|
debug.debug("make_package [STOP]")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -919,17 +928,25 @@ class Target:
|
|||||||
def make_package_binary_bin(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
|
def make_package_binary_bin(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
|
||||||
debug.debug("make_package_binary_bin [START]")
|
debug.debug("make_package_binary_bin [START]")
|
||||||
copy_list={}
|
copy_list={}
|
||||||
|
# creata basic output path
|
||||||
path_package_bin = os.path.join(path_package, self.pkg_path_bin)
|
path_package_bin = os.path.join(path_package, self.pkg_path_bin)
|
||||||
tools.create_directory_of_file(path_package_bin)
|
tools.create_directory_of_file(path_package_bin)
|
||||||
path_src = self.get_build_file_bin(pkg_name)
|
# Local module binary
|
||||||
|
path_src = self.get_build_file_bin(pkg_name, static)
|
||||||
|
if os.path.exists(path_src) == True:
|
||||||
|
try:
|
||||||
path_dst = os.path.join(path_package_bin, pkg_name + self.suffix_binary)
|
path_dst = os.path.join(path_package_bin, pkg_name + self.suffix_binary)
|
||||||
debug.verbose("path_dst: " + str(path_dst))
|
debug.verbose("path_dst: " + str(path_dst))
|
||||||
tools.copy_file(path_src,
|
tools.copy_file(path_src,
|
||||||
path_dst,
|
path_dst,
|
||||||
in_list=copy_list)
|
in_list=copy_list)
|
||||||
try:
|
except:
|
||||||
path_src = self.get_build_file_bin(pkg_name)
|
debug.extreme_verbose("can not find : " + path_src)
|
||||||
|
pass
|
||||||
|
path_src = self.get_build_file_bin(pkg_name, static)
|
||||||
path_src = path_src[:len(path_src)-4] + "js"
|
path_src = path_src[:len(path_src)-4] + "js"
|
||||||
|
if os.path.exists(path_src) == True:
|
||||||
|
try:
|
||||||
path_dst = os.path.join(path_package_bin, pkg_name + self.suffix_binary2)
|
path_dst = os.path.join(path_package_bin, pkg_name + self.suffix_binary2)
|
||||||
debug.verbose("path_dst: " + str(path_dst))
|
debug.verbose("path_dst: " + str(path_dst))
|
||||||
tools.copy_file(path_src,
|
tools.copy_file(path_src,
|
||||||
@ -938,7 +955,33 @@ class Target:
|
|||||||
except:
|
except:
|
||||||
debug.extreme_verbose("can not find : " + path_src)
|
debug.extreme_verbose("can not find : " + path_src)
|
||||||
pass
|
pass
|
||||||
|
# heritage binary
|
||||||
|
debug.debug("heritage for " + str(pkg_name) + ":")
|
||||||
|
for heritage in heritage_list.list_heritage:
|
||||||
|
debug.debug("sub elements: " + str(heritage.name))
|
||||||
|
path_src = self.get_build_file_bin(heritage.name, static)
|
||||||
|
if os.path.exists(path_src) == True:
|
||||||
|
try:
|
||||||
|
path_dst = os.path.join(path_package_bin, heritage.name + self.suffix_binary)
|
||||||
|
debug.verbose("path_dst: " + str(path_dst))
|
||||||
|
tools.copy_file(path_src,
|
||||||
|
path_dst,
|
||||||
|
in_list=copy_list)
|
||||||
|
except:
|
||||||
|
debug.extreme_verbose("can not find : " + path_src)
|
||||||
|
pass
|
||||||
|
path_src = self.get_build_file_bin(heritage.name, static)
|
||||||
|
path_src = path_src[:len(path_src)-4] + "js"
|
||||||
|
if os.path.exists(path_src) == True:
|
||||||
|
try:
|
||||||
|
path_dst = os.path.join(path_package_bin, heritage.name + self.suffix_binary2)
|
||||||
|
debug.verbose("path_dst: " + str(path_dst))
|
||||||
|
tools.copy_file(path_src,
|
||||||
|
path_dst,
|
||||||
|
in_list=copy_list)
|
||||||
|
except:
|
||||||
|
debug.extreme_verbose("can not find : " + path_src)
|
||||||
|
pass
|
||||||
#real copy files
|
#real copy files
|
||||||
ret_copy = tools.copy_list(copy_list)
|
ret_copy = tools.copy_list(copy_list)
|
||||||
ret_remove = False
|
ret_remove = False
|
||||||
@ -1068,7 +1111,7 @@ class Target:
|
|||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.error("action not implemented ...")
|
debug.error("action not implemented ...")
|
||||||
|
|
||||||
def run(self, pkg_name, option_list):
|
def run(self, pkg_name, option_list, binary_name = None):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
@ -59,7 +59,7 @@ def get_support_multithreading():
|
|||||||
##
|
##
|
||||||
def link(file, binary, target, depancy, flags, name, basic_path, static = False):
|
def link(file, binary, target, depancy, flags, name, basic_path, static = False):
|
||||||
file_src = file
|
file_src = file
|
||||||
file_dst = target.get_build_file_bin(binary)
|
file_dst = target.get_build_file_bin(name, static)
|
||||||
file_depend = file_dst + target.suffix_dependence
|
file_depend = file_dst + target.suffix_dependence
|
||||||
file_cmd = file_dst + target.suffix_cmd_line
|
file_cmd = file_dst + target.suffix_cmd_line
|
||||||
file_warning = file_dst + target.suffix_warning
|
file_warning = file_dst + target.suffix_warning
|
||||||
@ -128,7 +128,7 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
|
|||||||
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
cmd.append("-Wl,-rpath,\"\$ORIGIN/../lib\"")
|
cmd.append("-Wl,-rpath,\"$ORIGIN/../lib\"")
|
||||||
try:
|
try:
|
||||||
cmd.append(flags["local"]["link"])
|
cmd.append(flags["local"]["link"])
|
||||||
except:
|
except:
|
||||||
|
@ -462,7 +462,7 @@ class Target(target.Target):
|
|||||||
cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log"
|
cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log"
|
||||||
multiprocess.run_command_no_lock_out(cmdLine)
|
multiprocess.run_command_no_lock_out(cmdLine)
|
||||||
|
|
||||||
def run(self, pkg_name, option_list):
|
def run(self, pkg_name, option_list, binary_name = None):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
@ -162,11 +162,13 @@ class Target(target.Target):
|
|||||||
# remove executable link version:
|
# remove executable link version:
|
||||||
tools.remove_file(target_bin_link)
|
tools.remove_file(target_bin_link)
|
||||||
|
|
||||||
def run(self, pkg_name, option_list):
|
def run(self, pkg_name, option_list, binary_name = None):
|
||||||
|
if binary_name == None:
|
||||||
|
binary_name = pkg_name;
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
debug.info("-- Run package '" + pkg_name + "' executable: '" + binary_name + "' + option: " + str(option_list))
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", "bin", pkg_name)
|
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", "bin", binary_name)
|
||||||
cmd = appl_path + " "
|
cmd = appl_path + " "
|
||||||
for elem in option_list:
|
for elem in option_list:
|
||||||
cmd += elem + " "
|
cmd += elem + " "
|
||||||
|
@ -173,7 +173,7 @@ class Target(target.Target):
|
|||||||
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
||||||
shutil.rmtree("/Applications/" + pkg_name + ".app")
|
shutil.rmtree("/Applications/" + pkg_name + ".app")
|
||||||
|
|
||||||
def run(self, pkg_name, option_list):
|
def run(self, pkg_name, option_list, binary_name = None):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("-- Run package '" + pkg_name + "'")
|
debug.info("-- Run package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
@ -213,7 +213,7 @@ class Target(lutinTarget_Linux.Target):
|
|||||||
# remove executable link version:
|
# remove executable link version:
|
||||||
tools.remove_file(target_bin_link)
|
tools.remove_file(target_bin_link)
|
||||||
|
|
||||||
def run(self, pkg_name, option_list):
|
def run(self, pkg_name, option_list, binary_name = None):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
@ -196,7 +196,7 @@ class Target(target.Target):
|
|||||||
debug.warning(" ==> TODO")
|
debug.warning(" ==> TODO")
|
||||||
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
||||||
|
|
||||||
def run(self, pkg_name, option_list):
|
def run(self, pkg_name, option_list, binary_name = None):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user