You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Command "emulate" and options "--emulator/--device/--avd" are a bit confusing to use #2349
emulate command is used to run an app on an emulator but we already have options to specify on what device to run the app.
The different options that one can use to define deployment target are behaving differently --device - can be used to specify which device to be targeted and accepts device id and device name for some commands -> related issue 2345
run --emulator = emulate, but the option does not accept any parameters - related 2329
If emulate command is removed, to specify which device you'll use, you'll have to type the below command tns run android/ios --emulator --device {DeviceName/Id}
I think we should agree on some kind of flow that covers the most common use cases.
For me the way I use these options is something like that -> Option 1 - no emulate command tns run/debug/deploy/livesync --emulator - starts emulator and ignores all connected real devices tns run/debug/deploy/livesync --emulator {EmulatorName/Id} - starts/connects to specified emulator or if it doesn't exist give a meaningful error message
'tns run/debug/deploy/livesync --device {EmulatorName/Id}' - starts/connects to specified emulator or if it doesn't exist give a meaningful error message Option 2 - no --emulator option tns emulate - starts emulator and runs app on it, ignores all connected real devices tns emulate --device {DeviceName/Id} - starts emulator with specified name and runs the app on it
'tns run/debug/deploy/livesync --device {EmulatorName/Id}' - starts/connects to specified emulator or if it doesn't exist give a meaningful error message
The --avd option is depricated and it is not supported for some time now.
We plan to remove the emulate command (as discussed with @valentinstoychev): #2329
the option may be deprecated but it is available, as well as --geny option, as @rosen-vladimirov reminded me recently. Also I am not sure removing the command helps a lot - it will still be confusing to use tns run android/ios --emulator --device {DeviceName/Id} for me.
It is not necessary to use the --emulator option when using --device.
Currently we fail with an error message when the --avd option is used. I would opt for removing this option.
I was not aware that we have a --geny option. Maybe we should remove it?
@pkoleva@rosen-vladimirov I vote for removing the emulate command and replace it with tns run/debug --device "emulator/device name" Which will search for a connected device(emulator or real device) with that name and run on it, or try to start emulator with that name if no such connected device is found.
Before we deprecate the emulate command, we need to make sure the run command works reliably for the emulators.
In 2.5.1, I am still unable to specify a specific iOS device when using the run command. This does not work currently (it reports that the device with that name cannot be found):
$ tns run ios --device "iPad Air 2"
But this command DOES work:
$ tns emulate ios --device "iPad Air 2"
I would expect the first command to behave identically to the second, launching the iOS emulator with the specified device. Further, if we deprecate the emulate command, how would someone launch the emulator with just the default device?
There are scenarios where I only want to run my app on the emulators, even if I have a device connected. So if we take this path, I have to explicitly know the name of my emulators...or I have to disconnect all of my devices. There is no direct equivalent for tns emulate to just run on all available emulators. Correct?
Is there a harm in keeping the tns emulate command? Even if not widely promoted?
Meanwhile, for cases where the device name is known, your proposal is fine so long as tns run [platform] --device "[emulator name]" works.
I have to explicitly know the name of my emulators...
@toddanglin you're right, that's why if you run tns device you'd get all the names of devices and emulators that are currently connected. Of course that doesn't mean we can't keep the emulate command, but IMO we don't need it.
Is there a harm in keeping the tns emulate command? Even if not widely promoted?
There's no harm in keeping the command per se, but the fact is it has caused us trouble in the past. If we have duplicate functionality I see no reason in keeping both ways to do the same thing.
IMO if I have to chose to remove one of "--emulator" or "emulate", I'll choose to remove the first one. I think "--device" option is sufficient to cover the need to run an app on a specific device/emulator/simulator. About "emulate", before removing it we should first define who uses it and how and then find a way to provide the users a way to continue working like they did before.
@pkoleva I agree. I think the tns emulate command is still more intuitive than tns run --emulator
@Plamen5kov My concern is that tns run would require two different behaviors to run the emulator depending on whether you want to explicitly specify the device or not:
tns run [platform] --emulator // Use the default emulator tns run [platform] --device "Emulator Name" // Use a named emulator
Compared to the consistency of today's command:
tns emulate [platform] // Use the default emulator tns emulate [platform] --device "Emulator Name" // Use a named emulator
Further, if use I tns run ios (let's say), and I have a device connected, should it fire-up both the emulator and deploy to the device? Are we trying to make tns run do too much?
We had a discussion and came up with the following ideas. I'll be happy if you share what you think.
We defined 2 main scenarios:
Run your app on all available emulators/simulators
Run your app on a specific emulator/simulator
If we remove tns emulate both scenarios should be covered the following way:
tns run <platform> --emulator - either deploys on all available emulators/simulators or if none are running starts the default one.
tns run <platform> --device <emulatorName/id> - deploys app on the specified emulator/simulator if it's running or starts the emulator/simulator and then deploys
The benefit from using --emulator is actually reusing run command and its default watch behavior. If we all agree on that solution we'll deprecate the command with the release following 3.0.0. In 3.0.0 this command will still be available.
@toddanglin If you don't have connected devices and running emulators tns run <platform> will start your default emulator at our current state - this will not change. You wouldn't need to say tns run <platform> --emulator.
We're going to make the implementation described above by @pkoleva. I'm going to describe all cases we're going to support:
tns run <platform> - if device/emulator/simulator is available: start on all connected and paired devices tns run <platform> - if device/emulator/simulator is NOT available: start default emulator/simulator tns run <platform> --emulator - if emulators/simulators are available: start app on all of them tns run <platform> --emulator - if emulator/simulator is NOT available: start default simulator/emulator tns run <platform> --device <emulatorName/id> - if emulator/device/simulator with specified id is available: start app on it tns run <platform> --device <emulatorName/id> - if emulator/simulator/device with specified id is NOT available: tries to start emulator/simulator with given name
And again, what about the additional flags available on tns emulate today? Specifically:
--available-devices
--timeout
Will they work with tns run when the --emulator flag is used?
Critically, I think we should keep tns emulate in the next release in case we have missed other edge cases. It can be deprecated, but given the risk of breaking workflows, it probably should not be removed immediately.
@toddanglin--available-devices is already available in tns device android --available-devices, but there's no problem in adding this flag to the run command if it would be more convenient.
and --timeout shouldn't be too difficult to move as a functionality for starting the emulator.
I'm not sure that tns device ios --available-devices does the same thing as tns emulate ios --available-devices.
The first command just lists connected devices (similar to tns devices).
The second command shows a list of ALL valid iOS simulator device names you could use for emulation + any actual connected device names.
That said, I'm okay with moving the functionality of tns emulate ios --available devices to tns device. Let's just make sure they are, in fact, doing the same thing. :)
Activity
enchev commentedon Dec 14, 2016
I like Option 2.
tzraikov commentedon Dec 15, 2016
The --avd option is depricated and it is not supported for some time now.
We plan to remove the emulate command (as discussed with @valentinstoychev):
#2329
pkoleva commentedon Dec 15, 2016
the option may be deprecated but it is available, as well as --geny option, as @rosen-vladimirov reminded me recently. Also I am not sure removing the command helps a lot - it will still be confusing to use
tns run android/ios --emulator --device {DeviceName/Id}for me.tzraikov commentedon Dec 15, 2016
It is not necessary to use the
--emulator optionwhen using--device.Currently we fail with an error message when the
--avdoption is used. I would opt for removing this option.I was not aware that we have a
--genyoption. Maybe we should remove it?enchev commentedon Dec 15, 2016
I also believe that we should remove
--geny&--avd.Plamen5kov commentedon Jan 27, 2017
@pkoleva @rosen-vladimirov I vote for removing the emulate command and replace it with
tns run/debug --device "emulator/device name"Which will search for a connected device(emulator or real device) with that name and run on it, or try to start emulator with that name if no such connected device is found.toddanglin commentedon Feb 21, 2017
Before we deprecate the
emulatecommand, we need to make sure theruncommand works reliably for the emulators.In 2.5.1, I am still unable to specify a specific iOS device when using the
runcommand. This does not work currently (it reports that the device with that name cannot be found):$ tns run ios --device "iPad Air 2"But this command DOES work:
$ tns emulate ios --device "iPad Air 2"I would expect the first command to behave identically to the second, launching the iOS emulator with the specified device. Further, if we deprecate the
emulatecommand, how would someone launch the emulator with just the default device?Plamen5kov commentedon Feb 21, 2017
@toddanglin I was thinking something along the lines of:
Check for --device option:
toddanglin commentedon Feb 21, 2017
There are scenarios where I only want to run my app on the emulators, even if I have a device connected. So if we take this path, I have to explicitly know the name of my emulators...or I have to disconnect all of my devices. There is no direct equivalent for
tns emulateto just run on all available emulators. Correct?Is there a harm in keeping the
tns emulatecommand? Even if not widely promoted?Meanwhile, for cases where the device name is known, your proposal is fine so long as
tns run [platform] --device "[emulator name]"works.Plamen5kov commentedon Feb 21, 2017
@toddanglin you're right, that's why if you run
tns deviceyou'd get all the names of devices and emulators that are currently connected. Of course that doesn't mean we can't keep the emulate command, but IMO we don't need it.There's no harm in keeping the command per se, but the fact is it has caused us trouble in the past. If we have duplicate functionality I see no reason in keeping both ways to do the same thing.
pkoleva commentedon Feb 21, 2017
IMO if I have to chose to remove one of "--emulator" or "emulate", I'll choose to remove the first one. I think "--device" option is sufficient to cover the need to run an app on a specific device/emulator/simulator. About "emulate", before removing it we should first define who uses it and how and then find a way to provide the users a way to continue working like they did before.
toddanglin commentedon Feb 21, 2017
@pkoleva I agree. I think the
tns emulatecommand is still more intuitive thantns run --emulator@Plamen5kov My concern is that
tns runwould require two different behaviors to run the emulator depending on whether you want to explicitly specify the device or not:tns run [platform] --emulator // Use the default emulatortns run [platform] --device "Emulator Name" // Use a named emulatorCompared to the consistency of today's command:
tns emulate [platform] // Use the default emulatortns emulate [platform] --device "Emulator Name" // Use a named emulatorFurther, if use I
tns run ios(let's say), and I have a device connected, should it fire-up both the emulator and deploy to the device? Are we trying to maketns rundo too much?pkoleva commentedon Mar 1, 2017
Hey all,
We had a discussion and came up with the following ideas. I'll be happy if you share what you think.
We defined 2 main scenarios:
If we remove
tns emulateboth scenarios should be covered the following way:tns run <platform> --emulator- either deploys on all available emulators/simulators or if none are running starts the default one.tns run <platform> --device <emulatorName/id>- deploys app on the specified emulator/simulator if it's running or starts the emulator/simulator and then deploysThe benefit from using
--emulatoris actually reusing run command and its default watch behavior. If we all agree on that solution we'll deprecate the command with the release following 3.0.0. In 3.0.0 this command will still be available.@toddanglin If you don't have connected devices and running emulators
tns run <platform>will start your default emulator at our current state - this will not change. You wouldn't need to saytns run <platform> --emulator.@rosen-vladimirov @Plamen5kov @dtopuzov @vchimev @atanasovg
toddanglin commentedon Mar 1, 2017
This approach works fine for me if
tns run <platform> --device <emulatorName>is enabled.What about the other
tns emulateflags that are not ontns run? Where will they go? Specifically:--available-devices--timeoutI've used both at various times...with iOS to get list of available simulator names and with Android to adjust timeout for slow loading simulator.
dtopuzov commentedon Mar 7, 2017
Can we also cover the cases when we specify name of emulator image (instead of running android device identifier, like
emulator-5554for example)?Example:
tns run <platform> --device <name-of-emulator-image>Plamen5kov commentedon Mar 14, 2017
We're going to make the implementation described above by @pkoleva. I'm going to describe all cases we're going to support:
tns run <platform>- if device/emulator/simulator is available: start on all connected and paired devicestns run <platform>- if device/emulator/simulator is NOT available: start default emulator/simulatortns run <platform> --emulator- if emulators/simulators are available: start app on all of themtns run <platform> --emulator- if emulator/simulator is NOT available: start default simulator/emulatortns run <platform> --device <emulatorName/id>- if emulator/device/simulator with specified id is available: start app on ittns run <platform> --device <emulatorName/id>- if emulator/simulator/device with specified id is NOT available: tries to start emulator/simulator with given nameEDIT: deprecating the emulate comand.
toddanglin commentedon Mar 14, 2017
And again, what about the additional flags available on
tns emulatetoday? Specifically:--available-devices--timeoutWill they work with
tns runwhen the--emulatorflag is used?Critically, I think we should keep
tns emulatein the next release in case we have missed other edge cases. It can be deprecated, but given the risk of breaking workflows, it probably should not be removed immediately.Plamen5kov commentedon Mar 15, 2017
@toddanglin
--available-devicesis already available intns device android --available-devices, but there's no problem in adding this flag to the run command if it would be more convenient.and
--timeoutshouldn't be too difficult to move as a functionality for starting the emulator.toddanglin commentedon Mar 15, 2017
I'm not sure that
tns device ios --available-devicesdoes the same thing astns emulate ios --available-devices.The first command just lists connected devices (similar to
tns devices).The second command shows a list of ALL valid iOS simulator device names you could use for emulation + any actual connected device names.
That said, I'm okay with moving the functionality of
tns emulate ios --available devicestotns device. Let's just make sure they are, in fact, doing the same thing. :)