@@ -31,23 +31,27 @@ public MultiTemplateBuildTask(IPluginManager pluginManager
31
31
_pluginManager = pluginManager ;
32
32
_logger = logger ;
33
33
}
34
+
34
35
public async Task Build ( BuildContext context )
35
36
{
36
37
if ( context . Build . Parameters . Value ( TEMPLATES_KEY , out IEnumerable templates ) )
37
38
{
38
39
foreach ( var templateKVs in templates )
39
40
{
40
- var _templateKVs = ( Dictionary < object , object > ) templateKVs ;
41
+ var _templateKVs = ( Dictionary < object , object > ) templateKVs ;
41
42
if ( ! _templateKVs . Value ( TEMPLATE_KEY , out string templateKey ) )
42
43
{
43
44
throw new SmartCodeException ( $ "Build:{ context . BuildKey } ,Can not find TemplateKey!") ;
44
45
}
46
+
45
47
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 ) ;
47
50
if ( ! _templateKVs . Value ( TEMPLATE_OUTPUT_KEY , out Dictionary < object , object > outputKVs ) )
48
51
{
49
52
throw new SmartCodeException ( $ "Build:{ context . BuildKey } ,Can not find Output!") ;
50
53
}
54
+
51
55
if ( context . Output == null )
52
56
{
53
57
throw new SmartCodeException ( $ "Build:{ context . BuildKey } ,Output can not be null!") ;
@@ -57,39 +61,51 @@ public async Task Build(BuildContext context)
57
61
{
58
62
Path = context . Output . Path ,
59
63
Mode = context . Output . Mode ,
64
+ DotSplit = context . Output . DotSplit ,
60
65
Name = context . Output . Name ,
61
66
Extension = context . Output . Extension
62
67
} ;
63
68
if ( outputKVs . Value ( nameof ( Output . Path ) , out string outputPath ) )
64
69
{
65
70
output . Path = outputPath ;
66
71
}
72
+
67
73
if ( outputKVs . Value ( nameof ( Output . Mode ) , out CreateMode outputMode ) )
68
74
{
69
75
output . Mode = outputMode ;
70
76
}
77
+
78
+ if ( outputKVs . Value ( nameof ( Output . DotSplit ) , out string dotSplit ) )
79
+ {
80
+ output . DotSplit = Convert . ToBoolean ( dotSplit ) ;
81
+ }
82
+
71
83
if ( String . IsNullOrEmpty ( output . Path ) )
72
84
{
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!") ;
74
87
}
88
+
75
89
if ( ! outputKVs . Value ( nameof ( Output . Name ) , out string outputName ) )
76
90
{
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!") ;
78
93
}
94
+
79
95
output . Name = outputName ;
80
96
81
97
if ( outputKVs . Value ( nameof ( Output . Extension ) , out string extension ) )
82
98
{
83
99
output . Extension = extension ;
84
100
}
101
+
85
102
await _pluginManager . Resolve < IOutput > ( context . Output . Type ) . Output ( context , output ) ;
86
103
}
87
104
}
88
105
}
89
106
90
107
public void Initialize ( IDictionary < string , object > parameters )
91
108
{
92
-
93
109
}
94
110
}
95
- }
111
+ }
0 commit comments