Ejemplo n.º 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)
			};
		}
Ejemplo n.º 2
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;
                }
            }
        }
Ejemplo n.º 3
0
        static void Init()
        {
            knownOSVersions = new [] {
                new IPhoneSdkVersion(new [] { 3, 0 }),
                new IPhoneSdkVersion(new [] { 3, 1 }),
                new IPhoneSdkVersion(new [] { 3, 1, 2 }),
                new IPhoneSdkVersion(new [] { 3, 1, 3 }),
                new IPhoneSdkVersion(new [] { 3, 2 }),
                new IPhoneSdkVersion(new [] { 4, 0 }),
                new IPhoneSdkVersion(new [] { 4, 1 }),
                new IPhoneSdkVersion(new [] { 4, 2 }),
                new IPhoneSdkVersion(new [] { 4, 3 }),
            };

            const string sdkDir = "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/";

            if (!Directory.Exists(sdkDir))
            {
                installedSdkVersions = new IPhoneSdkVersion[0];
                return;
            }

            var sdks = new List <string> ();

            foreach (var dir in Directory.GetDirectories(sdkDir))
            {
                if (!File.Exists(dir + "/SDKSettings.plist"))
                {
                    continue;
                }

                string d = dir.Substring(sdkDir.Length);
                if (d.StartsWith("iPhoneOS"))
                {
                    d = d.Substring("iPhoneOS".Length);
                }
                if (d.EndsWith(".sdk"))
                {
                    d = d.Substring(0, d.Length - ".sdk".Length);
                }
                if (d.Length > 0)
                {
                    sdks.Add(d);
                }
            }
            var vs = new List <IPhoneSdkVersion> ();

            foreach (var s in sdks)
            {
                try {
                    vs.Add(IPhoneSdkVersion.Parse(s));
                } catch (Exception ex) {
                    LoggingService.LogError("Could not parse iPhone SDK version {0}:\n{1}", s, ex.ToString());
                }
            }
            installedSdkVersions = vs.ToArray();
            Array.Sort(installedSdkVersions);
        }
Ejemplo n.º 4
0
		public IPhoneProject (string languageName, ProjectCreateInformation info, XmlElement projectOptions)
			: base (languageName, info, projectOptions)
		{
			Init ();
			
			//don't create app settings and device/sim configurations for libraries, since they have no effect
			if (this.CompileTarget != CompileTarget.Exe)
				return;
			
			var mainNibAtt = projectOptions.Attributes ["MainNibFile"];
			if (mainNibAtt != null) {
				this.mainNibFile = mainNibAtt.InnerText;	
			}
			
			var ipadNibAtt = projectOptions.Attributes ["MainNibFileIPad"];
			if (ipadNibAtt != null) {
				this.mainNibFileIPad = ipadNibAtt.InnerText;	
			}
			
			var supportedDevicesAtt = projectOptions.Attributes ["SupportedDevices"];
			if (supportedDevicesAtt != null) {
				this.supportedDevices = (TargetDevice) Enum.Parse (typeof (TargetDevice), supportedDevicesAtt.InnerText);	
			}
			
			var sdkVersionAtt = projectOptions.Attributes ["SdkVersion"];
			IPhoneSdkVersion? sdkVersion = null;
			if (sdkVersionAtt != null)
				sdkVersion = IPhoneSdkVersion.Parse (sdkVersionAtt.InnerText);
			
			FilePath binPath = (info != null)? info.BinPath : new FilePath ("bin");
			
			int confCount = Configurations.Count;
			for (int i = 0; i < confCount; i++) {
				var simConf = (IPhoneProjectConfiguration)Configurations[i];
				simConf.Platform = PLAT_SIM;
				var deviceConf = (IPhoneProjectConfiguration) simConf.Clone ();
				deviceConf.Platform = PLAT_IPHONE;
				deviceConf.CodesignKey = DEV_CERT_PREFIX;
				Configurations.Add (deviceConf);
				
				deviceConf.MtouchSdkVersion = simConf.MtouchSdkVersion = sdkVersion ?? IPhoneSdkVersion.UseDefault;
				
				if (simConf.Name == "Debug")
					simConf.MtouchDebug = deviceConf.MtouchDebug = true;
				
				simConf.MtouchLink = MtouchLinkMode.None;
				
				simConf.OutputDirectory = binPath.Combine (simConf.Platform, simConf.Name);
				deviceConf.OutputDirectory = binPath.Combine (deviceConf.Platform, deviceConf.Name);
				simConf.SanitizeAppName ();
				deviceConf.SanitizeAppName ();
			}
		}
Ejemplo n.º 5
0
        static IPhoneSdkVersion[] EnumerateSdks(string sdkDir, string name)
        {
            if (!Directory.Exists(sdkDir))
            {
                return(new IPhoneSdkVersion[0]);
            }

            var sdks = new List <string> ();

            foreach (var dir in Directory.GetDirectories(sdkDir))
            {
                if (!File.Exists(Path.Combine(dir, "SDKSettings.plist")))
                {
                    continue;
                }
                string d = Path.GetFileName(dir);
                if (!d.StartsWith(name))
                {
                    continue;
                }
                d = d.Substring(name.Length);
                if (d.EndsWith(".sdk"))
                {
                    d = d.Substring(0, d.Length - ".sdk".Length);
                }
                if (d.Length > 0)
                {
                    sdks.Add(d);
                }
            }
            var vs = new List <IPhoneSdkVersion> ();

            foreach (var s in sdks)
            {
                try {
                    vs.Add(IPhoneSdkVersion.Parse(s));
                } catch (Exception ex) {
                    LoggingService.LogError("Could not parse {0} SDK version '{1}':\n{2}", name, s, ex.ToString());
                }
            }
            var versions = vs.ToArray();

            Array.Sort(versions);
            return(versions);
        }