Exemplo n.º 1
0
        public async Task FullBuildIntegrationTest()
        {
            var cache = new TestBlobCache();
            var client = new GitHubClient(new ProductHeaderValue("Peasant"));

            var fixture = new BuildQueue(client, cache);
            using (fixture.Start()) {
                var result = await fixture.Enqueue(TestBuild.RepoUrl, TestBuild.PassingBuildSHA1, TestBuild.BuildScriptUrl);
            }
        }
Exemplo n.º 2
0
        public static async Task StartBuildAsync(
            EnvDTE.Project project,
            string projectPath,
            string configName,
            Dictionary <string, string> properties,
            IEnumerable <string> targets,
            LoggerVerbosity verbosity)
        {
            if (project == null)
            {
                throw new ArgumentException("Project cannot be null.");
            }
            if (configName == null)
            {
                throw new ArgumentException("Configuration name cannot be null.");
            }

            RequestTimer.Restart();
            var tracker = QtProjectTracker.Get(project, projectPath);
            await tracker.Initialized;

            if (QtVsToolsPackage.Instance.Options.BuildDebugInformation)
            {
                Messages.Print(string.Format(
                                   "{0:HH:mm:ss.FFF} QtProjectBuild({1}): Request [{2}] {3}",
                                   DateTime.Now, Thread.CurrentThread.ManagedThreadId,
                                   configName, tracker.UnconfiguredProject.FullPath));
            }

            var knownConfigs = await tracker.UnconfiguredProject.Services
                               .ProjectConfigurationsService.GetKnownProjectConfigurationsAsync();

            ConfiguredProject configuredProject = null;

            foreach (var config in knownConfigs)
            {
                var configProject = await tracker.UnconfiguredProject
                                    .LoadConfiguredProjectAsync(config);

                if (configProject.ProjectConfiguration.Name == configName)
                {
                    configuredProject = configProject;
                    break;
                }
            }
            if (configuredProject == null)
            {
                throw new ArgumentException(string.Format("Unknown configuration '{0}'.", configName));
            }

            BuildQueue.Enqueue(new QtProjectBuild()
            {
                Project             = project,
                VcProject           = tracker.VcProject,
                UnconfiguredProject = tracker.UnconfiguredProject,
                ConfiguredProject   = configuredProject,
                Properties          = properties?.ToDictionary(x => x.Key, x => x.Value),
                Targets             = targets?.ToList(),
                LoggerVerbosity     = verbosity
            });
            StaticThreadSafeInit(() => BuildDispatcher,
                                 () => BuildDispatcher = Task.Run(BuildDispatcherLoopAsync))
            .Forget();
        }
Exemplo n.º 3
0
        public async Task BuildsThatFailShouldBeRecorded()
        {
            var cache = new TestBlobCache();
            var client = new GitHubClient(new ProductHeaderValue("Peasant"));

            var fixture = new BuildQueue(client, cache, async (q, o) => {
                throw new Exception("Didn't work lol");
            });

            fixture.Start();

            var queueItem = await fixture.Enqueue(TestBuild.RepoUrl, TestBuild.PassingBuildSHA1, TestBuild.BuildScriptUrl);

            Assert.NotNull(queueItem);
            Assert.False(queueItem.BuildSucceded.Value);

            fixture = new BuildQueue(client, cache);
            var result = await fixture.GetBuildOutput(queueItem.BuildId);

            Assert.True(result.Item1.Contains("Didn't work lol"));
            Assert.NotEqual(0, result.Item2);
        }
Exemplo n.º 4
0
        public async Task BuildsThatSucceedShouldBeRecorded()
        {
            var cache = new TestBlobCache();
            var client = new GitHubClient(new ProductHeaderValue("Peasant"));

            var fixture = new BuildQueue(client, cache, (q, o) => {
                return Task.FromResult(0);
            });

            fixture.Start();

            var queueItem = await fixture.Enqueue(TestBuild.RepoUrl, TestBuild.PassingBuildSHA1, TestBuild.BuildScriptUrl);

            Assert.NotNull(queueItem);
            Assert.True(queueItem.BuildSucceded.Value);

            fixture = new BuildQueue(client, cache);
            var result = await fixture.GetBuildOutput(queueItem.BuildId);

            Assert.Equal(0, result.Item2);
        }