[DEV] set it back (integration android)
This commit is contained in:
parent
979e71c101
commit
6ac4cc45fa
@ -178,10 +178,10 @@ class heritage:
|
|||||||
append_to_list(self.src['dynamic'], elements)
|
append_to_list(self.src['dynamic'], elements)
|
||||||
|
|
||||||
def add_lib_interpreted(self, type_interpretation, elements):
|
def add_lib_interpreted(self, type_interpretation, elements):
|
||||||
debug.error("TODO ...")
|
# TODO : Think at a better methodologie ...
|
||||||
if type(elements) == type(None):
|
if type(elements) == type(None):
|
||||||
debug.error("try add element none in a list ...")
|
debug.error("try add element none in a list ...")
|
||||||
append_to_list(self.src, elements)
|
append_to_list(self.src['src'], elements)
|
||||||
|
|
||||||
def auto_add_build_header(self):
|
def auto_add_build_header(self):
|
||||||
if self.include != "":
|
if self.include != "":
|
||||||
|
@ -14,14 +14,14 @@ from . import tools
|
|||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
from . import depend
|
from . import depend
|
||||||
|
|
||||||
enableResizeImage = True
|
enable_resize_image = True
|
||||||
try:
|
try:
|
||||||
if platform.system() == "Darwin":
|
if platform.system() == "Darwin":
|
||||||
import CoreGraphics
|
import CoreGraphics
|
||||||
else:
|
else:
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
except:
|
except:
|
||||||
enableResizeImage = False
|
enable_resize_image = False
|
||||||
debug.warning("Missing python tools : CoreGraphics (MacOs) or PIL")
|
debug.warning("Missing python tools : CoreGraphics (MacOs) or PIL")
|
||||||
|
|
||||||
def get_pow_2_multiple(size):
|
def get_pow_2_multiple(size):
|
||||||
@ -34,31 +34,31 @@ def get_pow_2_multiple(size):
|
|||||||
# check if force requested
|
# check if force requested
|
||||||
# check if time change
|
# check if time change
|
||||||
# check if command line change
|
# check if command line change
|
||||||
def resize(srcFile, destFile, x, y, cmd_file=None):
|
def resize(src_file, dest_file, x, y, cmd_file=None):
|
||||||
if enableResizeImage == False:
|
if enable_resize_image == False:
|
||||||
return
|
return
|
||||||
if os.path.exists(srcFile) == False:
|
if os.path.exists(src_file) == False:
|
||||||
debug.error("Request a resize an image that does not existed : '" + srcFile + "'")
|
debug.error("Request a resize an image that does not existed : '" + src_file + "'")
|
||||||
cmd_line = "resize Image : " + srcFile + " ==> " + destFile + " newSize=(" + str(x) + "x" + str(y) + ")"
|
cmd_line = "resize Image : " + src_file + " ==> " + dest_file + " newSize=(" + str(x) + "x" + str(y) + ")"
|
||||||
if False==depend.need_re_build(destFile, srcFile, file_cmd=cmd_file , cmdLine=cmd_line):
|
if False==depend.need_re_build(dest_file, src_file, file_cmd=cmd_file , cmd_line=cmd_line):
|
||||||
return
|
return
|
||||||
# add cmdLine ...
|
# add cmdLine ...
|
||||||
x = get_pow_2_multiple(x)
|
x = get_pow_2_multiple(x)
|
||||||
extension = destFile[destFile.rfind('.'):]
|
extension = dest_file[dest_file.rfind('.'):]
|
||||||
if platform.system() == "Darwin":
|
if platform.system() == "Darwin":
|
||||||
source_image = CoreGraphics.CGImageImport(CoreGraphics.CGDataProviderCreateWithFilename(srcFile))
|
source_image = CoreGraphics.CGImageImport(CoreGraphics.CGDataProviderCreateWithFilename(src_file))
|
||||||
source_width = source_image.getWidth()
|
source_width = source_image.getWidth()
|
||||||
source_height = source_image.getHeight()
|
source_height = source_image.getHeight()
|
||||||
if source_width <= x:
|
if source_width <= x:
|
||||||
# for small image just copy:
|
# for small image just copy:
|
||||||
tools.copy_file(srcFile, destFile)
|
tools.copy_file(src_file, dest_file)
|
||||||
else:
|
else:
|
||||||
if y <= 0:
|
if y <= 0:
|
||||||
# keep ratio :
|
# keep ratio :
|
||||||
y = int(float(x) * float(source_height) / float(source_width))
|
y = int(float(x) * float(source_height) / float(source_width))
|
||||||
y = get_pow_2_multiple(y)
|
y = get_pow_2_multiple(y)
|
||||||
debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", srcFile, "==>", destFile)
|
debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", src_file, "==>", dest_file)
|
||||||
debug.debug("Resize image: " + srcFile + " size=(" + str(source_width) + "x" + str(source_height) + ") -> (" + str(x) + "x" + str(y) + ")")
|
debug.debug("Resize image: " + src_file + " size=(" + str(source_width) + "x" + str(source_height) + ") -> (" + str(x) + "x" + str(y) + ")")
|
||||||
source_image_rect = CoreGraphics.CGRectMake(0, 0, source_width, source_height)
|
source_image_rect = CoreGraphics.CGRectMake(0, 0, source_width, source_height)
|
||||||
new_image = source_image.createWithImageInRect(source_image_rect)
|
new_image = source_image.createWithImageInRect(source_image_rect)
|
||||||
colors_space = CoreGraphics.CGColorSpaceCreateDeviceRGB()
|
colors_space = CoreGraphics.CGColorSpaceCreateDeviceRGB()
|
||||||
@ -67,27 +67,27 @@ def resize(srcFile, destFile, x, y, cmd_file=None):
|
|||||||
context.setInterpolationQuality(CoreGraphics.kCGInterpolationHigh)
|
context.setInterpolationQuality(CoreGraphics.kCGInterpolationHigh)
|
||||||
new_image_rect = CoreGraphics.CGRectMake(0, 0, x, y)
|
new_image_rect = CoreGraphics.CGRectMake(0, 0, x, y)
|
||||||
context.drawImage(new_image_rect, new_image)
|
context.drawImage(new_image_rect, new_image)
|
||||||
tools.create_directory_of_file(destFile)
|
tools.create_directory_of_file(dest_file)
|
||||||
if extension == ".jpeg":
|
if extension == ".jpeg":
|
||||||
context.writeToFile(destFile, CoreGraphics.kCGImageFormatJPEG)
|
context.writeToFile(dest_file, CoreGraphics.kCGImageFormatJPEG)
|
||||||
elif extension == ".png":
|
elif extension == ".png":
|
||||||
context.writeToFile(destFile, CoreGraphics.kCGImageFormatPNG)
|
context.writeToFile(dest_file, CoreGraphics.kCGImageFormatPNG)
|
||||||
else:
|
else:
|
||||||
debug.error(" can not manage extention ... : " + destFile)
|
debug.error(" can not manage extention ... : " + dest_file)
|
||||||
else:
|
else:
|
||||||
# open an image file (.bmp,.jpg,.png,.gif) you have in the working path
|
# open an image file (.bmp,.jpg,.png,.gif) you have in the working path
|
||||||
im1 = Image.open(srcFile)
|
im1 = Image.open(src_file)
|
||||||
if im1.size[0] <= x:
|
if im1.size[0] <= x:
|
||||||
# for small image just copy:
|
# for small image just copy:
|
||||||
tools.copy_file(srcFile, destFile)
|
tools.copy_file(src_file, dest_file)
|
||||||
else:
|
else:
|
||||||
if y <= 0:
|
if y <= 0:
|
||||||
# keep ratio :
|
# keep ratio :
|
||||||
y = int(float(x) * float(im1.size[1]) / float(im1.size[0]))
|
y = int(float(x) * float(im1.size[1]) / float(im1.size[0]))
|
||||||
y = get_pow_2_multiple(y)
|
y = get_pow_2_multiple(y)
|
||||||
debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", srcFile, "==>", destFile)
|
debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", src_file, "==>", dest_file)
|
||||||
# use one of these filter options to resize the image
|
# use one of these filter options to resize the image
|
||||||
tmpImage = im1.resize((x, y), Image.ANTIALIAS)
|
tmpImage = im1.resize((x, y), Image.ANTIALIAS)
|
||||||
tools.create_directory_of_file(destFile)
|
tools.create_directory_of_file(dest_file)
|
||||||
tmpImage.save(destFile)
|
tmpImage.save(dest_file)
|
||||||
multiprocess.store_command(cmd_line, cmd_file)
|
tools.store_command(cmd_line, cmd_file)
|
||||||
|
@ -18,6 +18,7 @@ from . import debug
|
|||||||
from . import heritage
|
from . import heritage
|
||||||
from . import builder
|
from . import builder
|
||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
|
from . import image
|
||||||
|
|
||||||
class Module:
|
class Module:
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ class Module:
|
|||||||
if sizeX > 0:
|
if sizeX > 0:
|
||||||
debug.verbose("Image file : " + display_source + " ==> " + destination + " resize=(" + str(sizeX) + "," + str(sizeY) + ")")
|
debug.verbose("Image file : " + display_source + " ==> " + destination + " resize=(" + str(sizeX) + "," + str(sizeY) + ")")
|
||||||
fileName, fileExtension = os.path.splitext(os.path.join(self.origin_path,source))
|
fileName, fileExtension = os.path.splitext(os.path.join(self.origin_path,source))
|
||||||
image.resize(source, os.path.join(target.get_build_path_data(self.name), dst), sizeX, sizeY, file_cmd)
|
image.resize(source, os.path.join(target.get_build_path_data(self.name), destination), sizeX, sizeY, file_cmd)
|
||||||
else:
|
else:
|
||||||
debug.verbose("Might copy file : " + display_source + " ==> " + destination)
|
debug.verbose("Might copy file : " + display_source + " ==> " + destination)
|
||||||
tools.copy_file(source, os.path.join(target.get_build_path_data(self.name), destination), file_cmd)
|
tools.copy_file(source, os.path.join(target.get_build_path_data(self.name), destination), file_cmd)
|
||||||
@ -480,23 +481,45 @@ class Module:
|
|||||||
elif self.type == 'BINARY' \
|
elif self.type == 'BINARY' \
|
||||||
or self.type == 'BINARY_SHARED' \
|
or self.type == 'BINARY_SHARED' \
|
||||||
or self.type == 'BINARY_STAND_ALONE':
|
or self.type == 'BINARY_STAND_ALONE':
|
||||||
|
shared_mode = False
|
||||||
|
if target.name=="Android":
|
||||||
|
debug.warning("Android mode ...")
|
||||||
|
# special case for android ...
|
||||||
|
for elem in self.sub_heritage_list.src['src']:
|
||||||
|
debug.warning(" " + elem[-4:])
|
||||||
|
if elem[-4:] == '.jar':
|
||||||
|
# abstract GUI interface ...
|
||||||
|
shared_mode = True
|
||||||
|
break;
|
||||||
|
if shared_mode == True:
|
||||||
|
try:
|
||||||
|
tmp_builder = builder.get_builder_with_output("so");
|
||||||
|
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||||
|
res_file = tmp_builder.link(list_file,
|
||||||
|
package_name,
|
||||||
|
target,
|
||||||
|
self.sub_heritage_list,
|
||||||
|
name = self.name,
|
||||||
|
basic_path = self.origin_path)
|
||||||
|
self.local_heritage.add_sources(res_file)
|
||||||
|
except ValueError:
|
||||||
|
debug.error(" UN-SUPPORTED link format: '.so'")
|
||||||
|
try:
|
||||||
|
tmp_builder = builder.get_builder_with_output("jar");
|
||||||
|
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)
|
||||||
|
self.local_heritage.add_sources(res_file)
|
||||||
|
except ValueError:
|
||||||
|
debug.error(" UN-SUPPORTED link format: '.jar'")
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder_with_output("bin");
|
tmp_builder = builder.get_builder_with_output("bin");
|
||||||
parents = { 'src':[],
|
|
||||||
'dynamic':[],
|
|
||||||
'static':[]
|
|
||||||
}
|
|
||||||
parents_dynamic = []
|
|
||||||
parents_static = []
|
|
||||||
#extract libs ...
|
|
||||||
for elem in self.sub_heritage_list.src:
|
|
||||||
if elem[-len(target.suffix_lib_static):] == target.suffix_lib_static:
|
|
||||||
parents_static.append(elem)
|
|
||||||
elif elem[-len(target.suffix_lib_dynamic):] == target.suffix_lib_dynamic:
|
|
||||||
parents_dynamic.append(elem)
|
|
||||||
else:
|
|
||||||
parents['src'].append(elem)
|
|
||||||
|
|
||||||
static_mode = True
|
static_mode = True
|
||||||
if self.type == 'BINARY_SHARED':
|
if self.type == 'BINARY_SHARED':
|
||||||
static_mode = False
|
static_mode = False
|
||||||
|
@ -18,7 +18,6 @@ from . import heritage
|
|||||||
from . import tools
|
from . import tools
|
||||||
from . import module
|
from . import module
|
||||||
from . import system
|
from . import system
|
||||||
from . import image
|
|
||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
|
|
||||||
class Target:
|
class Target:
|
||||||
@ -187,39 +186,6 @@ class Target:
|
|||||||
def get_build_mode(self):
|
def get_build_mode(self):
|
||||||
return self.config["mode"]
|
return self.config["mode"]
|
||||||
|
|
||||||
## @deprecated ...
|
|
||||||
def add_image_staging(self, inputFile, outputFile, sizeX, sizeY, cmdFile=None):
|
|
||||||
for source, dst, x, y, cmdFile2 in self.list_final_file:
|
|
||||||
if dst == outputFile :
|
|
||||||
debug.verbose("already added : " + outputFile)
|
|
||||||
return
|
|
||||||
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'")
|
|
||||||
self.list_final_file.append([inputFile,outputFile, sizeX, sizeY, cmdFile])
|
|
||||||
|
|
||||||
## @deprecated ...
|
|
||||||
def add_file_staging(self, inputFile, outputFile, cmdFile=None):
|
|
||||||
for source, dst, x, y, cmdFile2 in self.list_final_file:
|
|
||||||
if dst == outputFile :
|
|
||||||
debug.verbose("already added : " + outputFile)
|
|
||||||
return
|
|
||||||
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'");
|
|
||||||
self.list_final_file.append([inputFile, outputFile, -1, -1, cmdFile])
|
|
||||||
|
|
||||||
## @deprecated ...
|
|
||||||
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, os.path.join(base_path, dst), cmdFile)
|
|
||||||
else:
|
|
||||||
debug.verbose("resize image : '" + source + "' ==> '" + dst + "' size=(" + str(x) + "," + str(y) + ")");
|
|
||||||
image.resize(source, os.path.join(base_path, dst), x, y, cmdFile)
|
|
||||||
|
|
||||||
|
|
||||||
def clean_module_tree(self):
|
def clean_module_tree(self):
|
||||||
self.build_tree_done = []
|
self.build_tree_done = []
|
||||||
self.list_final_file = []
|
self.list_final_file = []
|
||||||
|
@ -45,7 +45,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path):
|
|||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.java,
|
target.java,
|
||||||
"-d", target.get_build_path(name)
|
"-d", target.get_build_path_object(name)
|
||||||
]
|
]
|
||||||
# add source dependency:
|
# add source dependency:
|
||||||
list_sources_path = []
|
list_sources_path = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user