Esempio n. 1
0
        private int CompileParallel(string pathToTool)
        {
            int returnCode = 0;

            // Compute sources that can be compiled together.
            Dictionary <string, List <ITaskItem> > srcGroups =
                new Dictionary <string, List <ITaskItem> >();

            foreach (ITaskItem sourceItem in CompileSourceList)
            {
                string commandLine = GenerateCommandLineForSource(sourceItem);
                if (srcGroups.ContainsKey(commandLine))
                {
                    srcGroups[commandLine].Add(sourceItem);
                }
                else
                {
                    srcGroups.Add(commandLine, new List <ITaskItem> {
                        sourceItem
                    });
                }
            }

            string pythonScript = Path.GetDirectoryName(Path.GetDirectoryName(PropertiesFile));

            pythonScript = Path.Combine(pythonScript, "compiler_wrapper.py");

            foreach (KeyValuePair <string, List <ITaskItem> > entry in srcGroups)
            {
                string           commandLine = entry.Key;
                string           cmd         = "\"" + pathToTool + "\" " + commandLine + " --";
                List <ITaskItem> sources     = entry.Value;

                foreach (ITaskItem sourceItem in sources)
                {
                    cmd += " ";
                    cmd += GCCUtilities.ConvertPathWindowsToPosix(sourceItem.ToString());
                }

                try
                {
                    // compile this group of sources
                    returnCode = base.ExecuteTool("python", cmd, "\"" + pythonScript + "\"");
                }
                catch (Exception e)
                {
                    Log.LogMessage("compiler exception: {0}", e);
                    returnCode = base.ExitCode;
                }

                //abort if an error was encountered
                if (returnCode != 0)
                {
                    break;
                }
            }

            Log.LogMessage(MessageImportance.Low, "compiler returned: {0}", returnCode);
            return(returnCode);
        }
Esempio n. 2
0
        protected override string GenerateResponseFileCommands()
        {
            StringBuilder responseFileCmds = new StringBuilder(GCCUtilities.s_CommandLineLength);

            responseFileCmds.Append("rcs ");
            responseFileCmds.Append(GCCUtilities.ConvertPathWindowsToPosix(OutputFile));

            foreach (ITaskItem item in Sources)
            {
                responseFileCmds.Append(" ");
                responseFileCmds.Append(GCCUtilities.ConvertPathWindowsToPosix(item.ToString()));
            }
            return(responseFileCmds.ToString());
        }
Esempio n. 3
0
        protected override string GenerateResponseFileCommands()
        {
            StringBuilder responseFileCmds = new StringBuilder(GCCUtilities.s_CommandLineLength);

            // We want GCC to behave more like visual studio in term of library dependencies
            // so we wrap all the inputs (libraries and object) into one group so they are
            // searched iteratively.
            responseFileCmds.Append("-Wl,--start-group ");
            foreach (ITaskItem sourceFile in Sources)
            {
                responseFileCmds.Append(GCCUtilities.ConvertPathWindowsToPosix(sourceFile.GetMetadata("Identity")));
                responseFileCmds.Append(" ");
            }
            responseFileCmds.Append("-Wl,--end-group ");

            responseFileCmds.Append(xamlParser.Parse(Sources[0], false, IsPNaCl() ? ".bc" : null));

            return(responseFileCmds.ToString());
        }
Esempio n. 4
0
        private int CompileSerial(string pathToTool)
        {
            int returnCode = 0;

            foreach (ITaskItem sourceItem in CompileSourceList)
            {
                try
                {
                    string commandLine = GenerateCommandLineForSource(sourceItem, true);
                    commandLine += " " + GCCUtilities.ConvertPathWindowsToPosix(sourceItem.ToString());

                    if (OutputCommandLine)
                    {
                        string logMessage = pathToTool + " " + commandLine;
                        Log.LogMessage(logMessage);
                    }
                    else
                    {
                        base.Log.LogMessage(Path.GetFileName(sourceItem.ToString()));
                    }

                    // compile
                    returnCode = base.ExecuteTool(pathToTool, commandLine, string.Empty);
                }
                catch (Exception)
                {
                    returnCode = base.ExitCode;
                }

                //abort if an error was encountered
                if (returnCode != 0)
                {
                    return(returnCode);
                }
            }
            return(returnCode);
        }
Esempio n. 5
0
 private void AddDependency(string filename)
 {
     filename = GCCUtilities.ConvertPathPosixToWindows(filename);
     filename = filename.Replace("\\ ", " ");
     m_dependencies.Add(filename);
 }
Esempio n. 6
0
 protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance)
 {
     base.LogEventsFromTextOutput(GCCUtilities.ConvertGCCOutput(singleLine), messageImportance);
 }