def configure(target, my_module): my_module.add_extra_flags() my_module.add_src_file([ 'eproperty/debug.cpp', 'eproperty/Property.cpp', 'eproperty/InterfaceData.cpp', 'eproperty/details/Range.cpp', 'eproperty/details/Value.cpp', ]) my_module.add_header_file([ 'eproperty/debug.hpp', 'eproperty/Value.hpp', 'eproperty/Interface.hpp', 'eproperty/InterfaceData.hpp', 'eproperty/Property.hpp', 'eproperty/PropertyType.hpp', 'eproperty/Range.hpp', 'eproperty/List.hpp', 'eproperty/details/Range.hxx', 'eproperty/details/Value.hxx', ]) my_module.add_depend(['etk']) my_module.add_path(".") my_module.add_flag('c++', [ "-DEPROPERTY_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) return True
def configure(target, my_module): my_module.add_extra_flags() my_module.add_src_file([ 'esignal/debug.cpp', 'esignal/Connection.cpp', 'esignal/InterfaceData.cpp', 'esignal/Base.cpp', 'esignal/details/Signal.cpp', ]) my_module.add_header_file([ 'esignal/debug.hpp', 'esignal/Interface.hpp', 'esignal/InterfaceData.hpp', 'esignal/Base.hpp', 'esignal/Signal.hpp', 'esignal/Connection.hpp', 'esignal/details/Signal.hxx', ]) my_module.compile_version("c++", 2011) my_module.add_depend(['etk', 'ememory']) my_module.add_path(".") my_module.add_flag('c++', [ "-DESIGNAL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) my_module.add_optionnal_depend( 'echrono', compilation_flags=["c++", "-DESIGNAL_BUILD_WITH_ECHRONO"]) my_module.add_tools(['esignal-test']) return True
def configure(target, my_module): my_module.add_extra_flags() my_module.add_src_file([ 'esignal/debug.cpp', 'esignal/Connection.cpp', 'esignal/InterfaceData.cpp', 'esignal/Base.cpp', 'esignal/details/Signal.cpp', ]) my_module.add_header_file([ 'esignal/debug.hpp', 'esignal/Interface.hpp', 'esignal/InterfaceData.hpp', 'esignal/Base.hpp', 'esignal/Signal.hpp', 'esignal/Connection.hpp', 'esignal/details/Signal.hxx', ]) my_module.compile_version("c++", 2011) my_module.add_depend([ 'etk', 'ememory' ]) my_module.add_path(".") my_module.add_flag('c++', [ "-DESIGNAL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) my_module.add_tools(['esignal-test']) return True
def configure(target, my_module): my_module.add_src_file([ 'appl/Main.cpp', 'appl/debug.cpp', 'appl/WidgetDisplay.cpp', 'appl/Windows.cpp', ]) my_module.add_depend(['ewol']) my_module.add_flag('c++', [ "-DPROJECT_NAME=\"\\\""+my_module.get_name()+"\\\"\"", "-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) my_module.copy_path('data/SnowFlake.svg','') my_module.add_path(".") # set the package properties : my_module.set_pkg("ICON", "../data/icon.png") my_module.set_pkg("SECTION", "example") my_module.set_pkg("PRIORITY", "extra") my_module.set_pkg("ANDROID_APPL_TYPE", "WALLPAPER") #for the exemple : my_module.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", \ [ ["key","value display"],\ ["key2","value display 2"]\ ] \ ]) my_module.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]]) # add the currrent module at the return True
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): debug.debug("------------------------------------------------------------------------") debug.info("-- Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"])) debug.debug("------------------------------------------------------------------------") #output path target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app") tools.create_directory_of_file(target_outpath) ## Create share datas: self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## copy binary files: self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## Create libraries: self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## Create generic files: self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static) ## create the package: debug.debug("package : " + os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.pkg")) os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") #multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") tools.create_directory_of_file(self.get_final_path()) tools.copy_file(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.tar.gz"), os.path.join(self.get_final_path(), pkg_name + ".app.gpkg"))
def configure(target, my_module): my_module.add_src_file([ 'appl/Main.cpp', 'appl/debug.cpp', 'appl/Windows.cpp', ]) my_module.add_depend([ 'ewol' ]) my_module.add_flag('c++', [ "-DPROJECT_NAME=\"\\\""+my_module.get_name()+"\\\"\"", "-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) my_module.add_path(".") return True
def configure(target, my_module): my_module.add_src_file( ['appl/debug.cpp', 'appl/main.cpp', 'appl/Windows.cpp']) my_module.add_depend('ege') my_module.add_path(".") my_module.copy_path("data/*") my_module.add_flag('c++', [ "-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"", "-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) # set the package properties: my_module.set_pkg("SECTION", ["Game"]) my_module.set_pkg("PRIORITY", "optional") return True
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): debug.debug("------------------------------------------------------------------------") debug.debug("-- Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"])) debug.debug("------------------------------------------------------------------------") #output path target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app") tools.create_directory_of_file(target_outpath) ## Create share datas: ret_share = self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## copy binary files: ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## Create libraries: ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## Create generic files: ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static) ## end of the package generation build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt") #Check date between the current file "list of action to generate package and the end of package generation need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True) ## create the package: if ret_share \ or ret_bin \ or ret_lib \ or ret_file \ or need_generate_package: debug.debug("package : " + os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.pkg")) os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") #multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") tools.create_directory_of_file(self.get_final_path()) tools.copy_file(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.tar.gz"), os.path.join(self.get_final_path(), pkg_name + ".app.gpkg")) # package is done corectly ... tools.file_write_data(build_package_path_done, "done...")
def configure(target, my_module): my_module.add_src_file([ 'appl/debug.cpp', 'appl/main.cpp', 'appl/Windows.cpp' ]) my_module.add_depend('ege') my_module.add_path(".") my_module.copy_path("data/*") my_module.add_flag('c++', [ "-DPROJECT_NAME=\"\\\"" + my_module.get_name() + "\\\"\"", "-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) # set the package properties: my_module.set_pkg("SECTION", ["Game"]) my_module.set_pkg("PRIORITY", "optional") return True
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): debug.debug("------------------------------------------------------------------------") debug.debug("-- Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"])) debug.debug("------------------------------------------------------------------------") #output path target_outpath = os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app") tools.create_directory_of_file(target_outpath) ## Create share datas: ret_share = self.make_package_binary_data(target_outpath, "zz_generic_zz", base_pkg_path, heritage_list, static) ## copy binary files: ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## Create libraries: ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## Create generic files: ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static) ## end of the package generation build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt") #Check date between the current file "list of action to generate package and the end of package generation need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True) ## create the package: if ret_share \ or ret_bin \ or ret_lib \ or ret_file \ or need_generate_package or True: # Zip the data debug.print_element("zip", "data.zip", "<==", os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app/share/*")) zip_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + ".data") zip.create_zip([ self.get_staging_path(pkg_name, tmp=True) + "/" + pkg_name + ".app/share/", target_outpath + "/pkg" ], zip_path) # copy if needed the binary: tools.copy_file( os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app", pkg_name + self.suffix_binary), os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary), force_identical=True) # patch the .js file to update the new real data ... js_file_data = tools.file_read_data(os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app", pkg_name + self.suffix_binary2)) data_to_replace = '"end": 6, "filename": "/' + self._file_data_tmp + '"}], "remote_package_size": 6' data_size = str(tools.file_size(zip_path)) replace_with = '"end": ' + data_size + ', "filename": "/data.zip"}], "remote_package_size": ' + data_size debug.print_element("js", pkg_name + ".data", "<==", "correct zip name and data") tools.file_write_data(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary2), js_file_data.replace(data_to_replace, replace_with), only_if_new = True) zip_path_final = os.path.join(self.get_final_path(), pkg_name + ".data") # generate deployed zip (for user) debug.print_element("zip", pkg_name + ".zip", "<==", self.get_staging_path(pkg_name), pkg_name + ".zip") zip.create_zip_file([ zip_path, os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary) ], pkg_name + ".app", zip_path_final) tools.file_write_data(build_package_path_done, "done...") ## create the package: """
def configure(target, my_module): # add extra compilation flags: my_module.add_extra_flags() # add the file to compile: my_module.add_src_file([ 'ewol/ewol.cpp', 'ewol/debug.cpp', 'ewol/Padding.cpp', 'ewol/DrawProperty.cpp', 'ewol/gravity.cpp' ]) my_module.add_header_file([ 'ewol/debug.hpp', # TODO : Remove this ... 'ewol/ewol.hpp', 'ewol/Padding.hpp', 'ewol/DrawProperty.hpp', 'ewol/gravity.hpp' ]) # compositing: my_module.add_src_file([ 'ewol/compositing/Compositing.cpp', 'ewol/compositing/TextBase.cpp', 'ewol/compositing/Text.cpp', 'ewol/compositing/TextDF.cpp', 'ewol/compositing/Drawing.cpp', 'ewol/compositing/Image.cpp', 'ewol/compositing/Sprite.cpp', 'ewol/compositing/Shaper.cpp', 'ewol/compositing/Area.cpp' ]) my_module.add_header_file([ 'ewol/compositing/Text.hpp', 'ewol/compositing/Drawing.hpp', 'ewol/compositing/Sprite.hpp', 'ewol/compositing/Area.hpp', 'ewol/compositing/Shaper.hpp', 'ewol/compositing/TextDF.hpp', 'ewol/compositing/TextBase.hpp', 'ewol/compositing/Compositing.hpp', 'ewol/compositing/Image.hpp' ]) # context: my_module.add_src_file([ 'ewol/context/ConfigFont.cpp', 'ewol/context/Context.cpp', 'ewol/context/Application.cpp', 'ewol/context/InputManager.cpp' ]) my_module.add_header_file([ 'ewol/context/ConfigFont.hpp', 'ewol/context/Context.hpp', 'ewol/context/Application.hpp', 'ewol/context/InputManager.hpp' ]) # event properties: my_module.add_src_file([ 'ewol/event/Entry.cpp', 'ewol/event/Time.cpp', 'ewol/event/Input.cpp' ]) my_module.add_header_file([ 'ewol/event/Time.hpp', 'ewol/event/Input.hpp', 'ewol/event/Entry.hpp' ]) # object: my_module.add_src_file([ 'ewol/object/Manager.cpp', 'ewol/object/Object.cpp', 'ewol/object/Worker.cpp' ]) my_module.add_header_file([ 'ewol/object/Worker.hpp', 'ewol/object/Manager.hpp', 'ewol/object/Object.hpp' ]) # resources: my_module.add_src_file([ 'ewol/resource/Colored3DObject.cpp', 'ewol/resource/ColorFile.cpp', 'ewol/resource/ConfigFile.cpp', 'ewol/resource/FontFreeType.cpp', 'ewol/resource/Image.cpp', 'ewol/resource/ImageDF.cpp', 'ewol/resource/Texture.cpp', 'ewol/resource/TexturedFont.cpp', 'ewol/resource/DistanceFieldFont.cpp' ]) my_module.add_header_file([ 'ewol/resource/FontFreeType.hpp', 'ewol/resource/TexturedFont.hpp', 'ewol/resource/ColorFile.hpp', 'ewol/resource/font/FontBase.hpp', 'ewol/resource/font/Kerning.hpp', 'ewol/resource/font/GlyphProperty.hpp', 'ewol/resource/DistanceFieldFont.hpp', 'ewol/resource/ImageDF.hpp', 'ewol/resource/Colored3DObject.hpp', 'ewol/resource/ConfigFile.hpp', 'ewol/resource/Texture.hpp', 'ewol/resource/Image.hpp' ]) # widget: my_module.add_src_file([ 'ewol/widget/ButtonColor.cpp', 'ewol/widget/Button.cpp', 'ewol/widget/CheckBox.cpp', 'ewol/widget/ColorBar.cpp', 'ewol/widget/Composer.cpp', 'ewol/widget/Container.cpp', 'ewol/widget/Container2.cpp', 'ewol/widget/ContainerN.cpp', 'ewol/widget/ContextMenu.cpp', 'ewol/widget/Entry.cpp', 'ewol/widget/Gird.cpp', 'ewol/widget/Image.cpp', 'ewol/widget/Joystick.cpp', 'ewol/widget/Label.cpp', 'ewol/widget/Layer.cpp', 'ewol/widget/List.cpp', 'ewol/widget/ListFileSystem.cpp', 'ewol/widget/Manager.cpp', 'ewol/widget/Menu.cpp', 'ewol/widget/meta/ColorChooser.cpp', 'ewol/widget/meta/FileChooser.cpp', 'ewol/widget/meta/Parameter.cpp', 'ewol/widget/meta/ParameterList.cpp', 'ewol/widget/meta/StdPopUp.cpp', 'ewol/widget/meta/SpinBase.cpp', 'ewol/widget/PopUp.cpp', 'ewol/widget/ProgressBar.cpp', 'ewol/widget/Scroll.cpp', 'ewol/widget/Select.cpp', 'ewol/widget/Sizer.cpp', 'ewol/widget/Slider.cpp', 'ewol/widget/Spacer.cpp', 'ewol/widget/Widget.cpp', 'ewol/widget/WidgetScrolled.cpp', 'ewol/widget/Windows.cpp', 'ewol/widget/WSlider.cpp', 'ewol/widget/Spin.cpp', ]) my_module.add_header_file([ 'ewol/widget/Menu.hpp', 'ewol/widget/Slider.hpp', 'ewol/widget/WidgetScrolled.hpp', 'ewol/widget/ListFileSystem.hpp', 'ewol/widget/Panned.hpp', 'ewol/widget/WSlider.hpp', 'ewol/widget/Container2.hpp', 'ewol/widget/Windows.hpp', 'ewol/widget/CheckBox.hpp', 'ewol/widget/Container.hpp', 'ewol/widget/PopUp.hpp', 'ewol/widget/Label.hpp', 'ewol/widget/Composer.hpp', 'ewol/widget/Sizer.hpp', 'ewol/widget/Scroll.hpp', 'ewol/widget/ContainerN.hpp', 'ewol/widget/Spacer.hpp', 'ewol/widget/Button.hpp', 'ewol/widget/Manager.hpp', 'ewol/widget/Entry.hpp', 'ewol/widget/ContextMenu.hpp', 'ewol/widget/Gird.hpp', 'ewol/widget/ProgressBar.hpp', 'ewol/widget/ColorBar.hpp', 'ewol/widget/ButtonColor.hpp', 'ewol/widget/Layer.hpp', 'ewol/widget/Joystick.hpp', 'ewol/widget/Widget.hpp', 'ewol/widget/meta/StdPopUp.hpp', 'ewol/widget/meta/SpinBase.hpp', 'ewol/widget/meta/ParameterList.hpp', 'ewol/widget/meta/ColorChooser.hpp', 'ewol/widget/meta/Parameter.hpp', 'ewol/widget/meta/FileChooser.hpp', 'ewol/widget/Image.hpp', 'ewol/widget/List.hpp', 'ewol/widget/Select.hpp', 'ewol/widget/Spin.hpp' ]) # tools: my_module.add_src_file([ 'ewol/tools/message.cpp' ]) my_module.add_header_file([ 'ewol/tools/message.hpp' ]) my_module.copy_path('data/theme/shape/square/*','theme/shape/square') my_module.copy_path('data/theme/shape/round/*','theme/shape/round') my_module.copy_path('data/theme/color/black/*','theme/color/black') my_module.copy_path('data/theme/color/white/*','theme/color/white') my_module.copy_path('data/textured.*','') my_module.copy_path('data/texturedNoMaterial.*','') my_module.copy_path('data/text.*','') my_module.copy_path('data/simple3D.*','') my_module.copy_path('data/color.*','') my_module.copy_path('data/color3.*','') my_module.copy_path('data/textured3D2.*','') my_module.copy_path('data/textured3D.*','') my_module.copy_path('data/texturedDF.*','') my_module.copy_path('data/fontDistanceField/*','fontDistanceField') my_module.copy_path('data/translate/*','translate/ewol') # name of the dependency my_module.add_depend([ 'elog', 'etk', 'esignal', 'eproperty', 'ememory', 'gale', 'freetype', 'exml', 'ejson', 'egami', 'edtaa3', 'etranslate', ]) my_module.add_path(".") my_module.add_flag('c++', [ "-DEWOL_VERSION=\"\\\"" + tools.version_to_string(my_module.get_pkg("VERSION")) + "\\\"\"" ]) return True
def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) my_module.add_extra_compile_flags() my_module.add_src_file(['sources/appl/ctags/readtags.cpp']) my_module.add_src_file([ 'sources/appl/debug.cpp', 'sources/appl/global.cpp', 'sources/appl/globalMsg.cpp', 'sources/appl/init.cpp' ]) # Gui: my_module.add_src_file([ 'sources/appl/Gui/BufferView.cpp', 'sources/appl/Gui/TextViewer.cpp', 'sources/appl/Gui/ViewerManager.cpp', 'sources/appl/Gui/MainWindows.cpp', 'sources/appl/Gui/Search.cpp', 'sources/appl/Gui/TagFileSelection.cpp', 'sources/appl/Gui/TagFileList.cpp', 'sources/appl/Gui/WorkerSaveFile.cpp', 'sources/appl/Gui/WorkerSaveAllFile.cpp', 'sources/appl/Gui/WorkerCloseFile.cpp', 'sources/appl/Gui/WorkerCloseAllFile.cpp' ]) # All needed for the buffer management : my_module.add_src_file([ 'sources/appl/Buffer.cpp', 'sources/appl/BufferManager.cpp', 'sources/appl/TextPlugin.cpp', 'sources/appl/TextPluginCopy.cpp', 'sources/appl/TextPluginMultiLineTab.cpp', 'sources/appl/TextPluginAutoIndent.cpp', 'sources/appl/TextPluginHistory.cpp', 'sources/appl/TextPluginRmLine.cpp', 'sources/appl/TextPluginSelectAll.cpp', 'sources/appl/TextPluginCtags.cpp', 'sources/appl/TextPluginManager.cpp' ]) # Generic color management for the text editor : my_module.add_src_file( ['sources/appl/GlyphDecoration.cpp', 'sources/appl/GlyphPainting.cpp']) # syntax coloration for the text editor my_module.add_src_file([ 'sources/appl/HighlightPattern.cpp', 'sources/appl/Highlight.cpp', 'sources/appl/HighlightManager.cpp' ]) my_module.add_module_depend(['ewol']) my_module.copy_path('data/icon.*', '') my_module.copy_path('data/languages/gcov/*.xml', 'languages/gcov/') my_module.copy_path('data/languages/asm/*.xml', 'languages/asm/') my_module.copy_path('data/languages/bash/*.xml', 'languages/bash/') my_module.copy_path('data/languages/boo/*.xml', 'languages/boo/') my_module.copy_path('data/languages/cpp/*.xml', 'languages/cpp/') my_module.copy_path('data/languages/c/*.xml', 'languages/c/') my_module.copy_path('data/languages/cmake/*.xml', 'languages/cmake/') my_module.copy_path('data/languages/glsl/*.xml', 'languages/glsl/') my_module.copy_path('data/languages/in/*.xml', 'languages/in/') my_module.copy_path('data/languages/java/*.xml', 'languages/java/') my_module.copy_path('data/languages/json/*.xml', 'languages/json/') my_module.copy_path('data/languages/lua/*.xml', 'languages/lua/') my_module.copy_path('data/languages/makefile/*.xml', 'languages/makefile/') my_module.copy_path('data/languages/matlab/*.xml', 'languages/matlab/') my_module.copy_path('data/languages/php/*.xml', 'languages/php/') my_module.copy_path('data/languages/xml/*.xml', 'languages/xml/') my_module.copy_path('data/languages/python/*.xml', 'languages/python/') my_module.copy_path('data/theme/default/*.svg', 'theme/shape/square/') my_module.copy_path('data/theme/default/*.edf', 'theme/shape/square/') my_module.copy_path('data/theme/colorWhite/*.json', 'theme/color/white/') my_module.copy_path('data/theme/colorBlack/*.json', 'theme/color/black/') my_module.copy_path('data/GUI-Search.xml', '') my_module.add_path( os.path.join(tools.get_current_path(__file__), "sources")) my_module.copy_file("data/Font/freefont/FreeSerif.ttf", "fonts/FreeSerif.ttf") my_module.copy_path("data/Font/freefont/FreeMon*.ttf", "fonts/") my_module.compile_flags('c', [ "-DPROJECT_NAME=\"\\\"" + my_module.name + "\\\"\"", "-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) versionIDCode = str(get_version_id()) # set the package properties: my_module.pkg_set("VERSION_CODE", versionIDCode) if target.name == "MacOs": my_module.pkg_set( "ICON", os.path.join(tools.get_current_path(__file__), "data/icon.icns")) else: my_module.pkg_set( "ICON", os.path.join(tools.get_current_path(__file__), "data/icon.png")) my_module.pkg_set("SECTION", ["Development", "Editors"]) my_module.pkg_set("PRIORITY", "optional") my_module.pkg_add("RIGHT", "WRITE_EXTERNAL_STORAGE") my_module.pkg_add("RIGHT", "SET_ORIENTATION") return my_module
def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) my_module.add_extra_compile_flags() my_module.add_src_file([ 'sources/appl/ctags/readtags.cpp' ]) my_module.add_src_file([ 'sources/appl/debug.cpp', 'sources/appl/global.cpp', 'sources/appl/globalMsg.cpp', 'sources/appl/init.cpp' ]) # Gui: my_module.add_src_file([ 'sources/appl/Gui/BufferView.cpp', 'sources/appl/Gui/TextViewer.cpp', 'sources/appl/Gui/ViewerManager.cpp', 'sources/appl/Gui/MainWindows.cpp', 'sources/appl/Gui/Search.cpp', 'sources/appl/Gui/TagFileSelection.cpp', 'sources/appl/Gui/TagFileList.cpp', 'sources/appl/Gui/WorkerSaveFile.cpp', 'sources/appl/Gui/WorkerSaveAllFile.cpp', 'sources/appl/Gui/WorkerCloseFile.cpp', 'sources/appl/Gui/WorkerCloseAllFile.cpp' ]) # All needed for the buffer management : my_module.add_src_file([ 'sources/appl/Buffer.cpp', 'sources/appl/BufferManager.cpp', 'sources/appl/TextPlugin.cpp', 'sources/appl/TextPluginCopy.cpp', 'sources/appl/TextPluginMultiLineTab.cpp', 'sources/appl/TextPluginAutoIndent.cpp', 'sources/appl/TextPluginHistory.cpp', 'sources/appl/TextPluginRmLine.cpp', 'sources/appl/TextPluginSelectAll.cpp', 'sources/appl/TextPluginCtags.cpp', 'sources/appl/TextPluginManager.cpp' ]) # Generic color management for the text editor : my_module.add_src_file([ 'sources/appl/GlyphDecoration.cpp', 'sources/appl/GlyphPainting.cpp' ]) # syntax coloration for the text editor my_module.add_src_file([ 'sources/appl/HighlightPattern.cpp', 'sources/appl/Highlight.cpp', 'sources/appl/HighlightManager.cpp' ]) my_module.add_module_depend(['ewol']) my_module.copy_path('data/icon.*','') my_module.copy_path('data/languages/gcov/*.xml','languages/gcov/') my_module.copy_path('data/languages/asm/*.xml','languages/asm/') my_module.copy_path('data/languages/bash/*.xml','languages/bash/') my_module.copy_path('data/languages/boo/*.xml','languages/boo/') my_module.copy_path('data/languages/cpp/*.xml','languages/cpp/') my_module.copy_path('data/languages/c/*.xml','languages/c/') my_module.copy_path('data/languages/cmake/*.xml','languages/cmake/') my_module.copy_path('data/languages/glsl/*.xml','languages/glsl/') my_module.copy_path('data/languages/in/*.xml','languages/in/') my_module.copy_path('data/languages/java/*.xml','languages/java/') my_module.copy_path('data/languages/json/*.xml','languages/json/') my_module.copy_path('data/languages/lua/*.xml','languages/lua/') my_module.copy_path('data/languages/makefile/*.xml','languages/makefile/') my_module.copy_path('data/languages/matlab/*.xml','languages/matlab/') my_module.copy_path('data/languages/php/*.xml','languages/php/') my_module.copy_path('data/languages/xml/*.xml','languages/xml/') my_module.copy_path('data/languages/python/*.xml','languages/python/') my_module.copy_path('data/theme/default/*.svg','theme/shape/square/') my_module.copy_path('data/theme/default/*.edf','theme/shape/square/') my_module.copy_path('data/theme/colorWhite/*.json','theme/color/white/') my_module.copy_path('data/theme/colorBlack/*.json','theme/color/black/') my_module.copy_path('data/GUI-Search.xml','') my_module.add_path(os.path.join(tools.get_current_path(__file__), "sources")) my_module.copy_file("data/Font/freefont/FreeSerif.ttf","fonts/FreeSerif.ttf") my_module.copy_path("data/Font/freefont/FreeMon*.ttf","fonts/") my_module.compile_flags('c', [ "-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\"", "-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) versionIDCode = str(get_version_id()) # set the package properties: my_module.pkg_set("VERSION_CODE", versionIDCode) if target.name=="MacOs": my_module.pkg_set("ICON", os.path.join(tools.get_current_path(__file__), "data/icon.icns")) else: my_module.pkg_set("ICON", os.path.join(tools.get_current_path(__file__), "data/icon.png")) my_module.pkg_set("SECTION", ["Development", "Editors"]) my_module.pkg_set("PRIORITY", "optional") my_module.pkg_add("RIGHT", "WRITE_EXTERNAL_STORAGE") my_module.pkg_add("RIGHT", "SET_ORIENTATION") return my_module
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): debug.debug("------------------------------------------------------------------------") debug.info("Generate package '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"])) debug.debug("------------------------------------------------------------------------") #output path target_outpath = self.get_staging_path(pkg_name) tools.create_directory_of_file(target_outpath) ## Create share datas: self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## copy binary files # in Android Package we have no binary element, only shared object ... (and java start file) ## Create libraries (special case of Android...) copy_list={} target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib) tools.create_directory_of_file(target_outpath_lib) # copy application lib: (needed to lunch ...) file_src = self.get_build_file_dynamic(pkg_name) if os.path.isfile(file_src): debug.debug(" need copy: " + file_src + " to " + target_outpath_lib) tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)), in_list=copy_list) # copy other if needed: if static == False: #copy all shared libsh... debug.verbose("libs for " + str(pkg_name) + ":") for heritage in heritage_list.list_heritage: debug.debug("sub elements: " + str(heritage.name)) file_src = self.get_build_file_dynamic(heritage.name) debug.verbose(" has directory: " + file_src) if os.path.isfile(file_src): debug.debug(" need copy: " + file_src + " to " + target_outpath_lib) #copy all data: # TODO : We can have a problem when writing over library files ... tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)), in_list=copy_list) #real copy files tools.copy_list(copy_list) if self.pkg_path_lib != "": # remove unneded files (NOT folder ...) tools.clean_directory(target_outpath_lib, copy_list) ## Create generic files: self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static) ## create specific android project (local) pkg_name_application_name = pkg_name if self.config["mode"] == "debug": pkg_name_application_name += "debug" #debug.info("ploppppp: " + str(pkg_properties)) # FINAL_path_JAVA_PROJECT self.path_java_project = os.path.join(target_outpath, "src") if pkg_properties["COMPAGNY_TYPE"] != "": self.path_java_project = os.path.join(self.path_java_project, pkg_properties["COMPAGNY_TYPE"]) if pkg_properties["COMPAGNY_NAME2"] != "": self.path_java_project = os.path.join(self.path_java_project, pkg_properties["COMPAGNY_NAME2"]) self.path_java_project = os.path.join(self.path_java_project, pkg_name_application_name) #FINAL_FILE_ABSTRACTION self.file_final_abstraction = os.path.join(self.path_java_project, pkg_name_application_name + ".java") compleatePackageName = "" if pkg_properties["COMPAGNY_TYPE"] != "": compleatePackageName += pkg_properties["COMPAGNY_TYPE"] + "." if pkg_properties["COMPAGNY_NAME2"] != "": compleatePackageName += pkg_properties["COMPAGNY_NAME2"] + "." compleatePackageName += pkg_name_application_name if "ADMOD_ID" in pkg_properties: pkg_properties["RIGHT"].append("INTERNET") pkg_properties["RIGHT"].append("ACCESS_NETWORK_STATE") debug.print_element("pkg", "absractionFile", "<==", "dynamic file") # Create path : tools.create_directory_of_file(self.file_final_abstraction) # 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(target_outpath + "/res/drawable/icon.png"); if "ICON" in pkg_properties.keys() \ and pkg_properties["ICON"] != "": image.resize(pkg_properties["ICON"], target_outpath + "/res/drawable/icon.png", 256, 256) else: # to be sure that we have all time a resource ... tmpFile = open(target_outpath + "/res/drawable/plop.txt", 'w') tmpFile.write('plop\n') tmpFile.flush() tmpFile.close() if pkg_properties["ANDROID_MANIFEST"]!="": debug.print_element("pkg", "AndroidManifest.xml", "<==", pkg_properties["ANDROID_MANIFEST"]) tools.copy_file(pkg_properties["ANDROID_MANIFEST"], target_outpath + "/AndroidManifest.xml", force=True) else: debug.error("missing parameter 'ANDROID_MANIFEST' in the properties ... ") #add properties on wallpaper : # myModule.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["list", key, title, summary, [["key","value display"],["key2","value display 2"]]) # myModule.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", [["key","value display"],["key2","value display 2"]]]) # myModule.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"]) # myModule.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"] #copy needed resources : for res_source, res_dest in pkg_properties["ANDROID_RESOURCES"]: if res_source == "": continue tools.copy_file(res_source , target_outpath + "/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(target_outpath + "/src/noFile") android_tool_path = self.path_sdk + "/build-tools/" # find android tool version dirnames = tools.get_list_sub_path(android_tool_path) if len(dirnames) == 0: debug.warning("This does not comport directory: '" + android_tool_path + "'") debug.error("An error occured when getting the tools for android") elif len(dirnames) > 1: dirnames = sorted(dirnames, reverse=True) debug.debug("sort tools directory: '" + str(dirnames) + "' ==> select : " + str(dirnames[0])) android_tool_path += dirnames[0] + "/" # this is to create resource file for android ... (we did not use aset in jar with ewol ... adModResoucepath = "" if "ADMOD_ID" in pkg_properties: adModResoucepath = " -S " + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ " cmdLine = android_tool_path + "aapt p -f " \ + "-M " + target_outpath + "/AndroidManifest.xml " \ + "-F " + target_outpath + "/resources.res " \ + "-I " + self.path_sdk + "/platforms/android-" + str(self.board_id) + "/android.jar "\ + "-S " + target_outpath + "/res/ " \ + adModResoucepath \ + "-J " + target_outpath + "/src/ " multiprocess.run_command(cmdLine) tools.create_directory_of_file(target_outpath + "/build/classes/noFile") debug.print_element("pkg", "*.class", "<==", "*.java") #generate android java files: filesString="" """ old : if "ADMOD_ID" in pkg_properties: # TODO : check this I do not think it is really usefull ... ==> write for IDE only ... filesString += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java " if len(pkg_properties["ANDROID_WALLPAPER_PROPERTIES"])!=0: filesString += self.path_java_project + pkg_name_application_name + "Settings.java " adModJarFile = "" if "ADMOD_ID" in pkg_properties: 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_path(pkg_name) + "/build/classes " \ + "-classpath " + self.path_sdk + "/platforms/android-" + str(self.board_id) + "/android.jar" \ + adModJarFile + " " \ + filesString \ + self.file_final_abstraction + " " \ + self.get_staging_path(pkg_name) + "/src/R.java " multiprocess.run_command(cmdLine) """ debug.verbose("heritage .so=" + str(tools.filter_extention(heritage_list.src['dynamic'], ["so"]))) debug.verbose("heritage .jar=" + str(tools.filter_extention(heritage_list.src['src'], ["jar"]))) class_extern = "" upper_jar = tools.filter_extention(heritage_list.src['src'], ["jar"]) #debug.warning("ploppppp = " + str(upper_jar)) for elem in upper_jar: if len(class_extern) > 0: class_extern += ":" class_extern += elem # create enpoint element : cmdLine = "javac " \ + "-d " + target_outpath + "/build/classes " \ + "-classpath " + class_extern + " " \ + target_outpath + "/src/R.java " multiprocess.run_command(cmdLine) debug.print_element("pkg", ".dex", "<==", "*.class") cmdLine = android_tool_path + "dx " \ + "--dex --no-strict " \ + "--output=" + target_outpath + "/build/" + pkg_name_application_name + ".dex " \ + target_outpath + "/build/classes/ " if "ADMOD_ID" in pkg_properties: 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: if elem[-len("android.jar"):] != "android.jar": cmdLine += elem + " " multiprocess.run_command(cmdLine) debug.print_element("pkg", ".apk", "<==", ".dex, assets, .so, res") #builderDebug="-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y " builderDebug="" # note : set -u not signed application... #+ ":" + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar " cmdLine = "java -Xmx128M " \ + " -classpath " + self.path_sdk + "/tools/lib/sdklib.jar " \ + builderDebug \ + " com.android.sdklib.build.ApkBuilderMain " \ + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \ + " -u " \ + " -z " + target_outpath + "/resources.res " \ + " -f " + target_outpath + "/build/" + pkg_name_application_name + ".dex " \ + " -rf " + target_outpath + "/data " multiprocess.run_command(cmdLine) # doc : # http://developer.android.com/tools/publishing/app-signing.html # Create a key for signing your application: # keytool -genkeypair -v -keystore AndroidKey.jks -storepass Pass__AndroidDebugKey -alias alias__AndroidDebugKey -keypass PassKey__AndroidDebugKey -keyalg RSA -validity 36500 if self.config["mode"] == "debug": debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)") # verbose mode : #debugOption = "-verbose -certs " debugOption = "" cmdLine = "jarsigner " \ + debugOption \ + "-keystore " + tools.get_current_path(__file__) + "/AndroidDebugKey.jks " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \ + " -storepass Pass__AndroidDebugKey " \ + " -keypass PassKey__AndroidDebugKey " \ + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \ + " alias__AndroidDebugKey" multiprocess.run_command(cmdLine) tmpFile = open("tmpPass.boo", 'w') tmpFile.write("\n") tmpFile.flush() tmpFile.close() else: print("On release mode we need the file : and key an pasword to sign the application ...") debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)") cmdLine = "jarsigner " \ + " -keystore " + pkg_properties["ANDROID_SIGN"] + " " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \ + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \ + " " + pkg_name_application_name multiprocess.run_command(cmdLine) cmdLine = "jarsigner " \ + " -verify -verbose -certs " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \ + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " multiprocess.run_command(cmdLine) debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)") tools.remove_file(target_outpath + "/" + pkg_name_application_name + ".apk") # verbose mode : -v cmdLine = android_tool_path + "zipalign 4 " \ + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \ + target_outpath + "/" + pkg_name_application_name + ".apk " multiprocess.run_command(cmdLine) # copy file in the final stage : tools.copy_file(target_outpath + "/" + pkg_name_application_name + ".apk", self.get_final_path() + "/" + pkg_name_application_name + ".apk", force=True)
def tool_generate_main_java_class(target, module, package_name): file_list = [] debug.debug("------------------------------------------------------------------------") debug.debug("Generate android wrapping for '" + package_name + "' ==> '" + target.convert_name_application(package_name) + "'" ) debug.debug("------------------------------------------------------------------------") application_name = target.convert_name_application(package_name) if target.get_mode() == "debug": application_name += "debug" target.path_java_project= target.get_build_path(package_name) \ + "/src/" \ + module.get_pkg("COMPAGNY_TYPE") \ + "/" + module.get_pkg("COMPAGNY_NAME2") \ + "/" + application_name + "/" java_file_wrapper = target.path_java_project + "/" + application_name + ".java" android_package_name = module.get_pkg("COMPAGNY_TYPE")+"."+module.get_pkg("COMPAGNY_NAME2")+"." + application_name debug.print_element("pkg", "absractionFile", "<==", "dynamic file") # Create path : tools.create_directory_of_file(java_file_wrapper) debug.debug("create file : '" + java_file_wrapper + "'") # Create file : tmpFile = open(java_file_wrapper + "_tmp", 'w') tmpFile.write( "/**\n") tmpFile.write( " * @author Edouard DUPIN, Kevin BILLONNEAU\n") tmpFile.write( " * @copyright 2011, Edouard DUPIN, all right reserved\n") tmpFile.write( " * @license APACHE v2.0 (see license file)\n") tmpFile.write( " * @note This file is autogenerate ==> see documantation to generate your own\n") tmpFile.write( " */\n") tmpFile.write( "package "+ android_package_name + ";\n") tmpFile.write( "import android.util.Log;\n") if module.get_pkg("ANDROID_APPL_TYPE")=="APPL": tmpFile.write( "import org.gale.GaleActivity;\n") else: tmpFile.write( "import org.gale.GaleWallpaper;\n") tmpFile.write( "\n") if module.get_pkg("GENERATE_SECTION__IMPORT") != None: for elem in module.get_pkg("GENERATE_SECTION__IMPORT"): for line in elem: tmpFile.write( line + "\n") if module.get_pkg("ANDROID_APPL_TYPE")=="APPL": tmpFile.write( "public class " + application_name + " extends GaleActivity {\n") else: tmpFile.write( "public class " + application_name + " extends GaleWallpaper {\n") tmpFile.write( " public static final String SHARED_PREFS_NAME = \"" + application_name + "settings\";\n") if module.get_pkg("GENERATE_SECTION__DECLARE") != None: for elem in module.get_pkg("GENERATE_SECTION__DECLARE"): for line in elem: tmpFile.write( " " + line + "\n") tmpFile.write( " \n") tmpFile.write( " static {\n") tmpFile.write( " try {\n") tmpFile.write( " System.loadLibrary(\"" + package_name + "\");\n") tmpFile.write( " } catch (UnsatisfiedLinkError e) {\n") tmpFile.write( " Log.e(\"" + application_name + "\", \"error getting lib(): \" + e);\n") tmpFile.write( " }\n") tmpFile.write( " }\n") tmpFile.write( " \n") if module.get_pkg("ANDROID_APPL_TYPE")!="APPL": tmpFile.write( " public Engine onCreateEngine() {\n") tmpFile.write( " Engine tmpEngine = super.onCreateEngine();\n") tmpFile.write( " initApkPath(\"" + module.get_pkg("COMPAGNY_TYPE")+"\", \""+module.get_pkg("COMPAGNY_NAME2")+"\", \"" + application_name + "\", \"" + package_name + "\");\n") tmpFile.write( " return tmpEngine;\n") tmpFile.write( " }\n") if module.get_pkg("GENERATE_SECTION__CONSTRUCTOR") != None: tmpFile.write( " public " + application_name + "() {\n") for elem in module.get_pkg("GENERATE_SECTION__CONSTRUCTOR"): for line in elem: tmpFile.write( " " + line + "\n") tmpFile.write( " }\n") if module.get_pkg("ANDROID_APPL_TYPE")!="APPL": tmpFile.write( " public void onCreate() {\n") tmpFile.write( " super.onCreate();\n") tmpFile.write( " initApkPath(\"" + module.get_pkg("COMPAGNY_TYPE")+"\", \""+module.get_pkg("COMPAGNY_NAME2")+"\", \"" + application_name + "\", \"" + package_name + "\");\n") else: tmpFile.write( " public void onCreate(android.os.Bundle savedInstanceState) {\n") tmpFile.write( " super.onCreate(savedInstanceState);\n") tmpFile.write( " initApkPath(\"" + module.get_pkg("COMPAGNY_TYPE")+"\", \""+module.get_pkg("COMPAGNY_NAME2")+"\", \"" + application_name + "\", \"" + package_name + "\");\n") if module.get_pkg("GENERATE_SECTION__ON_CREATE") != None: for elem in module.get_pkg("GENERATE_SECTION__ON_CREATE"): for line in elem: tmpFile.write( " " + line + "\n") tmpFile.write( " }\n") if module.get_pkg("GENERATE_SECTION__ON_START") != None: tmpFile.write( " @Override protected void onStart() {\n") for elem in module.get_pkg("GENERATE_SECTION__ON_START"): for line in elem: tmpFile.write( " " + line + "\n") tmpFile.write( " super.onStart();\n") tmpFile.write( " }\n") if module.get_pkg("GENERATE_SECTION__ON_RESTART") != None: tmpFile.write( " @Override protected void onRestart() {\n") for elem in module.get_pkg("GENERATE_SECTION__ON_RESTART"): for line in elem: tmpFile.write( " " + line + "\n") tmpFile.write( " super.onRestart();\n") tmpFile.write( " }\n") if module.get_pkg("GENERATE_SECTION__ON_RESUME") != None: tmpFile.write( " @Override protected void onResume() {\n") tmpFile.write( " super.onResume();\n") for elem in module.get_pkg("GENERATE_SECTION__ON_RESUME"): for line in elem: tmpFile.write( " " + line + "\n") tmpFile.write( " }\n") if module.get_pkg("GENERATE_SECTION__ON_PAUSE") != None: tmpFile.write( " @Override protected void onPause() {\n") for elem in module.get_pkg("GENERATE_SECTION__ON_PAUSE"): for line in elem: tmpFile.write( " " + line + "\n") tmpFile.write( " super.onPause();\n") tmpFile.write( " }\n") if module.get_pkg("GENERATE_SECTION__ON_STOP") != None: tmpFile.write( " @Override protected void onStop() {\n") for elem in module.get_pkg("GENERATE_SECTION__ON_STOP"): for line in elem: tmpFile.write( " " + line + "\n") tmpFile.write( " super.onStop();\n") tmpFile.write( " }\n") if module.get_pkg("GENERATE_SECTION__ON_DESTROY") != None: tmpFile.write( " @Override protected void onDestroy() {\n") for elem in module.get_pkg("GENERATE_SECTION__ON_DESTROY"): for line in elem: tmpFile.write( " " + line + "\n") tmpFile.write( " super.onDestroy();\n") tmpFile.write( " }\n") tmpFile.write( "}\n") tmpFile.flush() tmpFile.close() tools.move_if_needed(java_file_wrapper + "_tmp", java_file_wrapper); # add java file to build: module.add_src_file([java_file_wrapper]) ## todo: """ debug.warning("icon : " + module.get_pkg("ICON")) tools.create_directory_of_file(target.get_staging_path(package_name) + "/res/drawable/icon.png"); if module.get_pkg("ICON") != None \ and module.get_pkg("ICON") != "": image.resize(module.get_pkg("ICON"), target.get_staging_path(package_name) + "/res/drawable/icon.png", 256, 256) # if must be copied befor as user data ... todo : check pass else: debug.warning("copy a generic Atria-soft icon ...") # to be sure that we have all time a resource ... image.resize(os.path.join(tools.get_current_path(__file__),"atria-soft.png"), os.path.join(target.get_staging_path(package_name), "res", "drawable", "icon.png"), 256, 256) """ if module.get_pkg("ANDROID_MANIFEST") == "": # force manifest file: module.set_pkg("ANDROID_MANIFEST", os.path.join(target.get_build_path(package_name), "AndroidManifest.xml")); debug.debug(" create file: '" + module.get_pkg("ANDROID_MANIFEST") + "'") if module.get_pkg("VERSION_CODE") == None: module.set_pkg("VERSION_CODE", "1") debug.print_element("pkg", "AndroidManifest.xml", "<==", "package configurations") tools.create_directory_of_file(module.get_pkg("ANDROID_MANIFEST")) tmpFile = open(module.get_pkg("ANDROID_MANIFEST"), 'w') tmpFile.write( '<?xml version="1.0" encoding="utf-8"?>\n') tmpFile.write( '<!-- Manifest is autoGenerated with Gale ... do not patch it-->\n') tmpFile.write( '<manifest xmlns:android="http://schemas.android.com/apk/res/android" \n') tmpFile.write( ' package="' + android_package_name + '" \n') if module.get_pkg("VERSION_CODE") == '': debug.warning("Missing application 'VERSION_CODE' ==> set it at '0' (this can creata an NON update on android play store)") module.set_pkg("VERSION_CODE", "0") tmpFile.write( ' android:versionCode="' + str(module.get_pkg("VERSION_CODE")) + '" \n') tmpFile.write( ' android:versionName="'+tools.version_to_string(module.get_pkg("VERSION"))+'"> \n') tmpFile.write( ' <uses-feature android:glEsVersion="0x00020000" android:required="true" />\n') tmpFile.write( ' <uses-sdk android:minSdkVersion="' + str(target.board_id) + '" \n') tmpFile.write( ' android:targetSdkVersion="' + str(target.board_id) + '" /> \n') if module.get_pkg("ANDROID_APPL_TYPE")=="APPL": tmpFile.write( ' <application android:label="' + application_name + '" \n') if module.get_pkg("ICON") != None: tmpFile.write( ' android:icon="@drawable/icon" \n') if target.get_mode() == "debug": tmpFile.write( ' android:debuggable="true" \n') tmpFile.write( ' >\n') if module.get_pkg("ADMOD_ID") != None: tmpFile.write( ' <meta-data android:name="com.google.android.gms.version" \n') tmpFile.write( ' android:value="@integer/google_play_services_version"/>\n') tmpFile.write( ' <activity android:name=".' + application_name + '" \n') tmpFile.write( ' android:label="' + module.get_pkg('NAME')) if target.get_mode() == "debug": tmpFile.write("-debug") tmpFile.write( '"\n') if module.get_pkg("ICON") != None: tmpFile.write( ' android:icon="@drawable/icon" \n') tmpFile.write( ' android:hardwareAccelerated="true" \n') tmpFile.write( ' android:configChanges="keyboard|keyboardHidden|orientation|screenSize"> \n') tmpFile.write( ' <intent-filter> \n') tmpFile.write( ' <action android:name="android.intent.action.MAIN" /> \n') tmpFile.write( ' <category android:name="android.intent.category.LAUNCHER" /> \n') tmpFile.write( ' </intent-filter> \n') tmpFile.write( ' </activity> \n') if module.get_pkg("ADMOD_ID") != None: tmpFile.write( ' <activity android:name="com.google.android.gms.ads.AdActivity"\n') tmpFile.write( ' android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>\n') tmpFile.write( ' </application>\n') else: tmpFile.write( ' <application android:label="' + application_name + '" \n') tmpFile.write( ' android:permission="android.permission.BIND_WALLPAPER" \n') if module.get_pkg("ICON") != None: tmpFile.write( ' android:icon="@drawable/icon"\n') tmpFile.write( ' >\n') tmpFile.write( ' <service android:name=".' + application_name + '" \n') tmpFile.write( ' android:label="' + module.get_pkg('NAME')) if target.get_mode() == "debug": tmpFile.write("-debug") tmpFile.write( '"\n') if module.get_pkg("ICON") != None: tmpFile.write( ' android:icon="@drawable/icon"\n') tmpFile.write( ' >\n') tmpFile.write( ' <intent-filter>\n') tmpFile.write( ' <action android:name="android.service.wallpaper.WallpaperService" />\n') tmpFile.write( ' </intent-filter>\n') tmpFile.write( ' <meta-data android:name="android.service.wallpaper"\n') tmpFile.write( ' android:resource="@xml/' + application_name + '_resource" />\n') tmpFile.write( ' </service>\n') if len(module.get_pkg("ANDROID_WALLPAPER_PROPERTIES"))!=0: tmpFile.write( ' <activity android:label="Setting"\n') tmpFile.write( ' android:name=".' + application_name + 'Settings"\n') tmpFile.write( ' android:theme="@android:style/Theme.Light.WallpaperSettings"\n') tmpFile.write( ' android:exported="true"\n') if module.get_pkg("ICON") != None: tmpFile.write( ' android:icon="@drawable/icon"\n') tmpFile.write( ' >\n') tmpFile.write( ' </activity>\n') tmpFile.write( ' </application>\n') # write package autorisations : if "WRITE_EXTERNAL_STORAGE" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> \n') if "CAMERA" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.CAMERA" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.CAMERA" /> \n') if "INTERNET" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.INTERNET" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.INTERNET" /> \n') if "ACCESS_NETWORK_STATE" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.ACCESS_NETWORK_STATE" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> \n') if "MODIFY_AUDIO_SETTINGS" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> \n') if "READ_CALENDAR" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.READ_CALENDAR" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.READ_CALENDAR" /> \n') if "READ_CONTACTS" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.READ_CONTACTS" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.READ_CONTACTS" /> \n') if "READ_FRAME_BUFFER" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.READ_FRAME_BUFFER" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.READ_FRAME_BUFFER" /> \n') if "READ_PROFILE" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.READ_PROFILE" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.READ_PROFILE" /> \n') if "RECORD_AUDIO" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.RECORD_AUDIO" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.RECORD_AUDIO" /> \n') if "SET_ORIENTATION" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.SET_ORIENTATION" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.SET_ORIENTATION" /> \n') if "VIBRATE" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.VIBRATE" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.VIBRATE" /> \n') if "ACCESS_COARSE_LOCATION" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> \n') if "ACCESS_FINE_LOCATION" in module.get_pkg("RIGHT"): tmpFile.write( ' <permission android:name="android.permission.ACCESS_FINE_LOCATION" /> \n') tmpFile.write( ' <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> \n') tmpFile.write( '</manifest>\n\n') tmpFile.flush() tmpFile.close() # end generating android manifest if module.get_pkg("ANDROID_APPL_TYPE") != "APPL": #create the Wallpaper sub files : (main element for the application debug.print_element("pkg", application_name + "_resource.xml", "<==", "package configurations") resource_file_name = os.path.join(target.get_staging_path(package_name), "res", "xml", application_name + "_resource.xml") tools.create_directory_of_file(resource_file_name) tmpFile = open(resource_file_name, 'w') tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n") tmpFile.write( "<wallpaper xmlns:android=\"http://schemas.android.com/apk/res/android\"\n") if len(module.get_pkg("ANDROID_WALLPAPER_PROPERTIES"))!=0: tmpFile.write( " android:settingsActivity=\"" + android_package_name + "." + application_name + "Settings\"\n") if module.get_pkg("ICON") != None: tmpFile.write( " android:thumbnail=\"@drawable/icon\"\n") tmpFile.write( " />\n") tmpFile.flush() tmpFile.close() # create wallpaper setting if needed (class and config file) if len(module.get_pkg("ANDROID_WALLPAPER_PROPERTIES"))!=0: tools.create_directory_of_file(target.path_java_project + application_name + "Settings.java") debug.print_element("pkg", target.path_java_project + application_name + "Settings.java", "<==", "package configurations") tmpFile = open(target.path_java_project + application_name + "Settings.java", 'w'); tmpFile.write( "package " + android_package_name + ";\n") tmpFile.write( "\n") tmpFile.write( "import " + android_package_name + ".R;\n") tmpFile.write( "\n") tmpFile.write( "import android.content.SharedPreferences;\n") tmpFile.write( "import android.os.Bundle;\n") tmpFile.write( "import android.preference.PreferenceActivity;\n") tmpFile.write( "\n") tmpFile.write( "public class " + application_name + "Settings extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener\n") tmpFile.write( "{\n") tmpFile.write( " @Override protected void onCreate(Bundle icicle) {\n") tmpFile.write( " super.onCreate(icicle);\n") tmpFile.write( " getPreferenceManager().setSharedPreferencesName("+ application_name + ".SHARED_PREFS_NAME);\n") tmpFile.write( " addPreferencesFromResource(R.xml."+ application_name + "_settings);\n") tmpFile.write( " getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);\n") tmpFile.write( " }\n") tmpFile.write( " @Override protected void onResume() {\n") tmpFile.write( " super.onResume();\n") tmpFile.write( " }\n") tmpFile.write( " @Override protected void onDestroy() {\n") tmpFile.write( " getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);\n") tmpFile.write( " super.onDestroy();\n") tmpFile.write( " }\n") tmpFile.write( " public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key) { }\n") tmpFile.write( "}\n") tmpFile.flush() tmpFile.close() debug.print_element("pkg", target.get_build_path(package_name) + "/res/xml/" + application_name + "_settings.xml", "<==", "package configurations") tools.create_directory_of_file(target.get_build_path(package_name) + "/res/xml/" + application_name + "_settings.xml") tmpFile = open(target.get_build_path(package_name) + "/res/xml/" + application_name + "_settings.xml", 'w'); tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n") tmpFile.write( "<PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\"\n") tmpFile.write( " android:title=\"Settings\"\n") tmpFile.write( " android:key=\"" + application_name + "_settings\">\n") WALL_haveArray = False for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in module.get_pkg("ANDROID_WALLPAPER_PROPERTIES"): debug.info("find : '" + WALL_type + "'"); if WALL_type == "list": debug.info(" create : LIST"); tmpFile.write( " <ListPreference android:key=\"" + application_name + "_" + WALL_key + "\"\n") tmpFile.write( " android:title=\"" + WALL_title + "\"\n") tmpFile.write( " android:summary=\"" + WALL_summary + "\"\n") tmpFile.write( " android:entries=\"@array/" + application_name + "_" + WALL_key + "_names\"\n") tmpFile.write( " android:entryValues=\"@array/" + application_name + "_" + WALL_key + "_prefix\"/>\n") WALL_haveArray=True elif WALL_type == "bool": debug.info(" create : CHECKBOX"); tmpFile.write( " <CheckBoxPreference android:key=\"" + application_name + "_" + WALL_key + "\"\n") tmpFile.write( " android:title=\"" + WALL_title + "\"\n") tmpFile.write( " android:summary=\"" + WALL_summary + "\"\n") tmpFile.write( " android:summaryOn=\"" + WALL_other[0] + "\"\n") tmpFile.write( " android:summaryOff=\"" + WALL_other[1] + "\"/>\n") tmpFile.write( "</PreferenceScreen>\n") tmpFile.flush() tmpFile.close() if WALL_haveArray==True: for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in module.get_pkg("ANDROID_WALLPAPER_PROPERTIES"): if WALL_type == "list": debug.print_element("pkg", target.get_build_path(package_name) + "/res/values/" + WALL_key + ".xml", "<==", "package configurations") tools.create_directory_of_file(target.get_build_path(package_name) + "/res/values/" + WALL_key + ".xml") tmpFile = open(target.get_build_path(package_name) + "/res/values/" + WALL_key + ".xml", 'w'); tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n") tmpFile.write( "<resources xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\">\n") tmpFile.write( " <string-array name=\"" + application_name + "_" + WALL_key + "_names\">\n") for WALL_subKey, WALL_display in WALL_other: tmpFile.write( " <item>" + WALL_display + "</item>\n") tmpFile.write( " </string-array>\n") tmpFile.write( " <string-array name=\"" + application_name + "_" + WALL_key + "_prefix\">\n") for WALL_subKey, WALL_display in WALL_other: tmpFile.write( " <item>" + WALL_subKey + "</item>\n") tmpFile.write( " </string-array>\n") tmpFile.write( "</resources>\n") tmpFile.flush() tmpFile.close() """ #add properties on wallpaper : # my_module.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["list", key, title, summary, [["key","value display"],["key2","value display 2"]]) # my_module.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", [["key","value display"],["key2","value display 2"]]]) # my_module.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"]) # my_module.add_pkg("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"] #copy needed resources : for res_source, res_dest in module.get_pkg("ANDROID_RESOURCES"): if res_source == "": continue tools.copy_file(res_source , target.get_staging_path(package_name) + "/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(target.get_staging_path(package_name) + "/src/noFile") androidToolPath = target.path_sdk + "/build-tools/" # find android tool version 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] + "/" adModResoucepath = "" if module.get_pkg("ADMOD_ID") != None: adModResoucepath = " -S " + target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ " cmdLine = androidToolPath + "aapt p -f " \ + "-M " + target.get_staging_path(package_name) + "/AndroidManifest.xml " \ + "-F " + target.get_staging_path(package_name) + "/resources.res " \ + "-I " + target.path_sdk + "/platforms/android-" + str(target.board_id) + "/android.jar "\ + "-S " + target.get_staging_path(package_name) + "/res/ " \ + adModResoucepath \ + "-J " + target.get_staging_path(package_name) + "/src/ " multiprocess.run_command(cmdLine) #aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library} # -S ${android-resource-directory} [-m -J ${path.to.output.the.R.java}] tools.create_directory_of_file(target.get_staging_path(package_name) + "/build/classes/noFile") debug.print_element("pkg", "*.class", "<==", "*.java") # more information with : -Xlint # + java_file_wrapper + " "\ # this generate ex: out/Android/debug/staging/tethys/src/com/edouarddupin/tethys/edn.java #generate android java files: filesString="" for element in module.get_pkg("ANDROID_JAVA_FILES"): if element=="DEFAULT": filesString += target.path_gale + "/android/src/org/gale/GaleAudioTask.java " filesString += target.path_gale + "/android/src/org/gale/GaleCallback.java " filesString += target.path_gale + "/android/src/org/gale/GaleConstants.java " filesString += target.path_gale + "/android/src/org/gale/Gale.java " filesString += target.path_gale + "/android/src/org/gale/GaleRendererGL.java " filesString += target.path_gale + "/android/src/org/gale/GaleSurfaceViewGL.java " filesString += target.path_gale + "/android/src/org/gale/GaleActivity.java " filesString += target.path_gale + "/android/src/org/gale/GaleWallpaper.java " else: filesString += element + " " if in module.get_pkg("ADMOD_ID") != None: filesString += target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java " if len(module.get_pkg("ANDROID_WALLPAPER_PROPERTIES"))!=0: filesString += target.path_java_project + application_name + "Settings.java " adModJarFile = "" if module.get_pkg("ADMOD_ID") != None: adModJarFile = ":" + target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar" cmdLine = "javac " \ + "-d " + target.get_staging_path(package_name) + "/build/classes " \ + "-classpath " + target.path_sdk + "/platforms/android-" + str(target.board_id) + "/android.jar" \ + adModJarFile + " " \ + filesString \ + java_file_wrapper + " " \ + target.get_staging_path(package_name) + "/src/R.java " multiprocess.run_command(cmdLine) debug.print_element("pkg", ".dex", "<==", "*.class") cmdLine = androidToolPath + "dx " \ + "--dex --no-strict " \ + "--output=" + target.get_staging_path(package_name) + "/build/" + application_name + ".dex " \ + target.get_staging_path(package_name) + "/build/classes/ " if module.get_pkg("ADMOD_ID") != None: cmdLine += target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar " multiprocess.run_command(cmdLine) """ return {"files":file_list}
def configure(target, my_module): my_module.add_extra_flags() # add the file to compile: my_module.add_src_file([ 'gale/gale.cpp', 'gale/debug.cpp', 'gale/Dimension.cpp', 'gale/orientation.cpp', 'gale/Application.cpp', 'gale/Thread.cpp', ]) my_module.add_header_file([ 'gale/debug.hpp', 'gale/gale.hpp', 'gale/Dimension.hpp', 'gale/orientation.hpp', 'gale/Application.hpp', 'gale/Thread.hpp', ]) # context: my_module.add_src_file([ 'gale/context/clipBoard.cpp', 'gale/context/commandLine.cpp', 'gale/context/Context.cpp', 'gale/context/cursor.cpp', ]) my_module.add_header_file([ 'gale/context/clipBoard.hpp', 'gale/context/commandLine.hpp', 'gale/context/Context.hpp', 'gale/context/cursor.hpp', 'gale/context/Fps.hpp' ]) if "Linux" in target.get_type(): my_module.add_src_file('gale/context/X11/Context.cpp') # check if egami is present in the worktree: this is for the icon parsing ... my_module.add_optionnal_depend('egami', ["c++", "-DGALE_BUILD_EGAMI"]) elif "Windows" in target.get_type(): my_module.add_src_file('gale/context/Windows/Context.cpp') my_module.add_depend('start-mode-gui') elif "Android" in target.get_type(): my_module.add_src_file('gale/context/Android/Context.cpp') my_module.add_src_file([ 'android/src/org/gale/GaleCallback.java', 'android/src/org/gale/GaleConstants.java', 'android/src/org/gale/Gale.java', 'android/src/org/gale/GaleRendererGL.java', 'android/src/org/gale/GaleSurfaceViewGL.java', 'android/src/org/gale/GaleActivity.java', 'android/src/org/gale/GaleWallpaper.java', 'org.gale.GaleConstants.javah' ]) my_module.add_path('android/src/', type='java') elif "MacOs" in target.get_type(): my_module.add_src_file([ 'gale/context/MacOs/Context.mm', 'gale/context/MacOs/Interface.mm', 'gale/context/MacOs/Windows.mm', 'gale/context/MacOs/OpenglView.mm', 'gale/context/MacOs/AppDelegate.mm' ]) elif "IOs" in target.get_type(): my_module.add_src_file([ 'gale/context/IOs/Context.cpp', 'gale/context/IOs/Interface.m', 'gale/context/IOs/OpenglView.mm', 'gale/context/IOs/AppDelegate.mm' ]) else: debug.error("unknow mode...") # Key properties: my_module.add_src_file([ 'gale/key/keyboard.cpp', 'gale/key/Special.cpp', 'gale/key/status.cpp', 'gale/key/type.cpp' ]) my_module.add_header_file([ 'gale/key/keyboard.hpp', 'gale/key/Special.hpp', 'gale/key/status.hpp', 'gale/key/type.hpp', 'gale/key/key.hpp' ]) # OpenGL interface: my_module.add_src_file([ 'gale/renderer/openGL/openGL.cpp' ]) my_module.add_header_file([ 'gale/renderer/openGL/openGL.hpp', 'gale/renderer/openGL/openGL-include.hpp' ]) # resources: my_module.add_src_file([ 'gale/resource/Manager.cpp', 'gale/resource/Program.cpp', 'gale/resource/Resource.cpp', 'gale/resource/Shader.cpp', 'gale/resource/Texture.cpp', 'gale/resource/VirtualBufferObject.cpp' ]) my_module.add_header_file([ 'gale/resource/Manager.hpp', 'gale/resource/Program.hpp', 'gale/resource/Resource.hpp', 'gale/resource/Shader.hpp', 'gale/resource/Texture.hpp', 'gale/resource/VirtualBufferObject.hpp' ]) my_module.add_depend([ 'etk', 'opengl', 'echrono', ]) my_module.add_optionnal_depend('esignal', ["c++", "-DGALE_BUILD_ESIGNAL"]) my_module.add_optionnal_depend('eproperty', ["c++", "-DGALE_BUILD_EPROPERTY"]) my_module.add_path(".") my_module.add_flag('c++', [ "-DGALE_VERSION=\"\\\"" + tools.version_to_string(my_module.get_pkg("VERSION")) + "\\\"\"" ]) if "Linux" in target.get_type(): pass elif "Android" in target.get_type(): my_module.add_depend(["SDK", "jvm-basics"]) # add tre creator of the basic java class ... target.add_action("BINARY", 50, "gale-auto-wrapper", tool_generate_main_java_class) # TODO : Add the same for BINARY to create a console interface ? elif "Windows" in target.get_type(): my_module.add_depend("glew") elif "MacOs" in target.get_type(): my_module.add_depend([ "Cocoa", "QuartzCore", "AppKit", ]) elif "IOs" in target.get_type(): my_module.add_depend([ "CoreGraphics", "UIKit", "GLKit", "Foundation", "QuartzCore", ]) return True
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): # http://alp.developpez.com/tutoriels/debian/creer-paquet/ debianpkg_name = re.sub("_", "-", pkg_name) debug.debug("------------------------------------------------------------------------") debug.info("Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"])) debug.debug("------------------------------------------------------------------------") #output path target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app") tools.create_directory_of_file(target_outpath) ## Create share datas: ret_share = self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## copy binary files: ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## Create libraries: ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ## Create generic files: ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static) ## end of the package generation build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt") #Check date between the current file "list of action to generate package and the end of package generation need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True) ## create the package: if ret_share \ or ret_bin \ or ret_lib \ or ret_file \ or need_generate_package: """ ## create the package: debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg") os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") #multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") tools.create_directory_of_file(self.get_final_path()) tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg") def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): """ self.get_staging_path(pkg_name) target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/" finalFileControl = target_outpathDebian + "control" finalFilepostRm = target_outpathDebian + "postrm" # create the paths : tools.create_directory_of_file(finalFileControl) tools.create_directory_of_file(finalFilepostRm) ## Create the control file tools.create_directory_of_file(finalFileControl) tmpFile = open(finalFileControl, 'w') tmpFile.write("Package: " + debianpkg_name + "\n") tmpFile.write("Version: " + tools.version_to_string(pkg_properties["VERSION"]) + "\n") tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n") tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n") tmpFile.write("Architecture: all\n") tmpFile.write("Depends: bash\n") tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n") tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n") tmpFile.write("\n") tmpFile.flush() tmpFile.close() ## Create the PostRm tmpFile = open(finalFilepostRm, 'w') tmpFile.write("#!/bin/bash\n") tmpFile.write("touch ~/." + pkg_name + "\n") if pkg_name != "": tmpFile.write("touch ~/.local/share/" + pkg_name + "\n") tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n") tmpFile.write("\n") tmpFile.flush() tmpFile.close() ## 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_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README" tools.create_directory_of_file(readmeFileDest) if os.path.exists(base_pkg_path + "/os-Linux/README")==True: tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest) elif os.path.exists(base_pkg_path + "/README")==True: tools.copy_file(base_pkg_path + "/README", readmeFileDest) elif os.path.exists(base_pkg_path + "/README.md")==True: tools.copy_file(base_pkg_path + "/README.md", readmeFileDest) else: debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one") tmpFile = open(readmeFileDest, 'w') tmpFile.write("No documentation for " + pkg_name + "\n") tmpFile.flush() tmpFile.close() ## licence file license_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright" tools.create_directory_of_file(license_file_dest) if os.path.exists(base_pkg_path + "/license.txt")==True: tools.copy_file(base_pkg_path + "/license.txt", license_file_dest) else: debug.info("no file 'license.txt' ==> generate an empty one") tmpFile = open(license_file_dest, 'w') tmpFile.write("No license define by the developper for " + pkg_name + "\n") tmpFile.flush() tmpFile.close() ##changeLog file change_log_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog" tools.create_directory_of_file(change_log_file_dest) if os.path.exists(base_pkg_path + "/changelog")==True: tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest) else: debug.info("no file 'changelog' ==> generate an empty one") tmpFile = open(change_log_file_dest, 'w') tmpFile.write("No changelog data " + pkg_name + "\n") tmpFile.flush() tmpFile.close() ## create the package : debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb") os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name) tools.create_directory_of_file(self.get_final_path()) tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package) # package is done corectly ... tools.file_write_data(build_package_path_done, "done...")