Ejemplo n.º 1
0
        /// <summary>
        /// Called by workflow RunOnAgent sequence.
        /// </summary>
        /// <param name="context">The code activity context.</param>
        protected override void Execute(CodeActivityContext context)
        {
            var logger = new BuildLogLogger(context);

            Context = context;

            try
            {
                Platform.Initialize();
                var settings = LoadSettingsFromTfsRegistry(context);

                InternalExecute(logger, settings);
            }
            catch (DependencyServiceException e)
            {
                logger.LogError(string.Format("An dependency service error occured while executing {0} activity. Aborting ...", ActivityName));
                logger.LogMsg(string.Format("Exception message:{0}", e.Message));
                logger.LogMsg(string.Format("Stacktrace:\n{0}", e.StackTrace));
                throw;
            }
            catch (Exception e)
            {
                logger.LogError(string.Format("Fatal error occured while executing {0} activity. Aborting ...", ActivityName));
                logger.LogMsg(string.Format("Exception message:{0}", e.Message));
                logger.LogMsg(string.Format("Stacktrace:\n{0}", e.StackTrace));
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Implements the clean dependencies logic.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="settings">The settings.</param>
        protected override void InternalExecute(BuildLogLogger logger, ISettings <ServiceValidSettings> settings)
        {
            ActivityName = "CleanDependencies";

            var dependencyDefinitionFilePath = Context.GetValue(DependencyDefinitionPath);

            logger.LogMsg(string.Format("Clean dependencies (Based on {0}):", dependencyDefinitionFilePath));
            var ds = new DependencyService.DependencyService(settings);

            // Generate graph
            logger.LogMsg("Creating dependency graph...");
            var localDependencyDefinitionFilePath = Context.GetValue(Workspace).GetLocalItemForServerItem(dependencyDefinitionFilePath);
            var graph = ds.GetDependencyGraph(localDependencyDefinitionFilePath, logger);

            // Download components in graph
            logger.LogMsg("Cleaning dependency graph...");
            ds.CleanupGraph(graph, logger);
        }