internal static ICompilerServerHost CreateCompilerServerHost(ICompilerServerLogger logger)
        {
            var clientDirectory = BuildClient.GetClientDirectory();
            var sdkDirectory    = BuildClient.GetSystemSdkDirectory();

            return(new CompilerServerHost(clientDirectory, sdkDirectory, logger));
        }
Exemple #2
0
        private static BuildClient CreateBuildClient()
        {
            var http        = new HttpClientWrapper("teamcitytest:8080", "teamcity", "teamcity");
            var buildClient = new BuildClient(http);

            return(buildClient);
        }
Exemple #3
0
        private void OnReturnJewel(DataQueryResult dqr)
        {
            JewelBuildContext jbc = (JewelBuildContext)dqr.ContextData;

            // Apply any extensions to the data.
            dqr.QueryData = ApplyDataExtensions(dqr.QueryData);

            JSObject jewelNode = DataNodeWrapper.GetFirstChildNodeWithName(dqr.QueryData, DataNodeWrapper.JEWEL);

            Jewel = BuildJewelInternal(jewelNode, jbc);
            Jewel.JewelBuilder = this;
            BuildClient.OnComponentCreated(Jewel, Jewel.Id);

            if (JewelBuildOptions.AttachToDOM)
            {
                Jewel.AttachInternal(true);
            }
            else
            {
                Jewel.RefreshInternal();
                Placeholder.AppendChild(Jewel.ElementInternal);
                Utility.EnsureCSSClassOnElement(Placeholder, "loaded");
            }
            OnRootBuilt(Jewel);
            BuildClient.OnComponentBuilt(Jewel, Jewel.Id);
        }
Exemple #4
0
 public static int Main(string[] args)
 => BuildClient.RunWithConsoleOutput(
     args,
     clientDir: AppDomain.CurrentDomain.BaseDirectory,
     workingDir: Environment.CurrentDirectory,
     language: RequestLanguage.VisualBasicCompile,
     fallbackCompiler: Vbc.Run);
Exemple #5
0
        public void GetFiles()
        {
            BuildClient buildClient = CreateBuildClient();

            List <File> result = buildClient.GetFiles(48).Result;

            List <File> files = result.First().GetChildren().Result;
        }
Exemple #6
0
 public static int Main(string[] args)
 => BuildClient.RunWithConsoleOutput(
     args,
     clientDir: AppDomain.CurrentDomain.BaseDirectory,
     workingDir: Directory.GetCurrentDirectory(),
     sdkDir: RuntimeEnvironment.GetRuntimeDirectory(),
     language: RequestLanguage.CSharpCompile,
     fallbackCompiler: Csc.Run);
Exemple #7
0
        private static int MainCore(string[] args)
        {
#if BOOTSTRAP
            ExitingTraceListener.Install();
#endif

            return(BuildClient.Run(args, RequestLanguage.VisualBasicCompile, Vbc.Run));
        }
Exemple #8
0
        internal static ICompilerServerHost CreateCompilerServerHost()
        {
            // VBCSCompiler is installed in the same directory as csc.exe and vbc.exe which is also the
            // location of the response files.
            var clientDirectory = AppDomain.CurrentDomain.BaseDirectory;
            var sdkDirectory    = BuildClient.GetSystemSdkDirectory();

            return(new DesktopCompilerServerHost(clientDirectory, sdkDirectory));
        }
Exemple #9
0
        private static int MainCore(string[] args)
        {
#if BOOTSTRAP
            ExitingTraceListener.Install();
#endif

            using var logger = new CompilerServerLogger();
            return(BuildClient.Run(args, RequestLanguage.CSharpCompile, Csc.Run, logger));
        }
Exemple #10
0
 public static int Main(string[] args)
 => BuildClient.RunWithConsoleOutput(
     args,
     clientDir: AppDomain.CurrentDomain.BaseDirectory,
     workingDir: Directory.GetCurrentDirectory(),
     sdkDir: RuntimeEnvironment.GetRuntimeDirectory(),
     analyzerLoader: new SimpleAnalyzerAssemblyLoader(),
     language: RequestLanguage.VisualBasicCompile,
     fallbackCompiler: Vbc.Run);
