3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
7 # vim: tabstop=4 noexpandtab
10 Create a satellite assembly from "*.??.txt" files. ?? stands for a language code.
12 The projects Resources subfolder contains resources.??.txt string files for several languages.
13 The build folder will hold the satellite assemblies as ./??/ExeName.resources.dll
15 #gen becomes template (It is called gen because it also uses resx.py).
16 bld(source='Resources/resources.de.txt',gen=ExeName)
20 from waflib import Task
21 from waflib.TaskGen import feature,before_method
24 run_str = '${AL} ${ALFLAGS}'
26 @feature('satellite_assembly')
27 @before_method('process_source')
28 def satellite_assembly(self):
29 if not getattr(self, 'gen', None):
30 self.bld.fatal('satellite_assembly needs a template assembly provided with the "gen" parameter')
31 res_lang = re.compile(r'(.*)\.(\w\w)\.(?:resx|txt)',flags=re.I)
33 # self.source can contain node objects, so this will break in one way or another
34 self.source = self.to_list(self.source)
35 for i, x in enumerate(self.source):
36 #x = 'resources/resources.de.resx'
37 #x = 'resources/resources.de.txt'
38 mo = res_lang.match(x)
40 template = os.path.splitext(self.gen)[0]
41 templatedir, templatename = os.path.split(template)
44 #./Resources/resources.de.resources
45 resources = self.path.find_or_declare(res+ '.' + lang + '.resources')
46 self.create_task('resgen', self.to_nodes(x), [resources])
47 #./de/Exename.resources.dll
48 satellite = self.path.find_or_declare(os.path.join(templatedir,lang,templatename) + '.resources.dll')
49 tsk = self.create_task('al',[resources],[satellite])
50 tsk.env.append_value('ALFLAGS','/template:'+os.path.join(self.path.relpath(),self.gen))
51 tsk.env.append_value('ALFLAGS','/embed:'+resources.relpath())
52 tsk.env.append_value('ALFLAGS','/culture:'+lang)
53 tsk.env.append_value('ALFLAGS','/out:'+satellite.relpath())
55 # remove the None elements that we just substituted
56 self.source = list(filter(lambda x:x, self.source))
59 ctx.find_program('al', var='AL', mandatory=True)