#NEWLINE# def generate_vala_compile( self , compiler , target , outfile ) : #NEWLINE# #INDENT# 'Vala is compiled into C. Set up all necessary build steps here.' #NEWLINE# valac = self . environment . coredata . compilers [ 'vala' ] #NEWLINE# ( src , vapi_src ) = self . split_vala_sources ( target . get_sources ( ) ) #NEWLINE# vapi_src = [ x . rel_to_builddir ( self . build_to_src ) for x in vapi_src ] #NEWLINE# extra_dep_files = [ ] #NEWLINE# vala_input_files = [ ] #NEWLINE# for s in src : #NEWLINE# #INDENT# if s . endswith ( '.vala' ) : #NEWLINE# #INDENT# vala_input_files . append ( s . rel_to_builddir ( self . build_to_src ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( src ) == 0 ) : #NEWLINE# #INDENT# raise InvalidArguments ( 'Vala library has no Vala source files.' ) #NEWLINE# #UNINDENT# namebase = os . path . splitext ( os . path . split ( src [ 0 ] . fname ) [ 1 ] ) [ 0 ] #NEWLINE# base_h = ( namebase + '.h' ) #NEWLINE# base_vapi = ( namebase + '.vapi' ) #NEWLINE# hname = os . path . normpath ( os . path . join ( self . get_target_dir ( target ) , base_h ) ) #NEWLINE# vapiname = os . path . normpath ( os . path . join ( self . get_target_dir ( target ) , base_vapi ) ) #NEWLINE# generated_c_files = [ ] #NEWLINE# outputs = [ vapiname ] #NEWLINE# args = [ ] #NEWLINE# args += self . build . get_global_args ( compiler ) #NEWLINE# args += compiler . get_buildtype_args ( self . environment . coredata . get_builtin_option ( 'buildtype' ) ) #NEWLINE# args += [ '-d' , self . get_target_private_dir ( target ) ] #NEWLINE# args += [ '-C' ] #NEWLINE# if ( not isinstance ( target , build . Executable ) ) : #NEWLINE# #INDENT# outputs . append ( hname ) #NEWLINE# args += [ '-H' , hname ] #NEWLINE# args += [ ( '--library=' + target . name ) ] #NEWLINE# #UNINDENT# args += [ ( '--vapi=' + os . path . join ( '..' , base_vapi ) ) ] #NEWLINE# for src in vala_input_files : #NEWLINE# #INDENT# namebase = ( os . path . splitext ( os . path . split ( src ) [ 1 ] ) [ 0 ] + '.c' ) #NEWLINE# full_c = os . path . join ( self . get_target_private_dir ( target ) , namebase ) #NEWLINE# generated_c_files . append ( full_c ) #NEWLINE# outputs . append ( full_c ) #NEWLINE# #UNINDENT# if self . environment . coredata . get_builtin_option ( 'werror' ) : #NEWLINE# #INDENT# args += valac . get_werror_args ( ) #NEWLINE# #UNINDENT# for d in target . external_deps : #NEWLINE# #INDENT# if isinstance ( d , dependencies . PkgConfigDependency ) : #NEWLINE# #INDENT# if ( ( d . name == 'glib-2.0' ) and ( d . version_requirement is not None ) and d . version_requirement . startswith ( ( '>=' , '==' ) ) ) : #NEWLINE# #INDENT# args += [ '--target-glib' , d . version_requirement [ 2 : ] ] #NEWLINE# #UNINDENT# args += [ '--pkg' , d . name ] #NEWLINE# #UNINDENT# #UNINDENT# extra_args = [ ] #NEWLINE# for a in target . extra_args . get ( 'vala' , [ ] ) : #NEWLINE# #INDENT# if isinstance ( a , File ) : #NEWLINE# #INDENT# relname = a . rel_to_builddir ( self . build_to_src ) #NEWLINE# extra_dep_files . append ( relname ) #NEWLINE# extra_args . append ( relname ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# extra_args . append ( a ) #NEWLINE# #UNINDENT# #UNINDENT# dependency_vapis = self . determine_dep_vapis ( target ) #NEWLINE# extra_dep_files += dependency_vapis #NEWLINE# args += extra_args #NEWLINE# args += dependency_vapis #NEWLINE# element = NinjaBuildElement ( self . all_outputs , outputs , ( valac . get_language ( ) + '_COMPILER' ) , ( vala_input_files + vapi_src ) ) #NEWLINE# element . add_item ( 'ARGS' , args ) #NEWLINE# element . add_dep ( extra_dep_files ) #NEWLINE# element . write ( outfile ) #NEWLINE# return generated_c_files