Esempio n. 1
0
        /// <summary>
        /// Writes the compiler options to the specified <see cref="TextWriter" />.
        /// </summary>
        /// <param name="writer"><see cref="TextWriter" /> to which the compiler options should be written.</param>
        protected override void WriteOptions(TextWriter writer)
        {
            // causes the compiler to specify the full path of the file in which
            // an error was found
            WriteOption(writer, "fullpaths");

            // the base address for the DLL
            if (BaseAddress != null)
            {
                WriteOption(writer, "baseaddress", BaseAddress);
            }

            // If mcs is the compiler and the specified McsSdk version is specified, append the new
            // -sdk: option to the argument list.
            if (PlatformHelper.IsMono)
            {
                if (ExeName.Equals("mcs", StringComparison.InvariantCultureIgnoreCase) && _mcsSdk > 0)
                {
                    WriteOption(writer, "sdk", _mcsSdk.ToString());
                }
            }

            // XML documentation
            if (DocFile != null)
            {
                if (SupportsDocGeneration)
                {
                    WriteOption(writer, "doc", DocFile.FullName);
                }
                else
                {
                    Log(Level.Warning, ResourceUtils.GetString("String_CompilerDoesNotSupportXmlDoc"),
                        Project.TargetFramework.Description);
                }
            }

            // langversion
            if (LangVersion != null)
            {
                if (SupportsLangVersion)
                {
                    WriteOption(writer, "langversion", LangVersion);
                }
                else
                {
                    Log(Level.Warning, ResourceUtils.GetString("String_CompilerDoesNotSupportLangVersion"),
                        Project.TargetFramework.Description);
                }
            }

            // platform
            if (Platform != null)
            {
                if (SupportsPlatform)
                {
                    WriteOption(writer, "platform", Platform);
                }
                else
                {
                    Log(Level.Warning, ResourceUtils.GetString("String_CompilerDoesNotSupportPlatform"),
                        Project.TargetFramework.Description);
                }
            }

            // win32res
            if (Win32Res != null)
            {
                WriteOption(writer, "win32res", Win32Res.FullName);
            }

            // handle debug builds.
            switch (DebugOutput)
            {
            case DebugOutput.None:
                break;

            case DebugOutput.Enable:
                WriteOption(writer, "debug");
                WriteOption(writer, "define", "DEBUG");
                WriteOption(writer, "define", "TRACE");
                break;

            case DebugOutput.Full:
                WriteOption(writer, "debug");
                break;

            case DebugOutput.PdbOnly:
                WriteOption(writer, "debug", "pdbonly");
                break;

            default:
                throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                                                       ResourceUtils.GetString("NA2011"), DebugOutput), Location);
            }

            if (FileAlign > 0)
            {
                WriteOption(writer, "filealign", FileAlign.ToString(CultureInfo.InvariantCulture));
            }

            if (NoStdLib)
            {
                WriteOption(writer, "nostdlib");
            }

            if (Checked)
            {
                WriteOption(writer, "checked");
            }

            if (Unsafe)
            {
                WriteOption(writer, "unsafe");
            }

            if (Optimize)
            {
                WriteOption(writer, "optimize");
            }

            if (WarningLevel != null)
            {
                WriteOption(writer, "warn", WarningLevel);
            }

            if (Codepage != null)
            {
                WriteOption(writer, "codepage", Codepage);
            }

            if (NoConfig && !Arguments.Contains("/noconfig"))
            {
                Arguments.Add(new Argument("/noconfig"));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Writes the compiler options to the specified <see cref="TextWriter" />.
        /// </summary>
        /// <param name="writer"><see cref="TextWriter" /> to which the compiler options should be written.</param>
        protected override void WriteOptions(TextWriter writer)
        {
            // causes the compiler to specify the full path of the file in which
            // an error was found
            WriteOption(writer, "fullpaths");

            // the base address for the DLL
            if (BaseAddress != null)
            {
                WriteOption(writer, "baseaddress", BaseAddress);
            }

            // XML documentation
            if (DocFile != null)
            {
                if (SupportsDocGeneration)
                {
                    WriteOption(writer, "doc", DocFile.FullName);
                }
                else
                {
                    Log(Level.Warning, ResourceUtils.GetString("String_CompilerDoesNotSupportXmlDoc"),
                        Project.TargetFramework.Description);
                }
            }

            // handle debug builds.
            switch (DebugOutput)
            {
            case DebugOutput.None:
                break;

            case DebugOutput.Enable:
                WriteOption(writer, "debug");
                WriteOption(writer, "define", "DEBUG");
                WriteOption(writer, "define", "TRACE");
                break;

            case DebugOutput.Full:
                WriteOption(writer, "debug");
                break;

            case DebugOutput.PdbOnly:
                WriteOption(writer, "debug", "pdbonly");
                break;

            default:
                throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                                                       ResourceUtils.GetString("NA2011"), DebugOutput), Location);
            }

            if (FileAlign > 0)
            {
                WriteOption(writer, "filealign", FileAlign.ToString(CultureInfo.InvariantCulture));
            }

            if (NoStdLib)
            {
                WriteOption(writer, "nostdlib");
            }

            if (Checked)
            {
                WriteOption(writer, "checked");
            }

            if (Unsafe)
            {
                WriteOption(writer, "unsafe");
            }

            if (Optimize)
            {
                WriteOption(writer, "optimize");
            }

            if (WarningLevel != null)
            {
                WriteOption(writer, "warn", WarningLevel);
            }

            if (Codepage != null)
            {
                WriteOption(writer, "codepage", Codepage);
            }

            if (NoConfig && !Arguments.Contains("/noconfig"))
            {
                Arguments.Add(new Argument("/noconfig"));
            }
        }