2015-07-15 08:34:16 +02:00
#!/usr/bin/python
2016-10-04 23:41:29 +02:00
import lutin . debug as debug
2015-07-15 08:34:16 +02:00
import lutin . tools as tools
import lutin . debug as debug
2016-10-26 22:35:42 +02:00
import lutin . image as image
2015-07-15 08:34:16 +02:00
import os
import lutin . multiprocess as lutinMultiprocess
2015-10-14 21:21:03 +02:00
def get_type ( ) :
return " LIBRARY "
2015-07-15 08:34:16 +02:00
def get_desc ( ) :
return " gale is a main library to use widget in the openGl environement and manage all the wraping os "
2015-10-14 21:21:03 +02:00
def get_licence ( ) :
2017-01-05 21:28:23 +01:00
return " MPL-2 "
2015-07-15 08:34:16 +02:00
2015-10-14 21:21:03 +02:00
def get_compagny_type ( ) :
return " com "
def get_compagny_name ( ) :
return " atria-soft "
def get_maintainer ( ) :
2016-09-12 21:06:37 +02:00
return " authors.txt "
2015-10-14 21:21:03 +02:00
def get_version ( ) :
2016-09-12 21:06:37 +02:00
return " version.txt "
2015-10-14 21:21:03 +02:00
2016-10-04 23:41:29 +02:00
def configure ( target , my_module ) :
2016-09-08 21:35:02 +02:00
my_module . add_extra_flags ( )
2015-07-15 08:34:16 +02:00
# add the file to compile:
2015-09-24 21:44:04 +02:00
my_module . add_src_file ( [
2016-08-07 22:49:40 +02:00
' gale/gale.cpp ' ,
' gale/debug.cpp ' ,
' gale/Dimension.cpp ' ,
' gale/orientation.cpp ' ,
' gale/Application.cpp ' ,
' gale/Thread.cpp ' ,
] )
2015-09-24 21:44:04 +02:00
my_module . add_header_file ( [
2016-10-02 16:10:25 +02:00
' gale/debug.hpp ' ,
' gale/gale.hpp ' ,
' gale/Dimension.hpp ' ,
' gale/orientation.hpp ' ,
' gale/Application.hpp ' ,
' gale/Thread.hpp ' ,
2016-08-07 22:49:40 +02:00
] )
2015-10-14 21:21:03 +02:00
# context:
2015-09-24 21:44:04 +02:00
my_module . add_src_file ( [
2016-08-07 22:49:40 +02:00
' gale/context/clipBoard.cpp ' ,
' gale/context/commandLine.cpp ' ,
' gale/context/Context.cpp ' ,
' gale/context/cursor.cpp ' ,
] )
2015-09-24 21:44:04 +02:00
my_module . add_header_file ( [
2016-10-02 16:10:25 +02:00
' gale/context/clipBoard.hpp ' ,
' gale/context/commandLine.hpp ' ,
' gale/context/Context.hpp ' ,
' gale/context/cursor.hpp ' ,
' gale/context/Fps.hpp '
2016-08-07 22:49:40 +02:00
] )
2016-11-04 22:54:25 +01:00
if " Web " in target . get_type ( ) :
my_module . add_src_file ( ' gale/context/SDL/Context.cpp ' )
elif " Linux " in target . get_type ( ) :
2017-01-25 22:44:53 +01:00
my_module . add_optionnal_depend (
' X11 ' ,
[ " c++ " , " -DGALE_BUILD_X11 " ] ,
src_file = [
' gale/context/X11/Context.cpp ' ,
]
)
my_module . add_optionnal_depend (
' wayland ' ,
[ " c++ " , " -DGALE_BUILD_WAYLAND " ] ,
src_file = [
' gale/context/wayland/Context.cpp ' ,
]
)
2015-08-24 22:15:26 +02:00
# check if egami is present in the worktree: this is for the icon parsing ...
2016-09-08 21:35:02 +02:00
my_module . add_optionnal_depend ( ' egami ' , [ " c++ " , " -DGALE_BUILD_EGAMI " ] )
elif " Windows " in target . get_type ( ) :
2015-09-24 21:44:04 +02:00
my_module . add_src_file ( ' gale/context/Windows/Context.cpp ' )
2016-09-28 23:48:00 +02:00
my_module . add_depend ( ' start-mode-gui ' )
2016-09-08 21:35:02 +02:00
elif " Android " in target . get_type ( ) :
2015-09-24 21:44:04 +02:00
my_module . add_src_file ( ' gale/context/Android/Context.cpp ' )
my_module . add_src_file ( [
2016-08-07 22:49:40 +02:00
' 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 '
] )
2016-10-04 23:41:29 +02:00
my_module . add_path ( ' android/src/ ' , type = ' java ' )
2016-09-08 21:35:02 +02:00
elif " MacOs " in target . get_type ( ) :
2015-09-24 21:44:04 +02:00
my_module . add_src_file ( [
2016-08-07 22:49:40 +02:00
' 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 '
] )
2016-09-08 21:35:02 +02:00
elif " IOs " in target . get_type ( ) :
2015-09-24 21:44:04 +02:00
my_module . add_src_file ( [
2016-08-07 22:49:40 +02:00
' gale/context/IOs/Context.cpp ' ,
' gale/context/IOs/Interface.m ' ,
' gale/context/IOs/OpenglView.mm ' ,
' gale/context/IOs/AppDelegate.mm '
] )
2015-07-15 08:34:16 +02:00
else :
debug . error ( " unknow mode... " )
2017-01-25 22:44:53 +01:00
if " Linux " in target . get_type ( ) \
or " Windows " in target . get_type ( ) \
or " MacOs " in target . get_type ( ) :
# only in debug we add simulation:
if target . get_mode ( ) == " debug " :
my_module . add_flag ( ' c++ ' , " -DGALE_BUILD_SIMULATION " )
my_module . add_src_file ( ' gale/context/simulation/Context.cpp ' )
2015-10-14 21:21:03 +02:00
# Key properties:
2015-09-24 21:44:04 +02:00
my_module . add_src_file ( [
2016-08-07 22:49:40 +02:00
' gale/key/keyboard.cpp ' ,
' gale/key/Special.cpp ' ,
' gale/key/status.cpp ' ,
' gale/key/type.cpp '
] )
2015-09-24 21:44:04 +02:00
my_module . add_header_file ( [
2016-10-02 16:10:25 +02:00
' gale/key/keyboard.hpp ' ,
' gale/key/Special.hpp ' ,
' gale/key/status.hpp ' ,
' gale/key/type.hpp ' ,
' gale/key/key.hpp '
2016-08-07 22:49:40 +02:00
] )
2015-10-14 21:21:03 +02:00
# OpenGL interface:
2015-09-24 21:44:04 +02:00
my_module . add_src_file ( [
2016-08-07 22:49:40 +02:00
' gale/renderer/openGL/openGL.cpp '
] )
2015-09-24 21:44:04 +02:00
my_module . add_header_file ( [
2016-10-02 16:10:25 +02:00
' gale/renderer/openGL/openGL.hpp ' ,
' gale/renderer/openGL/openGL-include.hpp '
2016-08-07 22:49:40 +02:00
] )
2015-10-14 21:21:03 +02:00
# resources:
2015-09-24 21:44:04 +02:00
my_module . add_src_file ( [
2016-08-07 22:49:40 +02:00
' gale/resource/Manager.cpp ' ,
' gale/resource/Program.cpp ' ,
' gale/resource/Resource.cpp ' ,
' gale/resource/Shader.cpp ' ,
' gale/resource/Texture.cpp ' ,
' gale/resource/VirtualBufferObject.cpp '
] )
2015-09-24 21:44:04 +02:00
my_module . add_header_file ( [
2016-10-02 16:10:25 +02:00
' gale/resource/Manager.hpp ' ,
' gale/resource/Program.hpp ' ,
' gale/resource/Resource.hpp ' ,
' gale/resource/Shader.hpp ' ,
' gale/resource/Texture.hpp ' ,
' gale/resource/VirtualBufferObject.hpp '
2016-08-07 22:49:40 +02:00
] )
2016-09-08 21:35:02 +02:00
my_module . add_depend ( [
2016-08-07 22:49:40 +02:00
' etk ' ,
2016-10-14 21:13:39 +02:00
' opengl ' ,
' echrono ' ,
2016-08-07 22:49:40 +02:00
] )
2016-09-08 21:35:02 +02:00
my_module . add_optionnal_depend ( ' esignal ' , [ " c++ " , " -DGALE_BUILD_ESIGNAL " ] )
my_module . add_optionnal_depend ( ' eproperty ' , [ " c++ " , " -DGALE_BUILD_EPROPERTY " ] )
2016-10-04 23:41:29 +02:00
my_module . add_path ( " . " )
2015-10-14 21:21:03 +02:00
2016-09-08 21:35:02 +02:00
my_module . add_flag ( ' c++ ' , [
2016-09-16 23:17:09 +02:00
" -DGALE_VERSION= \" \\ \" " + tools . version_to_string ( my_module . get_pkg ( " VERSION " ) ) + " \\ \" \" "
2016-08-07 22:49:40 +02:00
] )
2015-07-15 08:34:16 +02:00
2016-11-04 22:54:25 +01:00
if " Web " in target . get_type ( ) :
my_module . add_depend ( [
" SDL "
] )
elif " Linux " in target . get_type ( ) :
2017-01-25 22:44:53 +01:00
# TODO : This is specific at wayland ==> check How we can add it better
my_module . add_depend ( [
' egl ' ,
' gles2 ' ,
' xkbcommon '
] )
2016-09-08 21:35:02 +02:00
elif " Android " in target . get_type ( ) :
my_module . add_depend ( [ " SDK " , " jvm-basics " ] )
2015-07-15 08:34:16 +02:00
# add tre creator of the basic java class ...
2015-09-18 21:29:53 +02:00
target . add_action ( " BINARY " , 50 , " gale-auto-wrapper " , tool_generate_main_java_class )
2015-07-15 08:34:16 +02:00
# TODO : Add the same for BINARY to create a console interface ?
2016-09-08 21:35:02 +02:00
elif " Windows " in target . get_type ( ) :
2016-09-16 23:17:09 +02:00
my_module . add_depend ( " glew " )
2016-09-08 21:35:02 +02:00
elif " MacOs " in target . get_type ( ) :
2016-09-28 22:39:33 +02:00
my_module . add_depend ( [
" Cocoa " ,
" QuartzCore " ,
" AppKit " ,
] )
2016-09-08 21:35:02 +02:00
elif " IOs " in target . get_type ( ) :
2016-09-28 22:39:33 +02:00
my_module . add_depend ( [
" CoreGraphics " ,
" UIKit " ,
" GLKit " ,
" Foundation " ,
" QuartzCore " ,
] )
2015-07-15 08:34:16 +02:00
2016-10-04 23:41:29 +02:00
return True
2015-07-15 08:34:16 +02:00
##################################################################
##
## Android specific section
##
##################################################################
def tool_generate_main_java_class ( target , module , package_name ) :
file_list = [ ]
debug . debug ( " ------------------------------------------------------------------------ " )
2015-11-02 21:35:08 +01:00
debug . debug ( " Generate android wrapping for ' " + package_name + " ' ==> ' " + target . convert_name_application ( package_name ) + " ' " )
2015-07-15 08:34:16 +02:00
debug . debug ( " ------------------------------------------------------------------------ " )
2015-11-02 21:35:08 +01:00
application_name = target . convert_name_application ( package_name )
2016-09-08 21:35:02 +02:00
if target . get_mode ( ) == " debug " :
2015-07-15 08:34:16 +02:00
application_name + = " debug "
2015-09-18 21:29:53 +02:00
target . path_java_project = target . get_build_path ( package_name ) \
2015-07-15 08:34:16 +02:00
+ " /src/ " \
2016-09-08 21:35:02 +02:00
+ module . get_pkg ( " COMPAGNY_TYPE " ) \
+ " / " + module . get_pkg ( " COMPAGNY_NAME2 " ) \
2015-07-15 08:34:16 +02:00
+ " / " + application_name + " / "
2015-09-18 21:29:53 +02:00
java_file_wrapper = target . path_java_project + " / " + application_name + " .java "
2015-07-15 08:34:16 +02:00
2016-09-08 21:35:02 +02:00
android_package_name = module . get_pkg ( " COMPAGNY_TYPE " ) + " . " + module . get_pkg ( " COMPAGNY_NAME2 " ) + " . " + application_name
2015-07-15 08:34:16 +02:00
debug . print_element ( " pkg " , " absractionFile " , " <== " , " dynamic file " )
2015-09-18 21:29:53 +02:00
# Create path :
2015-07-15 08:34:16 +02:00
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 " )
2017-01-05 21:28:23 +01:00
tmpFile . write ( " * @license MPL-2 (see license file) \n " )
2015-07-15 08:34:16 +02:00
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 " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ANDROID_APPL_TYPE " ) == " APPL " :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " import org.gale.GaleActivity; \n " )
else :
tmpFile . write ( " import org.gale.GaleWallpaper; \n " )
tmpFile . write ( " \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__IMPORT " ) != None :
for elem in module . get_pkg ( " GENERATE_SECTION__IMPORT " ) :
2015-07-15 08:34:16 +02:00
for line in elem :
tmpFile . write ( line + " \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ANDROID_APPL_TYPE " ) == " APPL " :
2015-07-15 08:34:16 +02:00
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 " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__DECLARE " ) != None :
for elem in module . get_pkg ( " GENERATE_SECTION__DECLARE " ) :
2015-07-15 08:34:16 +02:00
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 " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ANDROID_APPL_TYPE " ) != " APPL " :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " public Engine onCreateEngine() { \n " )
2016-09-08 21:35:02 +02:00
tmpFile . write ( " initApkPath( \" " + module . get_pkg ( " COMPAGNY_TYPE " ) + " \" , \" " + module . get_pkg ( " COMPAGNY_NAME2 " ) + " \" , \" " + application_name + " \" , \" " + package_name + " \" ); \n " )
2017-04-26 22:16:25 +02:00
tmpFile . write ( " Engine tmpEngine = super.onCreateEngine(); \n " )
2015-07-15 08:34:16 +02:00
tmpFile . write ( " return tmpEngine; \n " )
tmpFile . write ( " } \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__CONSTRUCTOR " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " public " + application_name + " () { \n " )
2016-09-08 21:35:02 +02:00
for elem in module . get_pkg ( " GENERATE_SECTION__CONSTRUCTOR " ) :
2015-07-15 08:34:16 +02:00
for line in elem :
tmpFile . write ( " " + line + " \n " )
tmpFile . write ( " } \n " )
2016-10-26 22:35:42 +02:00
if module . get_pkg ( " ANDROID_APPL_TYPE " ) != " APPL " :
tmpFile . write ( " public void onCreate() { \n " )
tmpFile . write ( " initApkPath( \" " + module . get_pkg ( " COMPAGNY_TYPE " ) + " \" , \" " + module . get_pkg ( " COMPAGNY_NAME2 " ) + " \" , \" " + application_name + " \" , \" " + package_name + " \" ); \n " )
2017-04-26 22:16:25 +02:00
tmpFile . write ( " super.onCreate(); \n " )
2016-10-26 22:35:42 +02:00
else :
tmpFile . write ( " public void onCreate(android.os.Bundle savedInstanceState) { \n " )
tmpFile . write ( " initApkPath( \" " + module . get_pkg ( " COMPAGNY_TYPE " ) + " \" , \" " + module . get_pkg ( " COMPAGNY_NAME2 " ) + " \" , \" " + application_name + " \" , \" " + package_name + " \" ); \n " )
2017-04-26 22:16:25 +02:00
tmpFile . write ( " super.onCreate(savedInstanceState); \n " )
2015-07-15 08:34:16 +02:00
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__ON_CREATE " ) != None :
for elem in module . get_pkg ( " GENERATE_SECTION__ON_CREATE " ) :
2015-07-15 08:34:16 +02:00
for line in elem :
tmpFile . write ( " " + line + " \n " )
tmpFile . write ( " } \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__ON_START " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " @Override protected void onStart() { \n " )
2016-09-08 21:35:02 +02:00
for elem in module . get_pkg ( " GENERATE_SECTION__ON_START " ) :
2015-07-15 08:34:16 +02:00
for line in elem :
tmpFile . write ( " " + line + " \n " )
tmpFile . write ( " super.onStart(); \n " )
tmpFile . write ( " } \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__ON_RESTART " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " @Override protected void onRestart() { \n " )
2016-09-08 21:35:02 +02:00
for elem in module . get_pkg ( " GENERATE_SECTION__ON_RESTART " ) :
2015-07-15 08:34:16 +02:00
for line in elem :
tmpFile . write ( " " + line + " \n " )
tmpFile . write ( " super.onRestart(); \n " )
tmpFile . write ( " } \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__ON_RESUME " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " @Override protected void onResume() { \n " )
tmpFile . write ( " super.onResume(); \n " )
2016-09-08 21:35:02 +02:00
for elem in module . get_pkg ( " GENERATE_SECTION__ON_RESUME " ) :
2015-07-15 08:34:16 +02:00
for line in elem :
tmpFile . write ( " " + line + " \n " )
tmpFile . write ( " } \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__ON_PAUSE " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " @Override protected void onPause() { \n " )
2016-09-08 21:35:02 +02:00
for elem in module . get_pkg ( " GENERATE_SECTION__ON_PAUSE " ) :
2015-07-15 08:34:16 +02:00
for line in elem :
tmpFile . write ( " " + line + " \n " )
tmpFile . write ( " super.onPause(); \n " )
tmpFile . write ( " } \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__ON_STOP " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " @Override protected void onStop() { \n " )
2016-09-08 21:35:02 +02:00
for elem in module . get_pkg ( " GENERATE_SECTION__ON_STOP " ) :
2015-07-15 08:34:16 +02:00
for line in elem :
tmpFile . write ( " " + line + " \n " )
tmpFile . write ( " super.onStop(); \n " )
tmpFile . write ( " } \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " GENERATE_SECTION__ON_DESTROY " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " @Override protected void onDestroy() { \n " )
2016-09-08 21:35:02 +02:00
for elem in module . get_pkg ( " GENERATE_SECTION__ON_DESTROY " ) :
2015-07-15 08:34:16 +02:00
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 ] )
2016-10-26 22:35:42 +02:00
## todo:
2015-07-15 08:34:16 +02:00
"""
2016-10-26 22:35:42 +02:00
debug . warning ( " icon : " + module . get_pkg ( " ICON " ) )
2015-09-18 21:29:53 +02:00
tools . create_directory_of_file ( target . get_staging_path ( package_name ) + " /res/drawable/icon.png " ) ;
2016-09-08 21:35:02 +02:00
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 )
2016-10-26 22:35:42 +02:00
# if must be copied befor as user data ... todo : check
pass
2015-07-15 08:34:16 +02:00
else :
2016-10-26 22:35:42 +02:00
debug . warning ( " copy a generic Atria-soft icon ... " )
2015-07-15 08:34:16 +02:00
# to be sure that we have all time a resource ...
2016-10-26 22:35:42 +02:00
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 )
2015-07-15 08:34:16 +02:00
"""
2016-10-26 22:35:42 +02:00
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ANDROID_MANIFEST " ) == " " :
2015-07-15 08:34:16 +02:00
# force manifest file:
2016-10-26 22:35:42 +02:00
module . set_pkg ( " ANDROID_MANIFEST " , os . path . join ( target . get_build_path ( package_name ) , " AndroidManifest.xml " ) ) ;
2016-09-08 21:35:02 +02:00
debug . debug ( " create file: ' " + module . get_pkg ( " ANDROID_MANIFEST " ) + " ' " )
if module . get_pkg ( " VERSION_CODE " ) == None :
module . set_pkg ( " VERSION_CODE " , " 1 " )
2015-07-15 08:34:16 +02:00
debug . print_element ( " pkg " , " AndroidManifest.xml " , " <== " , " package configurations " )
2016-09-08 21:35:02 +02:00
tools . create_directory_of_file ( module . get_pkg ( " ANDROID_MANIFEST " ) )
tmpFile = open ( module . get_pkg ( " ANDROID_MANIFEST " ) , ' w ' )
2015-07-15 08:34:16 +02:00
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 ' )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " VERSION_CODE " ) == ' ' :
2015-11-02 21:35:08 +01:00
debug . warning ( " Missing application ' VERSION_CODE ' ==> set it at ' 0 ' (this can creata an NON update on android play store) " )
2016-09-08 21:35:02 +02:00
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 ' )
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <uses-feature android:glEsVersion= " 0x00020000 " android:required= " true " /> \n ' )
2015-10-30 21:25:22 +01:00
tmpFile . write ( ' <uses-sdk android:minSdkVersion= " ' + str ( target . board_id ) + ' " \n ' )
tmpFile . write ( ' android:targetSdkVersion= " ' + str ( target . board_id ) + ' " /> \n ' )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ANDROID_APPL_TYPE " ) == " APPL " :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <application android:label= " ' + application_name + ' " \n ' )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ICON " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' android:icon= " @drawable/icon " \n ' )
2016-09-08 21:35:02 +02:00
if target . get_mode ( ) == " debug " :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' android:debuggable= " true " \n ' )
tmpFile . write ( ' > \n ' )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ADMOD_ID " ) != None :
2015-07-15 08:34:16 +02:00
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 ' )
2016-09-08 21:35:02 +02:00
tmpFile . write ( ' android:label= " ' + module . get_pkg ( ' NAME ' ) )
if target . get_mode ( ) == " debug " :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " -debug " )
tmpFile . write ( ' " \n ' )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ICON " ) != None :
2015-07-15 08:34:16 +02:00
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 ' )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ADMOD_ID " ) != None :
2015-07-15 08:34:16 +02:00
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 ' )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ICON " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' android:icon= " @drawable/icon " \n ' )
tmpFile . write ( ' > \n ' )
tmpFile . write ( ' <service android:name= " . ' + application_name + ' " \n ' )
2016-09-08 21:35:02 +02:00
tmpFile . write ( ' android:label= " ' + module . get_pkg ( ' NAME ' ) )
if target . get_mode ( ) == " debug " :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " -debug " )
tmpFile . write ( ' " \n ' )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ICON " ) != None :
2015-07-15 08:34:16 +02:00
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 ' )
2016-09-08 21:35:02 +02:00
if len ( module . get_pkg ( " ANDROID_WALLPAPER_PROPERTIES " ) ) != 0 :
2015-07-15 08:34:16 +02:00
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 ' )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ICON " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' android:icon= " @drawable/icon " \n ' )
tmpFile . write ( ' > \n ' )
tmpFile . write ( ' </activity> \n ' )
tmpFile . write ( ' </application> \n ' )
# write package autorisations :
2016-09-08 21:35:02 +02:00
if " WRITE_EXTERNAL_STORAGE " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.WRITE_EXTERNAL_STORAGE " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.WRITE_EXTERNAL_STORAGE " /> \n ' )
2016-09-08 21:35:02 +02:00
if " CAMERA " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.CAMERA " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.CAMERA " /> \n ' )
2016-09-08 21:35:02 +02:00
if " INTERNET " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.INTERNET " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.INTERNET " /> \n ' )
2016-09-08 21:35:02 +02:00
if " ACCESS_NETWORK_STATE " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.ACCESS_NETWORK_STATE " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.ACCESS_NETWORK_STATE " /> \n ' )
2016-09-08 21:35:02 +02:00
if " MODIFY_AUDIO_SETTINGS " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.MODIFY_AUDIO_SETTINGS " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.MODIFY_AUDIO_SETTINGS " /> \n ' )
2016-09-08 21:35:02 +02:00
if " READ_CALENDAR " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.READ_CALENDAR " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.READ_CALENDAR " /> \n ' )
2016-09-08 21:35:02 +02:00
if " READ_CONTACTS " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.READ_CONTACTS " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.READ_CONTACTS " /> \n ' )
2016-09-08 21:35:02 +02:00
if " READ_FRAME_BUFFER " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.READ_FRAME_BUFFER " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.READ_FRAME_BUFFER " /> \n ' )
2016-09-08 21:35:02 +02:00
if " READ_PROFILE " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.READ_PROFILE " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.READ_PROFILE " /> \n ' )
2016-09-08 21:35:02 +02:00
if " RECORD_AUDIO " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.RECORD_AUDIO " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.RECORD_AUDIO " /> \n ' )
2016-09-08 21:35:02 +02:00
if " SET_ORIENTATION " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.SET_ORIENTATION " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.SET_ORIENTATION " /> \n ' )
2016-09-08 21:35:02 +02:00
if " VIBRATE " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.VIBRATE " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.VIBRATE " /> \n ' )
2016-09-08 21:35:02 +02:00
if " ACCESS_COARSE_LOCATION " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
tmpFile . write ( ' <permission android:name= " android.permission.ACCESS_COARSE_LOCATION " /> \n ' )
tmpFile . write ( ' <uses-permission android:name= " android.permission.ACCESS_COARSE_LOCATION " /> \n ' )
2016-09-08 21:35:02 +02:00
if " ACCESS_FINE_LOCATION " in module . get_pkg ( " RIGHT " ) :
2015-07-15 08:34:16 +02:00
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
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ANDROID_APPL_TYPE " ) != " APPL " :
2015-07-15 08:34:16 +02:00
#create the Wallpaper sub files : (main element for the application
debug . print_element ( " pkg " , application_name + " _resource.xml " , " <== " , " package configurations " )
2016-10-26 22:35:42 +02:00
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 ' )
2015-07-15 08:34:16 +02:00
tmpFile . write ( " <?xml version= \" 1.0 \" encoding= \" utf-8 \" ?> \n " )
tmpFile . write ( " <wallpaper xmlns:android= \" http://schemas.android.com/apk/res/android \" \n " )
2016-09-08 21:35:02 +02:00
if len ( module . get_pkg ( " ANDROID_WALLPAPER_PROPERTIES " ) ) != 0 :
2016-10-26 22:35:42 +02:00
tmpFile . write ( " android:settingsActivity= \" " + android_package_name + " . " + application_name + " Settings \" \n " )
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ICON " ) != None :
2015-07-15 08:34:16 +02:00
tmpFile . write ( " android:thumbnail= \" @drawable/icon \" \n " )
tmpFile . write ( " /> \n " )
tmpFile . flush ( )
tmpFile . close ( )
# create wallpaper setting if needed (class and config file)
2016-09-08 21:35:02 +02:00
if len ( module . get_pkg ( " ANDROID_WALLPAPER_PROPERTIES " ) ) != 0 :
2015-09-18 21:29:53 +02:00
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 ' ) ;
2015-07-15 08:34:16 +02:00
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 ( )
2015-09-18 21:29:53 +02:00
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 ' ) ;
2015-07-15 08:34:16 +02:00
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
2016-09-08 21:35:02 +02:00
for WALL_type , WALL_key , WALL_title , WALL_summary , WALL_other in module . get_pkg ( " ANDROID_WALLPAPER_PROPERTIES " ) :
2015-07-15 08:34:16 +02:00
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 :
2016-09-08 21:35:02 +02:00
for WALL_type , WALL_key , WALL_title , WALL_summary , WALL_other in module . get_pkg ( " ANDROID_WALLPAPER_PROPERTIES " ) :
2015-07-15 08:34:16 +02:00
if WALL_type == " list " :
2015-09-18 21:29:53 +02:00
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 ' ) ;
2015-07-15 08:34:16 +02:00
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 :
2016-10-06 21:46:41 +02:00
# 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"]
2015-07-15 08:34:16 +02:00
#copy needed resources :
2016-09-08 21:35:02 +02:00
for res_source , res_dest in module . get_pkg ( " ANDROID_RESOURCES " ) :
2015-07-15 08:34:16 +02:00
if res_source == " " :
continue
2015-09-18 21:29:53 +02:00
tools . copy_file ( res_source , target . get_staging_path ( package_name ) + " /res/ " + res_dest + " / " + os . path . basename ( res_source ) , force = True )
2015-07-15 08:34:16 +02:00
"""
"""
# 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 " )
2015-09-18 21:29:53 +02:00
tools . create_directory_of_file ( target . get_staging_path ( package_name ) + " /src/noFile " )
androidToolPath = target . path_sdk + " /build-tools/ "
2015-07-15 08:34:16 +02:00
# find android tool version
2015-09-18 21:29:53 +02:00
dirnames = tools . get_list_sub_path ( androidToolPath )
2015-07-15 08:34:16 +02:00
if len ( dirnames ) != 1 :
debug . error ( " an error occured when getting the tools for android " )
androidToolPath + = dirnames [ 0 ] + " / "
2015-09-18 21:29:53 +02:00
adModResoucepath = " "
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ADMOD_ID " ) != None :
2015-09-18 21:29:53 +02:00
adModResoucepath = " -S " + target . path_sdk + " /extras/google/google_play_services/libproject/google-play-services_lib/res/ "
2015-07-15 08:34:16 +02:00
cmdLine = androidToolPath + " aapt p -f " \
2015-09-18 21:29:53 +02:00
+ " -M " + target . get_staging_path ( package_name ) + " /AndroidManifest.xml " \
+ " -F " + target . get_staging_path ( package_name ) + " /resources.res " \
2015-10-30 21:25:22 +01:00
+ " -I " + target . path_sdk + " /platforms/android- " + str ( target . board_id ) + " /android.jar " \
2015-09-18 21:29:53 +02:00
+ " -S " + target . get_staging_path ( package_name ) + " /res/ " \
+ adModResoucepath \
+ " -J " + target . get_staging_path ( package_name ) + " /src/ "
2015-07-15 08:34:16 +02:00
multiprocess . run_command ( cmdLine )
#aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library}
2015-09-18 21:29:53 +02:00
# -S ${android-resource-directory} [-m -J ${path.to.output.the.R.java}]
2015-07-15 08:34:16 +02:00
2015-09-18 21:29:53 +02:00
tools . create_directory_of_file ( target . get_staging_path ( package_name ) + " /build/classes/noFile " )
2015-07-15 08:34:16 +02:00
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 = " "
2016-09-08 21:35:02 +02:00
for element in module . get_pkg ( " ANDROID_JAVA_FILES " ) :
2015-07-15 08:34:16 +02:00
if element == " DEFAULT " :
2015-09-18 21:29:53 +02:00
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 "
2015-07-15 08:34:16 +02:00
else :
filesString + = element + " "
2016-09-08 21:35:02 +02:00
if in module . get_pkg ( " ADMOD_ID " ) != None :
2015-09-18 21:29:53 +02:00
filesString + = target . path_sdk + " /extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java "
2015-07-15 08:34:16 +02:00
2016-09-08 21:35:02 +02:00
if len ( module . get_pkg ( " ANDROID_WALLPAPER_PROPERTIES " ) ) != 0 :
2015-09-18 21:29:53 +02:00
filesString + = target . path_java_project + application_name + " Settings.java "
2015-07-15 08:34:16 +02:00
adModJarFile = " "
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ADMOD_ID " ) != None :
2015-09-18 21:29:53 +02:00
adModJarFile = " : " + target . path_sdk + " /extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
2015-07-15 08:34:16 +02:00
cmdLine = " javac " \
2015-09-18 21:29:53 +02:00
+ " -d " + target . get_staging_path ( package_name ) + " /build/classes " \
2015-10-30 21:25:22 +01:00
+ " -classpath " + target . path_sdk + " /platforms/android- " + str ( target . board_id ) + " /android.jar " \
2015-07-15 08:34:16 +02:00
+ adModJarFile + " " \
+ filesString \
+ java_file_wrapper + " " \
2015-09-18 21:29:53 +02:00
+ target . get_staging_path ( package_name ) + " /src/R.java "
2015-07-15 08:34:16 +02:00
multiprocess . run_command ( cmdLine )
debug . print_element ( " pkg " , " .dex " , " <== " , " *.class " )
cmdLine = androidToolPath + " dx " \
+ " --dex --no-strict " \
2015-09-18 21:29:53 +02:00
+ " --output= " + target . get_staging_path ( package_name ) + " /build/ " + application_name + " .dex " \
+ target . get_staging_path ( package_name ) + " /build/classes/ "
2015-07-15 08:34:16 +02:00
2016-09-08 21:35:02 +02:00
if module . get_pkg ( " ADMOD_ID " ) != None :
2015-09-18 21:29:53 +02:00
cmdLine + = target . path_sdk + " /extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
2015-07-15 08:34:16 +02:00
multiprocess . run_command ( cmdLine )
"""
return { " files " : file_list }