Exemple #11
0
 public static int Main(string[] args, string[] extraArgs)
 => BuildClient.RunWithConsoleOutput(
     BuildClient.GetCommandLineArgs(args).Concat(extraArgs),
     clientDir: AppDomain.CurrentDomain.BaseDirectory,
     workingDir: Directory.GetCurrentDirectory(),
     sdkDir: RuntimeEnvironment.GetRuntimeDirectory(),
     analyzerLoader: new SimpleAnalyzerAssemblyLoader(),
     language: RequestLanguage.CSharpCompile,
     fallbackCompiler: Csc.Run);
Exemple #12
0
        private void BuildClientCommandExecuted(object obj)
        {
            var w = new BuildClient {
                ConnectionString = ConnectionParameters.ConnectionString,
                Owner            = View as Window
            };

            w.ShowDialog();
        }
Exemple #13
0
        private static int MainCore(string[] args)
        {
#if BOOTSTRAP
            ExitingTraceListener.Install();
#endif

            var requestId = Guid.NewGuid();
            using var logger = new CompilerServerLogger($"vbc {requestId}");
            return(BuildClient.Run(args, RequestLanguage.VisualBasicCompile, Vbc.Run, logger, requestId));
        }
Exemple #14
0
        private static int MainCore(string[] args)
        {
            using var logger = new CompilerServerLogger($"vbc {Process.GetCurrentProcess().Id}");

#if BOOTSTRAP
            ExitingTraceListener.Install(logger);
#endif

            return(BuildClient.Run(args, RequestLanguage.VisualBasicCompile, Vbc.Run, BuildClient.GetCompileOnServerFunc(logger)));
        }
Exemple #15
0
        public PostSharpCompilerModule(IServiceProvider provider, string workingDirectory)
        {
            _provider        = provider;
            _logAdapter      = new LogAdapter();
            BuildClient      = new BuildClient(this._logAdapter);
            _inputDirectory  = Path.Combine(workingDirectory, "pre");
            _outputDirectory = workingDirectory;

            Directory.CreateDirectory(_inputDirectory);
        }
        public PostSharpCompilerModule(IServiceProvider provider, string workingDirectory) 
        {
            _provider = provider;
            _logAdapter = new LogAdapter();
            BuildClient = new BuildClient(this._logAdapter);
            _inputDirectory = Path.Combine(workingDirectory, "pre");
            _outputDirectory = workingDirectory;

            Directory.CreateDirectory(_inputDirectory);

        }
 public SshBasedTask()
 {
     buildClient      = new Lazy <IBuildClient>(() => BuildClients.Instance.Get(SessionId));
     messagingService = new Lazy <MessagingService>(() =>
     {
         var type     = BuildClient.GetType().GetTypeInfo();
         var property = type.GetDeclaredProperty("MessagingService");
         return(property.GetValue(BuildClient) as MessagingService);
     });
     macHomePath = new Lazy <string>(() => Commands.GetHomeDirectory());
 }
Exemple #18
0
        private static int MainCore(string[] args)
        {
            var requestId = Guid.NewGuid();

            using var logger = new CompilerServerLogger($"csc {requestId}");

#if BOOTSTRAP
            ExitingTraceListener.Install(logger);
#endif

            return(BuildClient.Run(args, RequestLanguage.CSharpCompile, Csc.Run, logger, requestId));
        }
