Last active
June 1, 2020 03:26
-
-
Save frencojobs/2f2f302e764f6afb3a326be2d4034b9e to your computer and use it in GitHub Desktop.
SourceCode generation helper for Flutter.
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
# pip install click | |
import click | |
import os | |
@click.command() | |
@click.option('--watch', is_flag=True, help='Watch file changes during build.') | |
@click.option('--restart', is_flag=True, help='Delete conflicting outputs.') | |
def generate(**kwargs): | |
'''Run build_runner source code generation''' | |
watch = kwargs['watch'] | |
restart = kwargs['restart'] | |
command = 'flutter packages pub run build_runner {buildType} {withRestart}' | |
buildType = 'watch' if watch else 'build' | |
withRestart = '--delete-conflicting-outputs' if restart else '' | |
executable = command.format(buildType=buildType, withRestart=withRestart) | |
os.system(executable) | |
if __name__ == '__main__': | |
generate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment