@@ -36,8 +36,14 @@ def find_default_moban_file():
36
36
def handle_moban_file_v1 (moban_file_configurations , command_line_options ):
37
37
merged_options = None
38
38
39
- targets = moban_file_configurations .get (constants .LABEL_TARGETS )
40
- target = extract_target (command_line_options )
39
+ targets = moban_file_configurations .get (constants .LABEL_TARGETS , [])
40
+ if constants .LABEL_COPY in moban_file_configurations :
41
+ legacy_copy_targets = handle_copy (
42
+ merged_options , moban_file_configurations [constants .LABEL_COPY ]
43
+ )
44
+ targets += legacy_copy_targets
45
+
46
+ cli_target = extract_target (command_line_options )
41
47
42
48
if constants .LABEL_CONFIG in moban_file_configurations :
43
49
merged_options = merge (
@@ -68,27 +74,16 @@ def handle_moban_file_v1(moban_file_configurations, command_line_options):
68
74
if template_types :
69
75
plugins .ENGINES .register_options (template_types )
70
76
71
- if targets :
72
- if target :
73
- targets = target
74
- # If template specified via CLI flag `-t:
75
- # 1. Only update the specified template
76
- # 2. Do not copy
77
- if constants .LABEL_COPY in moban_file_configurations :
78
- del moban_file_configurations [constants .LABEL_COPY ]
79
- number_of_templated_files = handle_targets (merged_options , targets )
77
+ if cli_target :
78
+ number_of_templated_files = handle_targets (
79
+ merged_options , [cli_target ])
80
+ elif targets :
81
+ number_of_templated_files = handle_targets (
82
+ merged_options , targets )
80
83
else :
81
84
number_of_templated_files = 0
82
85
83
- if constants .LABEL_COPY in moban_file_configurations :
84
- number_of_copied_files = handle_copy (
85
- merged_options , moban_file_configurations [constants .LABEL_COPY ]
86
- )
87
- else :
88
- number_of_copied_files = 0
89
- exit_code = reporter .convert_to_shell_exit_code (
90
- number_of_templated_files + number_of_copied_files
91
- )
86
+ exit_code = reporter .convert_to_shell_exit_code (number_of_templated_files )
92
87
reporter .report_up_to_date ()
93
88
return exit_code
94
89
@@ -100,12 +95,11 @@ def handle_copy(merged_options, copy_config):
100
95
copy_targets .append (
101
96
{
102
97
constants .LABEL_TEMPLATE : src ,
103
- constants .LABEL_CONFIG : None ,
104
98
constants .LABEL_OUTPUT : dest ,
105
99
constants .LABEL_TEMPLATE_TYPE : constants .TEMPLATE_COPY ,
106
100
}
107
101
)
108
- return handle_targets ( merged_options , copy_targets )
102
+ return copy_targets
109
103
110
104
111
105
def _iterate_list_of_dicts (list_of_dict ):
@@ -134,6 +128,7 @@ def handle_targets(merged_options, targets):
134
128
target .set_template_type (primary_template_type )
135
129
136
130
jobs_for_each_engine [primary_template_type ].append (target )
131
+ print (target )
137
132
138
133
count = 0
139
134
for template_type in jobs_for_each_engine .keys ():
@@ -172,15 +167,14 @@ def extract_target(options):
172
167
"Please specify a output file name for %s." % template
173
168
)
174
169
if config :
175
- result = [
176
- {
170
+ result = {
177
171
constants .LABEL_TEMPLATE : template ,
178
172
constants .LABEL_CONFIG : config ,
179
173
constants .LABEL_OUTPUT : output ,
180
174
}
181
- ]
175
+
182
176
else :
183
- result = [ {output : template }]
177
+ result = {output : template }
184
178
return result
185
179
186
180
0 commit comments