#!python

from flutter_debugger import *
from flutter_debugger.packager import *
from flutter_debugger.server import *
from os import *
import sys

project_name = 'test_project'
archive_folder = 'debug_archives'
port = '8006'
if len(sys.argv) > 1:
    port = sys.argv[1]
if '--disableInc' in sys.argv:
    Config.disableIncrementalCompile = True
if '--disablePatch' in sys.argv:
    Config.disablePackagePatch = True
logger = create_logger()

# 生成zip包地址的二维码
host_ip = get_host_ip()
logger.info(str.format("本机ip为 : {0}", host_ip))
debug_archive_url = str.format("{0}:{1}", host_ip, port)
os.system("echo {0} | pbcopy".format(debug_archive_url))
logger.info(str.format("================ 在Flutter调试入口填写以下地址(地址已经拷贝到剪切板) ================", debug_archive_url))
logger.info("")
logger.info(str.format("                  {0}  ", debug_archive_url))
logger.info("")
logger.info(str.format("======================================================================================",
                       debug_archive_url))

# 启动http服务
flt_server = FlutterDebuggerServer(port=port)
flt_server.run()