public GrowlNotifiactions(IStartupConfiguration startupConfiguration, Notifications notifications) { InitializeComponent(); this.startupConfiguration = startupConfiguration; Notifications = notifications; NotificationsControl.DataContext = Notifications; }
/// <summary> /// Constructor /// </summary> /// <param name="locator"></param> /// <param name="allModules"></param> /// <param name="filteredModules"></param> /// <param name="startupConfiguration"></param> public StartupContext(ILocator locator, IEnumerable <IDependencyNode> allModules, IEnumerable <IDependencyNode> filteredModules, IStartupConfiguration startupConfiguration) { Locator = locator; AllModuleTypes = allModules; FilteredModuleTypes = filteredModules; Configuration = startupConfiguration; }
/// <summary> /// Starup process, by default it scans assemblies, sorts modules, configures container, and runs startup for each module /// </summary> /// <param name="config"></param> /// <returns></returns> public virtual IStartupContext ConfigureLocator(IStartupConfiguration config) { IStartupTask startupTaskWithStartModules = null; var startupTaskContext = new StartupTaskContext(_enableImport, _locatorRegistryFactory, config, _locatorDefaultRegistrations, _finalizeRegistry); foreach (var task in CreateStartupTasks()) { task.Prepare(startupTaskContext); if (task is IStartupTaskWithStartupModules withStartupModules && withStartupModules.ExecuteStartupModules) { startupTaskWithStartModules = withStartupModules; continue; } task.Execute(config.TimedTaskManager); } if (startupTaskWithStartModules is null) { throw new Exception("No IStartupTaskWithStartupModules was used in startup tasks!"); } // optionally allows delaying startup until later, must be implemented on IStartupConfiguration instances _delayedStart = () => startupTaskWithStartModules.Execute(config.TimedTaskManager); if (!_enableDelayedStartupModules) { TryExecuteStartupModules(); } return(startupTaskContext.Get <IStartupContext>()); }
/// <nodoc /> public StartupConfiguration(IStartupConfiguration template, PathRemapper pathRemapper) { Contract.Assume(template != null); Contract.Assume(pathRemapper != null); ConfigFile = pathRemapper.Remap(template.ConfigFile); AdditionalConfigFiles = pathRemapper.Remap(template.AdditionalConfigFiles); Properties = new Dictionary <string, string>(); foreach (var kv in template.Properties) { Properties.Add(kv.Key, kv.Value); } QualifierIdentifiers = new List <string>(template.QualifierIdentifiers); ImplicitFilters = new List <string>(template.ImplicitFilters); CurrentHost = new Host(template.CurrentHost, pathRemapper); ABTestingArgs = new Dictionary <string, string>(); foreach (var kv in template.ABTestingArgs) { ABTestingArgs.Add(kv.Key, kv.Value); } ChosenABTestingKey = template.ChosenABTestingKey; }
public TranslatorBootstrapper(MainWindow mainWindow, GrowlNotifiactions growlNotifications, IStartupConfiguration startupConfiguration, ICacheManager cacheManager) { if (mainWindow == null) { throw new ArgumentNullException(nameof(mainWindow)); } if (growlNotifications == null) { throw new ArgumentNullException(nameof(growlNotifications)); } if (startupConfiguration == null) { throw new ArgumentNullException(nameof(startupConfiguration)); } if (cacheManager == null) { throw new ArgumentNullException(nameof(cacheManager)); } this.mainWindow = mainWindow; this.growlNotifications = growlNotifications; this.startupConfiguration = startupConfiguration; this.cacheManager = cacheManager; cache = this.cacheManager.GetCacheEnvironment <string, TranslateResult[]>(CacheNames.MeanCache); }
/// <summary> /// Constructor /// </summary> /// <param name="startupConfiguration"></param> /// <param name="reflectionHelper"></param> public ServiceProviderTypeChecker(IStartupConfiguration startupConfiguration, IReflectionHelper reflectionHelper) { _StartupConfiguration = startupConfiguration; _ReflectionHelper = reflectionHelper; _ScannedLookups = new Dictionary <Assembly, bool>(); _ScannedAssemblies = new List <Assembly>(); }
public LanguageManagementConfig(IIocManager iocManager, IStartupConfiguration configuration) { _iocManager = iocManager; _configuration = configuration; Logger = NullLogger.Instance; }
public static void ReplaceService(this IStartupConfiguration configuration, Type type, Type impl, DependencyLifeStyle lifeStyle = DependencyLifeStyle.Singleton) { configuration.ReplaceService(type, () => { configuration.IocManager.Register(type, impl, lifeStyle); }); }
/// <summary> /// Computes a fingerprint for looking up a reloadable build graph. Null indicates failure /// </summary> internal static GraphFingerprint TryComputeFingerprint( LoggingContext loggingContext, IStartupConfiguration startUpConfig, IConfiguration config, PathTable pathTable, IEvaluationFilter evaluationFilter, FileContentTable fileContentTable, string commitId, EngineTestHooksData testHooks) { Contract.Requires(pathTable != null); Contract.Requires(startUpConfig != null); Contract.Requires(fileContentTable != null); Contract.Requires(evaluationFilter != null); Optional <CompositeGraphFingerprint> exactFingerprint = GenerateHash( loggingContext, startUpConfig, config, pathTable, evaluationFilter, fileContentTable, commitId, testHooks); Optional <CompositeGraphFingerprint> compatibleFingerprint; if (!exactFingerprint.IsValid) { return(null); } if (evaluationFilter.CanPerformPartialEvaluation) { compatibleFingerprint = GenerateHash( loggingContext, startUpConfig, config, pathTable, null, fileContentTable, commitId, testHooks); if (!compatibleFingerprint.IsValid) { return(null); } } else { compatibleFingerprint = exactFingerprint; } return(new GraphFingerprint( exactFingerprint.Value.WithEvaluationFilter(evaluationFilter), compatibleFingerprint.Value.WithEvaluationFilter(evaluationFilter))); }
public static void ReplaceService <TType, TImpl>(this IStartupConfiguration configuration, DependencyLifeStyle lifeStyle = DependencyLifeStyle.Singleton) where TType : class where TImpl : class, TType { configuration.ReplaceService(typeof(TType), () => { configuration.IocManager.Register <TType, TImpl>(lifeStyle); }); }
/// <summary> /// Constructor /// </summary> /// <param name="enableImport"></param> /// <param name="locatorRegistryFactory"></param> /// <param name="startupConfiguration"></param> /// <param name="locatorDefaultRegistrations"></param> /// <param name="locatorRegistryFinalizer"></param> public StartupTaskContext(bool enableImport, ILocatorRegistryFactory locatorRegistryFactory, IStartupConfiguration startupConfiguration, ILocatorDefaultRegistrations locatorDefaultRegistrations, Action <ILocatorRegistry> locatorRegistryFinalizer) { EnableImport = enableImport; LocatorRegistry = locatorRegistryFactory?.CreateRegistry(); Locator = locatorRegistryFactory?.CreateLocator(); Configuration = startupConfiguration; _taskItems = new StartupEnvironmentItemCollection(); _taskItems.Set(locatorDefaultRegistrations); _taskItems.Set(locatorRegistryFinalizer); }
public SesliSozlukFinder(IMeanOrganizerFactory meanOrganizerFactory, IStartupConfiguration configuration) { if (meanOrganizerFactory == null) throw new ArgumentNullException(nameof(meanOrganizerFactory)); if (configuration == null) throw new ArgumentNullException(nameof(configuration)); this.meanOrganizerFactory = meanOrganizerFactory; this.configuration = configuration; }
/// <summary> /// Initializes a new instance of the <see cref="DbPerTenantConnectionStringResolver"/> class. /// </summary> public DbPerTenantConnectionStringResolver( IStartupConfiguration configuration, ICurrentUnitOfWorkProvider currentUnitOfWorkProvider, ITenantCache tenantCache) : base(configuration) { _currentUnitOfWorkProvider = currentUnitOfWorkProvider; _tenantCache = tenantCache; Session = NullInfrastructureSession.Instance; }
/// <inheritdoc /> AbsolutePath IConfigurationProcessor.FindPrimaryConfiguration(IStartupConfiguration startupConfiguration) { if (startupConfiguration.ConfigFile.IsValid) { return(startupConfiguration.ConfigFile); } var startDirectory = AbsolutePath.Create(Context.PathTable, Directory.GetCurrentDirectory()); return(TryFindConfig(startDirectory)); }
private static TFactoryType GetAssemblyFactory <TFactoryAttr, TFactoryType>(IStartupConfiguration config) where TFactoryAttr : AssemblyFactoryBaseAttribute { var dependents = config.DependencyFinder.Find <TFactoryAttr>(config.Assemblies); var sorted = config.DependencySorter.Sort <TFactoryAttr>(dependents); if (!(sorted.LastOrDefault()?.NodeAttribute is AssemblyFactoryBaseAttribute attr)) { return(default(TFactoryType)); } return((TFactoryType)Activator.CreateInstance(attr.FactoryType)); }
public void TestStartupConfiguration() { IServiceCollection services = new ServiceCollection(); IModuleManager modulManager = new ModuleManager(new SkeletonOptions()); //modulManager.Initialize(typeof(AutoMapper.AtaogeAutoMapperModule)); modulManager.ConfigModules(services); services.AddSingleton <IModuleManager>(modulManager); IServiceProvider sp = services.BuildServiceProvider(); IStartupConfiguration startupConfig = sp.GetService <IStartupConfiguration>(); Assert.False(startupConfig.MultiTenancy.IsEnabled, $"1 should not be prime"); }
public static void Configure(ConfigurationImpl config, IStartupConfiguration startupConfig, PathTable pathTable) { Contract.Requires(startupConfig.ConfigFile.IsValid); // Ide generation implies a schedule phase. config.Engine.Phase = EnginePhases.Schedule; var enlistmentRoot = startupConfig.ConfigFile.GetParent(pathTable); Contract.Assume(enlistmentRoot.IsValid); // Populate the missing values of the Ide configuration var ideConfiguration = config.Ide; // Deciding the solution name: // If the user passes a custom name for solution, use it. // Otherwise if the spec filtering is used, use the directory name of the spec. // Otherwise, use the directory name of the config file as the solution name. if (!ideConfiguration.SolutionName.IsValid) { // Translate enlistmentRoot because we need to get the name of the repository, which is not possible when using mapped path (e.g., b:\) var unmappedEnlistmentRoot = enlistmentRoot; PathTranslator translator; if (PathTranslator.CreateIfEnabled(config.Logging.SubstTarget, config.Logging.SubstSource, pathTable, out translator)) { unmappedEnlistmentRoot = translator.Translate(pathTable, enlistmentRoot); } // It's possible for the path to be at the root of the drive and not be able to be translated back when // the PathTranslator isn't enabled. In that case, fall back on some default solution name. string solutionNameCandidate = unmappedEnlistmentRoot.GetName(pathTable).ToString(pathTable.StringTable); if (string.IsNullOrWhiteSpace(solutionNameCandidate)) { solutionNameCandidate = "ideGenerated"; } // If a new solution generator is used, change the solution name so users can distinguish between the old and new one. if (ideConfiguration.IsNewEnabled) { solutionNameCandidate += "New"; } ideConfiguration.SolutionName = PathAtom.Create(pathTable.StringTable, solutionNameCandidate); } if (!ideConfiguration.SolutionRoot.IsValid) { ideConfiguration.SolutionRoot = config.Layout.OutputDirectory.Combine(pathTable, "VS"); } }
public MainWindow() { InitializeComponent(); IocManager.Instance.Register(typeof(MainWindow), this); translator = IocManager.Instance.Resolve<ITranslatorBootstrapper>(); translator.SubscribeShutdownEvents(); configuration = IocManager.Instance.Resolve<IStartupConfiguration>(); foreach (var language in configuration.LanguageMap) { ComboBoxLanguages.Items.Add(new Language(language.Key, language.Value)); } ComboBoxLanguages.SelectedValue = configuration.ToLanguageExtension; }
public YandexFinder(IStartupConfiguration configuration, IMeanOrganizerFactory meanOrganizerFactory) { if (meanOrganizerFactory == null) { throw new ArgumentNullException(nameof(meanOrganizerFactory)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } this.configuration = configuration; this.meanOrganizerFactory = meanOrganizerFactory; }
public GoogleTranslateFinder(IMeanOrganizerFactory meanOrganizerFactory, IStartupConfiguration configuration) { if (meanOrganizerFactory == null) { throw new ArgumentNullException(nameof(meanOrganizerFactory)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } this.meanOrganizerFactory = meanOrganizerFactory; this.configuration = configuration; }
public TranslatorBootstrapper(MainWindow mainWindow, GrowlNotifiactions growlNotifications, IStartupConfiguration startupConfiguration, ICacheManager cacheManager) { if (mainWindow == null) throw new ArgumentNullException(nameof(mainWindow)); if (growlNotifications == null) throw new ArgumentNullException(nameof(growlNotifications)); if (startupConfiguration == null) throw new ArgumentNullException(nameof(startupConfiguration)); if (cacheManager == null) throw new ArgumentNullException(nameof(cacheManager)); this.mainWindow = mainWindow; this.growlNotifications = growlNotifications; this.startupConfiguration = startupConfiguration; this.cacheManager = cacheManager; cache = this.cacheManager.GetCacheEnvironment<string, TranslateResult[]>(CacheNames.MeanCache); }
public YandexLanguageDetector(IStartupConfiguration configuration) { this.configuration = configuration; }
public ZarganFinder(IStartupConfiguration configuration, IMeanOrganizerFactory meanOrganizerFactory) { this.configuration = configuration; this.meanOrganizerFactory = meanOrganizerFactory; }
/// <summary> /// Injected constructor /// </summary> /// <param name="locator">Locator is passed to get all startup modules in a sorted manner, as some locators cannot sort while injecting</param> /// <param name="startupConfiguration">Used to log any errors</param> public ShutdownHandler(ILocator locator, IStartupConfiguration startupConfiguration) { _Locator = locator; _StartupModules = locator.GetAll <IStartupModule>().ToList(); _StartupConfiguration = startupConfiguration; }
public MikiBotApp(IStartupConfiguration configuration) { this.configuration = configuration; }
public GoogleLanguageDetector(IStartupConfiguration configuration) { this.configuration = configuration; }
public ModuleConfigurations(IStartupConfiguration startupConfiguration) { StartupConfiguration = startupConfiguration; }
public GoogleTranslateFinder(IMeanOrganizerFactory meanOrganizerFactory, IStartupConfiguration configuration) { this.meanOrganizerFactory = meanOrganizerFactory; this.configuration = configuration; }
private static Optional <CompositeGraphFingerprint> GenerateHash( LoggingContext loggingContext, IStartupConfiguration startUpConfig, IConfiguration config, PathTable pathTable, IEvaluationFilter partialEvaluationData, FileContentTable fileContentTable, string commitId, EngineTestHooksData testHooks) { ILayoutConfiguration layout = config.Layout; ILoggingConfiguration logging = config.Logging; var fingerprintTextElements = new List <(string, string)>(); using (var hasher = new CoreHashingHelper(recordFingerprintString: true)) { CompositeGraphFingerprint fingerprint = CompositeGraphFingerprint.Zero; AddInt(hasher, "version", GraphFingerprintVersion); using (var qualifierHasher = new CoreHashingHelper(recordFingerprintString: false)) { foreach (string qualifier in startUpConfig.QualifierIdentifiers.OrderBy(q => q)) { AddText(qualifierHasher, "qualifier", qualifier); } fingerprint.QualifierHash = qualifierHasher.GenerateHash(); AddFingerprint(hasher, "Qualifiers", fingerprint.QualifierHash); } if (partialEvaluationData != null && partialEvaluationData.CanPerformPartialEvaluation) { using (var evaluationFilterHasher = new CoreHashingHelper(recordFingerprintString: false)) { foreach (string value in partialEvaluationData.ValueNamesToResolveAsStrings.OrderBy(v => v)) { AddText(evaluationFilterHasher, "valueName", value); } foreach (string value in partialEvaluationData.ValueDefinitionRootsToResolveAsStrings.OrderBy(v => v)) { AddText(evaluationFilterHasher, "valuePath", value); } foreach (string value in partialEvaluationData.ModulesToResolveAsStrings.OrderBy(v => v)) { AddText(evaluationFilterHasher, "moduleName", value); } fingerprint.FilterHash = evaluationFilterHasher.GenerateHash(); AddFingerprint(hasher, "Values", fingerprint.FilterHash); } } // These paths get embedded in the result of evaluation. So if any change we must re-evaluate AddText(hasher, "ObjectDirectoryPath", layout.ObjectDirectory.IsValid ? layout.ObjectDirectory.ToString(pathTable) : "::null::"); AddText(hasher, "TempDirectoryPath", layout.TempDirectory.IsValid ? layout.TempDirectory.ToString(pathTable) : "::null::"); AddText(hasher, "SourceDirectoryPath", layout.SourceDirectory.IsValid ? layout.SourceDirectory.ToString(pathTable) : "::null::"); // All paths in the graph are relative to 'substTarget' (hence, 'substTarget' must be a part of the fingerprint, but 'substSource' need not be). AddText(hasher, "substTarget", logging.SubstTarget.IsValid ? logging.SubstTarget.ToString(pathTable) : "::null::"); AddText(hasher, "IsCompressed", config.Engine.CompressGraphFiles ? "true" : "false"); AddText(hasher, "IsSkipHashSourceFile", config.Schedule.SkipHashSourceFile ? "true" : "false"); // Pip static fingerprints are not always computed because computing them slows down the graph construction by 10%-13%. // Thus, the pip graph may and may not contain pip static fingerprints. To avoid unexpected result due to graph cache hit, // we temporarily add the option for computing pip static fingerprints as part of our graph fingerprint until the fingerprints // are always computed; see Task 1291638. AddText(hasher, "ComputePipStaticFingerprints", config.Schedule.ComputePipStaticFingerprints.ToString()); if (config.Schedule.ComputePipStaticFingerprints) { // Pip static fingerprints are part of the graph and include the extra fingerprint salts. // Thus, when pip static fingerprints are computed, any change to the salt will invalidate the graph because // the pip static fingerprints will no longer be valid. Reusing the graph when the salt changes can result in // underbuild. var extraFingerprintSalts = new ExtraFingerprintSalts( config, PipFingerprintingVersion.TwoPhaseV2, config.Cache.CacheSalt ?? string.Empty, new Scheduler.DirectoryMembershipFingerprinterRuleSet(config, pathTable.StringTable).ComputeSearchPathToolsHash()); AddFingerprint(hasher, "ExtraFingerprintSalts", extraFingerprintSalts.CalculatedSaltsFingerprint); } // Config files // Caution: Including the content hash of the config file is how changes to the default pip filter // invalidate a cached graph. If the config file content hash is removed, the values that get // evaluated because of it must be reflected in the values passed in to this method. using (var configHasher = new CoreHashingHelper(recordFingerprintString: false)) { var configFiles = new List <AbsolutePath> { startUpConfig.ConfigFile }; try { foreach (var configPath in configFiles .Select(path => path.ToString(pathTable)) .OrderBy(c => c, StringComparer.OrdinalIgnoreCase)) { AddContentHash( configHasher, configPath.ToUpperInvariant(), fileContentTable.GetAndRecordContentHashAsync(configPath) .GetAwaiter() .GetResult() .VersionedFileIdentityAndContentInfo.FileContentInfo.Hash); } fingerprint.ConfigFileHash = configHasher.GenerateHash(); AddFingerprint(hasher, "ConfigFiles", fingerprint.ConfigFileHash); } catch (BuildXLException ex) { return(LogAndReturnFailure(ex)); } } if (!string.IsNullOrEmpty(commitId)) { using (var commitHasher = new CoreHashingHelper(recordFingerprintString: false)) { commitHasher.Add("Commit", commitId); fingerprint.BuildEngineHash = commitHasher.GenerateHash(); } AddFingerprint(hasher, "BuildEngine", fingerprint.BuildEngineHash); } else { // BuildXL assemblies. This will invalidate the cached graph if build files change // or if the serialization format changes. try { Action <string, ContentHash> handleBuildFileAndHash = (buildFile, buildFileHash) => { // Directly add to fingerprint elements for logging, but the hash is represented in the build engine hash fingerprintTextElements.Add((buildFile, buildFileHash.ToString())); }; var deployment = testHooks?.AppDeployment ?? AppDeployment.ReadDeploymentManifestFromRunningApp(); fingerprint.BuildEngineHash = deployment.ComputeContentHashBasedFingerprint(fileContentTable, handleBuildFileAndHash); AddFingerprint(hasher, "BuildEngine", fingerprint.BuildEngineHash); } catch (BuildXLException ex) { Tracing.Logger.Log.FailedToComputeHashFromDeploymentManifest(loggingContext); Tracing.Logger.Log.FailedToComputeHashFromDeploymentManifestReason(loggingContext, ex.Message); return(default(Optional <CompositeGraphFingerprint>)); } } AddText(hasher, "HostOS", startUpConfig.CurrentHost.CurrentOS.ToString()); AddText(hasher, "HostCpuArchitecture", startUpConfig.CurrentHost.CpuArchitecture.ToString()); AddText(hasher, "HostIsElevated", CurrentProcess.IsElevated.ToString()); var salt = string.Empty; if (testHooks?.GraphFingerprintSalt != null) { salt += testHooks.GraphFingerprintSalt.Value.ToString(); } salt += EngineEnvironmentSettings.DebugGraphFingerprintSalt; if (!string.IsNullOrEmpty(salt)) { hasher.Add("GraphFingerprintSalt", salt); } fingerprint.OverallFingerprint = new ContentFingerprint(hasher.GenerateHash()); Tracing.Logger.Log.ElementsOfConfigurationFingerprint( loggingContext, fingerprint.OverallFingerprint.ToString(), string.Join(Environment.NewLine, fingerprintTextElements.Select(kvp => "\t" + kvp.Item1 + " : " + kvp.Item2))); return(new Optional <CompositeGraphFingerprint>(fingerprint)); } // Local functions void AddInt(CoreHashingHelper hasher, string key, int value) { hasher.Add(key, value); fingerprintTextElements.Add( (key, value.ToString(CultureInfo.InvariantCulture))); } void AddText(CoreHashingHelper hasher, string key, string value) { hasher.Add(key, value); fingerprintTextElements.Add((key, value)); } void AddFingerprint(CoreHashingHelper hasher, string key, Fingerprint value) { hasher.Add(key, value); fingerprintTextElements.Add((key, value.ToString())); } void AddContentHash(CoreHashingHelper hasher, string key, ContentHash value) { hasher.Add(key, value); fingerprintTextElements.Add((key, value.ToString())); } }
public TurengFinder(IMeanOrganizerFactory meanOrganizerFactory, IStartupConfiguration configuration) { this.meanOrganizerFactory = meanOrganizerFactory; this.configuration = configuration; }
public YandexFinder(IStartupConfiguration configuration, IMeanOrganizerFactory meanOrganizerFactory) { this.configuration = configuration; this.meanOrganizerFactory = meanOrganizerFactory; }
public Startup(IStartupConfiguration configuration) { _serviceType = configuration.ServiceType; }
public TextGuardInterceptor(IStartupConfiguration configuration) { this.configuration = configuration; }
public ModuleConfigurations(IStartupConfiguration configuration) { Configuration = configuration; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultConnectionStringResolver"/> class. /// </summary> public DefaultConnectionStringResolver(IStartupConfiguration configuration) { _configuration = configuration; }
public CachingConfiguration(IStartupConfiguration abpConfiguration) { Configuration = abpConfiguration; _configurators = new List <ICacheConfigurator>(); }
/// <inheritdoc /> public AbsolutePath FindPrimaryConfiguration(IStartupConfiguration startupConfiguration) { return(m_primaryConfiguration); }
/// <summary> /// Assigns default instances to the locator /// </summary> /// <param name="registry"></param> /// <param name="filteredModules"></param> /// <param name="configuration"></param> public virtual void Configure(ILocatorRegistry registry, IEnumerable <IDependencyNode> filteredModules, IStartupConfiguration configuration) { var modules = filteredModules.Select(x => x.Node).OfType <Type>(); RegisterScannedModules(registry, modules); RegisterStartupModuleCollection(registry); RegisterLocatorConfigureCollection(registry); // add default instances registry .AddInstance(configuration) .AddInstance(configuration.Environment) .AddInstance(configuration.Logger) .AddInstance(configuration.AssemblyScanner) .AddInstance(configuration.DependencyFinder) .AddInstance(configuration.DependencySorter) .AddTransient <ITimedTask, TimedTask>(); }
public GoogleAnalyticsService(IStartupConfiguration configuration) { this.configuration = configuration; }