Exemple #1
0
        public static CommonCompilerOptions Combine(params CommonCompilerOptions[] options)
        {
            var result = new CommonCompilerOptions();

            foreach (var option in options)
            {
                // Skip null options
                if (option == null)
                {
                    continue;
                }

                // Defines, suppressions, and additional arguments are always combined
                result.Defines             = Combine(option.Defines, result.Defines);
                result.SuppressWarnings    = Combine(option.SuppressWarnings, result.SuppressWarnings);
                result.AdditionalArguments = Combine(option.AdditionalArguments, result.AdditionalArguments);

                if (option.LanguageVersion != null)
                {
                    result.LanguageVersion = option.LanguageVersion;
                }

                if (option.Platform != null)
                {
                    result.Platform = option.Platform;
                }

                if (option.AllowUnsafe != null)
                {
                    result.AllowUnsafe = option.AllowUnsafe;
                }

                if (option.WarningsAsErrors != null)
                {
                    result.WarningsAsErrors = option.WarningsAsErrors;
                }

                if (option.Optimize != null)
                {
                    result.Optimize = option.Optimize;
                }

                if (option.KeyFile != null)
                {
                    result.KeyFile = option.KeyFile;
                }

                if (option.DelaySign != null)
                {
                    result.DelaySign = option.DelaySign;
                }

                if (option.PublicSign != null)
                {
                    result.PublicSign = option.PublicSign;
                }

                if (option.DebugType != null)
                {
                    result.DebugType = option.DebugType;
                }

                if (option.EmitEntryPoint != null)
                {
                    result.EmitEntryPoint = option.EmitEntryPoint;
                }

                if (option.PreserveCompilationContext != null)
                {
                    result.PreserveCompilationContext = option.PreserveCompilationContext;
                }

                if (option.GenerateXmlDocumentation != null)
                {
                    result.GenerateXmlDocumentation = option.GenerateXmlDocumentation;
                }

                if (option.OutputName != null)
                {
                    result.OutputName = option.OutputName;
                }

                if (option.CompileInclude != null)
                {
                    result.CompileInclude = option.CompileInclude;
                }

                if (option.EmbedInclude != null)
                {
                    result.EmbedInclude = option.EmbedInclude;
                }

                if (option.CopyToOutputInclude != null)
                {
                    result.CopyToOutputInclude = option.CopyToOutputInclude;
                }

                // compilerName set in the root cannot be overriden.
                if (result.CompilerName == null)
                {
                    result.CompilerName = option.CompilerName;
                }
            }

            return(result);
        }