Exemple #19
0
    // This handles a receive event on a particular client socket that has
    // connected. We read data from them and collect it into a string builder
    // for use later.
    public void ReadCallback(IAsyncResult ar)
    {
        try
        {
            // From the state of the event, get our the state object that wraps all
            // of the information for this client, and then get the socket out of
            // it.
            BuildClient client = (BuildClient)ar.AsyncState;
            Socket      socket = client.socket;

            // Perform the actual receive now; the result is the number of bytes
            // read, which can conceivably be 0; we only need to worry about doing
            // something if we actually got some data.
            int bytesRead = socket.EndReceive(ar);
            if (bytesRead == 0)
            {
                Console.WriteLine("Client closed connection");
                return;
            }

            // Console.WriteLine("==> Read {0} bytes", bytesRead);

            int bytesUsed = 0;
            while (bytesUsed != bytesRead)
            {
                // Give some bytes to the current partial message so it can
                // reconstruct itself.
                bytesUsed += inMsg.GiveBytes(client.readBuffer, bytesRead, bytesUsed);

                // If this message is complete, then echo it back to the other end
                // and get ready for another received message.
                if (inMsg.IsComplete())
                {
                    client.Dispatch(inMsg);
                    inMsg = new PartialMessage();
                }
            }

            // End by getting ready to read more data.
            client.BeginReading();
        }

        catch (SocketException se)
        {
            Console.WriteLine("Socket Error: {0}", se.Message);
            Console.WriteLine("Closing connection");
        }

        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
    }
        internal static ICompilerServerHost CreateCompilerServerHost()
        {
            // VBCSCompiler is installed in the same directory as csc.exe and vbc.exe which is also the
            // location of the response files.
            //
            // BaseDirectory was mistakenly marked as potentially null in 3.1
            // https://github.com/dotnet/runtime/pull/32486
            var clientDirectory = AppDomain.CurrentDomain.BaseDirectory !;
            var sdkDirectory    = BuildClient.GetSystemSdkDirectory();

            return(new CompilerServerHost(clientDirectory, sdkDirectory));
        }
Exemple #21
0
        public void Dispose()
        {
            if (!_disposed)
            {
                _disposed = true;

                Connection.Dispose();
                GitClient.Dispose();
                BuildClient.Dispose();
                NuGetClient.Dispose();
            }
        }
Exemple #22
0
    // This handles a send event on a particular client socket that has
    // connected. We transmit back to them the data that we originally read, as
    // a sort of echo.
    private void SendCallback(IAsyncResult ar)
    {
        try
        {
            sendMutex.WaitOne();

            BuildClient client = (BuildClient)ar.AsyncState;
            Socket      socket = client.socket;

            // Complete the transmission of the data to the remote end and
            // indicate that we did so.
            int bytesSent = socket.EndSend(ar);
            // Console.WriteLine("Sent {0} bytes to client.", bytesSent);
            client.bytesSent += bytesSent;

            if (client.bytesSent == client.sendBuffer.Length)
            {
                // Console.WriteLine("Send: Complete");
                client.sendBuffer = null;
                client.bytesSent  = 0;

                if (client.closeAfterSending)
                {
                    Console.WriteLine("Closing connection");
                    socket.Shutdown(SocketShutdown.Both);
                    socket.Disconnect(true);
                    return;
                }
            }

            // Trigger another send; if this send was complete, then this will
            // check and see if there's another message that we can send, but
            // if this send was not complete, then we'll try to finish the job.
            client.BeginSending();
        }

        catch (SocketException se)
        {
            Console.WriteLine("Socket Error: {0}", se.Message);
            Console.WriteLine("Closing connection");
        }

        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }

        finally
        {
            sendMutex.ReleaseMutex();
        }
    }
 internal IClient GetClient()
 {
     if (BuildClient.CanLoad(Url))
     {
         var build = new Build();
         build.ConfigurationFrom(System.Reflection.Assembly.LoadFile(Url));
         return(new BuildClient(build));
     }
     if (JsonClient.CanLoad(Url))
     {
         return(new JsonClient(new IsopClient(new JsonHttpClient(), Url)));
     }
     return(null);
 }
        static void Main(string[] args)
        {
            var projectClient    = new ProjectClient();
            var definitionClient = new DefinitionClient();
            var buildClient      = new BuildClient();

            var allProjects = projectClient.Index().Result;

            Console.WriteLine(allProjects);

            var createProject = projectClient.Create(GetInput("Enter the name of the project to create it..."), AskForVisibility()).Result;

            Console.WriteLine(createProject);

            var allBuilds = buildClient.Index(GetInput("Enter the id of the project to retrieve builds....")).Result;

            Console.WriteLine(allBuilds);

            var project = projectClient.Get(GetInput("Enter the id of the project to retrieve it...")).Result;

            Console.WriteLine(project);

            var projectProperties = projectClient.GetProperties(GetInput("Enter the id of the project to retrieve the properties...")).Result;

            Console.WriteLine(projectProperties);

            var deleteProject = projectClient.Delete(GetInput("Enter the id of the project to delete it...")).Result;

            Console.WriteLine(deleteProject);

            var definitions = definitionClient.Index(GetInput("Enter the id of the project to retrieve definitions..."))
                              .Result;

            Console.WriteLine(definitions);

            var definition = definitionClient.Get(GetInput("Enter the id of the project to retrieve the definition..."),
                                                  GetInput("Enter the id of the definition to retrieve it...")).Result;

            Console.WriteLine(definition);
        }
