Skip to content

Instantly share code, notes, and snippets.

@liuliu
Created August 2, 2020 22:06
Show Gist options
  • Save liuliu/6172e7535b4218e27c829492d2499f98 to your computer and use it in GitHub Desktop.
Save liuliu/6172e7535b4218e27c829492d2499f98 to your computer and use it in GitHub Desktop.
#!/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