public Cpu(IRegisters registers, IRam ram) { this.registers = registers; this.ram = ram; this.destinationProvider = new DestinationProvider(registers, ram); this.sourceProvider = new SourceProvider(registers, ram); }
private void HaveUpdatesHandler(ISourceProvider sourceProvider) { if (_updateHandler.HaveUpdates()) { ProcessUpdate(sourceProvider); } }
private void ProcessUpdate(ISourceProvider sourceProvider) { string appPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().FullName); string zipPackageName = Path.Combine(appPath, UpdatePackageName); string updaterFolder = Path.Combine(appPath, UpdateFolderName); var packageInfo = sourceProvider.GetPackage(); using (var fs = new FileStream(zipPackageName, FileMode.Create)) { packageInfo.Stream.CopyTo(fs); fs.Close(); } packageInfo.Stream.Dispose(); if (Directory.Exists(updaterFolder)) { Directory.Delete(updaterFolder, true); } ZipFile.ExtractToDirectory(zipPackageName, updaterFolder); File.Delete(zipPackageName); Process.Start( Path.Combine(updaterFolder, UpdaterName), String.Format("{0} {1}", Process.GetCurrentProcess().Id, Path.Combine(appPath, packageInfo.AppName))); }
public static void Init( ISecurityProvider securityProvider, bool alwaysCheck, IUpdateHandler updateHandler, ISourceProvider[] sourceProviders) { if (securityProvider == null || updateHandler == null) { throw new ArgumentException("Parameters missed!"); } var sp = new List<ISourceProvider> { new WebApiSourceProvider(securityProvider) }; if (sourceProviders != null && sourceProviders.Any()) { sp.AddRange(sourceProviders); } var updateManager = new UpdateManager(updateHandler, sp); updateManager.InitialCheck(); if (alwaysCheck) { updateManager.Subscribe(); } }
public async Task RunMaintenanceOperation(IExecutionContext executionContext) { Trace.Entering(); ArgUtil.NotNull(executionContext, nameof(executionContext)); // this might be not accurate when the agent is configured for old TFS server int totalAvailableTimeInMinutes = executionContext.Variables.GetInt("maintenance.jobtimeoutinminutes") ?? 60; // start a timer to track how much time we used Stopwatch totalTimeSpent = Stopwatch.StartNew(); var trackingManager = HostContext.GetService <ITrackingManager>(); int staleBuildDirThreshold = executionContext.Variables.GetInt("maintenance.deleteworkingdirectory.daysthreshold") ?? 0; if (staleBuildDirThreshold > 0) { // scan unused build directories executionContext.Output(StringUtil.Loc("DiscoverBuildDir", staleBuildDirThreshold)); trackingManager.MarkExpiredForGarbageCollection(executionContext, TimeSpan.FromDays(staleBuildDirThreshold)); } else { executionContext.Output(StringUtil.Loc("GCBuildDirNotEnabled")); return; } executionContext.Output(StringUtil.Loc("GCBuildDir")); // delete unused build directories trackingManager.DisposeCollectedGarbage(executionContext); // give source provider a chance to run maintenance operation Trace.Info("Scan all SourceFolder tracking files."); string searchRoot = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), Constants.Build.Path.SourceRootMappingDirectory); if (!Directory.Exists(searchRoot)) { executionContext.Output(StringUtil.Loc("GCDirNotExist", searchRoot)); return; } // <tracking config, tracking file path> List <Tuple <TrackingConfig, string> > optimizeTrackingFiles = new List <Tuple <TrackingConfig, string> >(); var allTrackingFiles = Directory.EnumerateFiles(searchRoot, Constants.Build.Path.TrackingConfigFile, SearchOption.AllDirectories); Trace.Verbose($"Find {allTrackingFiles.Count()} tracking files."); foreach (var trackingFile in allTrackingFiles) { executionContext.Output(StringUtil.Loc("EvaluateTrackingFile", trackingFile)); TrackingConfigBase tracking = trackingManager.LoadIfExists(executionContext, trackingFile); // detect whether the tracking file is in new format. TrackingConfig newTracking = tracking as TrackingConfig; if (newTracking == null) { executionContext.Output(StringUtil.Loc("GCOldFormatTrackingFile", trackingFile)); } else if (string.IsNullOrEmpty(newTracking.RepositoryType)) { // repository not been set. executionContext.Output(StringUtil.Loc("SkipTrackingFileWithoutRepoType", trackingFile)); } else { optimizeTrackingFiles.Add(new Tuple <TrackingConfig, string>(newTracking, trackingFile)); } } // Sort the all tracking file ASC by last maintenance attempted time foreach (var trackingInfo in optimizeTrackingFiles.OrderBy(x => x.Item1.LastMaintenanceAttemptedOn)) { // maintenance has been cancelled. executionContext.CancellationToken.ThrowIfCancellationRequested(); bool runMainenance = false; TrackingConfig trackingConfig = trackingInfo.Item1; string trackingFile = trackingInfo.Item2; if (trackingConfig.LastMaintenanceAttemptedOn == null) { // this folder never run maintenance before, we will do maintenance if there is more than half of the time remains. if (totalTimeSpent.Elapsed.TotalMinutes < totalAvailableTimeInMinutes / 2) // 50% time left { runMainenance = true; } else { executionContext.Output($"Working directory '{trackingConfig.BuildDirectory}' has never run maintenance before. Skip since we may not have enough time."); } } else if (trackingConfig.LastMaintenanceCompletedOn == null) { // this folder did finish maintenance last time, this might indicate we need more time for this working directory if (totalTimeSpent.Elapsed.TotalMinutes < totalAvailableTimeInMinutes / 4) // 75% time left { runMainenance = true; } else { executionContext.Output($"Working directory '{trackingConfig.BuildDirectory}' didn't finish maintenance last time. Skip since we may not have enough time."); } } else { // estimate time for running maintenance TimeSpan estimateTime = trackingConfig.LastMaintenanceCompletedOn.Value - trackingConfig.LastMaintenanceAttemptedOn.Value; // there is more than 10 mins left after we run maintenance on this repository directory if (totalAvailableTimeInMinutes > totalTimeSpent.Elapsed.TotalMinutes + estimateTime.TotalMinutes + 10) { runMainenance = true; } else { executionContext.Output($"Working directory '{trackingConfig.BuildDirectory}' may take about '{estimateTime.TotalMinutes}' mins to finish maintenance. It's too risky since we only have '{totalAvailableTimeInMinutes - totalTimeSpent.Elapsed.TotalMinutes}' mins left for maintenance."); } } if (runMainenance) { var extensionManager = HostContext.GetService <IExtensionManager>(); ISourceProvider sourceProvider = extensionManager.GetExtensions <ISourceProvider>().FirstOrDefault(x => string.Equals(x.RepositoryType, trackingConfig.RepositoryType, StringComparison.OrdinalIgnoreCase)); if (sourceProvider != null) { try { trackingManager.MaintenanceStarted(trackingConfig, trackingFile); string repositoryPath = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), trackingConfig.SourcesDirectory); await sourceProvider.RunMaintenanceOperations(executionContext, repositoryPath); trackingManager.MaintenanceCompleted(trackingConfig, trackingFile); } catch (Exception ex) { executionContext.Error(StringUtil.Loc("ErrorDuringBuildGC", trackingFile)); executionContext.Error(ex); } } } } }
public Source(ISourceProvider sourceProvider, string identifier = null) { SourceProvider = sourceProvider; Identifier = identifier; }
public GraphicLoader(PaletteCollection paletteCollection, PaletteTable paletteTable, ISourceProvider sourceProvider) { this.paletteCollection = paletteCollection; this.paletteTable = paletteTable; this.sourceProvider = sourceProvider; graphicCount = 0; // Precache the EPF header information sourceHeaders = new GraphicCollectionHeader[sourceProvider.SourceCount]; for(int index = 0; index < sourceProvider.SourceCount; ++index) { using(Stream stream = sourceProvider.GetSourceStream(index)) sourceHeaders[index] = GraphicCollectionHeader.FromStream(stream); graphicCount += sourceHeaders[index].GraphicCount; } }
public TrackingConfig PrepareDirectory( IExecutionContext executionContext, ServiceEndpoint endpoint, ISourceProvider sourceProvider) { // Validate parameters. Trace.Entering(); ArgUtil.NotNull(executionContext, nameof(executionContext)); ArgUtil.NotNull(executionContext.Variables, nameof(executionContext.Variables)); ArgUtil.NotNull(endpoint, nameof(endpoint)); ArgUtil.NotNull(sourceProvider, nameof(sourceProvider)); var trackingManager = HostContext.GetService<ITrackingManager>(); // Defer to the source provider to calculate the hash key. Trace.Verbose("Calculating build directory hash key."); string hashKey = sourceProvider.GetBuildDirectoryHashKey(executionContext, endpoint); Trace.Verbose($"Hash key: {hashKey}"); // Load the existing tracking file if one already exists. string trackingFile = Path.Combine( IOUtil.GetWorkPath(HostContext), Constants.Build.Path.SourceRootMappingDirectory, executionContext.Variables.System_CollectionId, executionContext.Variables.System_DefinitionId, Constants.Build.Path.TrackingConfigFile); Trace.Verbose($"Loading tracking config if exists: {trackingFile}"); TrackingConfigBase existingConfig = trackingManager.LoadIfExists(executionContext, trackingFile); // Check if the build needs to be garbage collected. If the hash key // has changed, then the existing build directory cannot be reused. TrackingConfigBase garbageConfig = null; if (existingConfig != null && !string.Equals(existingConfig.HashKey, hashKey, StringComparison.OrdinalIgnoreCase)) { // Just store a reference to the config for now. It can safely be // marked for garbage collection only after the new build directory // config has been created. Trace.Verbose($"Hash key from existing tracking config does not match. Existing key: {existingConfig.HashKey}"); garbageConfig = existingConfig; existingConfig = null; } // Create a new tracking config if required. TrackingConfig newConfig; if (existingConfig == null) { Trace.Verbose("Creating a new tracking config file."); newConfig = trackingManager.Create(executionContext, endpoint, hashKey, trackingFile); ArgUtil.NotNull(newConfig, nameof(newConfig)); } else { // Convert legacy format to the new format if required. newConfig = ConvertToNewFormat(executionContext, endpoint, existingConfig); // For existing tracking config files, update the job run properties. Trace.Verbose("Updating job run properties."); trackingManager.UpdateJobRunProperties(executionContext, newConfig, trackingFile); } // Mark the old configuration for garbage collection. if (garbageConfig != null) { Trace.Verbose("Marking existing config for garbage collection."); trackingManager.MarkForGarbageCollection(executionContext, garbageConfig); } // Prepare the build directory. // Delete entire build directory if clean=all is set. // Always recreate artifactstaging dir and testresult dir. // Recreate binaries dir if clean=binary is set. // Delete source dir if clean=src is set. BuildCleanOption? cleanOption = executionContext.Variables.Build_Clean; CreateDirectory( executionContext, description: "build directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.BuildDirectory), deleteExisting: cleanOption == BuildCleanOption.All); CreateDirectory( executionContext, description: "artifacts directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.ArtifactsDirectory), deleteExisting: true); CreateDirectory( executionContext, description: "test results directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.TestResultsDirectory), deleteExisting: true); CreateDirectory( executionContext, description: "binaries directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.BuildDirectory, Constants.Build.Path.BinariesDirectory), deleteExisting: cleanOption == BuildCleanOption.Binary); CreateDirectory( executionContext, description: "source directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.BuildDirectory, Constants.Build.Path.SourcesDirectory), deleteExisting: cleanOption == BuildCleanOption.Source); return newConfig; }
public override async Task RunAsync(AgentTaskPluginExecutionContext executionContext, CancellationToken token) { var sourceSkipVar = StringUtil.ConvertToBoolean(executionContext.Variables.GetValueOrDefault("agent.source.skip")?.Value) || !StringUtil.ConvertToBoolean(executionContext.Variables.GetValueOrDefault("build.syncSources")?.Value ?? bool.TrueString); if (sourceSkipVar) { executionContext.Output($"Skip sync source for repository."); return; } var repoAlias = executionContext.GetInput(Pipelines.PipelineConstants.CheckoutTaskInputs.Repository, true); var repo = executionContext.Repositories.Single(x => string.Equals(x.Alias, repoAlias, StringComparison.OrdinalIgnoreCase)); MergeCheckoutOptions(executionContext, repo); var currentRepoPath = repo.Properties.Get <string>(Pipelines.RepositoryPropertyNames.Path); var buildDirectory = executionContext.Variables.GetValueOrDefault("agent.builddirectory")?.Value; var tempDirectory = executionContext.Variables.GetValueOrDefault("agent.tempdirectory")?.Value; ArgUtil.NotNullOrEmpty(currentRepoPath, nameof(currentRepoPath)); ArgUtil.NotNullOrEmpty(buildDirectory, nameof(buildDirectory)); ArgUtil.NotNullOrEmpty(tempDirectory, nameof(tempDirectory)); // Determine the path that we should clone/move the repository into const string sourcesDirectory = "s"; //Constants.Build.Path.SourcesDirectory string expectRepoPath; var path = executionContext.GetInput("path"); if (!string.IsNullOrEmpty(path)) { // When the checkout task provides a path, always use that one expectRepoPath = IOUtil.ResolvePath(buildDirectory, path); if (!expectRepoPath.StartsWith(buildDirectory.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar)) { throw new ArgumentException($"Input path '{path}' should resolve to a directory under '{buildDirectory}', current resolved path '{expectRepoPath}'."); } } else if (HasMultipleCheckouts(executionContext)) { // When there are multiple checkout tasks (and this one didn't set the path), default to directory 1/s/<repoName> expectRepoPath = Path.Combine(buildDirectory, sourcesDirectory, RepositoryUtil.GetCloneDirectory(repo)); } else { // When there's a single checkout task that doesn't have path set, default to sources directory 1/s expectRepoPath = Path.Combine(buildDirectory, sourcesDirectory); } // Update the repository path in the worker process executionContext.UpdateRepositoryPath(repoAlias, expectRepoPath); executionContext.Debug($"Repository requires to be placed at '{expectRepoPath}', current location is '{currentRepoPath}'"); if (!string.Equals(currentRepoPath.Trim(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), expectRepoPath.Trim(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), IOUtil.FilePathStringComparison)) { executionContext.Output($"Repository is current at '{currentRepoPath}', move to '{expectRepoPath}'."); var count = 1; var staging = Path.Combine(tempDirectory, $"_{count}"); while (Directory.Exists(staging)) { count++; staging = Path.Combine(tempDirectory, $"_{count}"); } try { executionContext.Debug($"Move existing repository '{currentRepoPath}' to '{expectRepoPath}' via staging directory '{staging}'."); IOUtil.MoveDirectory(currentRepoPath, expectRepoPath, staging, CancellationToken.None); } catch (Exception ex) { executionContext.Debug("Catch exception during repository move."); executionContext.Debug(ex.ToString()); executionContext.Warning("Unable move and reuse existing repository to required location."); IOUtil.DeleteDirectory(expectRepoPath, CancellationToken.None); } executionContext.Output($"Repository will be located at '{expectRepoPath}'."); repo.Properties.Set <string>(Pipelines.RepositoryPropertyNames.Path, expectRepoPath); } ISourceProvider sourceProvider = SourceProviderFactory.GetSourceProvider(repo.Type); await sourceProvider.GetSourceAsync(executionContext, repo, token); }
public NightlyMlSoftwareDetector(IProductProvider productProvider, ISourceProvider sourceProvider) : base(productProvider, sourceProvider) { }
public FhpSoftwareDetector(IProductProvider productProvider, ISourceProvider sourceProvider) : base(productProvider, sourceProvider) { }
public static void Main(string[] args) { ISourceProvider sourceProvider = null; ITargetProvider targetProvider = null; var parser = new Parser(settings => { settings.IgnoreUnknownArguments = true; settings.HelpWriter = Parser.Default.Settings.HelpWriter; }); var options = new Options(); if (parser.ParseArguments(args, options)) { switch (options.SourceProvider) { case "VstsRest": { var providerOptions = new VstsRestSourceProviderOptions(); if (parser.ParseArguments(args, providerOptions)) { sourceProvider = new VstsRestSourceProvider(providerOptions); } break; } case "JsonFile": { var providerOptions = new JsonFileSourceProviderOptions(); if (parser.ParseArguments(args, providerOptions)) { sourceProvider = new JsonFileSourceProvider(providerOptions); } else { } break; } default: Console.Error.WriteLine("Invalid sourceProvider"); break; } if (sourceProvider == null) { return; } switch (options.TargetProvider) { case "SQLite": { var providerOptions = new SQLiteTargetProviderOptions(); if (parser.ParseArguments(args, providerOptions)) { targetProvider = new SQLiteTargetProvider(providerOptions); } break; } case "JsonFile": { var providerOptions = new JsonFileTargetProviderOptions(); if (parser.ParseArguments(args, providerOptions)) { targetProvider = new JsonFileTargetProvider(providerOptions); } break; } default: Console.Error.WriteLine("Invalid targetProvider"); break; } if (targetProvider == null) { return; } } if (sourceProvider != null && targetProvider != null) { Task.Run(async() => { var runtime = new ReportingRuntime(); await runtime.Export(sourceProvider, targetProvider); }).Wait(); } }
protected MlSoftwareDetector(IProductProvider productProvider, ISourceProvider sourceProvider) : base(productProvider, sourceProvider) { }
public TrackingConfig PrepareDirectory( IExecutionContext executionContext, ServiceEndpoint endpoint, ISourceProvider sourceProvider) { // Validate parameters. Trace.Entering(); ArgUtil.NotNull(executionContext, nameof(executionContext)); ArgUtil.NotNull(executionContext.Variables, nameof(executionContext.Variables)); ArgUtil.NotNull(endpoint, nameof(endpoint)); ArgUtil.NotNull(sourceProvider, nameof(sourceProvider)); var trackingManager = HostContext.GetService <ITrackingManager>(); // Defer to the source provider to calculate the hash key. Trace.Verbose("Calculating build directory hash key."); string hashKey = sourceProvider.GetBuildDirectoryHashKey(executionContext, endpoint); Trace.Verbose($"Hash key: {hashKey}"); // Load the existing tracking file if one already exists. string trackingFile = Path.Combine( IOUtil.GetWorkPath(HostContext), Constants.Build.Path.SourceRootMappingDirectory, executionContext.Variables.System_CollectionId, executionContext.Variables.System_DefinitionId, Constants.Build.Path.TrackingConfigFile); Trace.Verbose($"Loading tracking config if exists: {trackingFile}"); TrackingConfigBase existingConfig = trackingManager.LoadIfExists(executionContext, trackingFile); // Check if the build needs to be garbage collected. If the hash key // has changed, then the existing build directory cannot be reused. TrackingConfigBase garbageConfig = null; if (existingConfig != null && !string.Equals(existingConfig.HashKey, hashKey, StringComparison.OrdinalIgnoreCase)) { // Just store a reference to the config for now. It can safely be // marked for garbage collection only after the new build directory // config has been created. Trace.Verbose($"Hash key from existing tracking config does not match. Existing key: {existingConfig.HashKey}"); garbageConfig = existingConfig; existingConfig = null; } // Create a new tracking config if required. TrackingConfig newConfig; if (existingConfig == null) { Trace.Verbose("Creating a new tracking config file."); newConfig = trackingManager.Create( executionContext, endpoint, hashKey, trackingFile, sourceProvider.TestOverrideBuildDirectory()); ArgUtil.NotNull(newConfig, nameof(newConfig)); } else { // Convert legacy format to the new format if required. newConfig = ConvertToNewFormat(executionContext, endpoint, existingConfig); // Fill out repository type if it's not there. // repository type is a new property introduced for maintenance job if (string.IsNullOrEmpty(newConfig.RepositoryType)) { newConfig.RepositoryType = endpoint.Type; } // For existing tracking config files, update the job run properties. Trace.Verbose("Updating job run properties."); trackingManager.UpdateJobRunProperties(executionContext, newConfig, trackingFile); } // Mark the old configuration for garbage collection. if (garbageConfig != null) { Trace.Verbose("Marking existing config for garbage collection."); trackingManager.MarkForGarbageCollection(executionContext, garbageConfig); } // Prepare the build directory. // There are 2 ways to provide build directory clean policy. // 1> set definition variable build.clean or agent.clean.buildDirectory. (on-prem user need to use this, since there is no Web UI in TFS 2016) // 2> select source clean option in definition repository tab. (VSTS will have this option in definition designer UI) BuildCleanOption cleanOption = GetBuildDirectoryCleanOption(executionContext, endpoint); CreateDirectory( executionContext, description: "build directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.BuildDirectory), deleteExisting: cleanOption == BuildCleanOption.All); CreateDirectory( executionContext, description: "artifacts directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.ArtifactsDirectory), deleteExisting: true); CreateDirectory( executionContext, description: "test results directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.TestResultsDirectory), deleteExisting: true); CreateDirectory( executionContext, description: "binaries directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.BuildDirectory, Constants.Build.Path.BinariesDirectory), deleteExisting: cleanOption == BuildCleanOption.Binary); CreateDirectory( executionContext, description: "source directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.BuildDirectory, Constants.Build.Path.SourcesDirectory), deleteExisting: cleanOption == BuildCleanOption.Source); return(newConfig); }
public RoslynDeclarationProvider(ISourceProvider sourceProvider) { SourceProvider = sourceProvider; }
public RipeISOCountryReader(ISourceProvider sourceProvider) : base(new RipeParser(), new RipeNormalizer(), sourceProvider) { }
public TrackingConfig PrepareDirectory( IExecutionContext executionContext, ServiceEndpoint endpoint, ISourceProvider sourceProvider) { // Validate parameters. Trace.Entering(); ArgUtil.NotNull(executionContext, nameof(executionContext)); ArgUtil.NotNull(executionContext.Variables, nameof(executionContext.Variables)); ArgUtil.NotNull(endpoint, nameof(endpoint)); ArgUtil.NotNull(sourceProvider, nameof(sourceProvider)); var trackingManager = HostContext.GetService <ITrackingManager>(); // Defer to the source provider to calculate the hash key. Trace.Verbose("Calculating build directory hash key."); string hashKey = sourceProvider.GetBuildDirectoryHashKey(executionContext, endpoint); Trace.Verbose($"Hash key: {hashKey}"); // Load the existing tracking file if one already exists. string trackingFile = Path.Combine( IOUtil.GetWorkPath(HostContext), Constants.Build.Path.SourceRootMappingDirectory, executionContext.Variables.System_CollectionId, executionContext.Variables.System_DefinitionId, Constants.Build.Path.TrackingConfigFile); Trace.Verbose($"Loading tracking config if exists: {trackingFile}"); TrackingConfigBase existingConfig = trackingManager.LoadIfExists(executionContext, trackingFile); // Check if the build needs to be garbage collected. If the hash key // has changed, then the existing build directory cannot be reused. TrackingConfigBase garbageConfig = null; if (existingConfig != null && !string.Equals(existingConfig.HashKey, hashKey, StringComparison.OrdinalIgnoreCase)) { // Just store a reference to the config for now. It can safely be // marked for garbage collection only after the new build directory // config has been created. Trace.Verbose($"Hash key from existing tracking config does not match. Existing key: {existingConfig.HashKey}"); garbageConfig = existingConfig; existingConfig = null; } // Create a new tracking config if required. TrackingConfig newConfig; if (existingConfig == null) { Trace.Verbose("Creating a new tracking config file."); newConfig = trackingManager.Create(executionContext, endpoint, hashKey, trackingFile); ArgUtil.NotNull(newConfig, nameof(newConfig)); } else { // Convert legacy format to the new format if required. newConfig = ConvertToNewFormat(executionContext, endpoint, existingConfig); // For existing tracking config files, update the job run properties. Trace.Verbose("Updating job run properties."); trackingManager.UpdateJobRunProperties(executionContext, newConfig, trackingFile); } // Mark the old configuration for garbage collection. if (garbageConfig != null) { Trace.Verbose("Marking existing config for garbage collection."); trackingManager.MarkForGarbageCollection(executionContext, garbageConfig); } // Prepare the build directory. // Delete entire build directory if clean=all is set. // Always recreate artifactstaging dir and testresult dir. // Recreate binaries dir if clean=binary is set. // Delete source dir if clean=src is set. BuildCleanOption?cleanOption = executionContext.Variables.Build_Clean; CreateDirectory( executionContext, description: "build directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.BuildDirectory), deleteExisting: cleanOption == BuildCleanOption.All); CreateDirectory( executionContext, description: "artifacts directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.ArtifactsDirectory), deleteExisting: true); CreateDirectory( executionContext, description: "test results directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.TestResultsDirectory), deleteExisting: true); CreateDirectory( executionContext, description: "binaries directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.BuildDirectory, Constants.Build.Path.BinariesDirectory), deleteExisting: cleanOption == BuildCleanOption.Binary); CreateDirectory( executionContext, description: "source directory", path: Path.Combine(IOUtil.GetWorkPath(HostContext), newConfig.BuildDirectory, Constants.Build.Path.SourcesDirectory), deleteExisting: cleanOption == BuildCleanOption.Source); return(newConfig); }
public SourceProviderHost(ISourceProvider sourceProvider) { this.sourceProvider = sourceProvider; sources = new List <Source>(); }
private bool TrySetPrimaryEndpointAndProviderInfo(IExecutionContext executionContext) { // Return the first service endpoint that contains a supported source provider. Trace.Entering(); var extensionManager = HostContext.GetService<IExtensionManager>(); List<ISourceProvider> sourceProviders = extensionManager.GetExtensions<ISourceProvider>(); foreach (ServiceEndpoint ep in executionContext.Endpoints) { SourceProvider = sourceProviders .FirstOrDefault(x => string.Equals(x.RepositoryType, ep.Type, StringComparison.OrdinalIgnoreCase)); if (SourceProvider != null) { SourceEndpoint = ep; return true; } } return false; }
public UpdateActionProvider(MainViewModel mainViewModel, ISourceProvider sourceProvider, ICameraProvider cameraProvider, IServiceActivator serviceActivator) : base(mainViewModel, sourceProvider, cameraProvider, serviceActivator) { }