Created
August 2, 2020 22:06
-
-
Save liuliu/6172e7535b4218e27c829492d2499f98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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