Skip to content

Instantly share code, notes, and snippets.

@liuliu

liuliu/variant.py

Created Aug 2, 2020
Embed
What would you like to do?
#!/usr/bin/env python
import argparse
import os
VARIANTS = [
'prod',
'debug',
]
WHOLE_MODULE_OPTIMIZATION = [
'prod',
]
def main():
parser = argparse.ArgumentParser(description="Bazel with Variant: {}".format(', '.join(VARIANTS)))
parser.add_argument('variant', type=str, choices=VARIANTS)
args = parser.parse_args()
wsroot = os.path.dirname(__file__)
with open('.bazelrc.variant', 'w+') as f:
f.write("build --define variant={}\n".format(args.variant))
if args.variant in WHOLE_MODULE_OPTIMIZATION:
f.write("build --swiftcopt=-whole-module-optimization\n")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.