예제 #1
0
        protected override void Update(CommandArrayInfo info)
        {
            var proj = IdeApp.ProjectOperations.CurrentSelectedProject as IPhoneProject;

            if (proj == null)
            {
                return;
            }

            var workspaceConfig = IdeApp.Workspace.ActiveConfigurationId;
            var conf            = proj.GetConfiguration(new SolutionConfigurationSelector(workspaceConfig)) as IPhoneProjectConfiguration;

            if (conf == null || conf.Platform != IPhoneProject.PLAT_SIM)
            {
                return;
            }

            var projSetting = proj.GetSimulatorTarget(conf);

            var def = info.Add("Default", null);

            if (projSetting == null)
            {
                def.Checked = true;
            }

            foreach (var st in IPhoneFramework.GetSimulatorTargets(IPhoneSdkVersion.Parse(conf.MtouchMinimumOSVersion), proj.SupportedDevices))
            {
                var i = info.Add(st.ToString(), st);
                if (projSetting != null && projSetting.Equals(st))
                {
                    i.Checked = true;
                }
            }
        }
예제 #2
0
        protected override void Run()
        {
            if (IPhoneFramework.SimOnly)
            {
                IPhoneFramework.ShowSimOnlyDialog();
                return;
            }

            var proj = GetActiveExecutableIPhoneProject();
            var conf = (IPhoneProjectConfiguration)proj.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);

            if (!IdeApp.Preferences.BuildBeforeExecuting)
            {
                IPhoneUtility.Upload(proj.TargetRuntime, proj.TargetFramework, conf.AppDirectory);
                return;
            }

            IdeApp.ProjectOperations.Build(proj).Completed += delegate(IAsyncOperation op) {
                if (!op.Success || (op.SuccessWithWarnings && !IdeApp.Preferences.RunWithWarnings))
                {
                    return;
                }
                IPhoneUtility.Upload(proj.TargetRuntime, proj.TargetFramework, conf.AppDirectory);
            };
        }
예제 #3
0
        public static IEnumerable <IPhoneSimulatorTarget> GetSimulatorTargets()
        {
            foreach (var v in IPhoneFramework.GetInstalledSdkVersions(true))
            {
                var settings = GetSdkSettings(v, true);

                if (v < IPhoneSdkVersion.V3_2)
                {
                    yield return(new IPhoneSimulatorTarget(TargetDevice.IPhone, v));

                    continue;
                }
                if (v == IPhoneSdkVersion.V3_2)
                {
                    yield return(new IPhoneSimulatorTarget(TargetDevice.IPad, v));

                    continue;
                }

                if (settings.DeviceFamilies.HasFlag(TargetDevice.IPhone))
                {
                    yield return(new IPhoneSimulatorTarget(TargetDevice.IPhone, v));
                }
                if (settings.DeviceFamilies.HasFlag(TargetDevice.IPad))
                {
                    yield return(new IPhoneSimulatorTarget(TargetDevice.IPad, v));
                }
            }
        }
예제 #4
0
        protected override void Run()
        {
            if (IPhoneFramework.SimOnly)
            {
                IPhoneFramework.ShowSimOnlyDialog();
                return;
            }

            var proj    = DefaultUploadToDeviceHandler.GetActiveExecutableIPhoneProject();
            var slnConf = IdeApp.Workspace.ActiveConfiguration;
            var conf    = (IPhoneProjectConfiguration)proj.GetConfiguration(slnConf);

            IdeApp.ProjectOperations.Build(proj).Completed += delegate(IAsyncOperation op) {
                if (!op.Success)
                {
                    return;
                }
                GenerateXCodeProject(proj, conf, slnConf);
            };
        }
        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);
        }
예제 #6
0
        public static IPhoneSdkVersion GetDefault(bool sim)
        {
            var v = IPhoneFramework.GetInstalledSdkVersions(sim);

            return(v.Count > 0? v[v.Count - 1] : UseDefault);
        }