//FIXME: report errors void UpdateXcodeProject() { var projFile = outputDir.Combine(dnp.Name + ".xcodeproj", dnp.Name + ".pbxproj"); if (!xcodeProjectDirty && File.Exists(projFile)) { return; } xcodeProjectDirty = false; if (!Directory.Exists(outputDir)) { Directory.CreateDirectory(outputDir); } trackedFiles.Clear(); var xcp = new XcodeProject(dnp.Name); foreach (var file in dnp.Files.Where(IsPageOrContent)) { string pvp = file.ProjectVirtualPath; xcp.AddResource(pvp); CopyFile(file); } foreach (var cls in userClasses) { string h = cls + ".h"; xcp.AddSource(h); xcp.AddSource(cls + ".m"); string fullH = outputDir.Combine(h); trackedFiles[fullH] = File.GetLastWriteTime(fullH); } xcp.Generate(outputDir); }
void UpdateXcodeProject() { if (!syncing) { return; } var projFile = outputDir.Combine(dnp.Name + ".xcodeproj", dnp.Name + ".pbxproj"); if (!xcodeProjectDirty && File.Exists(projFile)) { return; } xcodeProjectDirty = false; if (!Directory.Exists(outputDir)) { Directory.CreateDirectory(outputDir); } var xcp = new XcodeProject(dnp.Name); foreach (var file in dnp.Files.Where(IsPageOrContent)) { xcp.AddResource(file.ProjectVirtualPath); CopyFile(file); } foreach (var cls in userClasses) { xcp.AddSource(cls + ".h"); xcp.AddSource(cls + ".m"); } xcp.Generate(outputDir); }
public override void AddToProject (XcodeProject project, FilePath syncProjectDir) { project.AddResource (targetRelative); }
// Note: This method may throw TimeoutException or AppleScriptException public void UpdateProject (IProgressMonitor monitor, List<XcodeSyncedItem> allItems, XcodeProject emptyProject) { items = allItems; monitor.BeginTask (GettextCatalog.GetString ("Updating Xcode project for {0}...", name), items.Count); var ctx = new XcodeSyncContext (projectDir, syncTimeCache); var toRemove = new HashSet<string> (itemMap.Keys); var toClose = new HashSet<string> (); var syncList = new List<XcodeSyncedItem> (); bool updateProject = false; foreach (var item in items) { bool needsSync = item.NeedsSyncOut (monitor, ctx); if (needsSync) syncList.Add (item); var files = item.GetTargetRelativeFileNames (); foreach (var file in files) { toRemove.Remove (file); if (!itemMap.ContainsKey (file)) { monitor.Log.WriteLine ("'{0}' needs to be updated.", file); updateProject = true; } else if (needsSync) { monitor.Log.WriteLine ("'{0}' needs to be closed.", file); toClose.Add (file); } itemMap[file] = item; } } updateProject = updateProject || toRemove.Any (); bool removedOldProject = false; if (updateProject) { if (pendingProjectWrite == null && ProjectExists ()) { monitor.Log.WriteLine ("A project file needs to be updated, closing and removing old project."); CloseProject (); DeleteXcproj (monitor); removedOldProject = true; } } else { foreach (var f in toClose) CloseFile (monitor, projectDir.Combine (f)); } foreach (var f in toRemove) { itemMap.Remove (f); syncTimeCache.Remove (f); var path = projectDir.Combine (f); if (File.Exists (path)) File.Delete (path); } if (removedOldProject) { HackRelocateProject (monitor); ctx.ProjectDir = projectDir; } foreach (var item in items) { if (updateProject) item.AddToProject (emptyProject, projectDir); } foreach (var item in syncList) { item.SyncOut (monitor, ctx); monitor.Step (1); } if (updateProject) { monitor.Log.WriteLine ("Queued write of '{0}'.", xcproj); pendingProjectWrite = emptyProject; } monitor.EndTask (); monitor.ReportSuccess (GettextCatalog.GetString ("Xcode project updated.")); }
void SyncProject (IProgressMonitor monitor) { if (pendingProjectWrite != null) { monitor.Log.WriteLine ("Generating project.pbxproj file for {0}", name); pendingProjectWrite.Generate (projectDir); pendingProjectWrite = null; } }
void SyncProject () { if (pendingProjectWrite != null) { pendingProjectWrite.Generate (projectDir); pendingProjectWrite = null; } }
public void OpenProject () { if (pendingProjectWrite != null) { pendingProjectWrite.Generate (projectDir); pendingProjectWrite = null; } if (!NSWorkspace.SharedWorkspace.OpenFile (xcproj, AppleSdkSettings.XcodePath)) throw new Exception ("Failed to open Xcode project"); }
protected override XcodeProject CreateProject (string name) { var proj = new XcodeProject (name, "macosx", "MonoMac"); proj.AddFramework ("Cocoa"); return proj; }
public override void AddToProject (XcodeProject project, FilePath syncProjectDir) { project.AddSource (Type.ObjCName + ".h"); var grp = project.GetGroup (supportingFilesGroup) ?? project.AddGroup (supportingFilesGroup); project.AddSource (Type.ObjCName + ".m", grp); }
//FIXME: report errors void UpdateXcodeProject () { var projFile = outputDir.Combine (dnp.Name + ".xcodeproj", dnp.Name + ".pbxproj"); if (!xcodeProjectDirty && File.Exists (projFile)) return; xcodeProjectDirty = false; if (!Directory.Exists (outputDir)) Directory.CreateDirectory (outputDir); trackedFiles.Clear (); var xcp = new XcodeProject (dnp.Name); foreach (var file in dnp.Files.Where (IsPageOrContent)) { string pvp = file.ProjectVirtualPath; xcp.AddResource (pvp); CopyFile (file); } foreach (var cls in userClasses) { string h = cls + ".h"; xcp.AddSource (h); xcp.AddSource (cls + ".m"); string fullH = outputDir.Combine (h); trackedFiles[fullH] = File.GetLastWriteTime (fullH); } xcp.Generate (outputDir); }
public abstract void AddToProject (XcodeProject project, FilePath syncProjectDir);
public void UpdateProject (List<XcodeSyncedItem> allItems, XcodeProject emptyProject) { items = allItems; int workItem = 1; Ide.IdeApp.Workbench.StatusBar.BeginProgress (GettextCatalog.GetString ("Updating synchronized project...")); XC4Debug.Log ("Updating synced project with {0} items", items.Count); var ctx = new XcodeSyncContext (projectDir, syncTimeCache); var toRemove = new HashSet<string> (itemMap.Keys); var toClose = new HashSet<string> (); var syncList = new List<XcodeSyncedItem> (); bool updateProject = false; foreach (var item in items) { bool needsSync = item.NeedsSyncOut (ctx); if (needsSync) syncList.Add (item); var files = item.GetTargetRelativeFileNames (); foreach (var f in files) { toRemove.Remove (f); if (!itemMap.ContainsKey (f)) { updateProject = true; } else if (needsSync) { toClose.Add (f); } itemMap [f] = item; } } updateProject = updateProject || toRemove.Any (); bool removedOldProject = false; if (updateProject) { if (pendingProjectWrite == null && ProjectExists ()) { XC4Debug.Log ("Project file needs to be updated, closing and removing old project"); CloseProject (); DeleteProjectArtifacts (); removedOldProject = true; } } else { foreach (var f in toClose) CloseFile (projectDir.Combine (f)); } foreach (var f in toRemove) { itemMap.Remove (f); syncTimeCache.Remove (f); var path = projectDir.Combine (f); if (File.Exists (path)) File.Delete (path); } if (removedOldProject) { HackRelocateProject (); } foreach (var item in items) { if (updateProject) item.AddToProject (emptyProject, projectDir); } foreach (var item in syncList) { XC4Debug.Log ("Syncing item {0}", item.GetTargetRelativeFileNames ()[0]); item.SyncOut (ctx); Ide.IdeApp.Workbench.StatusBar.SetProgressFraction (workItem * 100.0 / syncList.Count); workItem++; } if (updateProject) { XC4Debug.Log ("Queuing Xcode project {0} to write when opened", projectDir); pendingProjectWrite = emptyProject; } Ide.IdeApp.Workbench.StatusBar.EndProgress (); Ide.IdeApp.Workbench.StatusBar.ShowMessage (GettextCatalog.GetString ("Synchronized project updated.")); }
protected override XcodeProject CreateProject (string name) { XcodeProject project = new XcodeProject (name, "macosx", "MonoMac"); foreach (var framework in Frameworks) project.AddFramework (framework); return project; }
void UpdateXcodeProject () { if (!syncing) return; var projFile = outputDir.Combine (dnp.Name + ".xcodeproj", dnp.Name + ".pbxproj"); if (!xcodeProjectDirty && File.Exists (projFile)) return; xcodeProjectDirty = false; if (!Directory.Exists (outputDir)) Directory.CreateDirectory (outputDir); var xcp = new XcodeProject (dnp.Name); foreach (var file in dnp.Files.Where (IsPageOrContent)) { xcp.AddResource (file.ProjectVirtualPath); CopyFile (file); } foreach (var cls in userClasses) { xcp.AddSource (cls + ".h"); xcp.AddSource (cls + ".m"); } xcp.Generate (outputDir); }
public override void AddToProject (XcodeProject project, FilePath syncProjectDir) { project.AddSource (Type.ObjCName + ".h"); project.AddSource (Type.ObjCName + ".m"); }
public override void AddToProject (XcodeProject project, FilePath syncProjectDir) { PBXGroup grp = project.RootGroup; foreach (var groupName in GetGroups ()) grp = project.GetGroup (grp, groupName) ?? project.AddGroup (grp, groupName); project.AddResource (targetRelative.FileName, targetRelative, grp); }