static XSharpProjectOptions()
        {
            xsCmdLineparser = XSharpCommandLineParser.Default;
            _includedirs    = "";
            var path = (string)Registry.GetValue(REG_KEY, XSharp.Constants.RegistryValue, "");

            if (!string.IsNullOrEmpty(path))
            {
                if (!path.EndsWith("\\"))
                {
                    path += @"\";
                }
                path         += @"Include\";
                _includedirs += path;
            }
            // Check for Vulcan path
            var key = @"HKEY_LOCAL_MACHINE\SOFTWARE\Grafx\Vulcan.NET";

            path = (string)Registry.GetValue(key, "InstallPath", "");
            if (!string.IsNullOrEmpty(path))
            {
                if (!path.EndsWith("\\"))
                {
                    path += @"\";
                }
                path         += @"Include\";
                _includedirs += ";" + path;
            }
            XSharpSpecificCompilationOptions.SetDefaultIncludeDir(_includedirs);
            XSharpSpecificCompilationOptions.SetWinDir(Environment.GetFolderPath(Environment.SpecialFolder.Windows));
            XSharpSpecificCompilationOptions.SetSysDir(Environment.GetFolderPath(Environment.SpecialFolder.System));
        }
Exemplo n.º 2
0
        // Original csc Run() function

        /*
         * internal static int Run(string[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
         * {
         *  FatalError.Handler = FailFast.OnFatalException;
         *
         *  var responseFile = Path.Combine(buildPaths.ClientDirectory, CSharpCompiler.ResponseFileName);
         *  var compiler = new Xsc(responseFile, buildPaths, args, analyzerLoader);
         *  return ConsoleUtil.RunWithUtf8Output(compiler.Arguments.Utf8Output, textWriter, tw => compiler.Run(tw));
         * }
         */


        internal static int Run(string[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
        {
            FatalError.Handler = FailFast.OnFatalException;
            string[] paths = GetPaths();
            XSharpSpecificCompilationOptions.SetDefaultIncludeDir(paths[0]);
            XSharpSpecificCompilationOptions.SetWinDir(paths[1]);
            XSharpSpecificCompilationOptions.SetSysDir(paths[2]);
            var responseFile = Path.Combine(buildPaths.ClientDirectory, CSharpCompiler.ResponseFileName);
            var compiler     = new Xsc(responseFile, buildPaths, args, analyzerLoader);
            var result       = ConsoleUtil.RunWithUtf8Output(compiler.Arguments.Utf8Output, textWriter, tw => compiler.Run(tw));

            return(result);
        }
Exemplo n.º 3
0
        internal static string[] GetCommandLineArguments(BuildRequest req, out string currentDirectory, out string tempDirectory, out string libDirectory)
        {
            currentDirectory = null;
            libDirectory     = null;
            tempDirectory    = null;
            List <string> commandLineArguments = new List <string>();

            foreach (BuildRequest.Argument arg in req.Arguments)
            {
                if (arg.ArgumentId == BuildProtocolConstants.ArgumentId.CurrentDirectory)
                {
                    currentDirectory = arg.Value;
                }
                else if (arg.ArgumentId == BuildProtocolConstants.ArgumentId.TempDirectory)
                {
                    tempDirectory = arg.Value;
                }
                else if (arg.ArgumentId == BuildProtocolConstants.ArgumentId.LibEnvVariable)
                {
#if XSHARP
                    string tmp = arg.Value;
                    if (arg.Value.Contains(":::"))
                    {
                        var values = tmp.Split(new string[] { ":::" }, StringSplitOptions.None);
                        libDirectory = values[0];
                        if (values.Length == 4)
                        {
                            XSharpSpecificCompilationOptions.SetDefaultIncludeDir(values[1]);
                            XSharpSpecificCompilationOptions.SetWinDir(values[2]);
                            XSharpSpecificCompilationOptions.SetSysDir(values[3]);
                        }
                    }
#else
                    libDirectory = arg.Value;
#endif
                }
                else if (arg.ArgumentId == BuildProtocolConstants.ArgumentId.CommandLineArgument)
                {
                    int argIndex = arg.ArgumentIndex;
                    while (argIndex >= commandLineArguments.Count)
                    {
                        commandLineArguments.Add("");
                    }
                    commandLineArguments[argIndex] = arg.Value;
                }
            }

            return(commandLineArguments.ToArray());
        }