예제 #1
0
		protected override ExecutionCommand CreateExecutionCommand (ConfigurationSelector configSel,
			DotNetProjectConfiguration configuration)
		{
			var conf = (IPhoneProjectConfiguration) configuration;
			bool isSim = conf.IsSimPlatform;
			
			IPhoneSimulatorTarget simTarget = null;
			
			var minOS = string.IsNullOrEmpty (conf.MtouchMinimumOSVersion)?
				IPhoneSdkVersion.GetDefault (isSim) : IPhoneSdkVersion.Parse (conf.MtouchMinimumOSVersion);
			
			if (isSim) {
				simTarget = GetSimulatorTarget (conf);
				if (simTarget == null) {
					var defaultDevice = ((IPhoneProject)conf.ParentItem).SupportedDevices == TargetDevice.IPad?
						TargetDevice.IPad : TargetDevice.IPhone;
					simTarget = new IPhoneSimulatorTarget (defaultDevice, conf.MtouchSdkVersion.ResolveIfDefault (isSim));
				}
			}
			
			return new IPhoneExecutionCommand (TargetRuntime, TargetFramework, conf.AppDirectory, conf.OutputDirectory,
				conf.DebugMode && conf.MtouchDebug, simTarget, minOS, SupportedDevices)
			{
				UserAssemblyPaths = GetUserAssemblyPaths (configSel)
			};
		}
 public IPhoneExecutionCommand(TargetRuntime runtime, TargetFramework framework, FilePath appPath,
                               FilePath logDirectory, bool debugMode, IPhoneSimulatorTarget target,
                               IPhoneSdkVersion minimumOSVersion, TargetDevice supportedDevices)
 {
     this.AppPath          = appPath;
     this.LogDirectory     = logDirectory;
     this.Framework        = framework;
     this.Runtime          = runtime;
     this.DebugMode        = debugMode;
     this.SimulatorTarget  = target;
     this.MinimumOSVersion = minimumOSVersion;
     this.SupportedDevices = supportedDevices;
 }
        public static ProcessStartInfo CreateMtouchSimStartInfo(IPhoneExecutionCommand cmd, bool logSimOutput,
                                                                IPhoneSimulatorTarget forceTarget)
        {
            string mtouchPath = cmd.Runtime.GetToolPath(cmd.Framework, "mtouch");

            if (string.IsNullOrEmpty(mtouchPath))
            {
                throw new InvalidOperationException("Cannot execute iPhone application. mtouch tool is missing.");
            }

            var outLog = cmd.OutputLogPath;
            var errLog = cmd.ErrorLogPath;

            try {
                if (File.Exists(errLog))
                {
                    File.Delete(errLog);
                }
                if (File.Exists(outLog))
                {
                    File.Delete(outLog);
                }
            } catch (IOException) {}

            var sb = new StringBuilder();

            sb.AppendFormat("-launchsim='{0}'", cmd.AppPath);
            if (logSimOutput)
            {
                sb.AppendFormat(" -stderr='{0}' -stdout='{1}'", errLog, outLog);
            }

            if (forceTarget != null)
            {
                sb.AppendFormat(" -sdk='{0}'", forceTarget.Version.ToString());
                if (forceTarget.Device == TargetDevice.IPad)
                {
                    sb.AppendFormat(" -device=2");
                }
            }

            var psi = new ProcessStartInfo(mtouchPath, sb.ToString())
            {
                WorkingDirectory = cmd.LogDirectory,
                UseShellExecute  = false
            };

            return(psi);
        }
 public IPhoneExecutionHandler(IPhoneSimulatorTarget target)
 {
     this.SimulatorTarget = target;
 }
예제 #5
0
		public void SetSimulatorTarget (IPhoneProjectConfiguration conf, IPhoneSimulatorTarget value)
		{
			UserProperties.SetValue<IPhoneSimulatorTarget> (GetSimulatorTargetKey (conf), value);
		}
 public IPhoneExecutionMode(IPhoneSimulatorTarget target)
 {
     this.Target = target;
 }
        public static ProcessStartInfo CreateMtouchSimStartInfo(IPhoneExecutionCommand cmd, bool logSimOutput,
                                                                IPhoneSimulatorTarget forceTarget)
        {
            string mtouchPath = cmd.Runtime.GetToolPath(cmd.Framework, "mtouch");

            if (string.IsNullOrEmpty(mtouchPath))
            {
                throw new InvalidOperationException("Cannot execute iPhone application. mtouch tool is missing.");
            }

            var outLog = cmd.OutputLogPath;
            var errLog = cmd.ErrorLogPath;

            try {
                if (File.Exists(errLog))
                {
                    File.Delete(errLog);
                }
                if (File.Exists(outLog))
                {
                    File.Delete(outLog);
                }
            } catch (IOException) {}

            var cb = new ProcessArgumentBuilder();

            cb.AddQuotedFormat("-launchsim={0}", cmd.AppPath);
            if (logSimOutput)
            {
                cb.AddQuotedFormat("-stderr={0}", errLog);
                cb.AddQuotedFormat("-stdout={0}", outLog);
            }

            if (forceTarget != null)
            {
                var version = forceTarget.Version;

                if (!version.IsUseDefault && !IPhoneFramework.SdkIsInstalled(version, true))
                {
                    version = IPhoneFramework.GetClosestInstalledSdk(version, true);
                    LoggingService.LogWarning("iOS SDK '{0}' not installed, falling back to simulator '{1}'",
                                              forceTarget.Version, version);
                }

                if (!version.IsUseDefault)
                {
                    cb.AddQuotedFormat("-sdk={0}", forceTarget.Version);
                }

                if (forceTarget.Device == TargetDevice.IPad)
                {
                    cb.Add("-device=2");
                }
            }

            var psi = new ProcessStartInfo(mtouchPath, cb.ToString())
            {
                WorkingDirectory = cmd.LogDirectory,
                UseShellExecute  = false
            };

            return(psi);
        }