Commit f3d9961a authored by Ian Fischer's avatar Ian Fischer

Add global release flag that will attempt to use release builds during install.

parent ce512896
......@@ -175,7 +175,9 @@ class StartSky(object):
project_or_path = os.path.abspath(args.project_or_path)
if args.android_build_available:
if args.android_build_available and args.use_release:
apk_path = os.path.join(os.path.normpath(args.sky_src_path), args.android_release_build_path, 'apks', APK_NAME)
elif args.android_build_available:
apk_path = os.path.join(os.path.normpath(args.sky_src_path), args.android_debug_build_path, 'apks', APK_NAME)
else:
apk_path = os.path.join(APK_DIR, APK_NAME)
......@@ -228,11 +230,17 @@ class StartSky(object):
# Install on connected iOS device
if IOSDevice.is_connected() and args.ios_build_available:
if args.use_release:
app_path = os.path.join(args.sky_src_path, args.ios_release_build_path, IOS_APP_NAME)
else:
app_path = os.path.join(args.sky_src_path, args.ios_debug_build_path, IOS_APP_NAME)
IOSDevice.install_app(app_path)
# Install on iOS simulator if it's running
if IOSSimulator.is_booted() and args.ios_sim_build_available:
if args.use_release:
app_path = os.path.join(args.sky_src_path, args.ios_sim_release_build_path, IOS_APP_NAME)
else:
app_path = os.path.join(args.sky_src_path, args.ios_sim_debug_build_path, IOS_APP_NAME)
IOSSimulator.fork_install_app(app_path)
......@@ -618,6 +626,11 @@ class StartListening(object):
return True
def run(self, args, pids):
if args.use_release:
logging.info('Note that the listen command is not compatible with the '
'release flag for iOS and iOS simulator builds. If you have '
'installed iOS release builds, your Sky app will fail to '
'reload while using listen.')
tempdir = tempfile.mkdtemp()
currdir = os.getcwd()
while True:
......@@ -819,6 +832,12 @@ class SkyShellRunner(object):
sys.exit(2)
parser = argparse.ArgumentParser(description='Sky App Runner')
parser.add_argument('--release', dest='use_release', action='store_true',
help='Set this if you are building Sky locally and want to use the release build products. '
'When set, attempts to automaticaly determine sky-src-path if sky-src-path is '
'not set. Using this flag automatically turns on local-build as well, so you do not '
'need to specify both. Note that --release is not compatible with the listen command '
'on iOS devices and simulators. Not normally required.')
parser.add_argument('--local-build', dest='local_build', action='store_true',
help='Set this if you are building Sky locally and want to use those build products. '
'When set, attempts to automaticaly determine sky-src-path if sky-src-path is '
......@@ -830,14 +849,26 @@ class SkyShellRunner(object):
help='Path to your Android Debug out directory, if you are building Sky locally. '
'This path is relative to sky-src-path. Not normally required.',
default='out/android_Debug/')
parser.add_argument('--android-release-build-path', dest='android_release_build_path',
help='Path to your Android Release out directory, if you are building Sky locally. '
'This path is relative to sky-src-path. Not normally required.',
default='out/android_Release/')
parser.add_argument('--ios-debug-build-path', dest='ios_debug_build_path',
help='Path to your iOS Debug out directory, if you are building Sky locally. '
'This path is relative to sky-src-path. Not normally required.',
default='out/ios_Debug/')
parser.add_argument('--ios-release-build-path', dest='ios_release_build_path',
help='Path to your iOS Release out directory, if you are building Sky locally. '
'This path is relative to sky-src-path. Not normally required.',
default='out/ios_Release/')
parser.add_argument('--ios-sim-debug-build-path', dest='ios_sim_debug_build_path',
help='Path to your iOS Simulator Debug out directory, if you are building Sky locally. '
'This path is relative to sky-src-path. Not normally required.',
default='out/ios_sim_Debug/')
parser.add_argument('--ios-sim-release-build-path', dest='ios_sim_release_build_path',
help='Path to your iOS Simulator Release out directory, if you are building Sky locally. '
'This path is relative to sky-src-path. Not normally required.',
default='out/ios_sim_Release/')
subparsers = parser.add_subparsers(help='sub-command help')
......@@ -845,6 +876,9 @@ class SkyShellRunner(object):
command.add_subparser(subparsers)
args = parser.parse_args()
if args.use_release:
args.local_build = True
# TODO(iansf): args is unfortunately just a global context variable. For now, add some additional context to it.
args.android_build_available = False
args.ios_build_available = False
......@@ -880,7 +914,14 @@ class SkyShellRunner(object):
logging.warning('The selected sky-src-path (' + args.sky_src_path + ') does not exist.'
'Disabling local-build flag.')
args.local_build = False
if args.local_build:
if args.local_build and args.use_release:
if os.path.isdir(os.path.join(args.sky_src_path, args.android_release_build_path)):
args.android_build_available = True
if os.path.isdir(os.path.join(args.sky_src_path, args.ios_release_build_path)):
args.ios_build_available = True
if os.path.isdir(os.path.join(args.sky_src_path, args.ios_sim_release_build_path)):
args.ios_sim_build_available = True
elif args.local_build:
if os.path.isdir(os.path.join(args.sky_src_path, args.android_debug_build_path)):
args.android_build_available = True
if os.path.isdir(os.path.join(args.sky_src_path, args.ios_debug_build_path)):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment