Esempio n. 1
0
        private static void WriteMasterCompilerSection(FileGenerator masterBffGenerator, MasterBffInfo masterBffInfo)
        {
            var sortedMasterCompileSettings = masterBffInfo.CompilerSettings.OrderBy(x => x.Value.CompilerName);

            foreach (var compiler in sortedMasterCompileSettings)
            {
                var    compilerSettings        = compiler.Value;
                var    compilerPlatform        = compilerSettings.PlatformFlags;
                string fastBuildCompilerFamily = UtilityMethods.GetFBuildCompilerFamily(compilerSettings.FastBuildCompilerFamily);

                string fastBuildCompilerUseRelativePaths = FileGeneratorUtilities.RemoveLineTag;
                if (FastBuildSettings.CompilersUsingRelativePaths.Contains(compiler.Key))
                {
                    fastBuildCompilerUseRelativePaths = "true";
                }

                string fastBuildCompilerAdditionalSettings = FileGeneratorUtilities.RemoveLineTag;
                if (FastBuildSettings.AdditionalCompilerSettings.TryGetValue(compiler.Key, out IList <string> extraOptions) &&
                    extraOptions.Any())
                {
                    fastBuildCompilerAdditionalSettings = string.Join(Environment.NewLine, extraOptions.Select(option => "    " + option));
                }

                using (masterBffGenerator.Declare("fastbuildCompilerName", compiler.Key))
                    using (masterBffGenerator.Declare("fastBuildCompilerRootPath", compilerSettings.RootPath))
                        using (masterBffGenerator.Declare("fastBuildCompilerExecutable", string.IsNullOrEmpty(compilerSettings.Executable) ? FileGeneratorUtilities.RemoveLineTag : compilerSettings.Executable))
                            using (masterBffGenerator.Declare("fastBuildExtraFiles", compilerSettings.ExtraFiles.Count > 0 ? UtilityMethods.FBuildCollectionFormat(compilerSettings.ExtraFiles, 28) : FileGeneratorUtilities.RemoveLineTag))
                                using (masterBffGenerator.Declare("fastBuildCompilerFamily", string.IsNullOrEmpty(fastBuildCompilerFamily) ? FileGeneratorUtilities.RemoveLineTag : fastBuildCompilerFamily))
                                    using (masterBffGenerator.Declare("fastBuildCompilerUseRelativePaths", fastBuildCompilerUseRelativePaths))
                                        using (masterBffGenerator.Declare("fastBuildCompilerAdditionalSettings", fastBuildCompilerAdditionalSettings))
                                        {
                                            masterBffGenerator.Write(Bff.Template.ConfigurationFile.CompilerSetting);
                                            foreach (var compilerConfiguration in compilerSettings.Configurations.OrderBy(x => x.Key))
                                            {
                                                var    compConf            = compilerConfiguration.Value;
                                                string fastBuildLinkerType = UtilityMethods.GetFBuildLinkerType(compConf.FastBuildLinkerType);

                                                using (masterBffGenerator.Declare("fastBuildConfigurationName", compilerConfiguration.Key))
                                                    using (masterBffGenerator.Declare("fastBuildBinPath", compConf.BinPath))
                                                        using (masterBffGenerator.Declare("fastBuildLinkerPath", compConf.LinkerPath))
                                                            using (masterBffGenerator.Declare("fastBuildResourceCompiler", compConf.ResourceCompiler))
                                                                using (masterBffGenerator.Declare("fastBuildCompilerName", compConf.Compiler != FileGeneratorUtilities.RemoveLineTag ? compConf.Compiler : compiler.Key))
                                                                    using (masterBffGenerator.Declare("fastBuildLibrarian", compConf.Librarian))
                                                                        using (masterBffGenerator.Declare("fastBuildLinker", compConf.Linker))
                                                                            using (masterBffGenerator.Declare("fastBuildLinkerType", string.IsNullOrEmpty(fastBuildLinkerType) ? FileGeneratorUtilities.RemoveLineTag : fastBuildLinkerType))
                                                                                using (masterBffGenerator.Declare("fastBuildPlatformLibPaths", string.IsNullOrWhiteSpace(compConf.PlatformLibPaths) ? FileGeneratorUtilities.RemoveLineTag : compConf.PlatformLibPaths))
                                                                                    using (masterBffGenerator.Declare("fastBuildExecutable", compConf.Executable))
                                                                                        using (masterBffGenerator.Declare("fastBuildUsing", compConf.UsingOtherConfiguration))
                                                                                        {
                                                                                            masterBffGenerator.Write(Bff.Template.ConfigurationFile.CompilerConfiguration);
                                                                                        }
                                            }
                                        }
            }
        }
