public static Aapt2Daemon GetInstance(IBuildEngine4 engine, string aapt2, int numberOfInstances, int initalNumberOfDaemons, bool registerInDomain = false) { var area = registerInDomain ? RegisteredTaskObjectLifetime.AppDomain : RegisteredTaskObjectLifetime.Build; var daemon = engine.GetRegisteredTaskObjectAssemblyLocal <Aapt2Daemon> (RegisterTaskObjectKey, area); if (daemon == null) { daemon = new Aapt2Daemon(aapt2, numberOfInstances, initalNumberOfDaemons); engine.RegisterTaskObjectAssemblyLocal(RegisterTaskObjectKey, daemon, area, allowEarlyCollection: false); } return(daemon); }
public static bool SaveCustomViewMapFile(IBuildEngine4 engine, string mapFile, Dictionary <string, HashSet <string> > map) { engine?.RegisterTaskObjectAssemblyLocal(mapFile, map, RegisteredTaskObjectLifetime.Build); using (var writer = MemoryStreamPool.Shared.CreateStreamWriter()) { foreach (var i in map.OrderBy(x => x.Key)) { foreach (var v in i.Value.OrderBy(x => x)) { writer.WriteLine($"{i.Key};{v}"); } } writer.Flush(); return(Files.CopyIfStreamChanged(writer.BaseStream, mapFile)); } }
public static void SaveResourceCaseMap(IBuildEngine4 engine, Dictionary <string, string> map) => engine.RegisterTaskObjectAssemblyLocal(ResourceCaseMapKey, map, RegisteredTaskObjectLifetime.Build);