Пример #1
0
        public Task EnsureConnectionAsync()
        {
            return(Task.Run(() =>
            {
                if (_connection == null || !_client.Connected)
                {
                    _client?.Dispose();

                    using (var l = new OneShotTcpServer())
                    {
                        var path = typeof(NextRequestType).Assembly.GetModules()[0].FullyQualifiedName;
                        path = Path.Combine(Path.GetDirectoryName(path), "host.csproj");

                        string args = $"msbuild /p:AvaloniaIdePort={l.Port} {path}";

                        Console.WriteLine(args);

                        hostProcess = PlatformSupport.LaunchShellCommand("dotnet", args,
                                                                         (sender, e) =>
                        {
                            if (e.Data != null)
                            {
                                lock (outputLines)
                                {
                                    outputLines.Add(e.Data);
                                }

                                if (e.Data == "*** Request Handled")
                                {
                                    requestComplete.Set();
                                }
                            }
                        },
                                                                         (sender, e) =>
                        {
                            if (e.Data != null)
                            {
                                lock (errorLines)
                                {
                                    errorLines.Add(e.Data);
                                }
                            }
                        }, false, Platforms.Platform.ExecutionPath, false);

                        _client = l.WaitForOneConnection();
                        _connection = new WireHelper(_client.GetStream());
                    }
                }
            }));
        }
Пример #2
0
        public override async Task BeforeBuild(IConsole console, IProject project)
        {
            await base.BeforeBuild(console, project);

            var process = PlatformSupport.LaunchShellCommand($"{CCExecutable}", "--version", (s, e) =>
            {
                if (e.Data != null)
                {
                    console.WriteLine(e.Data);
                }
            }, (s, e) => { },
                                                             false, BinDirectory, false, RunWithSystemPaths);

            await process.WaitForExitAsync();

            console.WriteLine();
        }
Пример #3
0
        private async Task <List <string> > CalculateToolchainIncludes(bool cpp)
        {
            bool foundListStart = false;

            var result = new List <string>();

            string args = cpp ? "-xc++" : "-E";

            var process = PlatformSupport.LaunchShellCommand("echo", $" | {LibraryQueryCommand} {args} -Wp,-v -", (s, e) => { }, (s, e) =>
            {
                if (e.Data != null)
                {
                    if (!foundListStart)
                    {
                        if (e.Data == "#include <...> search starts here:")
                        {
                            foundListStart = true;
                        }
                    }
                    else
                    {
                        if (e.Data == "End of search list.")
                        {
                            foundListStart = false;
                        }
                        else
                        {
                            result.Add(e.Data.NormalizePath());
                        }
                    }
                }
            },
                                                             false, BinDirectory, true, RunWithSystemPaths);

            await process.WaitForExitAsync();

            return(result);
        }