@@ -533,7 +533,8 @@ static void PyCompiler_dealloc (PyCompiler * self);
533533static PyObject * PyCompiler_build (PyCompiler * self , PyObject * args , PyObject * kw );
534534static PyObject * PyCompiler_watch (PyCompiler * self , PyObject * args , PyObject * kw );
535535static gboolean PyCompiler_set_options (FridaCompilerOptions * options , const gchar * project_root_value , const gchar * output_format_value ,
536- const gchar * bundle_format_value , const gchar * type_check_value , const gchar * source_maps_value , const gchar * compression_value );
536+ const gchar * bundle_format_value , const gchar * type_check_value , const gchar * source_maps_value , const gchar * compression_value ,
537+ const gchar * platform_value , PyObject * externals_value );
537538
538539static int PyPackageManager_init (PyPackageManager * self , PyObject * args , PyObject * kw );
539540static void PyPackageManager_dealloc (PyPackageManager * self );
@@ -4904,26 +4905,28 @@ static PyObject *
49044905PyCompiler_build (PyCompiler * self , PyObject * args , PyObject * kw )
49054906{
49064907 PyObject * result ;
4907- static char * keywords [] =
4908- { "entrypoint " , "project_root" , "output_format" , "bundle_format" , "type_check" , "source_maps" , "compression " , NULL };
4908+ static char * keywords [] = { "entrypoint" , "project_root" , "output_format" , "bundle_format" , "type_check" , "source_maps" , "compression" ,
4909+ "platform " , "externals " , NULL };
49094910 const char * entrypoint ;
49104911 const char * project_root = NULL ;
49114912 const char * output_format = NULL ;
49124913 const char * bundle_format = NULL ;
49134914 const char * type_check = NULL ;
49144915 const char * source_maps = NULL ;
49154916 const char * compression = NULL ;
4917+ const char * platform = NULL ;
4918+ PyObject * externals = NULL ;
49164919 FridaBuildOptions * options ;
49174920 GError * error = NULL ;
49184921 gchar * bundle ;
49194922
4920- if (!PyArg_ParseTupleAndKeywords (args , kw , "s|ssssss " , keywords , & entrypoint , & project_root , & output_format , & bundle_format , & type_check ,
4921- & source_maps , & compression ))
4923+ if (!PyArg_ParseTupleAndKeywords (args , kw , "s|sssssssO " , keywords , & entrypoint , & project_root , & output_format , & bundle_format ,
4924+ & type_check , & source_maps , & compression , & platform , & externals ))
49224925 return NULL ;
49234926
49244927 options = frida_build_options_new ();
49254928 if (!PyCompiler_set_options (FRIDA_COMPILER_OPTIONS (options ), project_root , output_format , bundle_format , type_check , source_maps ,
4926- compression ))
4929+ compression , platform , externals ))
49274930 goto invalid_option_value ;
49284931
49294932 Py_BEGIN_ALLOW_THREADS
@@ -4950,25 +4953,27 @@ PyCompiler_build (PyCompiler * self, PyObject * args, PyObject * kw)
49504953static PyObject *
49514954PyCompiler_watch (PyCompiler * self , PyObject * args , PyObject * kw )
49524955{
4953- static char * keywords [] =
4954- { "entrypoint " , "project_root" , "output_format" , "bundle_format" , "type_check" , "source_maps" , "compression " , NULL };
4956+ static char * keywords [] = { "entrypoint" , "project_root" , "output_format" , "bundle_format" , "type_check" , "source_maps" , "compression" ,
4957+ "platform " , "externals " , NULL };
49554958 const char * entrypoint ;
49564959 const char * project_root = NULL ;
49574960 const char * output_format = NULL ;
49584961 const char * bundle_format = NULL ;
49594962 const char * type_check = NULL ;
49604963 const char * source_maps = NULL ;
49614964 const char * compression = NULL ;
4965+ const char * platform = NULL ;
4966+ PyObject * externals = NULL ;
49624967 FridaWatchOptions * options ;
49634968 GError * error = NULL ;
49644969
4965- if (!PyArg_ParseTupleAndKeywords (args , kw , "s|ssssss " , keywords , & entrypoint , & project_root , & output_format , & bundle_format , & type_check ,
4966- & source_maps , & compression ))
4970+ if (!PyArg_ParseTupleAndKeywords (args , kw , "s|sssssssO " , keywords , & entrypoint , & project_root , & output_format , & bundle_format ,
4971+ & type_check , & source_maps , & compression , & platform , & externals ))
49674972 return NULL ;
49684973
49694974 options = frida_watch_options_new ();
49704975 if (!PyCompiler_set_options (FRIDA_COMPILER_OPTIONS (options ), project_root , output_format , bundle_format , type_check , source_maps ,
4971- compression ))
4976+ compression , platform , externals ))
49724977 goto invalid_option_value ;
49734978
49744979 Py_BEGIN_ALLOW_THREADS
@@ -4991,7 +4996,8 @@ PyCompiler_watch (PyCompiler * self, PyObject * args, PyObject * kw)
49914996
49924997static gboolean
49934998PyCompiler_set_options (FridaCompilerOptions * options , const gchar * project_root_value , const gchar * output_format_value ,
4994- const gchar * bundle_format_value , const gchar * type_check_value , const gchar * source_maps_value , const gchar * compression_value )
4999+ const gchar * bundle_format_value , const gchar * type_check_value , const gchar * source_maps_value , const gchar * compression_value ,
5000+ const gchar * platform_value , PyObject * externals_value )
49955001{
49965002 if (project_root_value != NULL )
49975003 frida_compiler_options_set_project_root (options , project_root_value );
@@ -5046,6 +5052,43 @@ PyCompiler_set_options (FridaCompilerOptions * options, const gchar * project_ro
50465052 frida_compiler_options_set_compression (options , compression );
50475053 }
50485054
5055+ if (platform_value != NULL )
5056+ {
5057+ FridaJsPlatform platform ;
5058+
5059+ if (!PyGObject_unmarshal_enum (platform_value , FRIDA_TYPE_JS_PLATFORM , & platform ))
5060+ return FALSE;
5061+
5062+ frida_compiler_options_set_platform (options , platform );
5063+ }
5064+
5065+ if (externals_value != NULL )
5066+ {
5067+ gint n , i ;
5068+
5069+ n = PySequence_Size (externals_value );
5070+ if (n == -1 )
5071+ return FALSE;
5072+
5073+ for (i = 0 ; i != n ; i ++ )
5074+ {
5075+ PyObject * element ;
5076+ gchar * external = NULL ;
5077+
5078+ element = PySequence_GetItem (externals_value , i );
5079+ if (element == NULL )
5080+ return FALSE;
5081+ PyGObject_unmarshal_string (element , & external );
5082+ Py_DecRef (element );
5083+ if (external == NULL )
5084+ return FALSE;
5085+
5086+ frida_compiler_options_add_external (options , external );
5087+
5088+ g_free (external );
5089+ }
5090+ }
5091+
50495092 return TRUE;
50505093}
50515094
0 commit comments