... |
... |
@@ -166,6 +166,24 @@ original_main = click.BaseCommand.main |
166
|
166
|
click.BaseCommand.main = override_main
|
167
|
167
|
|
168
|
168
|
|
|
169
|
+def get_files(directory, *excludes):
|
|
170
|
+ import re
|
|
171
|
+ output = tuple()
|
|
172
|
+ for root, _, files in os.walk(directory):
|
|
173
|
+ for file in files:
|
|
174
|
+ if excludes:
|
|
175
|
+ for regex in excludes:
|
|
176
|
+ if not re.match(regex, file):
|
|
177
|
+ relDir = os.path.relpath(root, directory)
|
|
178
|
+ relFile = os.path.join(relDir, file).strip("./")
|
|
179
|
+ output = output + (relFile,)
|
|
180
|
+ else:
|
|
181
|
+ relDir = os.path.relpath(root, directory)
|
|
182
|
+ relFile = os.path.join(relDir, file).strip("./")
|
|
183
|
+ output = output + (relFile,)
|
|
184
|
+ return output
|
|
185
|
+
|
|
186
|
+
|
169
|
187
|
##################################################################
|
170
|
188
|
# Main Options #
|
171
|
189
|
##################################################################
|
... |
... |
@@ -305,10 +323,12 @@ def init(app, project_name, format_version, element_path, force): |
305
|
323
|
help="Allow tracking to cross junction boundaries")
|
306
|
324
|
@click.option('--track-save', default=False, is_flag=True,
|
307
|
325
|
help="Deprecated: This is ignored")
|
|
326
|
+@click.option('--world', 'build_world', default=False, is_flag=True,
|
|
327
|
+ help="Build every element in the project")
|
308
|
328
|
@click.argument('elements', nargs=-1,
|
309
|
329
|
type=click.Path(readable=False))
|
310
|
330
|
@click.pass_obj
|
311
|
|
-def build(app, elements, all_, track_, track_save, track_all, track_except, track_cross_junctions):
|
|
331
|
+def build(app, elements, all_, track_, track_save, track_all, track_except, track_cross_junctions, build_world):
|
312
|
332
|
"""Build elements in a pipeline"""
|
313
|
333
|
|
314
|
334
|
if (track_except or track_cross_junctions) and not (track_ or track_all):
|
... |
... |
@@ -322,6 +342,13 @@ def build(app, elements, all_, track_, track_save, track_all, track_except, trac |
322
|
342
|
if track_all:
|
323
|
343
|
track_ = elements
|
324
|
344
|
|
|
345
|
+ if elements and build_world:
|
|
346
|
+ click.echo("ERROR: --world cannot be used along side a named element: '{}'".format(elements[0]), err=True)
|
|
347
|
+ sys.exit(-1)
|
|
348
|
+
|
|
349
|
+ if build_world:
|
|
350
|
+ elements = get_files("elements", r"^\..*", r".*~$")
|
|
351
|
+
|
325
|
352
|
with app.initialized(session_name="Build"):
|
326
|
353
|
app.stream.build(elements,
|
327
|
354
|
track_targets=track_,
|