[DEV] review methodologie of build
This commit is contained in:
parent
10c0f98cef
commit
22965f5a57
@ -21,7 +21,7 @@ is_init = False
|
||||
|
||||
if is_init == False:
|
||||
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__))
|
||||
module.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...");
|
||||
# Import all sub path without out and archive
|
||||
for folder in os.listdir("."):
|
||||
if os.path.isdir(folder)==True:
|
||||
if folder.lower()!="android" \
|
||||
and folder.lower()!="archive" \
|
||||
and folder.lower()!="out" :
|
||||
debug.debug("Automatic load path: '" + folder + "'")
|
||||
builder.import_path(folder)
|
||||
module.import_path(folder)
|
||||
system.import_path(folder)
|
||||
target.import_path(folder)
|
||||
for path in os.listdir("."):
|
||||
if os.path.isdir(path)==True:
|
||||
if path.lower()!="android" \
|
||||
and path.lower()!="archive" \
|
||||
and path.lower()!="out" :
|
||||
debug.debug("Automatic load path: '" + path + "'")
|
||||
builder.import_path(path)
|
||||
module.import_path(path)
|
||||
system.import_path(path)
|
||||
target.import_path(path)
|
||||
|
||||
builder.init()
|
||||
|
||||
|
@ -75,7 +75,7 @@ def resize(srcFile, destFile, x, y, cmd_file=None):
|
||||
else:
|
||||
debug.error(" can not manage extention ... : " + destFile)
|
||||
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)
|
||||
if im1.size[0] <= x:
|
||||
# for small image just copy:
|
||||
|
108
lutin/module.py
108
lutin/module.py
@ -34,7 +34,7 @@ class Module:
|
||||
## Remove all variable to prevent error of multiple deffinition of the module ...
|
||||
debug.verbose("Create a new module : '" + moduleName + "' TYPE=" + moduleType)
|
||||
self.origin_file=''
|
||||
self.origin_folder=''
|
||||
self.origin_path=''
|
||||
# type of the module:
|
||||
self.type='LIBRARY'
|
||||
# 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 ...
|
||||
# sources list:
|
||||
self.src = []
|
||||
# copy files and folders:
|
||||
# copy files and paths:
|
||||
self.image_to_copy = []
|
||||
self.files = []
|
||||
self.folders = []
|
||||
self.paths = []
|
||||
self.isbuild = False
|
||||
|
||||
## end of basic INIT ...
|
||||
@ -73,7 +73,7 @@ class Module:
|
||||
debug.error(' ==> error : "%s" ' %moduleType)
|
||||
raise 'Input value error'
|
||||
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.package_prop = { "COMPAGNY_TYPE" : set(""),
|
||||
@ -134,14 +134,14 @@ class Module:
|
||||
and sizeX > 0:
|
||||
debug.error("Can not manage image other than .png and jpg to resize : " + source);
|
||||
displaySource = source
|
||||
source = self.origin_folder + "/" + source
|
||||
source = self.origin_path + "/" + source
|
||||
if destination == "":
|
||||
destination = source[source.rfind('/')+1:]
|
||||
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:
|
||||
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)
|
||||
else:
|
||||
debug.verbose("Might copy file : " + displaySource + " ==> " + destination)
|
||||
@ -153,11 +153,11 @@ class Module:
|
||||
def files_to_staging(self, binary_name, target):
|
||||
for source, destination in self.files:
|
||||
displaySource = source
|
||||
source = self.origin_folder + "/" + source
|
||||
source = self.origin_path + "/" + source
|
||||
if destination == "":
|
||||
destination = source[source.rfind('/')+1:]
|
||||
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 ...
|
||||
debug.verbose("Might copy file : " + displaySource + " ==> " + destination)
|
||||
target.add_file_staging(source, destination, file_cmd)
|
||||
@ -165,10 +165,10 @@ class Module:
|
||||
##
|
||||
## @brief Commands for copying files
|
||||
##
|
||||
def folders_to_staging(self, binary_name, target):
|
||||
for source, destination in self.folders:
|
||||
debug.debug("Might copy folder : " + source + "==>" + destination)
|
||||
tools.copy_anything_target(target, self.origin_folder + "/" + source, destination)
|
||||
def paths_to_staging(self, binary_name, target):
|
||||
for source, destination in self.paths:
|
||||
debug.debug("Might copy path : " + source + "==>" + destination)
|
||||
tools.copy_anything_target(target, self.origin_path + "/" + source, destination)
|
||||
|
||||
def gcov(self, target, generate_output=False):
|
||||
if self.type == 'PREBUILD':
|
||||
@ -179,7 +179,7 @@ class Module:
|
||||
global_list_file = ""
|
||||
for file in list_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 + " "
|
||||
cmd = "gcov"
|
||||
# specify the version of gcov we need to use
|
||||
@ -209,11 +209,11 @@ class Module:
|
||||
remove_next = True
|
||||
continue
|
||||
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
|
||||
continue
|
||||
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
|
||||
start_with = "Lines executed:"
|
||||
if elem[:len(start_with)] != start_with:
|
||||
@ -245,7 +245,7 @@ class Module:
|
||||
debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
|
||||
pourcent = 100.0*float(executed_lines)/float(executable_lines)
|
||||
# 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)
|
||||
tmp_file = open(json_file_name, 'w')
|
||||
tmp_file.write('{\n')
|
||||
@ -336,7 +336,7 @@ class Module:
|
||||
flags = self.flags,
|
||||
path = self.path,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
basic_path = self.origin_path)
|
||||
if res_file["action"] == "add":
|
||||
list_sub_file_needed_to_build.append(res_file["file"])
|
||||
elif res_file["action"] == "path":
|
||||
@ -344,7 +344,7 @@ class Module:
|
||||
else:
|
||||
debug.error("an not do action for : " + str(res_file))
|
||||
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 :
|
||||
list_file = tools.filter_extention(self.src, self.extention_order_build, invert=True)
|
||||
for file in list_file:
|
||||
@ -359,7 +359,7 @@ class Module:
|
||||
flags = self.flags,
|
||||
path = self.path,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
basic_path = self.origin_path)
|
||||
if res_file["action"] == "add":
|
||||
list_sub_file_needed_to_build.append(res_file["file"])
|
||||
elif res_file["action"] == "path":
|
||||
@ -367,7 +367,7 @@ class Module:
|
||||
else:
|
||||
debug.error("an not do action for : " + str(res_file))
|
||||
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 ...
|
||||
multiprocess.pool_synchrosize()
|
||||
|
||||
@ -385,8 +385,18 @@ class Module:
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
basic_path = self.origin_path)
|
||||
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:
|
||||
debug.error(" UN-SUPPORTED link format: '.a'")
|
||||
try:
|
||||
@ -398,7 +408,7 @@ class Module:
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.jar'")
|
||||
@ -410,7 +420,7 @@ class Module:
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
basic_path = self.origin_path)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.bin'")
|
||||
# generate tree for this special binary
|
||||
@ -428,7 +438,7 @@ class Module:
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = "lib" + self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.so'")
|
||||
@ -441,7 +451,7 @@ class Module:
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.jar'")
|
||||
@ -453,7 +463,7 @@ class Module:
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
basic_path = self.origin_path)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: 'binary'")
|
||||
target.clean_module_tree()
|
||||
@ -464,9 +474,9 @@ class Module:
|
||||
# generate the package with his properties ...
|
||||
if target.name=="Android":
|
||||
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:
|
||||
target.make_package(self.name, self.package_prop, self.origin_folder + "/..")
|
||||
target.make_package(self.name, self.package_prop, self.origin_path + "/..")
|
||||
else:
|
||||
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)
|
||||
self.image_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
|
||||
for dep in self.depends:
|
||||
inherit = target.build_tree(dep, package_name)
|
||||
@ -495,19 +505,19 @@ class Module:
|
||||
# nothing to add ==> just dependence
|
||||
None
|
||||
elif self.type=='LIBRARY':
|
||||
# remove folder of the lib ... for this targer
|
||||
folderbuild = target.get_build_folder(self.name)
|
||||
debug.info("remove folder : '" + folderbuild + "'")
|
||||
tools.remove_folder_and_sub_folder(folderbuild)
|
||||
# remove path of the lib ... for this targer
|
||||
pathbuild = target.get_build_path(self.name)
|
||||
debug.info("remove path : '" + pathbuild + "'")
|
||||
tools.remove_path_and_sub_path(pathbuild)
|
||||
elif self.type=='BINARY' \
|
||||
or self.type=='PACKAGE':
|
||||
# remove folder of the lib ... for this targer
|
||||
folderbuild = target.get_build_folder(self.name)
|
||||
debug.info("remove folder : '" + folderbuild + "'")
|
||||
tools.remove_folder_and_sub_folder(folderbuild)
|
||||
folderStaging = target.get_staging_folder(self.name)
|
||||
debug.info("remove folder : '" + folderStaging + "'")
|
||||
tools.remove_folder_and_sub_folder(folderStaging)
|
||||
# remove path of the lib ... for this targer
|
||||
pathbuild = target.get_build_path(self.name)
|
||||
debug.info("remove path : '" + pathbuild + "'")
|
||||
tools.remove_path_and_sub_path(pathbuild)
|
||||
pathStaging = target.get_staging_path(self.name)
|
||||
debug.info("remove path : '" + pathStaging + "'")
|
||||
tools.remove_path_and_sub_path(pathStaging)
|
||||
else:
|
||||
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=''):
|
||||
self.files.append([source, destination])
|
||||
|
||||
def copy_folder(self, source, destination=''):
|
||||
self.folders.append([source, destination])
|
||||
def copy_path(self, source, destination=''):
|
||||
self.paths.append([source, destination])
|
||||
|
||||
def print_list(self, description, list):
|
||||
if len(list) > 0:
|
||||
@ -607,7 +617,7 @@ class Module:
|
||||
print('-----------------------------------------------')
|
||||
print(' type:"' + str(self.type) + "'")
|
||||
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_optionnal', self.depends_optionnal)
|
||||
@ -622,7 +632,7 @@ class Module:
|
||||
|
||||
self.print_list('src',self.src)
|
||||
self.print_list('files',self.files)
|
||||
self.print_list('folders',self.folders)
|
||||
self.print_list('paths',self.paths)
|
||||
for element in self.path["local"]:
|
||||
value = self.path["local"][element]
|
||||
self.print_list('local path ' + element, value)
|
||||
@ -717,10 +727,10 @@ class Module:
|
||||
return
|
||||
added_module.append(self.name)
|
||||
debug.verbose("add a module to the project generator :" + self.name)
|
||||
debug.verbose("local path :" + self.origin_folder)
|
||||
projectMng.add_files(self.name, self.origin_folder, self.src)
|
||||
#projectMng.add_data_file(self.origin_folder, self.files)
|
||||
#projectMng.add_data_folder(self.origin_folder, self.folders)
|
||||
debug.verbose("local path :" + self.origin_path)
|
||||
projectMng.add_files(self.name, self.origin_path, self.src)
|
||||
#projectMng.add_data_file(self.origin_path, self.files)
|
||||
#projectMng.add_data_path(self.origin_path, self.paths)
|
||||
"""
|
||||
for depend in self.depends:
|
||||
target.project_add_module(depend, projectMng, added_module)
|
||||
|
182
lutin/target.py
182
lutin/target.py
@ -83,8 +83,8 @@ class Target:
|
||||
self.suffix_binary=''
|
||||
self.suffix_package='.deb'
|
||||
|
||||
self.folder_generate_code="/generate_header"
|
||||
self.folder_arch="/" + self.name
|
||||
self.path_generate_code="/generate_header"
|
||||
self.path_arch="/" + self.name
|
||||
|
||||
if "debug" == self.config["mode"]:
|
||||
self.global_flags_cc.append("-g")
|
||||
@ -101,17 +101,18 @@ class Target:
|
||||
self.global_flags_ld.append("-fprofile-arcs")
|
||||
self.global_flags_ld.append("-ftest-coverage")
|
||||
|
||||
self.update_folder_tree()
|
||||
self.update_path_tree()
|
||||
"""
|
||||
self.folder_bin="/usr/bin"
|
||||
self.folder_lib="/usr/lib"
|
||||
self.folder_data="/usr/share"
|
||||
self.folder_doc="/usr/share/doc"
|
||||
self.path_bin="usr/bin"
|
||||
self.path_lib="usr/lib"
|
||||
self.path_data="usr/share"
|
||||
self.path_doc="usr/share/doc"
|
||||
"""
|
||||
self.folder_bin="/bin"
|
||||
self.folder_lib="/lib"
|
||||
self.folder_data="/share"
|
||||
self.folder_doc="/doc"
|
||||
self.path_bin="bin"
|
||||
self.path_lib="lib"
|
||||
self.path_data="share"
|
||||
self.path_doc="doc"
|
||||
self.path_doc="include"
|
||||
|
||||
|
||||
self.build_done=[]
|
||||
@ -124,11 +125,11 @@ class Target:
|
||||
|
||||
self.action_on_state={}
|
||||
|
||||
def update_folder_tree(self):
|
||||
self.folder_out="/out/" + self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"] + "/" + self.config["mode"]
|
||||
self.folder_final="/final/" + self.config["compilator"]
|
||||
self.folder_staging="/staging/" + self.config["compilator"]
|
||||
self.folder_build="/build/" + self.config["compilator"]
|
||||
def update_path_tree(self):
|
||||
self.path_out = os.path.join("out", self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"], self.config["mode"])
|
||||
self.path_final = os.path.join("final", self.config["compilator"])
|
||||
self.path_staging = os.path.join("staging", self.config["compilator"])
|
||||
self.path_build = os.path.join("build", self.config["compilator"])
|
||||
|
||||
def create_number_from_version_string(self, data):
|
||||
list = data.split(".")
|
||||
@ -179,7 +180,7 @@ class Target:
|
||||
self.nm = self.cross + "nm"
|
||||
self.strip = self.cross + "strip"
|
||||
self.dlltool = self.cross + "dlltool"
|
||||
self.update_folder_tree()
|
||||
self.update_path_tree()
|
||||
|
||||
def get_build_mode(self):
|
||||
return self.config["mode"]
|
||||
@ -200,46 +201,40 @@ class Target:
|
||||
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'");
|
||||
self.list_final_file.append([inputFile, outputFile, -1, -1, cmdFile])
|
||||
|
||||
def copy_to_staging(self, binaryName):
|
||||
baseFolder = self.get_staging_folder_data(binaryName)
|
||||
def copy_to_staging(self, binary_name):
|
||||
base_path = self.get_staging_path_data(binary_name)
|
||||
for source, dst, x, y, cmdFile in self.list_final_file:
|
||||
if cmdFile != None \
|
||||
and cmdFile != "":
|
||||
debug.verbose("cmd file " + cmdFile)
|
||||
if x == -1:
|
||||
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:
|
||||
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):
|
||||
self.build_tree_done = []
|
||||
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):
|
||||
if file[0] == '/':
|
||||
if tools.os.path.isfile(file):
|
||||
return 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 tools.os.path.isfile(file):
|
||||
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):
|
||||
return self.get_build_folder(moduleName) + "/" + file + self.suffix_warning;
|
||||
def get_full_name_warning(self, module_name, basePath, file):
|
||||
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:
|
||||
if file[-4:] == "java":
|
||||
for elem in ["org/", "com/"]:
|
||||
@ -254,10 +249,10 @@ class Target:
|
||||
suffix = suffix[0]
|
||||
else:
|
||||
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):
|
||||
return self.get_build_folder(moduleName) + "/" + file + self.suffix_dependence
|
||||
def get_full_dependency(self, module_name, basePath, file):
|
||||
return self.get_build_path(module_name) + "/" + file + self.suffix_dependence
|
||||
|
||||
"""
|
||||
return a list of 3 elements :
|
||||
@ -265,52 +260,87 @@ class Target:
|
||||
1 : destination file
|
||||
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=[]
|
||||
if (type=="bin"):
|
||||
list.append(file)
|
||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + 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))
|
||||
list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_dependence))
|
||||
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(os.path.join(self.get_build_path(binary_name), self.path_bin, module_name + self.suffix_binary + self.suffix_warning))
|
||||
elif (type=="lib-shared"):
|
||||
list.append(file)
|
||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + 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))
|
||||
list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_dependence))
|
||||
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(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"):
|
||||
list.append(file)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + 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))
|
||||
list.append(os.path.join(self.get_build_path(module_name), module_name + self.suffix_dependence))
|
||||
list.append(os.path.join(self.get_build_path(module_name), module_name + 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_warning))
|
||||
elif (type=="jar"):
|
||||
list.append(file)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar")
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".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"))
|
||||
list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar" + self.suffix_dependence))
|
||||
list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar" + self.suffix_cmd_line))
|
||||
list.append(os.path.join(self.get_build_path(module_name), module_name + ".jar" + self.suffix_warning))
|
||||
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:
|
||||
debug.error("unknow type : " + type)
|
||||
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):
|
||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName
|
||||
def get_staging_path(self, binary_name):
|
||||
return os.path.join(tools.get_run_path(), self.path_out, self.path_staging, binary_name)
|
||||
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data + "/" + binaryName
|
||||
def get_build_path(self, module_name):
|
||||
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):
|
||||
return tools.get_run_folder() + self.folder_out + self.folder_doc + "/" + moduleName
|
||||
def get_build_path_bin(self, binary_name):
|
||||
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):
|
||||
for mod in self.build_done:
|
||||
@ -418,7 +448,7 @@ class Target:
|
||||
else:
|
||||
# get the action an the module ....
|
||||
gettedElement = name.split("?")
|
||||
moduleName = gettedElement[0]
|
||||
module_name = gettedElement[0]
|
||||
if len(gettedElement)>=3:
|
||||
sub_action_name = gettedElement[2]
|
||||
else:
|
||||
@ -427,41 +457,41 @@ class Target:
|
||||
actionName = gettedElement[1]
|
||||
else :
|
||||
actionName = "build"
|
||||
debug.verbose("requested : " + moduleName + "?" + actionName)
|
||||
debug.verbose("requested : " + module_name + "?" + actionName)
|
||||
if actionName == "install":
|
||||
self.build(moduleName + "?build")
|
||||
self.install_package(moduleName)
|
||||
self.build(module_name + "?build")
|
||||
self.install_package(module_name)
|
||||
elif actionName == "uninstall":
|
||||
self.un_install_package(moduleName)
|
||||
self.un_install_package(module_name)
|
||||
elif actionName == "log":
|
||||
self.Log(moduleName)
|
||||
self.Log(module_name)
|
||||
else:
|
||||
present = self.load_if_needed(moduleName, optionnal=optionnal)
|
||||
present = self.load_if_needed(module_name, optionnal=optionnal)
|
||||
if present == False \
|
||||
and optionnal == True:
|
||||
return [heritage.HeritageList(), False]
|
||||
# clean requested
|
||||
for mod in self.module_list:
|
||||
if mod.name == moduleName:
|
||||
if mod.name == module_name:
|
||||
if actionName == "dump":
|
||||
debug.info("dump module '" + moduleName + "'")
|
||||
debug.info("dump module '" + module_name + "'")
|
||||
return mod.display(self)
|
||||
elif actionName == "clean":
|
||||
debug.info("clean module '" + moduleName + "'")
|
||||
debug.info("clean module '" + module_name + "'")
|
||||
return mod.clean(self)
|
||||
elif actionName == "gcov":
|
||||
debug.debug("gcov on module '" + moduleName + "'")
|
||||
debug.debug("gcov on module '" + module_name + "'")
|
||||
if sub_action_name == "output":
|
||||
return mod.gcov(self, generate_output=True)
|
||||
return mod.gcov(self, generate_output=False)
|
||||
elif actionName == "build":
|
||||
debug.debug("build module '" + moduleName + "'")
|
||||
debug.debug("build module '" + module_name + "'")
|
||||
if optionnal == True:
|
||||
return [mod.build(self, None), True]
|
||||
return mod.build(self, None)
|
||||
if optionnal == True:
|
||||
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):
|
||||
debug.verbose("add action : " + name)
|
||||
|
@ -20,7 +20,7 @@ from . import env
|
||||
"""
|
||||
|
||||
"""
|
||||
def get_run_folder():
|
||||
def get_run_path():
|
||||
return os.getcwd()
|
||||
|
||||
"""
|
||||
@ -30,21 +30,21 @@ def get_current_path(file):
|
||||
return os.path.dirname(os.path.realpath(file))
|
||||
|
||||
def create_directory_of_file(file):
|
||||
folder = os.path.dirname(file)
|
||||
path = os.path.dirname(file)
|
||||
try:
|
||||
os.stat(folder)
|
||||
os.stat(path)
|
||||
except:
|
||||
os.makedirs(folder)
|
||||
os.makedirs(path)
|
||||
|
||||
def get_list_sub_folder(path):
|
||||
def get_list_sub_path(path):
|
||||
# TODO : os.listdir(path)
|
||||
for dirname, dirnames, filenames in os.walk(path):
|
||||
return dirnames
|
||||
return []
|
||||
|
||||
def remove_folder_and_sub_folder(path):
|
||||
def remove_path_and_sub_path(path):
|
||||
if os.path.isdir(path):
|
||||
debug.verbose("remove folder : '" + path + "'")
|
||||
debug.verbose("remove path : '" + path + "'")
|
||||
shutil.rmtree(path)
|
||||
|
||||
def remove_file(path):
|
||||
|
@ -40,8 +40,8 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to link an executable.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_folder):
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "bin")
|
||||
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_path, file, "bin")
|
||||
#create comdLine :
|
||||
cmd = [
|
||||
target.xx
|
||||
|
@ -40,12 +40,12 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to compile a C file in object file.
|
||||
##
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_src = target.get_full_name_source(basic_folder, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_path):
|
||||
file_src = target.get_full_name_source(basic_path, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
|
@ -39,12 +39,12 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to compile a C++ file in object file.
|
||||
##
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_src = target.get_full_name_source(basic_folder, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_path):
|
||||
file_src = target.get_full_name_source(basic_path, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
target.xx,
|
||||
|
@ -38,8 +38,8 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to link a shared library.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_folder):
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "jar")
|
||||
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_path, file, "jar")
|
||||
#create command Line
|
||||
cmd = [
|
||||
target.jar,
|
||||
|
@ -36,16 +36,16 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to compile a C++ file in object file.
|
||||
##
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_src = target.get_full_name_source(basic_folder, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type(), remove_suffix=True)
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_path):
|
||||
file_src = target.get_full_name_source(basic_path, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||
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_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
target.java,
|
||||
"-d", target.get_build_folder(name)
|
||||
"-d", target.get_build_path(name)
|
||||
]
|
||||
# add source dependency:
|
||||
list_sources_path = []
|
||||
|
@ -36,29 +36,29 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to compile a C++ file in object file.
|
||||
##
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
# file_src = target.get_full_name_source(basic_folder, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
# file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_path):
|
||||
# file_src = target.get_full_name_source(basic_path, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||
# file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
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:
|
||||
cmd.append("-verbose")
|
||||
|
||||
cmd.append("-classpath")
|
||||
cmd.append(target.get_build_folder(name))
|
||||
cmd.append(target.get_build_path(name))
|
||||
class_to_build = file[:-6]
|
||||
cmd.append(class_to_build)
|
||||
# Create cmd line
|
||||
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 :
|
||||
#if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
||||
# 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)
|
||||
debug.verbose("file= " + 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}
|
||||
|
||||
|
@ -38,8 +38,8 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to link a shared library.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_folder):
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "lib-shared")
|
||||
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_path, file, "lib-shared")
|
||||
#create command Line
|
||||
cmd = [
|
||||
target.xx,
|
||||
|
@ -38,8 +38,8 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running ar.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_folder):
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "lib-static")
|
||||
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_path, file, "lib-static")
|
||||
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
||||
cmd = [
|
||||
target.ar
|
||||
|
@ -41,12 +41,12 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to compile a m file in object file.
|
||||
##
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_src = target.get_full_name_source(basic_folder, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_path):
|
||||
file_src = target.get_full_name_source(basic_path, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
target.cc,
|
||||
|
@ -41,12 +41,12 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to compile a m++ file in object file.
|
||||
##
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_src = target.get_full_name_source(basic_folder, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
def compile(file, binary, target, depancy, flags, path, name, basic_path):
|
||||
file_src = target.get_full_name_source(basic_path, file)
|
||||
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
target.xx,
|
||||
|
@ -33,28 +33,28 @@ class Target(target.Target):
|
||||
else:
|
||||
arch="arm64"
|
||||
|
||||
self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
|
||||
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
||||
self.path_ndk = os.getenv('PROJECT_NDK', "AUTO")
|
||||
self.path_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
||||
# auto search NDK
|
||||
if self.folder_ndk == "AUTO":
|
||||
for folder in os.listdir("."):
|
||||
if os.path.isdir(folder)==True:
|
||||
if folder=="android":
|
||||
self.folder_ndk = folder + "/ndk"
|
||||
if self.folder_ndk == "AUTO":
|
||||
self.folder_ndk = tools.get_run_folder() + "/../android/ndk"
|
||||
if self.path_ndk == "AUTO":
|
||||
for path in os.listdir("."):
|
||||
if os.path.isdir(path)==True:
|
||||
if path=="android":
|
||||
self.path_ndk = path + "/ndk"
|
||||
if self.path_ndk == "AUTO":
|
||||
self.path_ndk = tools.get_run_path() + "/../android/ndk"
|
||||
# auto search SDK
|
||||
if self.folder_sdk == "AUTO":
|
||||
for folder in os.listdir("."):
|
||||
if os.path.isdir(folder)==True:
|
||||
if folder=="android":
|
||||
self.folder_sdk = folder + "/sdk"
|
||||
if self.folder_sdk == "AUTO":
|
||||
self.folder_sdk = tools.get_run_folder() + "/../android/sdk"
|
||||
if self.path_sdk == "AUTO":
|
||||
for path in os.listdir("."):
|
||||
if os.path.isdir(path)==True:
|
||||
if path=="android":
|
||||
self.path_sdk = path + "/sdk"
|
||||
if self.path_sdk == "AUTO":
|
||||
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")
|
||||
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")
|
||||
|
||||
|
||||
@ -63,34 +63,34 @@ class Target(target.Target):
|
||||
if host.BUS_SIZE==64:
|
||||
tmpOsVal = "_64"
|
||||
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:
|
||||
baseFolderArm = self.folder_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/"
|
||||
baseFolderX86 = self.folder_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
self.set_cross_base(baseFolderArm + "arm-linux-androideabi-")
|
||||
if not os.path.isdir(baseFolderArm):
|
||||
basepathArm = self.path_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
basepathMips = self.path_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
basepathX86 = self.path_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
self.set_cross_base(basepathArm + "arm-linux-androideabi-")
|
||||
if not os.path.isdir(basepathArm):
|
||||
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 !!!")
|
||||
if not os.path.isdir(baseFolderX86):
|
||||
if not os.path.isdir(basepathX86):
|
||||
debug.info("Gcc x86 path does not exist !!!")
|
||||
|
||||
self.folder_bin="/mustNotCreateBinary"
|
||||
self.folder_lib="/data/lib/armeabi"
|
||||
self.folder_data="/data/assets"
|
||||
self.folder_doc="/doc"
|
||||
self.path_bin="/mustNotCreateBinary"
|
||||
self.path_lib="/data/lib/armeabi"
|
||||
self.path_data="/data/assets"
|
||||
self.path_doc="/doc"
|
||||
self.suffix_package='.pkg'
|
||||
|
||||
# board id at 14 is for android 4.0 and more ...
|
||||
self.boardId = 14
|
||||
self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.boardId))
|
||||
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":
|
||||
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":
|
||||
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 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")
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
# llvm-libc++ : BSD | MIT
|
||||
self.global_include_cc.append("-gcc-toolchain " + self.folder_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.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
|
||||
self.global_include_cc.append("-gcc-toolchain " + self.path_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.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
|
||||
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_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "armv7":
|
||||
@ -111,51 +111,51 @@ class Target(target.Target):
|
||||
self.global_flags_cc.append("-march=armv7-a")
|
||||
self.global_flags_cc.append("-mfpu=vfpv3-d16")
|
||||
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("-target armv7-none-linux-androideabi")
|
||||
self.global_flags_ld.append("-Wl,--fix-cortex-a8")
|
||||
self.global_flags_ld.append("-Wl,--no-warn-mismatch")
|
||||
self.global_flags_ld.append("-lm_hard")
|
||||
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_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
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_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
else:
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
# 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.folder_ndk +"/sources/android/support/include/")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/android/support/include/")
|
||||
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_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||
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_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||
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_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
|
||||
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_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
|
||||
else :
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/system/include/")
|
||||
self.global_include_cc.append("-I" + self.folder_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_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/system/include/")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/stlport/stlport/")
|
||||
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_5T__")
|
||||
@ -203,8 +203,8 @@ class Target(target.Target):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data
|
||||
def get_staging_path_data(self, binaryName):
|
||||
return self.get_staging_path(binaryName) + self.path_data
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath, heritage):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
@ -214,14 +214,14 @@ class Target(target.Target):
|
||||
pkgNameApplicationName = pkgName
|
||||
if self.config["mode"] == "debug":
|
||||
pkgNameApplicationName += "debug"
|
||||
# FINAL_FOLDER_JAVA_PROJECT
|
||||
self.folder_javaProject= self.get_staging_folder(pkgName) \
|
||||
# FINAL_path_JAVA_PROJECT
|
||||
self.path_javaProject= self.get_staging_path(pkgName) \
|
||||
+ "/src/" \
|
||||
+ pkgProperties["COMPAGNY_TYPE"] \
|
||||
+ "/" + pkgProperties["COMPAGNY_NAME2"] \
|
||||
+ "/" + pkgNameApplicationName + "/"
|
||||
#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
|
||||
|
||||
@ -231,25 +231,25 @@ class Target(target.Target):
|
||||
|
||||
|
||||
debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
|
||||
# Create folder :
|
||||
# Create path :
|
||||
tools.create_directory_of_file(self.file_finalAbstraction)
|
||||
# Create file :
|
||||
# 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() \
|
||||
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:
|
||||
# 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.flush()
|
||||
tmpFile.close()
|
||||
|
||||
if 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:
|
||||
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"]:
|
||||
if res_source == "":
|
||||
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 :
|
||||
# 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")
|
||||
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
|
||||
androidToolPath = self.folder_sdk + "/build-tools/"
|
||||
tools.create_directory_of_file(self.get_staging_path(pkgName) + "/src/noFile")
|
||||
androidToolPath = self.path_sdk + "/build-tools/"
|
||||
# find android tool version
|
||||
dirnames = tools.get_list_sub_folder(androidToolPath)
|
||||
dirnames = tools.get_list_sub_path(androidToolPath)
|
||||
if len(dirnames) != 1:
|
||||
debug.error("an error occured when getting the tools for android")
|
||||
androidToolPath += dirnames[0] + "/"
|
||||
|
||||
# this is to create resource file for android ... (we did not use aset in jar with ewol ...
|
||||
adModResouceFolder = ""
|
||||
adModResoucepath = ""
|
||||
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 " \
|
||||
+ "-M " + self.get_staging_folder(pkgName) + "/AndroidManifest.xml " \
|
||||
+ "-F " + self.get_staging_folder(pkgName) + "/resources.res " \
|
||||
+ "-I " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
|
||||
+ "-S " + self.get_staging_folder(pkgName) + "/res/ " \
|
||||
+ adModResouceFolder \
|
||||
+ "-J " + self.get_staging_folder(pkgName) + "/src/ "
|
||||
+ "-M " + self.get_staging_path(pkgName) + "/AndroidManifest.xml " \
|
||||
+ "-F " + self.get_staging_path(pkgName) + "/resources.res " \
|
||||
+ "-I " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
|
||||
+ "-S " + self.get_staging_path(pkgName) + "/res/ " \
|
||||
+ adModResoucepath \
|
||||
+ "-J " + self.get_staging_path(pkgName) + "/src/ "
|
||||
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")
|
||||
#generate android java files:
|
||||
filesString=""
|
||||
@ -298,21 +298,21 @@ class Target(target.Target):
|
||||
old :
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
# 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:
|
||||
filesString += self.folder_javaProject + pkgNameApplicationName + "Settings.java "
|
||||
filesString += self.path_javaProject + pkgNameApplicationName + "Settings.java "
|
||||
|
||||
adModJarFile = ""
|
||||
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 " \
|
||||
+ "-d " + self.get_staging_folder(pkgName) + "/build/classes " \
|
||||
+ "-classpath " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
|
||||
+ "-d " + self.get_staging_path(pkgName) + "/build/classes " \
|
||||
+ "-classpath " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
|
||||
+ adModJarFile + " " \
|
||||
+ filesString \
|
||||
+ self.file_finalAbstraction + " " \
|
||||
+ self.get_staging_folder(pkgName) + "/src/R.java "
|
||||
+ self.get_staging_path(pkgName) + "/src/R.java "
|
||||
multiprocess.run_command(cmdLine)
|
||||
"""
|
||||
debug.verbose("heritage .so=" + str(tools.filter_extention(heritage.src, ["so"])))
|
||||
@ -327,19 +327,19 @@ class Target(target.Target):
|
||||
class_extern += elem
|
||||
# create enpoint element :
|
||||
cmdLine = "javac " \
|
||||
+ "-d " + self.get_staging_folder(pkgName) + "/build/classes " \
|
||||
+ "-d " + self.get_staging_path(pkgName) + "/build/classes " \
|
||||
+ "-classpath " + class_extern + " " \
|
||||
+ self.get_staging_folder(pkgName) + "/src/R.java "
|
||||
+ self.get_staging_path(pkgName) + "/src/R.java "
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
debug.print_element("pkg", ".dex", "<==", "*.class")
|
||||
cmdLine = androidToolPath + "dx " \
|
||||
+ "--dex --no-strict " \
|
||||
+ "--output=" + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/classes/ "
|
||||
+ "--output=" + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
|
||||
+ self.get_staging_path(pkgName) + "/build/classes/ "
|
||||
|
||||
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:
|
||||
for elem in upper_jar:
|
||||
# remove android sdk:
|
||||
@ -352,16 +352,16 @@ class Target(target.Target):
|
||||
#builderDebug="-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y "
|
||||
builderDebug=""
|
||||
# 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 " \
|
||||
+ " -classpath " + self.folder_sdk + "/tools/lib/sdklib.jar " \
|
||||
+ " -classpath " + self.path_sdk + "/tools/lib/sdklib.jar " \
|
||||
+ builderDebug \
|
||||
+ " com.android.sdklib.build.ApkBuilderMain " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ " -u " \
|
||||
+ " -z " + self.get_staging_folder(pkgName) + "/resources.res " \
|
||||
+ " -f " + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
|
||||
+ " -rf " + self.get_staging_folder(pkgName) + "/data "
|
||||
+ " -z " + self.get_staging_path(pkgName) + "/resources.res " \
|
||||
+ " -f " + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
|
||||
+ " -rf " + self.get_staging_path(pkgName) + "/data "
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
# doc :
|
||||
@ -379,7 +379,7 @@ class Target(target.Target):
|
||||
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
|
||||
+ " -storepass Pass__AndroidDebugKey " \
|
||||
+ " -keypass PassKey__AndroidDebugKey " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ " alias__AndroidDebugKey"
|
||||
multiprocess.run_command(cmdLine)
|
||||
tmpFile = open("tmpPass.boo", 'w')
|
||||
@ -392,26 +392,26 @@ class Target(target.Target):
|
||||
cmdLine = "jarsigner " \
|
||||
+ " -keystore " + basePkgPath + "/AndroidKey.jks " \
|
||||
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ " " + pkgNameApplicationName
|
||||
multiprocess.run_command(cmdLine)
|
||||
cmdLine = "jarsigner " \
|
||||
+ " -verify -verbose -certs " \
|
||||
+ " -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)
|
||||
|
||||
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
|
||||
cmdLine = androidToolPath + "zipalign 4 " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
|
||||
+ self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk "
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
# copy file in the final stage :
|
||||
tools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
|
||||
self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
|
||||
tools.copy_file(self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk",
|
||||
self.get_final_path() + "/" + pkgNameApplicationName + ".apk",
|
||||
force=True)
|
||||
|
||||
def install_package(self, pkgName):
|
||||
@ -421,8 +421,8 @@ class Target(target.Target):
|
||||
pkgNameApplicationName = pkgName
|
||||
if self.config["mode"] == "debug":
|
||||
pkgNameApplicationName += "debug"
|
||||
cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \
|
||||
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
|
||||
cmdLine = self.path_sdk + "/platform-tools/adb install -r " \
|
||||
+ self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk "
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
def un_install_package(self, pkgName):
|
||||
@ -432,15 +432,15 @@ class Target(target.Target):
|
||||
pkgNameApplicationName = pkgName
|
||||
if self.config["mode"] == "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)
|
||||
|
||||
def Log(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("logcat of android board")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("cmd: " + self.folder_sdk + "/platform-tools/adb shell logcat ")
|
||||
cmdLine = self.folder_sdk + "/platform-tools/adb shell logcat "
|
||||
debug.info("cmd: " + self.path_sdk + "/platform-tools/adb shell logcat ")
|
||||
cmdLine = self.path_sdk + "/platform-tools/adb shell logcat "
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
|
||||
|
@ -45,9 +45,9 @@ class Target(target.Target):
|
||||
|
||||
# remove unneeded ranlib ...
|
||||
self.ranlib=""
|
||||
self.folder_bin=""
|
||||
self.folder_data="/share"
|
||||
self.folder_doc="/doc"
|
||||
self.path_bin=""
|
||||
self.path_data="share"
|
||||
self.path_doc="doc"
|
||||
|
||||
self.suffix_lib_static='.a'
|
||||
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("-fmodules")
|
||||
|
||||
def get_staging_folder(self, binaryName):
|
||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/"
|
||||
def get_staging_path(self, binaryName):
|
||||
return tools.get_run_path() + self.path_out + self.path_staging + "/" + binaryName + ".app/"
|
||||
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data + "/"
|
||||
def get_staging_path_data(self, binaryName):
|
||||
return self.get_staging_path(binaryName) + self.path_data + "/"
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
@ -93,26 +93,26 @@ class Target(target.Target):
|
||||
# TODO : Do not regenerate if source resource is not availlable
|
||||
# TODO : Add a colored background ...
|
||||
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"])
|
||||
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"])
|
||||
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"])
|
||||
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"])
|
||||
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"])
|
||||
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"])
|
||||
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"])
|
||||
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"])
|
||||
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????")
|
||||
infoFile = self.get_staging_folder(pkgName) + "/PkgInfo"
|
||||
infoFile = self.get_staging_path(pkgName) + "/PkgInfo"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("APPL????")
|
||||
@ -205,29 +205,29 @@ class Target(target.Target):
|
||||
dataFile += "</plist>\n"
|
||||
dataFile += "\n\n"
|
||||
|
||||
infoFile = self.get_staging_folder(pkgName) + "/Info.plist"
|
||||
infoFile = self.get_staging_path(pkgName) + "/Info.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
"""
|
||||
infoFile = self.get_staging_folder(pkgName) + "/" + pkgName + "-Info.plist"
|
||||
infoFile = self.get_staging_path(pkgName) + "/" + pkgName + "-Info.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
cmdLine = "builtin-infoPlistUtility "
|
||||
cmdLine += " " + self.get_staging_folder(pkgName) + "/" + pkgName + "-Info.plist "
|
||||
cmdLine += " -genpkginfo " + self.get_staging_folder(pkgName) + "/PkgInfo"
|
||||
cmdLine += " " + self.get_staging_path(pkgName) + "/" + pkgName + "-Info.plist "
|
||||
cmdLine += " -genpkginfo " + self.get_staging_path(pkgName) + "/PkgInfo"
|
||||
cmdLine += " -expandbuildsettings "
|
||||
cmdLine += " -format binary "
|
||||
if self.sumulator == False:
|
||||
cmdLine += " -platform iphonesimulator "
|
||||
else:
|
||||
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)
|
||||
"""
|
||||
"""
|
||||
@ -273,7 +273,7 @@ class Target(target.Target):
|
||||
dataFile += "</plist>\n"
|
||||
dataFile += "\n\n"
|
||||
|
||||
infoFile = self.get_staging_folder(pkgName) + "/ResourceRules.plist"
|
||||
infoFile = self.get_staging_path(pkgName) + "/ResourceRules.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
@ -291,14 +291,14 @@ class Target(target.Target):
|
||||
dataFile += "</plist>\n"
|
||||
dataFile += "\n\n"
|
||||
|
||||
infoFile = self.get_staging_folder(pkgName) + "/Entitlements.plist"
|
||||
infoFile = self.get_staging_path(pkgName) + "/Entitlements.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
# Simulateur folder :
|
||||
# Simulateur path :
|
||||
#~/Library/Application\ Support/iPhone\ Simulator/7.0.3/Applications/
|
||||
# must have a 'uuidgen' UID generate value with this elemennt ...
|
||||
# get the bundle path : ==> maybe usefull in MocOS ...
|
||||
@ -310,7 +310,7 @@ class Target(target.Target):
|
||||
|
||||
if self.sumulator == False:
|
||||
# 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("<!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")
|
||||
@ -340,8 +340,8 @@ class Target(target.Target):
|
||||
cmdLine = 'codesign --force --sign '
|
||||
# to get this key ; certtool y | grep "Developer"
|
||||
cmdLine += ' "' + signatureKey + '" '
|
||||
cmdLine += ' --entitlements ' + self.get_build_folder(pkgName) + '/worddown.xcent'
|
||||
cmdLine += ' ' + self.get_staging_folder(pkgName)
|
||||
cmdLine += ' --entitlements ' + self.get_build_path(pkgName) + '/worddown.xcent'
|
||||
cmdLine += ' ' + self.get_staging_path(pkgName)
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
# --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:
|
||||
debug.error("Can not create ios-deploy external software ...")
|
||||
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)
|
||||
else:
|
||||
simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt"
|
||||
@ -388,14 +388,14 @@ class Target(target.Target):
|
||||
tmpFile.close()
|
||||
simulatorId = tools.file_read_data(simulatorIdFile)
|
||||
home = os.path.expanduser("~")
|
||||
destinationFolderBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId
|
||||
destinationFolder = 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"
|
||||
debug.info("install in simulator : " + destinationFolder)
|
||||
tools.create_directory_of_file(destinationFolder + "/plop.txt")
|
||||
cmdLine = "cp -rf " + self.get_staging_folder(pkgName) + " " + destinationFolder2
|
||||
destinationpathBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId
|
||||
destinationpath = 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 : " + destinationpath)
|
||||
tools.create_directory_of_file(destinationpath + "/plop.txt")
|
||||
cmdLine = "cp -rf " + self.get_staging_path(pkgName) + " " + destinationpath2
|
||||
multiprocess.run_command(cmdLine)
|
||||
cmdLine = "touch " + destinationFolderBase
|
||||
cmdLine = "touch " + destinationpathBase
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
#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:
|
||||
debug.error("Can not create ios-deploy external software ...")
|
||||
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)
|
||||
else:
|
||||
cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log"
|
||||
|
@ -59,11 +59,11 @@ class Target(target.Target):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
self.get_staging_folder(pkgName)
|
||||
targetOutFolderDebian = self.get_staging_folder(pkgName) + "/DEBIAN/"
|
||||
finalFileControl = targetOutFolderDebian + "control"
|
||||
finalFilepostRm = targetOutFolderDebian + "postrm"
|
||||
# create the folders :
|
||||
self.get_staging_path(pkgName)
|
||||
targetOutpathDebian = self.get_staging_path(pkgName) + "/DEBIAN/"
|
||||
finalFileControl = targetOutpathDebian + "control"
|
||||
finalFilepostRm = targetOutpathDebian + "postrm"
|
||||
# create the paths :
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tools.create_directory_of_file(finalFilepostRm)
|
||||
## Create the control file
|
||||
@ -93,7 +93,7 @@ class Target(target.Target):
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## 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)
|
||||
if os.path.exists(basePkgPath + "/os-Linux/README")==True:
|
||||
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
|
||||
@ -108,7 +108,7 @@ class Target(target.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## 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)
|
||||
if os.path.exists(basePkgPath + "/license.txt")==True:
|
||||
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest)
|
||||
@ -119,7 +119,7 @@ class Target(target.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##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)
|
||||
if os.path.exists(basePkgPath + "/changelog")==True:
|
||||
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest)
|
||||
@ -130,22 +130,22 @@ class Target(target.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## create the package :
|
||||
debug.debug("package : " + self.get_staging_folder(pkgName) + "/" + debianPkgName + ".deb")
|
||||
os.system("cd " + self.get_staging_folder("") + " ; dpkg-deb --build " + pkgName)
|
||||
tools.create_directory_of_file(self.get_final_folder())
|
||||
tools.copy_file(self.get_staging_folder("") + "/" + pkgName + self.suffix_package, self.get_final_folder() + "/" + pkgName + self.suffix_package)
|
||||
debug.debug("package : " + self.get_staging_path(pkgName) + "/" + debianPkgName + ".deb")
|
||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkgName)
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path("") + "/" + pkgName + self.suffix_package, self.get_final_path() + "/" + pkgName + self.suffix_package)
|
||||
|
||||
def install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
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):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
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
|
||||
@ -182,30 +182,30 @@ class Target(target.Target):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
targetOutFolder = self.get_staging_folder(pkgName) + "/edn.app/"
|
||||
tools.create_directory_of_file(targetOutFolder)
|
||||
targetOutpath = self.get_staging_path(pkgName) + "/edn.app/"
|
||||
tools.create_directory_of_file(targetOutpath)
|
||||
## Create version file
|
||||
tmpFile = open(targetOutFolder + "/version.txt", 'w')
|
||||
tmpFile = open(targetOutpath + "/version.txt", 'w')
|
||||
tmpFile.write(pkgProperties["VERSION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## 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.flush()
|
||||
tmpFile.close()
|
||||
## 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.flush()
|
||||
tmpFile.close()
|
||||
## 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.flush()
|
||||
tmpFile.close()
|
||||
## Create Readme file
|
||||
readmeFileDest = targetOutFolder + "/readme.txt"
|
||||
readmeFileDest = targetOutpath + "/readme.txt"
|
||||
if os.path.exists(basePkgPath + "/os-Linux/README")==True:
|
||||
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(basePkgPath + "/README")==True:
|
||||
@ -219,7 +219,7 @@ class Target(target.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create licence file
|
||||
licenseFileDest = targetOutFolder + "/license/"+ debianPkgName + ".txt"
|
||||
licenseFileDest = targetOutpath + "/license/"+ debianPkgName + ".txt"
|
||||
tools.create_directory_of_file(licenseFileDest)
|
||||
if os.path.exists(basePkgPath + "/license.txt")==True:
|
||||
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest)
|
||||
@ -230,7 +230,7 @@ class Target(target.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create changeLog file
|
||||
changeLogFileDest = targetOutFolder + "/changelog.txt"
|
||||
changeLogFileDest = targetOutpath + "/changelog.txt"
|
||||
if os.path.exists(basePkgPath + "/changelog") == True:
|
||||
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest)
|
||||
else:
|
||||
@ -239,24 +239,24 @@ class Target(target.Target):
|
||||
tmpFile.write("No changelog data " + pkgName + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## copy share folder
|
||||
#debug.info("plop:" + self.get_staging_folder(pkgName) + self.folder_data)
|
||||
if os.path.exists(self.get_staging_folder(pkgName) + self.folder_data) == True:
|
||||
tools.copy_anything(self.get_staging_folder(pkgName) + self.folder_data + "/*", targetOutFolder + self.folder_data, recursive=True)
|
||||
## copy share path
|
||||
#debug.info("plop:" + self.get_staging_path(pkgName) + self.path_data)
|
||||
if os.path.exists(self.get_staging_path(pkgName) + self.path_data) == True:
|
||||
tools.copy_anything(self.get_staging_path(pkgName) + self.path_data + "/*", targetOutpath + self.path_data, recursive=True)
|
||||
|
||||
## Create binary folder:
|
||||
bin_folder = targetOutFolder + self.folder_bin
|
||||
#tools.create_directory_of_file(bin_folder)
|
||||
tools.copy_anything(self.get_staging_folder(pkgName) + self.folder_bin + "/*",
|
||||
bin_folder,
|
||||
## Create binary path:
|
||||
bin_path = targetOutpath + self.path_bin
|
||||
#tools.create_directory_of_file(bin_path)
|
||||
tools.copy_anything(self.get_staging_path(pkgName) + self.path_bin + "/*",
|
||||
bin_path,
|
||||
executable=True)
|
||||
|
||||
## create the package:
|
||||
debug.debug("package : " + self.get_staging_folder(pkgName) + "/" + debianPkgName + ".app.pkg")
|
||||
os.system("cd " + self.get_staging_folder(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")
|
||||
tools.create_directory_of_file(self.get_final_folder())
|
||||
tools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgName + ".app.tar.gz", self.get_final_folder() + "/" + pkgName + ".app.gpkg")
|
||||
debug.debug("package : " + self.get_staging_path(pkgName) + "/" + debianPkgName + ".app.pkg")
|
||||
os.system("cd " + self.get_staging_path(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_path())
|
||||
tools.copy_file(self.get_staging_path(pkgName) + "/" + pkgName + ".app.tar.gz", self.get_final_path() + "/" + pkgName + ".app.gpkg")
|
||||
|
||||
|
||||
|
||||
|
@ -28,10 +28,10 @@ class Target(target.Target):
|
||||
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
|
||||
target.Target.__init__(self, "MacOs", config, "")
|
||||
|
||||
self.folder_bin="/MacOS"
|
||||
self.folder_lib="/lib"
|
||||
self.folder_data="/Resources"
|
||||
self.folder_doc="/doc"
|
||||
self.path_bin="MacOS"
|
||||
self.path_lib="lib"
|
||||
self.path_data="Resources"
|
||||
self.path_doc="doc"
|
||||
|
||||
self.suffix_lib_static='.a'
|
||||
self.suffix_lib_dynamic='.dylib'
|
||||
@ -41,11 +41,11 @@ class Target(target.Target):
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
|
||||
|
||||
def get_staging_folder(self, binaryName):
|
||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
|
||||
def get_staging_path(self, binaryName):
|
||||
return tools.get_run_path() + self.path_out + self.path_staging + "/" + binaryName + ".app/Contents/"
|
||||
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data + "/"
|
||||
def get_staging_path_data(self, binaryName):
|
||||
return self.get_staging_path(binaryName) + self.path_data + "/"
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
@ -54,10 +54,10 @@ class Target(target.Target):
|
||||
|
||||
if "ICON" in pkgProperties.keys() \
|
||||
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
|
||||
infoFile=self.get_staging_folder(pkgName) + "/Info.plist"
|
||||
infoFile=self.get_staging_path(pkgName) + "/Info.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||
@ -79,7 +79,7 @@ class Target(target.Target):
|
||||
tmpFile.write("\n\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
infoFile=self.get_staging_folder(pkgName) + "/PkgInfo"
|
||||
infoFile=self.get_staging_path(pkgName) + "/PkgInfo"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("APPL????")
|
||||
@ -87,7 +87,7 @@ class Target(target.Target):
|
||||
tmpFile.close()
|
||||
|
||||
# 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
|
||||
tools.create_directory_of_file(shell_file_name)
|
||||
tmpFile = open(shell_file_name, 'w')
|
||||
@ -101,10 +101,10 @@ class Target(target.Target):
|
||||
|
||||
# Must create the disk image of the application
|
||||
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 += pkgName + " -srcfolder "
|
||||
cmd += tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app"
|
||||
cmd += pkgName + " -srcpath "
|
||||
cmd += tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app"
|
||||
cmd += " -ov -format UDZO "
|
||||
cmd += output_file_name
|
||||
tools.create_directory_of_file(output_file_name)
|
||||
@ -118,18 +118,18 @@ class Target(target.Target):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
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:
|
||||
shutil.rmtree("/Applications/" + pkgName + ".app")
|
||||
# copy the application in the basic application folder : /Applications/xxx.app
|
||||
shutil.copytree(tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app", "/Applications/" + pkgName + ".app")
|
||||
# copy the application in the basic application path : /Applications/xxx.app
|
||||
shutil.copytree(tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app", "/Applications/" + pkgName + ".app")
|
||||
|
||||
def un_install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
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:
|
||||
shutil.rmtree("/Applications/" + pkgName + ".app")
|
||||
|
||||
|
@ -50,10 +50,10 @@ class Target(target.Target):
|
||||
"-static-libstdc++",
|
||||
"-static"])
|
||||
|
||||
self.folder_bin=""
|
||||
self.folder_lib="/lib"
|
||||
self.folder_data="/data"
|
||||
self.folder_doc="/doc"
|
||||
self.path_bin=""
|
||||
self.path_lib="lib"
|
||||
self.path_data="data"
|
||||
self.path_doc="doc"
|
||||
|
||||
self.suffix_lib_static='.a'
|
||||
self.suffix_lib_dynamic='.dll'
|
||||
@ -62,24 +62,24 @@ class Target(target.Target):
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
|
||||
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data
|
||||
def get_staging_path_data(self, binaryName):
|
||||
return self.get_staging_path(binaryName) + self.path_data
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.print_element("zip", "data.zip", "<==", "data/*")
|
||||
zipPath = self.get_staging_folder(pkgName) + "/data.zip"
|
||||
zip.create_zip(self.get_staging_folder_data(pkgName), zipPath)
|
||||
zipPath = self.get_staging_path(pkgName) + "/data.zip"
|
||||
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)
|
||||
debug.info("binarysize : " + str(binSize/1024) + " ko ==> " + str(binSize) + " octets")
|
||||
|
||||
#now we create a simple bundle binary ==> all file is stored in one file ...
|
||||
self.get_staging_folder(pkgName)
|
||||
finalBin = self.get_final_folder() + "/" + pkgName + self.suffix_binary
|
||||
self.get_staging_path(pkgName)
|
||||
finalBin = self.get_final_path() + "/" + pkgName + self.suffix_binary
|
||||
tools.create_directory_of_file(finalBin);
|
||||
debug.print_element("pkg", finalBin, "<==", pkgName + self.suffix_binary)
|
||||
#open output file
|
||||
|
Loading…
Reference in New Issue
Block a user