Example #1
0
        static void CreateBinaryNuspec(
            string id,
            string compiler,
            IEnumerable <Targets.ItemDefinitionGroup> itemDefinitionGroupList,
            IEnumerable <Nuspec.File> fileList,
            IEnumerable <Nuspec.Dependency> dependencyList,
            Optional <string> name)
        {
            var info        = Config.CompilerMap[compiler];
            var description =
                id +
                ". Compiler: " +
                info.Name +
                ".";

            Nuspec.Create(
                id,
                id,
                SrcPackage.CompilerVersion(info),
                description,
                itemDefinitionGroupList,
                fileList,
                Enumerable.Empty <CompilationUnit>(),
                dependencyList,
                new[] { "binaries", compiler }.
                Concat(name.ToEnumerable()));
        }
Example #2
0
 public SrcPackage(string name, SrcPackage package, IEnumerable <string> fileList) :
     this(
         name : name,
         preprocessorDefinitions : package.PreprocessorDefinitions.ToOptionalClass(),
         lineList : package.LineList.ToOptionalClass(),
         fileList : fileList.ToOptionalClass(),
         skip : package.Skip)
 {
 }
Example #3
0
 public void Make(SrcPackage package)
 => File.WriteAllLines(
     FileName("boost_" + package.Name.Select(n => n, () => "") + "-src"),
     new[]
 {
     "#define _SCL_SECURE_NO_WARNINGS",
     "#define _CRT_SECURE_NO_WARNINGS",
     "#pragma warning(disable: 4244 4503 4752 4800 4996)"
 }.
     Concat(package.LineList).
     Concat(
         new[]
 {
     "#include \"" + Path.GetFileName(_localFile) + "\""
 }
         )
     );
Example #4
0
        static void Main(string[] args)
        {
            var doc = new Doc();

            // Changes
            {
                doc = doc[T.H1("Release Notes")];
                foreach (var change in Config.Release)
                {
                    doc = doc[change];
                }
            }

            // headers only library.
            {
                doc = doc
                      [T.H1("Headers Only Libraries")]
                      [T.List[A("boost", Config.Version)]];
                var path     = Path.Combine(Config.BoostDir, "boost");
                var fileList =
                    new Dir(new DirectoryInfo(path), "boost").
                    FileList(f => true);
                Nuspec.Create(
                    "boost",
                    "boost",
                    Config.Version,
                    "boost",
                    new[]
                {
                    new Targets.ItemDefinitionGroup(
                        clCompile:
                        new Targets.ClCompile(
                            additionalIncludeDirectories:
                            new[]
                    {
                        Targets.PathFromThis(
                            Targets.IncludePath)
                    }
                            )
                        )
                },
                    fileList.Select(
                        f =>
                        new Nuspec.File(
                            Path.Combine(Config.BoostDir, f),
                            Path.Combine(Targets.IncludePath, f)
                            )
                        ),
                    new CompilationUnit[0],
                    new Nuspec.Dependency[0],
                    new[] { "headers" }
                    );
            }

            // source libraries.
            doc = doc[T.H1("Source Libraries")];
            var srcLibList = new List <string>();

            foreach (var directory in Directory
                     .GetDirectories(Path.Combine(Config.BoostDir, "libs")))
            {
                var src = Path.Combine(directory, "src");
                if (Directory.Exists(src))
                {
                    var name = Path.GetFileName(directory);

                    var libraryConfig = Config
                                        .LibraryList
                                        .Where(l => l.Name == name)
                                        .FirstOrDefault()
                                        ?? new Library(name);

                    foreach (var libName in MakeSrcLibrary(libraryConfig, src))
                    {
                        var fullName = "boost_" + libName + "-src";
                        srcLibList.Add(libName);
                        doc = doc[T.List[A(
                                             libName, fullName, Config.Version)]];
                    }
                }
            }
            Nuspec.Create(
                "boost-src",
                "boost-src",
                Config.Version,
                "boost-src",
                Enumerable.Empty <Targets.ItemDefinitionGroup>(),
                Enumerable.Empty <Nuspec.File>(),
                Enumerable.Empty <CompilationUnit>(),
                srcLibList.Select(srcLib => new Nuspec.Dependency(
                                      "boost_" + srcLib + "-src", Config.Version.ToString())),
                new[] { "sources" });

            // create dictionaries for binary NuGet packages.
            doc = doc[T.H1("Precompiled Libraries")];

            // compiler -> (library name -> pacakge)
            var compilerDictionary =
                new Dictionary <string, Dictionary <string, CompiledPackage> >();

            // library name -> library.
            var libraryDictionary = new Dictionary <string, CompiledLibrary>();

            ScanCompiledFileSet(compilerDictionary, libraryDictionary);

            // all libraries for specific compiler.
            {
                var list = T.List[T.Text("all libraries")];
                foreach (var compiler in compilerDictionary.Keys.OrderBy(Config.CompilerNumber))
                {
                    var id = "boost-" + compiler;
                    var compilerLibraries = compilerDictionary[compiler];
                    CreateBinaryNuspec(
                        id,
                        compiler,
                        Enumerable.Empty <Targets.ItemDefinitionGroup>(),
                        Enumerable.Empty <Nuspec.File>(),
                        compilerLibraries
                        .Keys
                        .Select(lib => SrcPackage.Dependency(lib, compiler)),
                        Optional <string> .Absent.Value);
                    list = list
                           [T.Text(" ")]
                           [A(
                                compiler,
                                id,
                                SrcPackage.CompilerVersion(Config.CompilerMap[compiler]))];
                }
                doc = doc[list];
            }

            //
            var itemDefinitionGroupList = new[]
            {
                new Targets.ItemDefinitionGroup(
                    link: new Targets.Link(
                        additionalLibraryDirectories:
                        new[]
                {
                    Targets.PathFromThis(Targets.LibNativePath)
                }
                        ))
            };

            // NuGet packages for each library.
            foreach (var library in libraryDictionary)
            {
                var name      = library.Key;
                var libraryId = "boost_" + name;
                var list      = T.List[T.Text(name)];
                foreach (var package in library
                         .Value
                         .PackageDictionary
                         .OrderBy(p => Config.CompilerNumber(p.Key)))
                {
                    var compiler     = package.Key;
                    var packageValue = package.Value;
                    var nuspecId     = libraryId + "-" + compiler;
                    CreateBinaryNuspec(
                        nuspecId,
                        compiler,
                        itemDefinitionGroupList,
                        packageValue.FileList.Select(
                            f =>
                            new Nuspec.File(
                                Path.Combine(Config.BoostDir, f),
                                Targets.LibNativePath)
                            ),
                        SrcPackage.BoostDependency,
                        name.ToOptional());
                    list = list
                           [T.Text(" ")]
                           [A(
                                package.Key,
                                nuspecId,
                                SrcPackage.CompilerVersion(Config.CompilerMap[compiler]))];
                }
                doc = doc[list];
            }

            // release.md
            using (var file = new StreamWriter("RELEASE.md"))
            {
                doc.Write(file);
            }
        }