Exemple #1
0
 internal CommandLine(IBuildEnvironment buildEnvironment, ICmdParser cmdParser, ICmdArguments cmdArguments, IOutput output)
 {
     _buildEnvironment = buildEnvironment;
     _cmdParser = cmdParser;
     _cmdArguments = cmdArguments;
     _output = output;
 }
Exemple #2
0
 internal BuildHeaderWriter(IClock clock, IBuildEnvironment buildEnvironment, IOutput output, ICmdArguments cmdArguments)
 {
     _clock = clock;
     _buildEnvironment = buildEnvironment;
     _output = output;
     _cmdArguments = cmdArguments;
 }
Exemple #3
0
 public BuildStarter(ICmdArguments cmdArguments, IApp app, IOutput output, IBuildEnvironment buildEnvironment, IInput input)
 {
     _cmdArguments = cmdArguments;
     _app = app;
     _output = output;
     _buildEnvironment = buildEnvironment;
     _input = input;
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="MbUnitTask"/> class.
		/// </summary>
		/// <param name="buildEnvironment">The build environment.</param>
		public MbUnitTask(IBuildEnvironment buildEnvironment)
		{
			BuildEnvironment = buildEnvironment;

			FilterAuthors = new IncludeSet();
			FilterCategories = new FilterSet();
			FilterNamespaces = new IncludeSet();
			FilterTypes = new IncludeSet();
		}
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MbUnitTask"/> class.
        /// </summary>
        /// <param name="buildEnvironment">The build environment.</param>
        public MbUnitTask(IBuildEnvironment buildEnvironment)
        {
            BuildEnvironment = buildEnvironment;

            FilterAuthors    = new IncludeSet();
            FilterCategories = new FilterSet();
            FilterNamespaces = new IncludeSet();
            FilterTypes      = new IncludeSet();
        }
        protected override void Before_each_spec()
        {
            _messageProvider = Mocks.StrictMock<ITeamCityMessageProvider>();
            _buildEnvironment = Mocks.StrictMock<IBuildEnvironment>();

            _task = Mocks.PartialMock<ImportDataTask>(_buildEnvironment, _messageProvider);
            _task.ForceTaskExecution = true;

            // Logging is allowed at any time.
            _task.Log(Level.Debug, null);
            LastCall.IgnoreArguments().Repeat.Any();
        }
 internal AddStatisticFromPropertiesTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
     : base(environment, messageProvider)
 {
     IgnoreCase = true;
 }
 internal StatusTextTask(IBuildEnvironment environment) : base(environment)
 {
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="MachineSpecificationsTask"/> class.
		/// </summary>
		/// <param name="buildEnvironment">The build environment.</param>
		public MachineSpecificationsTask(IBuildEnvironment buildEnvironment)
		{
			BuildEnvironment = buildEnvironment;
		}
Exemple #10
0
 internal ImportDataTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
     : base(environment, messageProvider)
 {
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="BuildLogTask"/> class.
		/// </summary>
		/// <param name="buildEnvironment">The build environment.</param>
		protected BuildLogTask(IBuildEnvironment buildEnvironment) : base(buildEnvironment)
		{
		}
		internal ImportDataTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
			: base(environment, messageProvider)
		{
		}
		internal AddStatisticTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
			: base(environment, messageProvider)
		{
		}
        public Task<ITarget> BuildAsync(IBuildEnvironment build, IDictionary<ModuleName, Task<ITarget>> dependencies, CancellationToken token)
        {
            return Task.Factory.StartNew(
                () =>
                {
                    var ldr = build.CreateLoader(new LoaderOptions(null, null));

                    var aggregateMessages = dependencies.Values
                        .SelectMany(t => t.Result.Messages);
                    var aggregateExceptions = dependencies.Values
                        .Select(t => t.Result.Exception)
                        .Where(e => e != null);
                    if (dependencies.Values.All(t => t.Result.IsSuccessful))
                    {
                        try
                        {
                            TextReader reader;
                            if (!_source.TryOpen(out reader))
                                throw new BuildFailureException(this,
                                    string.Format("The source for target {0} could not be opened.", Name),
                                    Enumerable.Empty<Message>());
                            using (reader)
                            {
                                token.ThrowIfCancellationRequested();
                                Plan.Trace.TraceEvent(TraceEventType.Information, 0, "Building {0}.", this);
                                Trace.CorrelationManager.StartLogicalOperation("Build");
                                try
                                {
                                    // Hand compilation off to loader. 
                                    // If the description is backed by a file, allow inclusion of 
                                    // other files via realtive paths.
                                    FileInfo fsContext;
                                    if (_fileName != null)
                                    {
                                        fsContext = new FileInfo(_fileName);
                                        ldr.LoadPaths.Push(fsContext.DirectoryName);
                                    }
                                    else
                                    {
                                        fsContext = null;
                                    }
                                    ldr.LoadFromReader(reader, _fileName);
                                    if (ldr.ErrorCount > 0 || ldr.Warnings.Count > 0)
                                    {
                                        Plan.Trace.TraceEvent(TraceEventType.Error, 0, "Build of {0} completed with {1} error(s) and {2} warning(s).", 
                                            this, ldr.ErrorCount, ldr.Warnings.Count);
                                    }
                                    foreach (var msg in ldr.Infos.Append(ldr.Warnings).Append(ldr.Errors).OrderBy(m => m))
                                    {
                                        TraceEventType evType;
                                        switch (msg.Severity)
                                        {
                                            case MessageSeverity.Error:
                                                evType = TraceEventType.Error;
                                                break;
                                            case MessageSeverity.Warning:
                                                evType = TraceEventType.Warning;
                                                break;
                                            case MessageSeverity.Info:
                                                evType = TraceEventType.Information;
                                                break;
                                            default:
                                                throw new ArgumentOutOfRangeException();
                                        }
                                        Plan.Trace.TraceEvent(evType, 0, "({0}) {1}", this, msg);
                                    }

                                    if (fsContext != null)
                                    {
                                        ldr.LoadPaths.Pop();
                                    }
                                }
                                finally
                                {
                                    Trace.CorrelationManager.StopLogicalOperation();
                                }

                                Plan.Trace.TraceEvent(TraceEventType.Verbose, 0, "Done with building {0}, wrapping result in target.", this);
                            }

                            // ReSharper disable PossibleMultipleEnumeration
                            return DefaultModuleTarget._FromLoader(ldr, aggregateExceptions.ToArray(), aggregateMessages);
                        }
                        catch (Exception e)
                        {
                            Plan.Trace.TraceEvent(TraceEventType.Error, 0, "Exception while building {0}, constructing failure result. Exception: {1}", this, e);
                            return DefaultModuleTarget._FromLoader(ldr, aggregateExceptions.Append(e).ToArray(),
                                aggregateMessages);
                            // ReSharper restore PossibleMultipleEnumeration
                        }
                    }
                    else
                    {
                        Plan.Trace.TraceEvent(TraceEventType.Error, 0,
                            "Not all dependencies of {0} were built successfully. Waiting for other dependencies to finish and then return a failed target. Failed dependencies: {1}",
                            this, dependencies.Where(d => !d.Value.Result.IsSuccessful).Select(d => d.Key).ToEnumerationString());
                        Task.WaitAll(dependencies.Values.ToArray<Task>());
                        return DefaultModuleTarget._FromLoader(ldr, aggregateExceptions.ToArray(), aggregateMessages);
                    }
                }, token);
        }
Exemple #15
0
 public Project CreateCodeBuildProject(string identification, string projectName, IRole role, BuildSpec buildSpec, IBuildEnvironment buildEnvironment = null)
 {
     return(new Project(Scope, identification, new ProjectProps
     {
         ProjectName = projectName,
         Role = role,
         Environment = buildEnvironment,
         BuildSpec = buildSpec
     }));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageTask"/> class.
 /// </summary>
 /// <param name="buildEnvironment">The build environment.</param>
 /// <param name="messageProvider">The message provider.</param>
 protected MessageTask(IBuildEnvironment buildEnvironment, ITeamCityMessageProvider messageProvider)
     : base(buildEnvironment)
 {
     MessageProvider = messageProvider ?? IoC.Resolve<ITeamCityMessageProvider>(new { taskToUseForLogging = this });
 }
Exemple #17
0
 internal BuildNumberTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
     : base(environment, messageProvider)
 {
 }
Exemple #18
0
 internal HelpWriter(ITaskRegistration taskRegistration, IOutput output, IBuildEnvironment buildEnvironment)
 {
     _taskRegistration = taskRegistration;
     _output = output;
     _buildEnvironment = buildEnvironment;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageTask"/> class.
 /// </summary>
 /// <param name="buildEnvironment">The build environment.</param>
 /// <param name="messageProvider">The message provider.</param>
 protected MessageTask(IBuildEnvironment buildEnvironment, ITeamCityMessageProvider messageProvider)
     : base(buildEnvironment)
 {
     MessageProvider = messageProvider ?? IoC.Resolve <ITeamCityMessageProvider>(new { taskToUseForLogging = this });
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TeamCityTask"/> class.
 /// </summary>
 /// <param name="buildEnvironment">The build environment.</param>
 protected TeamCityTask(IBuildEnvironment buildEnvironment)
 {
     BuildEnvironment = buildEnvironment ?? IoC.Resolve <IBuildEnvironment>();
 }
 public TaskFactory()
 {
     _messageProvider = InternalMocks.DynamicMock<ITeamCityMessageProvider>();
     _buildEnvironment = InternalMocks.StrictMock<IBuildEnvironment>();
 }
		internal ProgressTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
			: base(environment, messageProvider)
		{
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="BuildLogTask"/> class.
 /// </summary>
 /// <param name="buildEnvironment">The build environment.</param>
 protected BuildLogTask(IBuildEnvironment buildEnvironment) : base(buildEnvironment)
 {
 }
Exemple #24
0
 internal AddStatisticTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
     : base(environment, messageProvider)
 {
 }
 internal StatusTextTask(IBuildEnvironment environment)
     : base(environment)
 {
 }
		public DefaultTeamCityLogWriter(IBuildEnvironment buildEnvironment)
		{
			BuildEnvironment = buildEnvironment;

			_isOpen = true;
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="MachineSpecificationsTask"/> class.
 /// </summary>
 /// <param name="buildEnvironment">The build environment.</param>
 public MachineSpecificationsTask(IBuildEnvironment buildEnvironment)
 {
     BuildEnvironment = buildEnvironment;
 }
Exemple #28
0
 internal PublishArtifactsTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
     : base(environment, messageProvider)
 {
 }
        public DefaultTeamCityLogWriter(IBuildEnvironment buildEnvironment)
        {
            BuildEnvironment = buildEnvironment;

            _isOpen = true;
        }
Exemple #30
0
 public Task<ITarget> BuildAsync(IBuildEnvironment build, IDictionary<ModuleName, Task<ITarget>> dependencies, CancellationToken token)
 {
     var tcs = new TaskCompletionSource<ITarget>();
     tcs.SetResult(this);
     Plan.Trace.TraceEvent(TraceEventType.Information, 0, "Used provided target {0}.", this);
     return tcs.Task;
 }
        protected override void Before_each_spec()
        {
            _messageProvider = Mocks.StrictMock<ITeamCityMessageProvider>();
            _buildEnvironment = Mocks.StrictMock<IBuildEnvironment>();

            _task = Mocks.PartialMock<AddStatisticFromPropertiesTask>(_buildEnvironment, _messageProvider);
            _task.ForceTaskExecution = true;

            // Logging is allowed at any time.
            _task.Log(Level.Debug, null);
            LastCall.IgnoreArguments().Repeat.Any();

            _properties = new PropertyDictionary(null)
                          { { "foo", "bar" }, { "test.foo", "test.bar" }, { "TEST.BAR", "TEST.BAZ" } };
        }
		internal BuildNumberTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
			: base(environment, messageProvider)
		{
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="TeamCityTask"/> class.
		/// </summary>
		/// <param name="buildEnvironment">The build environment.</param>
		protected TeamCityTask(IBuildEnvironment buildEnvironment)
		{
			BuildEnvironment = buildEnvironment ?? IoC.Resolve<IBuildEnvironment>();
		}
 internal AddStatisticFromPropertiesTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
     : base(environment, messageProvider)
 {
     IgnoreCase = true;
 }
		internal PublishArtifactsTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
			: base(environment, messageProvider)
		{
		}
        protected override void Before_each_spec()
        {
            _buildEnvironment = Mocks.StrictMock<IBuildEnvironment>();

            _task = Mocks.PartialMock<StatusTextTask>(_buildEnvironment);
            _task.ForceTaskExecution = true;

            // Logging is allowed at any time.
            _task.Log(Level.Debug, null);
            LastCall.IgnoreArguments().Repeat.Any();

            using (Mocks.Record())
            {
                SetupResult.For(_task.Properties).Return(null);
            }

            if (File.Exists(_task.TeamCityInfoPath))
            {
                File.Delete(_task.TeamCityInfoPath);
            }
        }
 internal ProgressTask(IBuildEnvironment environment, ITeamCityMessageProvider messageProvider)
     : base(environment, messageProvider)
 {
 }