Files
swift-mirror/utils/pass-pipeline/scripts/pipeline_generator.py
Michael Gottesman faa2f9339e Rename normal_pipeline.py => pipeline_generator.py and pipelines.py => pipelines_build_script.py.
This makes it clearer via their name what the two scripts are meant to
be used for.

As a recap:

1. pipeline_generator.py is meant for generating pass pipeline json
files.
2. pipelines_build_script.py is a script built ontop of
pipeline_generator.py that makes it easy to run build-script with
various pass pipelines that can be generated from
pipeline_generator.py. It is meant to be used on buildbots and for ones
own enjoyment as well.

Swift SVN r24315
2015-01-09 17:29:36 +00:00

41 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python
import os
import sys
import argparse
import itertools
import json
import textwrap
# Append the src dir
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'src'))
import pass_pipeline_library
import passes
normal_pipeline = [x for x in pass_pipeline_library.normal_passpipelines()]
pass_pipelines = [x.identifier for x in normal_pipeline]
parser = argparse.ArgumentParser(description=textwrap.dedent("""
Generate pass pipelines based off of the normal swift pipeline.
"""))
parser.add_argument('--disable-pass', nargs='*', help='Disable this pass',
choices=[x.name for x in passes.PASSES], action='append', default=[])
parser.add_argument('--disable-passpipeline', nargs='*', help='Disable this pass list',
choices=pass_pipelines, default=[], action='append')
args = parser.parse_args()
disabled_passes = sum(args.disable_pass, [])
disabled_passpipelines = sum(args.disable_passpipeline, [])
# First filter out pipelines.
normal_pipeline_generated = [x.generate() for x in normal_pipeline if not x.identifier in disabled_passpipelines]
# Then filter out specific passes.
for i in range(len(normal_pipeline_generated)):
normal_pipeline_generated[i] = [x for x in normal_pipeline_generated[i] if x not in disabled_passes]
json.dump(normal_pipeline_generated, sys.stdout, sort_keys=True, indent=4, separators=(',', ': '))