@@ -31,23 +31,27 @@ public MultiTemplateBuildTask(IPluginManager pluginManager
3131 _pluginManager = pluginManager ;
3232 _logger = logger ;
3333 }
34+
3435 public async Task Build ( BuildContext context )
3536 {
3637 if ( context . Build . Parameters . Value ( TEMPLATES_KEY , out IEnumerable templates ) )
3738 {
3839 foreach ( var templateKVs in templates )
3940 {
40- var _templateKVs = ( Dictionary < object , object > ) templateKVs ;
41+ var _templateKVs = ( Dictionary < object , object > ) templateKVs ;
4142 if ( ! _templateKVs . Value ( TEMPLATE_KEY , out string templateKey ) )
4243 {
4344 throw new SmartCodeException ( $ "Build:{ context . BuildKey } ,Can not find TemplateKey!") ;
4445 }
46+
4547 context . Build . TemplateEngine . Path = templateKey ;
46- context . Result = await _pluginManager . Resolve < ITemplateEngine > ( context . Build . TemplateEngine . Name ) . Render ( context ) ;
48+ context . Result = await _pluginManager . Resolve < ITemplateEngine > ( context . Build . TemplateEngine . Name )
49+ . Render ( context ) ;
4750 if ( ! _templateKVs . Value ( TEMPLATE_OUTPUT_KEY , out Dictionary < object , object > outputKVs ) )
4851 {
4952 throw new SmartCodeException ( $ "Build:{ context . BuildKey } ,Can not find Output!") ;
5053 }
54+
5155 if ( context . Output == null )
5256 {
5357 throw new SmartCodeException ( $ "Build:{ context . BuildKey } ,Output can not be null!") ;
@@ -57,39 +61,51 @@ public async Task Build(BuildContext context)
5761 {
5862 Path = context . Output . Path ,
5963 Mode = context . Output . Mode ,
64+ DotSplit = context . Output . DotSplit ,
6065 Name = context . Output . Name ,
6166 Extension = context . Output . Extension
6267 } ;
6368 if ( outputKVs . Value ( nameof ( Output . Path ) , out string outputPath ) )
6469 {
6570 output . Path = outputPath ;
6671 }
72+
6773 if ( outputKVs . Value ( nameof ( Output . Mode ) , out CreateMode outputMode ) )
6874 {
6975 output . Mode = outputMode ;
7076 }
77+
78+ if ( outputKVs . Value ( nameof ( Output . DotSplit ) , out string dotSplit ) )
79+ {
80+ output . DotSplit = Convert . ToBoolean ( dotSplit ) ;
81+ }
82+
7183 if ( String . IsNullOrEmpty ( output . Path ) )
7284 {
73- throw new SmartCodeException ( $ "Build:{ context . BuildKey } ,Template:{ templateKey } ,can not find Output.Path!") ;
85+ throw new SmartCodeException (
86+ $ "Build:{ context . BuildKey } ,Template:{ templateKey } ,can not find Output.Path!") ;
7487 }
88+
7589 if ( ! outputKVs . Value ( nameof ( Output . Name ) , out string outputName ) )
7690 {
77- throw new SmartCodeException ( $ "Build:{ context . BuildKey } ,Template:{ templateKey } ,can not find Output.Name!") ;
91+ throw new SmartCodeException (
92+ $ "Build:{ context . BuildKey } ,Template:{ templateKey } ,can not find Output.Name!") ;
7893 }
94+
7995 output . Name = outputName ;
8096
8197 if ( outputKVs . Value ( nameof ( Output . Extension ) , out string extension ) )
8298 {
8399 output . Extension = extension ;
84100 }
101+
85102 await _pluginManager . Resolve < IOutput > ( context . Output . Type ) . Output ( context , output ) ;
86103 }
87104 }
88105 }
89106
90107 public void Initialize ( IDictionary < string , object > parameters )
91108 {
92-
93109 }
94110 }
95- }
111+ }
0 commit comments