[DEV] try think at a correct package

This commit is contained in:
Edouard DUPIN 2016-11-23 00:10:37 +01:00
parent 49bb4ffa2b
commit fad39e0bb9
2 changed files with 20 additions and 13 deletions

View File

@ -512,13 +512,14 @@ class Module:
# create the package heritage # create the package heritage
self._local_heritage = heritage.heritage(self, target) self._local_heritage = heritage.heritage(self, target)
if package_name==None \ if package_name == None \
and ( self._type == 'BINARY' and ( self._type == 'BINARY'
or self._type == 'BINARY_SHARED' \ or self._type == 'BINARY_SHARED' \
or self._type == 'BINARY_STAND_ALONE' \ or self._type == 'BINARY_STAND_ALONE' \
or self._type == 'PACKAGE' ) : or self._type == 'PACKAGE' ) :
# this is the endpoint binary ... # this is the endpoint binary ...
package_name = self._name package_name = self._name
debug.warning("package name = " + package_name)
else: else:
pass pass
# build dependency before # build dependency before
@ -527,7 +528,7 @@ class Module:
# optionnal dependency : # optionnal dependency :
for dep, option, export, src_file, header_file, option_not_found in self._depends_optionnal: for dep, option, export, src_file, header_file, option_not_found in self._depends_optionnal:
debug.verbose("try find optionnal dependency: '" + str(dep) + "'") debug.verbose("try find optionnal dependency: '" + str(dep) + "'")
inherit_list, isBuilt = target.build(dep, True) inherit_list, isBuilt = target.build(dep, True, package_name=package_name)
if isBuilt == True: if isBuilt == True:
self._local_heritage.add_depends(dep); self._local_heritage.add_depends(dep);
self.add_flag(option[0], option[1], export=export); self.add_flag(option[0], option[1], export=export);
@ -539,7 +540,7 @@ class Module:
self._sub_heritage_list.add_heritage_list(inherit_list) self._sub_heritage_list.add_heritage_list(inherit_list)
for dep in self._depends: for dep in self._depends:
debug.debug("module: '" + str(self._name) + "' request: '" + dep + "'") debug.debug("module: '" + str(self._name) + "' request: '" + dep + "'")
inherit_list = target.build(dep, False) inherit_list = target.build(dep, False, package_name=package_name)
# add at the heritage list : # add at the heritage list :
self._sub_heritage_list.add_heritage_list(inherit_list) self._sub_heritage_list.add_heritage_list(inherit_list)
# do sub library action for automatic generating ... # do sub library action for automatic generating ...
@ -633,7 +634,8 @@ class Module:
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# -- Sources compilation -- # -- Sources compilation --
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
if self._type != 'PREBUILD': if self._type != 'PREBUILD' \
and self._type != 'PACKAGE':
# build local sources in a specific order: # build local sources in a specific order:
for extention_local in self._extention_order_build: for extention_local in self._extention_order_build:
list_file = tools.filter_extention(self._src, [extention_local]) list_file = tools.filter_extention(self._src, [extention_local])
@ -699,7 +701,7 @@ class Module:
# ---------------------------------------------------- # ----------------------------------------------------
# -- Generation point -- # -- Generation point --
# ---------------------------------------------------- # ----------------------------------------------------
if self._type=='PREBUILD': if self._type == 'PREBUILD':
self._local_heritage.add_sources(self._src) self._local_heritage.add_sources(self._src)
elif self._type == 'LIBRARY' \ elif self._type == 'LIBRARY' \
or self._type == 'LIBRARY_DYNAMIC' \ or self._type == 'LIBRARY_DYNAMIC' \
@ -797,7 +799,7 @@ class Module:
basic_path = self._origin_path) 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'")
else: else:
try: try:
tmp_builder = builder.get_builder_with_output("bin"); tmp_builder = builder.get_builder_with_output("bin");
@ -810,7 +812,7 @@ class Module:
basic_path = self._origin_path, basic_path = self._origin_path,
static = static_mode) static = static_mode)
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":
if "Android" in target.get_type(): if "Android" in target.get_type():
# special case for android wrapper: # special case for android wrapper:
@ -826,7 +828,7 @@ class Module:
basic_path = self._origin_path) 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'")
try: try:
tmp_builder = builder.get_builder_with_output("jar"); tmp_builder = builder.get_builder_with_output("jar");
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type()) list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
@ -842,6 +844,9 @@ class Module:
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.jar'") debug.error(" UN-SUPPORTED link format: '.jar'")
else: else:
pass
# TODO : Check this but I this this is not needed ==> a package can not have build stage ...
"""
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,
@ -853,6 +858,7 @@ class Module:
basic_path = self._origin_path) basic_path = self._origin_path)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: 'binary'") debug.error(" UN-SUPPORTED link format: 'binary'")
"""
elif self._type == "DATA": elif self._type == "DATA":
debug.debug("Data package have noting to build... just install") debug.debug("Data package have noting to build... just install")
else: else:

View File

@ -635,9 +635,10 @@ class Target:
## @param[in] name (string) Module to build ## @param[in] name (string) Module to build
## @param[in] optionnal (bool) If the module is not accessible, this is not a probleme ==> optionnal dependency requested ## @param[in] optionnal (bool) If the module is not accessible, this is not a probleme ==> optionnal dependency requested
## @param[in] actions ([string,...]) list of action to do. ex: build, gcov, dump, all, clean, install, uninstall, run, log ## @param[in] actions ([string,...]) list of action to do. ex: build, gcov, dump, all, clean, install, uninstall, run, log
## @param[in] package_name Current package name that request the build
## @return (None|Module handle| ...) complicated return ... ## @return (None|Module handle| ...) complicated return ...
## ##
def build(self, name, optionnal=False, actions=[]): def build(self, name, optionnal=False, actions=[], package_name=None):
if len(name.split("?")) != 1\ if len(name.split("?")) != 1\
or len(name.split("@")) != 1: or len(name.split("@")) != 1:
debug.error("need update") debug.error("need update")
@ -693,11 +694,11 @@ class Target:
for mod in self.module_list: for mod in self.module_list:
if self._name == "Android": if self._name == "Android":
if mod.get_type() == "PACKAGE": if mod.get_type() == "PACKAGE":
mod.build(self, None) mod.build(self, package_name)
else: else:
if mod.get_type() == "BINARY" \ if mod.get_type() == "BINARY" \
or mod.get_type() == "PACKAGE": or mod.get_type() == "PACKAGE":
mod.build(self, None) mod.build(self, package_name)
elif name == "clean": elif name == "clean":
debug.info("clean all") debug.info("clean all")
self.load_all() self.load_all()
@ -786,9 +787,9 @@ class Target:
debug.warning("action 'build' does not support options ... : '" + action_name + "'") debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'") debug.debug("build module '" + module_name + "'")
if optionnal == True: if optionnal == True:
ret = [mod.build(self, None), True] ret = [mod.build(self, package_name), True]
else: else:
ret = mod.build(self, None) ret = mod.build(self, package_name)
break break
if optionnal == True \ if optionnal == True \
and ret == None: and ret == None: