private static void TestRelativePathModuloCustomRemap( PathTable pt1, PathTable pt2, Func <string, string> customRemapper, string relativePath, string expectedRelativePath) { var remapper = new PathRemapper(pt1, pt2, pathAtomStringRemapper: customRemapper); var r1 = RelativePath.Create(pt1.StringTable, relativePath); var r1Remap = remapper.Remap(r1); var r2 = RelativePath.Create(pt2.StringTable, expectedRelativePath); XAssert.AreEqual(r2, r1Remap, $"Expected: {r2.ToString(pt2.StringTable)}, Actual: {r1Remap.ToString(pt2.StringTable)}"); }
private static void TestAbsolutePathModuloCustomRemap( PathTable pt1, PathTable pt2, Func <string, string> customRemapper, string absolutePath, string expectedAbsolutePath) { var remapper = new PathRemapper(pt1, pt2, pathStringRemapper: customRemapper); var r1 = AbsolutePath.Create(pt1, absolutePath); var r1Remap = remapper.Remap(r1); var r2 = AbsolutePath.Create(pt2, expectedAbsolutePath); XAssert.AreEqual(r2, r1Remap, $"Expected: {r2.ToString(pt2)}, Actual: {r1Remap.ToString(pt2)}"); }
private GraphReuseResult ReloadPipGraphOnly( EngineSerializer serializer, LoggingContext loggingContext, EngineState engineState, InputTracker.InputChanges inputChanges) { Tuple <PipGraph, EngineContext> t = EngineSchedule.LoadPipGraphAsync( Context, serializer, Configuration, loggingContext, engineState).GetAwaiter().GetResult(); if (t == null) { return(GraphReuseResult.CreateForNoReuse(inputChanges)); } var newContext = t.Item2; if (!ShouldReuseReloadedEngineContextGivenHistoricData(loggingContext, newContext.NextHistoricTableSizes)) { return(GraphReuseResult.CreateForNoReuse(inputChanges)); } var newPathTable = newContext.PathTable; var pathRemapper = new PathRemapper(Context.PathTable, newPathTable); Configuration = new ConfigurationImpl(Configuration, pathRemapper); m_initialCommandLineConfiguration = new CommandLineConfiguration(m_initialCommandLineConfiguration, pathRemapper); // Invalidate the old context to ensure nothing uses it anymore // Update engine state to deserialized state Context.Invalidate(); Context = newContext; // Additionally recreate front end controller, because the old one uses the invalidated context. // - to fully initialize the front end, we have to go through all the steps that have already been // executed on the old controller; those steps are (1) InitializeHost, and (2) ParseConfig FrontEndController = m_frontEndControllerFactory.Create(Context.PathTable, Context.SymbolTable); FrontEndController.InitializeHost(Context.ToFrontEndContext(loggingContext), m_initialCommandLineConfiguration); FrontEndController.ParseConfig(m_initialCommandLineConfiguration); return(GraphReuseResult.CreateForPartialReuse(t.Item1, inputChanges)); }
private static void ValidateConfigurationCopyConstructor(bool booleanDefault) { var context = BuildXLContext.CreateInstanceForTesting(); var initialInstance = (CommandLineConfiguration)CreateInstance(context, typeof(CommandLineConfiguration), booleanDefault); string from = A("x"); string to = A("y"); var remapper = new Remapper(new PathTable(), p => p.Replace(from, to), a => a + "_"); var pathRemapper = new PathRemapper( context.PathTable, remapper.PathTable, pathStringRemapper: remapper.PathStringRemapper, pathAtomStringRemapper: remapper.PathAtomStringRemapper); var clone = new CommandLineConfiguration(initialInstance, pathRemapper); ValidateEqual(context, typeof(CommandLineConfiguration), initialInstance, clone, "configuration", remapper); }
private GraphReuseResult ReloadPipGraphOnly( EngineSerializer serializer, LoggingContext loggingContext, EngineState engineState, InputTracker.InputChanges inputChanges) { Tuple <PipGraph, EngineContext> t = null; try { t = EngineSchedule.LoadPipGraphAsync( Context, serializer, Configuration, loggingContext, engineState).GetAwaiter().GetResult(); } catch (BuildXLException e) { Logger.Log.FailedReloadPipGraph(loggingContext, e.ToString()); } if (t == null) { return(GraphReuseResult.CreateForNoReuse(inputChanges)); } var newContext = t.Item2; if (!ShouldReuseReloadedEngineContextGivenHistoricData(loggingContext, newContext.NextHistoricTableSizes)) { return(GraphReuseResult.CreateForNoReuse(inputChanges)); } var newPathTable = newContext.PathTable; var pathRemapper = new PathRemapper(Context.PathTable, newPathTable); Configuration = new ConfigurationImpl(Configuration, pathRemapper); m_initialCommandLineConfiguration = new CommandLineConfiguration(m_initialCommandLineConfiguration, pathRemapper); // Invalidate the old context to ensure nothing uses it anymore // Update engine state to deserialized state Context.Invalidate(); Context = newContext; // Additionally recreate front end controller, because the old one uses the invalidated context. // - to fully initialize the front end, we have to go through all the steps that have already been // executed on the old controller; those steps are (1) InitializeHost, and (2) ParseConfig FrontEndController = m_frontEndControllerFactory.Create(Context.PathTable, Context.SymbolTable); FrontEndController.InitializeHost(Context.ToFrontEndContext(loggingContext), m_initialCommandLineConfiguration); var configurationEngine = new BasicFrontEndEngineAbstraction(Context.PathTable, Context.FileSystem, m_initialCommandLineConfiguration); if (!configurationEngine.TryPopulateWithDefaultMountsTable(loggingContext, Context, m_initialCommandLineConfiguration, m_initialCommandLineConfiguration.Startup.Properties)) { Contract.Assert(loggingContext.ErrorWasLogged); return(null); } FrontEndController.ParseConfig(configurationEngine, m_initialCommandLineConfiguration); return(GraphReuseResult.CreateForPartialReuse(t.Item1, inputChanges)); }
/// <nodoc /> public UntrackingResolverSettings(IResolverSettings template, IUntrackingSettings untrackingTemplate, PathRemapper pathRemapper) : base(template, pathRemapper) { UntrackedDirectoryScopes = untrackingTemplate.UntrackedDirectoryScopes; UntrackedFiles = untrackingTemplate.UntrackedFiles; UntrackedDirectories = untrackingTemplate.UntrackedDirectories; UntrackedGlobalDirectoryScopes = untrackingTemplate.UntrackedGlobalDirectoryScopes; ChildProcessesToBreakawayFromSandbox = untrackingTemplate.ChildProcessesToBreakawayFromSandbox; }