public void CopyAotDataFilesToDirectory(string directory) { foreach (var aotdata in AotInfos.Values.SelectMany((info) => info.AotDataFiles)) { Application.UpdateFile(aotdata, Path.Combine(directory, Path.GetFileName(aotdata))); } }
public void CopyMdbToDirectory (string directory) { string mdb_src = FullPath + ".mdb"; if (File.Exists (mdb_src)) { string mdb_target = Path.Combine (directory, FileName + ".mdb"); Application.UpdateFile (mdb_src, mdb_target); } }
public void CopyConfigToDirectory (string directory) { string config_src = FullPath + ".config"; if (File.Exists (config_src)) { string config_target = Path.Combine (directory, FileName + ".config"); Application.UpdateFile (config_src, config_target); } }
// returns false if the assembly was not copied (because it was already up-to-date). public bool CopyAssembly(string source, string target, bool copy_debug_symbols = true, StripAssembly strip = null) { var copied = false; try { var strip_assembly = strip != null && strip(source); if (!Application.IsUptodate(source, target) && (strip_assembly || !Cache.CompareAssemblies(source, target))) { copied = true; if (strip_assembly) { Driver.FileDelete(target); Directory.CreateDirectory(Path.GetDirectoryName(target)); MonoTouch.Tuner.Stripper.Process(source, target); } else { Application.CopyFile(source, target); } } else { Driver.Log(3, "Target '{0}' is up-to-date.", target); } // Update the debug symbols file even if the assembly didn't change. if (copy_debug_symbols) { if (File.Exists(source + ".mdb")) { Application.UpdateFile(source + ".mdb", target + ".mdb", true); } var spdb = Path.ChangeExtension(source, "pdb"); if (File.Exists(spdb)) { Application.UpdateFile(spdb, Path.ChangeExtension(target, "pdb"), true); } } CopyConfigToDirectory(Path.GetDirectoryName(target)); } catch (Exception e) { throw new MonoTouchException(1009, true, e, Errors.MX1009, source, target, e.Message); } return(copied); }
public void CopyDebugSymbolsToDirectory(string directory) { string mdb_src = FullPath + ".mdb"; if (File.Exists(mdb_src)) { string mdb_target = Path.Combine(directory, FileName + ".mdb"); Application.UpdateFile(mdb_src, mdb_target); } var spdb = Path.ChangeExtension(FullPath, "pdb"); if (File.Exists(spdb)) { Application.UpdateFile(spdb, Path.Combine(directory, Path.ChangeExtension(FileName, "pdb")), true); } }
// returns false if the assembly was not copied (because it was already up-to-date). public bool CopyAssembly (string source, string target, bool copy_mdb = true) { var copied = false; try { if (!Application.IsUptodate (source, target) && !Cache.CompareAssemblies (source, target)) { copied = true; Application.CopyFile (source, target); } // Update the mdb even if the assembly didn't change. if (copy_mdb && File.Exists (source + ".mdb")) Application.UpdateFile (source + ".mdb", target + ".mdb", true); CopyConfigToDirectory (Path.GetDirectoryName (target)); } catch (Exception e) { throw new MonoTouchException (1009, true, e, "Could not copy the assembly '{0}' to '{1}': {2}", source, target, e.Message); } return copied; }
// this will copy (and optionally strip) the assembly and all the related files: // * debug file (.mdb) // * config file (.config) // * satellite assemblies (<language id>/.dll) // * aot data public void CopyToDirectory(string directory, bool reload = true, bool check_case = false, bool only_copy = false, bool copy_mdb = true, bool strip = false) { var target = Path.Combine(directory, FileName); var fileNameNoExtension = Path.GetFileNameWithoutExtension(FileName); var assemblyName = AssemblyDefinition.Name.Name; if (check_case && fileNameNoExtension != assemblyName && string.Equals(fileNameNoExtension, assemblyName, StringComparison.OrdinalIgnoreCase)) { // Fix up the name of the target file to match the assembly name. target = Path.Combine(directory, assemblyName + Path.GetExtension(FileName)); } // our Copy code deletes the target (so copy'ing over itself is a bad idea) if (directory != Path.GetDirectoryName(FullPath)) { CopyAssembly(FullPath, target, copy_mdb: copy_mdb, strip: strip); } CopySatellitesToDirectory(directory); if (!only_copy) { if (reload) { LoadAssembly(target); } else { FullPath = target; } } foreach (var aotdata in AotInfos.Values.SelectMany((info) => info.AotDataFiles)) { Application.UpdateFile(aotdata, Path.Combine(directory, Path.GetFileName(aotdata))); } }
protected override void Execute() { Application.UpdateFile(InputFile, OutputFile); }