Exemple #25
0
        /// <summary>
        /// Builds the toolbar and attaches it to the page.
        /// Called once the DataQuery completes and the toolbar data is available.
        /// </summary>
        private void OnReturnToolbarData(DataQueryResult res)
        {
            ToolbarBuildContext context = (ToolbarBuildContext)res.ContextData;

            // Apply any extensions to the data.
            res.QueryData = ApplyDataExtensions(res.QueryData);

            Toolbar = BuildToolbarFromData(res.QueryData, context);
            Toolbar.ToolbarBuilder = this;
            BuildClient.OnComponentCreated(Toolbar, Toolbar.Id);
            Toolbar.RefreshInternal();

            Placeholder.AppendChild(Toolbar.ElementInternal);

            // If there's a jewel on the toolbar, position the left buttondock adjacent to it
            foreach (ButtonDock dock in Toolbar.Children)
            {
                if (dock.Alignment == DataNodeWrapper.LEFTALIGN)
                {
                    Div jewelContainer = (Div)Browser.Document.GetById("jewelcontainer");
                    if (!CUIUtility.IsNullOrUndefined(jewelContainer))
                    {
                        if (Toolbar.TextDirection == Direction.LTR)
                        {
                            dock.ElementInternal.Style.Left = jewelContainer.OffsetWidth + "px";
                        }
                        else
                        {
                            dock.ElementInternal.Style.Right = jewelContainer.OffsetWidth + "px";
                        }
                    }
                    break;
                }
            }

            Utility.EnsureCSSClassOnElement(Placeholder, "loaded");
            BuildClient.OnComponentBuilt(Toolbar, Toolbar.Id);
        }
Exemple #26
0
        private void OnReturnQAT(DataQueryResult dqr)
        {
            QATBuildContext qbc = (QATBuildContext)dqr.ContextData;

            // Apply any extensions to the data.
            dqr.QueryData = ApplyDataExtensions(dqr.QueryData);

            QAT            = BuildQATInternal(DataNodeWrapper.GetFirstChildNodeWithName(dqr.QueryData, DataNodeWrapper.QAT), qbc);
            QAT.QATBuilder = this;
            BuildClient.OnComponentCreated(QAT, QAT.Id);

            if (QATBuildOptions.AttachToDOM)
            {
                QAT.AttachInternal(true);
            }
            else
            {
                QAT.RefreshInternal();
                Placeholder.AppendChild(QAT.ElementInternal);
                Utility.EnsureCSSClassOnElement(Placeholder, "loaded");
            }
            OnRootBuilt(QAT);
            BuildClient.OnComponentBuilt(QAT, QAT.Id);
        }
 public void ReportsThatItCanUse()
 {
     Assert.True(BuildClient.CanLoad(_validUrl), "Valid url");
     Assert.False(BuildClient.CanLoad(_invalidUrl), "Invalid url");
     Assert.False(BuildClient.CanLoad(_httpUrl), "http url");
 }
 private static string?GetDefaultPipeName()
 {
     return(BuildServerConnection.GetPipeName(BuildClient.GetClientDirectory()));
 }
Exemple #29
0
 public static int Main(string[] args)
 => BuildClient.RunWithConsoleOutput(args, VisualBasicCompile, Program.Main);