Esempio n. 2
0
        private static void WriteMasterCompilerSection(FileGenerator masterBffGenerator, MasterBffInfo masterBffInfo)
        {
            var sortedMasterCompileSettings = masterBffInfo.CompilerSettings.OrderBy(x => x.Value.CompilerName);

            foreach (var compiler in sortedMasterCompileSettings)
            {
                var    compilerSettings        = compiler.Value;
                var    compilerPlatform        = compilerSettings.PlatformFlags;
                string fastBuildCompilerFamily = UtilityMethods.GetFBuildCompilerFamily(compilerSettings.FastBuildCompilerFamily);

                string fastBuildVS2012EnumBugWorkaround = FileGeneratorUtilities.RemoveLineTag;
                if (FastBuildSettings.EnableVS2012EnumBugWorkaround &&
                    compilerSettings.DevEnv == DevEnv.vs2012 &&
                    compilerPlatform.HasFlag(Platform.win64))
                {
                    fastBuildVS2012EnumBugWorkaround = ".VS2012EnumBugFix = true";
                }

                using (masterBffGenerator.Declare("fastbuildCompilerName", compiler.Key))
                    using (masterBffGenerator.Declare("fastBuildCompilerRootPath", compilerSettings.RootPath))
                        using (masterBffGenerator.Declare("fastBuildCompilerExecutable", string.IsNullOrEmpty(compilerSettings.Executable) ? FileGeneratorUtilities.RemoveLineTag : compilerSettings.Executable))
                            using (masterBffGenerator.Declare("fastBuildExtraFiles", compilerSettings.ExtraFiles.Count > 0 ? UtilityMethods.FBuildCollectionFormat(compilerSettings.ExtraFiles, 28) : FileGeneratorUtilities.RemoveLineTag))
                                using (masterBffGenerator.Declare("fastBuildCompilerFamily", string.IsNullOrEmpty(fastBuildCompilerFamily) ? FileGeneratorUtilities.RemoveLineTag : fastBuildCompilerFamily))
                                    using (masterBffGenerator.Declare("fastBuildVS2012EnumBugWorkaround", fastBuildVS2012EnumBugWorkaround))
                                    {
                                        masterBffGenerator.Write(Bff.Template.ConfigurationFile.CompilerSetting);
                                        foreach (var compilerConfiguration in compilerSettings.Configurations.OrderBy(x => x.Key))
                                        {
                                            var    compConf            = compilerConfiguration.Value;
                                            string fastBuildLinkerType = UtilityMethods.GetFBuildLinkerType(compConf.FastBuildLinkerType);

                                            using (masterBffGenerator.Declare("fastBuildConfigurationName", compilerConfiguration.Key))
                                                using (masterBffGenerator.Declare("fastBuildBinPath", compConf.BinPath))
                                                    using (masterBffGenerator.Declare("fastBuildLinkerPath", compConf.LinkerPath))
                                                        using (masterBffGenerator.Declare("fastBuildResourceCompiler", compConf.ResourceCompiler))
                                                            using (masterBffGenerator.Declare("fastBuildCompilerName", compConf.Compiler != FileGeneratorUtilities.RemoveLineTag ? compConf.Compiler : compiler.Key))
                                                                using (masterBffGenerator.Declare("fastBuildLibrarian", compConf.Librarian))
                                                                    using (masterBffGenerator.Declare("fastBuildLinker", compConf.Linker))
                                                                        using (masterBffGenerator.Declare("fastBuildLinkerType", string.IsNullOrEmpty(fastBuildLinkerType) ? FileGeneratorUtilities.RemoveLineTag : fastBuildLinkerType))
                                                                            using (masterBffGenerator.Declare("fastBuildPlatformLibPaths", string.IsNullOrWhiteSpace(compConf.PlatformLibPaths) ? FileGeneratorUtilities.RemoveLineTag : compConf.PlatformLibPaths))
                                                                                using (masterBffGenerator.Declare("fastBuildExecutable", compConf.Executable))
                                                                                    using (masterBffGenerator.Declare("fastBuildUsing", compConf.UsingOtherConfiguration))
                                                                                    {
                                                                                        masterBffGenerator.Write(Bff.Template.ConfigurationFile.CompilerConfiguration);
                                                                                    }
                                        }
                                    }
            }
        }