s4:lib/messaging: terminate the irpc_servers_byname() result with server_id_set_disco...
[Samba/gebeck_regimport.git] / buildtools / wafadmin / Tools / cs.py
blob43544856f34045ede3b6c3f4680d87b0d5c94794
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Thomas Nagy, 2006 (ita)
5 "C# support"
7 import TaskGen, Utils, Task, Options
8 from Logs import error
9 from TaskGen import before, after, taskgen, feature
11 flag_vars= ['FLAGS', 'ASSEMBLIES']
13 @feature('cs')
14 def init_cs(self):
15 Utils.def_attrs(self,
16 flags = '',
17 assemblies = '',
18 resources = '',
19 uselib = '')
21 @feature('cs')
22 @after('init_cs')
23 def apply_uselib_cs(self):
24 if not self.uselib:
25 return
26 global flag_vars
27 for var in self.to_list(self.uselib):
28 for v in self.flag_vars:
29 val = self.env[v+'_'+var]
30 if val: self.env.append_value(v, val)
32 @feature('cs')
33 @after('apply_uselib_cs')
34 @before('apply_core')
35 def apply_cs(self):
36 try: self.meths.remove('apply_core')
37 except ValueError: pass
39 # process the flags for the assemblies
40 for i in self.to_list(self.assemblies) + self.env['ASSEMBLIES']:
41 self.env.append_unique('_ASSEMBLIES', '/r:'+i)
43 # process the flags for the resources
44 for i in self.to_list(self.resources):
45 self.env.append_unique('_RESOURCES', '/resource:'+i)
47 # what kind of assembly are we generating?
48 self.env['_TYPE'] = getattr(self, 'type', 'exe')
50 # additional flags
51 self.env.append_unique('_FLAGS', self.to_list(self.flags))
52 self.env.append_unique('_FLAGS', self.env.FLAGS)
54 # process the sources
55 nodes = [self.path.find_resource(i) for i in self.to_list(self.source)]
56 self.create_task('mcs', nodes, self.path.find_or_declare(self.target))
58 Task.simple_task_type('mcs', '${MCS} ${SRC} /target:${_TYPE} /out:${TGT} ${_FLAGS} ${_ASSEMBLIES} ${_RESOURCES}', color='YELLOW')
60 def detect(conf):
61 csc = getattr(Options.options, 'cscbinary', None)
62 if csc:
63 conf.env.MCS = csc
64 conf.find_program(['gmcs', 'mcs'], var='MCS')
66 def set_options(opt):
67 opt.add_option('--with-csc-binary', type='string', dest='cscbinary')