Exemple #30
0
 public static int Main(string[] args)
 => BuildClient.RunWithConsoleOutput(args, RequestLanguage.VisualBasicCompile, Vbc.Run);
Exemple #31
0
        private void OnReturnRibbonAndInitialTab(DataQueryResult res)
        {
            PMetrics.PerfMark(PMarker.perfCUIRibbonInitStart);

            RibbonBuildContext rbc = (RibbonBuildContext)res.ContextData;

            // Apply any extensions to the data.
            res.QueryData = ApplyDataExtensions(res.QueryData);
            Utility.EnsureCSSClassOnElement(Placeholder, "loaded");
            JSObject templates = DataNodeWrapper.GetFirstChildNodeWithName(res.QueryData, DataNodeWrapper.TEMPLATES);

            if (!CUIUtility.IsNullOrUndefined(templates))
            {
                TemplateManager.Instance.LoadTemplates(templates);
            }

            Ribbon = BuildRibbon(res.QueryData, rbc);
            Ribbon.RibbonBuilder = this;
            BuildClient.OnComponentCreated(Ribbon, Ribbon.Id);
            if (RibbonBuildOptions.Minimized)
            {
                Ribbon.MinimizedInternal = true;
            }
            else
            {
                Ribbon.MinimizedInternal = false;
                Tab firstTab = (Tab)Ribbon.GetChild(rbc.InitialTabId);
                if (!CUIUtility.IsNullOrUndefined(firstTab))
                {
                    // We need this in order to set the "ChangedByUser" property of the first
                    // TabSwitch command that comes out of the ribbon correctly.
                    firstTab.SelectedByUser = RibbonBuildOptions.InitialTabSelectedByUser;
                    Ribbon.MakeTabSelectedInternal(firstTab);
                }
            }

            Ribbon.ClientID = RibbonBuildOptions.ClientID;

            bool shouldAttach = !RibbonBuildOptions.Minimized && RibbonBuildOptions.AttachToDOM;

            if (shouldAttach)
            {
                // Scale the ribbon to the scaling index that matches the ribbon that was
                // rendered by the server.  This sets the in memory Ribbon structure to match
                // what was rendered by the server.  This is needed so that Ribbon.AttachInternal()
                // will work properly.
                if (!((RibbonBuildOptions)Options).Minimized)
                {
                    // We subtract one from this scaling index because internally
                    // this scaling index is an entry into an array of "<ScaleStep>" so
                    // the MaxSize for all the groups is actually index "-1" and the first
                    // step is index 0.
                    Ribbon.ScaleIndex(rbc.InitialScalingIndex - 1);
                }

                Ribbon.AttachInternal(true);

                // Attach to the QAT and Jewel
                if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowQATId))
                {
                    Ribbon.BuildAndSetQAT(RibbonBuildOptions.ShowQATId, true, DataSource);
                }
                if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowJewelId))
                {
                    Ribbon.BuildAndSetJewel(RibbonBuildOptions.ShowJewelId, true, DataSource);
                }

