public override bool NeedsSyncBack(XcodeSyncContext context) { var h = Type.ObjCName + ".h"; var path = context.ProjectDir.Combine(h); return(File.Exists(path) && File.GetLastWriteTime(path) != context.GetSyncTime(h)); }
public override bool NeedsSyncBack (XcodeSyncContext context) { if (!isInterfaceDefinition) return false; string target = context.ProjectDir.Combine (targetRelative); return File.GetLastWriteTime (target) > context.GetSyncTime (targetRelative); }
public override bool NeedsSyncOut(XcodeSyncContext context) { //FIXME: types dep on other types on project, need better regeneration skipping var h = Type.ObjCName + ".h"; var path = context.ProjectDir.Combine(h); return(!File.Exists(path) || context.GetSyncTime(h) != Type.DefinedIn.Max(f => File.GetLastWriteTime(f))); }
public override bool NeedsSyncBack (XcodeSyncContext context) { var h = Type.ObjCName + ".h"; var path = context.ProjectDir.Combine (h); if (File.Exists (path) && File.GetLastWriteTime (path) > context.GetSyncTime (h)) return true; return false; }
public override bool NeedsSyncOut (XcodeSyncContext context) { //FIXME: types dep on other types on project, need better regeneration skipping var h = Type.ObjCName + ".h"; var path = context.ProjectDir.Combine (h); return !File.Exists (path) || context.GetSyncTime (h) != Type.DefinedIn.Max (f => File.GetLastWriteTime (f)); }
public override void SyncOut (IProgressMonitor monitor, XcodeSyncContext context) { monitor.Log.WriteLine ("Exporting Objective-C source code for the {0} class to Xcode.", Type.CliName); Type.GenerateObjcType (context.ProjectDir, Frameworks); DateTime mtime = File.GetLastWriteTime (GetObjCHeaderPath (context)); context.SetSyncTime (Type.ObjCName + ".h", mtime); }
public override void SyncOut(IProgressMonitor monitor, XcodeSyncContext context) { monitor.Log.WriteLine("Exporting Objective-C source code for the {0} class to Xcode.", Type.CliName); Type.GenerateObjcType(context.ProjectDir, Frameworks); DateTime mtime = File.GetLastWriteTime(GetObjCHeaderPath(context)); context.SetSyncTime(Type.ObjCName + ".h", mtime); }
public override bool NeedsSyncBack(XcodeSyncContext context) { if (!isInterfaceDefinition) { return(false); } string target = context.ProjectDir.Combine(targetRelative); return(File.GetLastWriteTime(target) != context.GetSyncTime(targetRelative)); }
public override void SyncOut (XcodeSyncContext context) { var target = context.ProjectDir.Combine (targetRelative); var dir = target.ParentDirectory; if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); if (File.Exists (target)) File.Delete (target); File.Copy (source, target); context.UpdateSyncTime (targetRelative); }
public override void SyncOut (XcodeSyncContext context) { FilePath target = context.ProjectDir.Combine (targetRelative); var dir = target.ParentDirectory; if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); if (File.Exists (target)) File.Delete (target); var result = Mono.Unix.Native.Syscall.link (source, target); Mono.Unix.UnixMarshal.ThrowExceptionForLastErrorIf (result); context.UpdateSyncTime (targetRelative); }
public override bool NeedsSyncBack (IProgressMonitor monitor, XcodeSyncContext context) { string path = GetObjCHeaderPath (context); string h = Type.ObjCName + ".h"; if (File.Exists (path) && File.GetLastWriteTime (path) > context.GetSyncTime (h)) { monitor.Log.WriteLine ("{0} has changed since last sync.", h); return true; } return false; }
public override bool NeedsSyncBack(IProgressMonitor monitor, XcodeSyncContext context) { string path = GetObjCHeaderPath(context); string h = Type.ObjCName + ".h"; if (File.Exists(path) && File.GetLastWriteTime(path) > context.GetSyncTime(h)) { monitor.Log.WriteLine("{0} has changed since last sync.", h); return(true); } return(false); }
public override bool NeedsSyncBack (IProgressMonitor monitor, XcodeSyncContext context) { if (!isInterfaceDefinition) return false; string target = context.ProjectDir.Combine (targetRelative); if (File.GetLastWriteTime (target) > context.GetSyncTime (targetRelative)) { monitor.Log.WriteLine ("{0} has changed since last sync.", targetRelative); return true; } return false; }
public override bool NeedsSyncOut (IProgressMonitor monitor, XcodeSyncContext context) { string target = context.ProjectDir.Combine (targetRelative); if (!File.Exists (target)) return true; if (File.GetLastWriteTime (source) > context.GetSyncTime (targetRelative)) { monitor.Log.WriteLine ("{0} has changed since last sync.", targetRelative); return true; } return false; }
public override void SyncOut(XcodeSyncContext context) { var target = context.ProjectDir.Combine(targetRelative); var dir = target.ParentDirectory; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } if (File.Exists(target)) { File.Delete(target); } File.Copy(source, target); context.UpdateSyncTime(targetRelative); }
public override bool NeedsSyncOut(IProgressMonitor monitor, XcodeSyncContext context) { string target = context.ProjectDir.Combine(targetRelative); if (!File.Exists(target)) { return(true); } if (File.GetLastWriteTime(source) > context.GetSyncTime(targetRelative)) { monitor.Log.WriteLine("{0} has changed since last sync.", targetRelative); return(true); } return(false); }
public override void SyncOut (IProgressMonitor monitor, XcodeSyncContext context) { monitor.Log.WriteLine ("Exporting '{0}' to Xcode.", targetRelative); var target = context.ProjectDir.Combine (targetRelative); var dir = target.ParentDirectory; if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); if (File.Exists (target)) File.Delete (target); File.Copy (source, target); DateTime mtime = File.GetLastWriteTime (target); context.SetSyncTime (targetRelative, mtime); }
public override bool NeedsSyncOut (IProgressMonitor monitor, XcodeSyncContext context) { //FIXME: types dep on other types on project, need better regeneration skipping string h = Type.ObjCName + ".h"; if (!File.Exists (GetObjCHeaderPath (context))) return true; DateTime syncTime = context.GetSyncTime (h); foreach (var path in Type.DefinedIn) { if (File.GetLastWriteTime (path) > syncTime) { monitor.Log.WriteLine ("The {0} class has changed since last sync ({1}).", Type.CliName, Path.GetFileName (path)); return true; } } return false; }
public override bool NeedsSyncBack (IProgressMonitor monitor, XcodeSyncContext context) { if (!isInterfaceDefinition) return false; string target = context.ProjectDir.Combine (targetRelative); if (!File.Exists (target)) { monitor.Log.WriteLine ("{0} has been removed since last sync.", targetRelative); // FIXME: some day we should mirror this change back to MonoDevelop return false; } if (File.GetLastWriteTime (target) > context.GetSyncTime (targetRelative)) { monitor.Log.WriteLine ("{0} has changed since last sync.", targetRelative); return true; } return false; }
public override void SyncOut(XcodeSyncContext context) { FilePath target = context.ProjectDir.Combine(targetRelative); var dir = target.ParentDirectory; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } if (File.Exists(target)) { File.Delete(target); } try { var result = Mono.Unix.Native.Syscall.link(source, target); Mono.Unix.UnixMarshal.ThrowExceptionForLastErrorIf(result); } catch { File.Copy(source, target); } context.UpdateSyncTime(targetRelative); }
bool ExistsInLocalizedDir (XcodeSyncContext context) { // We only check interface definition files. if (!isInterfaceDefinition) return false; var dirs = Directory.GetDirectories (context.ProjectDir); if (dirs == null) return false; string fileName = targetRelative.FileName; foreach (var lproj in dirs) { if (!lproj.EndsWith (".lproj")) continue; if (File.Exists (Path.Combine (lproj, fileName))) return true; } return false; }
public override void SyncOut(IProgressMonitor monitor, XcodeSyncContext context) { monitor.Log.WriteLine("Exporting '{0}' to Xcode.", targetRelative); var target = context.ProjectDir.Combine(targetRelative); var dir = target.ParentDirectory; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } if (File.Exists(target)) { File.Delete(target); } File.Copy(source, target); DateTime mtime = File.GetLastWriteTime(target); context.SetSyncTime(targetRelative, mtime); }
public override bool NeedsSyncOut(IProgressMonitor monitor, XcodeSyncContext context) { //FIXME: types dep on other types on project, need better regeneration skipping string h = Type.ObjCName + ".h"; if (!File.Exists(GetObjCHeaderPath(context))) { return(true); } DateTime syncTime = context.GetSyncTime(h); foreach (var path in Type.DefinedIn) { if (File.GetLastWriteTime(path) > syncTime) { monitor.Log.WriteLine("The {0} class has changed since last sync ({1}).", Type.CliName, Path.GetFileName(path)); return(true); } } return(false); }
public override bool NeedsSyncBack(IProgressMonitor monitor, XcodeSyncContext context) { if (!isInterfaceDefinition) { return(false); } string target = context.ProjectDir.Combine(targetRelative); if (!File.Exists(target)) { monitor.Log.WriteLine("{0} has been removed since last sync.", targetRelative); // FIXME: some day we should mirror this change back to MonoDevelop return(false); } if (File.GetLastWriteTime(target) > context.GetSyncTime(targetRelative)) { monitor.Log.WriteLine("{0} has changed since last sync.", targetRelative); return(true); } return(false); }
public abstract void SyncOut(IProgressMonitor monitor, XcodeSyncContext context);
public abstract bool NeedsSyncBack(IProgressMonitor monitor, XcodeSyncContext context);
public override bool NeedsSyncOut(XcodeSyncContext context) { string target = context.ProjectDir.Combine(targetRelative); return(!File.Exists(target) || context.GetSyncTime(targetRelative) != File.GetLastWriteTime(source)); }
public override bool NeedsSyncBack (IProgressMonitor monitor, XcodeSyncContext context) { if (!isInterfaceDefinition) return false; string target = context.ProjectDir.Combine (targetRelative); if (!File.Exists (target)) { // Note: We only return true IF AND ONLY IF the file was *moved* by Xcode into a *.lproj/ dir. // We DO NOT wan't to echo other deleted file changes back to MonoDevelop. if (ExistsInLocalizedDir (context)) { monitor.Log.WriteLine ("{0} has been localized.", targetRelative); return true; } monitor.Log.WriteLine ("{0} has been removed since last sync.", targetRelative); return false; } if (File.GetLastWriteTime (target) > context.GetSyncTime (targetRelative)) { monitor.Log.WriteLine ("{0} has changed since last sync.", targetRelative); return true; } return false; }
public void UpdateProject(IProgressMonitor monitor, List <XcodeSyncedItem> allItems, XcodeProject emptyProject) { items = allItems; monitor.BeginTask(GettextCatalog.GetString("Updating Xcode project..."), items.Count); monitor.Log.WriteLine("Updating synced project with {0} items", items.Count); 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()) { monitor.Log.WriteLine("Project file needs to be updated, closing and removing old project"); CloseProject(); DeleteXcproj(); 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) { monitor.Log.WriteLine("Syncing item {0}", item.GetTargetRelativeFileNames()[0]); item.SyncOut(ctx); monitor.Step(1); } if (updateProject) { monitor.Log.WriteLine("Queuing Xcode project {0} to write when opened", projectDir); pendingProjectWrite = emptyProject; } monitor.EndTask(); monitor.ReportSuccess(GettextCatalog.GetString("Xcode project updated.")); }
public override void SyncOut (XcodeSyncContext context) { Type.GenerateObjcType (context.ProjectDir); context.UpdateSyncTime (Type.ObjCName + ".h"); context.UpdateSyncTime (Type.ObjCName + ".m"); }
public string GetObjCHeaderPath(XcodeSyncContext context) { return(context.ProjectDir.Combine(Type.ObjCName + ".h")); }
public abstract void SyncOut(XcodeSyncContext context);
public abstract bool NeedsSyncBack(XcodeSyncContext context);
public abstract bool NeedsSyncOut(XcodeSyncContext context);
public override bool NeedsSyncBack (XcodeSyncContext context) { return false; }
// 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; monitor.Log.WriteLine("Calculating sync list..."); 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 added.", file); updateProject = true; } else if (needsSync) { monitor.Log.WriteLine(" '{0}' needs to be closed & updated.", file); toClose.Add(file); } itemMap[file] = item; } } updateProject = updateProject || toRemove.Any(); bool removedOldProject = false; if (updateProject) { if (pendingProjectWrite == null && ProjectExists()) { monitor.Log.WriteLine("The project.pbxproj file needs to be updated, closing and removing old project."); CloseProject(); DeleteXcproj(monitor); removedOldProject = true; // All items need to be re-synced... syncList.Clear(); foreach (var item in items) { syncList.Add(item); var files = item.GetTargetRelativeFileNames(); foreach (var file in files) { itemMap[file] = item; } } } } else { foreach (var f in toClose) { CloseFile(monitor, projectDir.Combine(f)); } } if (removedOldProject) { HackRelocateProject(monitor); ctx.ProjectDir = projectDir; syncTimeCache.Clear(); } else { foreach (var f in toRemove) { itemMap.Remove(f); syncTimeCache.Remove(f); var path = projectDir.Combine(f); try { if (File.Exists(path)) { File.Delete(path); } } catch { } } } 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.")); }
public abstract void SyncOut (IProgressMonitor monitor, XcodeSyncContext context);
public override bool NeedsSyncOut (XcodeSyncContext context) { string target = context.ProjectDir.Combine (targetRelative); return !File.Exists (target) || context.GetSyncTime (targetRelative) < File.GetLastWriteTime (source); }
public abstract bool NeedsSyncBack (IProgressMonitor monitor, XcodeSyncContext context);
public string GetObjCHeaderPath (XcodeSyncContext context) { return context.ProjectDir.Combine (Type.ObjCName + ".h"); }
// 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.")); }
public abstract bool NeedsSyncOut (XcodeSyncContext context);
public override void SyncOut(XcodeSyncContext context) { Type.GenerateObjcType(context.ProjectDir, Frameworks); context.UpdateSyncTime(Type.ObjCName + ".h"); context.UpdateSyncTime(Type.ObjCName + ".m"); }
public abstract bool NeedsSyncBack (XcodeSyncContext context);
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.")); }
public abstract void SyncOut (XcodeSyncContext context);