public static IW1Top WAssemblyUnit(this IW1Top w1Top, IGAssemblyUnit gAssemblyUnit, StringBuilder?sB = default, CancellationToken?ct = default) { ct?.ThrowIfCancellationRequested(); var path = Path.Combine(w1Top.BasePath, gAssemblyUnit.GRelativePath); var dirInfo = new DirectoryInfo(path); if (!dirInfo.Exists) { if (!(bool)w1Top.Force) { //ToDo: Log exception throw new Exception(message: $"Relative directory for Generated code does not exist (try force=true): {path}"); } else { try { dirInfo.Create(); } catch (System.IO.IOException e) { //ToDo: Log exception throw new Exception(message: $"Could not create relative directory for Generated code: {path}", innerException: e); } } } return(w1Top); }
public static IR1Top RAssemblyUnit(this IR1Top r1Top, IGAssemblyUnit gAssemblyUnit, IW1Top w1Top) { r1Top.Ct?.ThrowIfCancellationRequested(); // This primarly changes the path where the AssemblyUnits' child Units are written var _savepath = w1Top.BasePath; w1Top.WAssemblyUnit(gAssemblyUnit); w1Top.BasePath = Path.Combine(w1Top.BasePath, gAssemblyUnit.GRelativePath); if (gAssemblyUnit.GCompilationUnits.Any()) { foreach (var kvp in gAssemblyUnit.GCompilationUnits) { r1Top.RCompilationUnit(kvp.Value, w1Top); r1Top.Sb.Clear(); } } if (gAssemblyUnit.GPropertiesUnits.Any()) { foreach (var kvp in gAssemblyUnit.GPropertiesUnits) { //r1Top.RPropertiesUnit(kvp.Value,w1Top); r1Top.Sb.Clear(); } } if (gAssemblyUnit.GResourceUnits.Any()) { foreach (var kvp in gAssemblyUnit.GResourceUnits) { r1Top.RResourceUnit(kvp.Value, w1Top); r1Top.Sb.Clear(); } } r1Top.RProjectUnit(gAssemblyUnit.GProjectUnit, w1Top); // Change the Top path back to its state before the AssemblyUnit is rendered // DirectoryInfo assemblyParentPathDirectoryInfo = Directory.GetParent(w1Top.BasePath); //ToDo: re-architect to ensure the main path variable is restored, or, do assemblies and their paths on different thread-local data and async with throtleing and backpressure w1Top.BasePath = _savepath; return(r1Top); }
MProjectReferenceItemGroupInProjectUnitForFileSystemToObjectGraphBaseAssembly(IGAssemblyUnit gAssemblyUnit) { var gItemGroupInProjectUnit = new GItemGroupInProjectUnit("ReferencesUsedByFileSystemToObjectGraph", "References used by the FileSystemToObjectGraph", new GBody(new List <string>() { "<PackageReference Include=\"ATAP.Utilities.ComputerInventory.Hardware.Extensions\" />", "<PackageReference Include=\"ATAP.Utilities.ComputerInventory.ProcessInfo.Models\" />", "<PackageReference Include=\"ATAP.Utilities.ComputerInventory.Software.Enumerations\" />", "<PackageReference Include=\"ATAP.Utilities.Persistence.Interfaces\" />", "<PackageReference Include=\"ATAP.Utilities.Persistence\" />", "<PackageReference Include=\"ATAP.Utilities.Extensions.Persistence\" />", })); gAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits.Add(gItemGroupInProjectUnit.Philote, gItemGroupInProjectUnit); }