#if DEBUG
                // Validate that the server rendered ribbon is identical to the client rendered one
                // for this tab.
                if (Options.ValidateServerRendering)
                {
                    RibbonBuilder rb2 = new RibbonBuilder(this.RibbonBuildOptions,
                                                          this.Placeholder,
                                                          null);

                    DataSource ds = new DataSource(this.DataSource.DataUrl,
                                                   this.DataSource.Version,
                                                   this.DataSource.Lcid);

                    rb2.DataSource = ds;
                    SPRibbon r2 = rb2.BuildRibbon(res.QueryData, rbc);
                    r2.Id           += "-client";
                    r2.ClientID      = RibbonBuildOptions.ClientID + "-client";
                    r2.RibbonBuilder = this;
                    if (!RibbonBuildOptions.Minimized)
                    {
                        r2.Minimized = false;
                    }

                    // Clone all the peripheral sections for the client-rendering version
                    Div p_qrc = (Div)Browser.Document.GetById(RibbonBuildOptions.ClientID + "-" + RibbonPeripheralSection.QATRowCenter);
                    Div p_qrr = (Div)Browser.Document.GetById(RibbonBuildOptions.ClientID + "-" + RibbonPeripheralSection.QATRowRight);
                    Div p_trl = (Div)Browser.Document.GetById(RibbonBuildOptions.ClientID + "-" + RibbonPeripheralSection.TabRowLeft);
                    Div p_trr = (Div)Browser.Document.GetById(RibbonBuildOptions.ClientID + "-" + RibbonPeripheralSection.TabRowRight);

                    Div hiddenClonedPeripherals = new Div();
                    hiddenClonedPeripherals.Style.Display = "none";
                    Browser.Document.Body.AppendChild(hiddenClonedPeripherals);

                    Div clone;
                    if (null != p_qrc)
                    {
                        clone    = (Div)p_qrc.CloneNode(true);
                        clone.Id = clone.Id.Replace(RibbonBuildOptions.ClientID, r2.ClientID);
                        hiddenClonedPeripherals.AppendChild(clone);
                    }
                    if (null != p_qrr)
                    {
                        clone    = (Div)p_qrr.CloneNode(true);
                        clone.Id = clone.Id.Replace(RibbonBuildOptions.ClientID, r2.ClientID);
                        hiddenClonedPeripherals.AppendChild(clone);
                    }
                    if (null != p_trl)
                    {
                        clone    = (Div)p_trl.CloneNode(true);
                        clone.Id = clone.Id.Replace(RibbonBuildOptions.ClientID, r2.ClientID);
                        hiddenClonedPeripherals.AppendChild(clone);
                    }
                    if (null != p_trr)
                    {
                        clone    = (Div)p_trr.CloneNode(true);
                        clone.Id = clone.Id.Replace(RibbonBuildOptions.ClientID, r2.ClientID);
                        hiddenClonedPeripherals.AppendChild(clone);
                    }

                    r2.MakeTabSelectedInternal((Tab)r2.GetChild(rbc.InitialTabId));
                    r2.RefreshInternal();

                    if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowQATId))
                    {
                        r2.BuildAndSetQAT(RibbonBuildOptions.ShowQATId, false, ds);
                    }
                    if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowJewelId))
                    {
                        r2.BuildAndSetJewel(RibbonBuildOptions.ShowJewelId, false, ds);
                    }

                    r2.ScaleIndex(rbc.InitialScalingIndex - 1);
                    r2.CompleteConstruction();

                    // If this returns a message it means that it found some inconsistencies
                    // between the DOM Nodes
                    CompareNodes(Ribbon.ElementInternal, r2.ElementInternal);
                }
#endif
            }
            else
            {
                // Do the minimum amount of work necessary in order to be able to
                // get the outer ribbon element and to be able to attach the Jewel and QAT.
                Ribbon.EnsureDOMElement();

                // Build the QAT and Jewel after the ribbon so that the placeholders
                // will have been created within the ribbon via Ribbon.RefreshInternal()
                if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowQATId))
                {
                    Ribbon.BuildAndSetQAT(RibbonBuildOptions.ShowQATId, false, DataSource);
                }
                if (!string.IsNullOrEmpty(RibbonBuildOptions.ShowJewelId))
                {
                    Ribbon.BuildAndSetJewel(RibbonBuildOptions.ShowJewelId, false, DataSource);
                }

                // Remove anything else that is in the placeholder in case there is a temporary
                // animated gif or a static ribbon in there while the ribbon is loading.
                // We're doing this the slow way since partners might have a reference to this node
                Utility.RemoveChildNodesSlow(Placeholder);
                Placeholder.AppendChild(Ribbon.ElementInternal);
            }

            Ribbon.Scale();
            OnRootBuilt(Ribbon);
            BuildClient.OnComponentBuilt(Ribbon, Ribbon.Id);
            if (RibbonBuildOptions.LaunchedByKeyboard)
            {
                Ribbon.SetFocusOnRibbon();
            }

            PMetrics.PerfMark(PMarker.perfCUIRibbonInitPercvdEnd);
        }