private InstallationSupportUtility.SystemManagerInterface.Messages.BuildMessage.Build.NuGetPackagesType packageEwl(
            DevelopmentInstallation installation, PackagingConfiguration packagingConfiguration, string logicPackagesFolderPath)
        {
            var buildMessageNuGetPackages = new InstallationSupportUtility.SystemManagerInterface.Messages.BuildMessage.Build.NuGetPackagesType();

            buildMessageNuGetPackages.Prerelease = CreateEwlNuGetPackage(installation, packagingConfiguration, false, logicPackagesFolderPath, true);
            buildMessageNuGetPackages.Stable     = CreateEwlNuGetPackage(installation, packagingConfiguration, false, logicPackagesFolderPath, false);
            return(buildMessageNuGetPackages);
        }
Esempio n. 2
0
 private IEnumerable <InstallationSupportUtility.SystemManagerInterface.Messages.BuildMessage.NuGetPackage> packageEwl(
     DevelopmentInstallation installation, PackagingConfiguration packagingConfiguration, string logicPackagesFolderPath) =>
 CreateEwlNuGetPackages(installation, packagingConfiguration, false, logicPackagesFolderPath, new bool?[] { true, false })
 .Select(
     i => {
     var package        = new InstallationSupportUtility.SystemManagerInterface.Messages.BuildMessage.NuGetPackage();
     package.Id         = i.id;
     package.Prerelease = i.packages[0];
     package.Stable     = i.packages[1];
     return(package);
 });
        private static void writeNuGetPackageManifest(
            DevelopmentInstallation installation, PackagingConfiguration packagingConfiguration, bool?prerelease, DateTime?localExportDateAndTime,
            TextWriter writer)
        {
            writer.WriteLine("<?xml version=\"1.0\"?>");
            writer.WriteLine("<package>");
            writer.WriteLine("<metadata>");
            writer.WriteLine("<id>" + EwlNuGetPackageSpecificationStatics.GetNuGetPackageId(packagingConfiguration.SystemShortName) + "</id>");
            writer.WriteLine(
                "<version>" + EwlNuGetPackageSpecificationStatics.GetNuGetPackageVersionString(
                    installation.CurrentMajorVersion,
                    !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                    localExportDateAndTime: localExportDateAndTime) + "</version>");
            writer.WriteLine("<title>" + installation.ExistingInstallationLogic.RuntimeConfiguration.SystemName + "</title>");
            writer.WriteLine("<authors>William Gross, Greg Smalter, Sam Rueby</authors>");
            writer.WriteLine(
                "<description>The {0} ({1}), and its tailored infrastructure platform, are a complete and open solution for developing and operating web-based enterprise software.</description>"
                .FormatWith(EwlStatics.EwlName, EwlStatics.EwlInitialism));
            writer.WriteLine("<projectUrl>http://enterpriseweblibrary.org</projectUrl>");
            writer.WriteLine("<licenseUrl>http://enterpriseweblibrary.org/license</licenseUrl>");
            writer.WriteLine("<requireLicenseAcceptance>false</requireLicenseAcceptance>");
            writer.WriteLine("<dependencies>");

            var lines = from line in File.ReadAllLines(EwlStatics.CombinePaths(installation.GeneralLogic.Path, AppStatics.CoreProjectName, "packages.config"))
                        let trimmedLine = line.Trim()
                                          where trimmedLine.StartsWith("<package ")
                                          select trimmedLine;

            foreach (var line in lines)
            {
                writer.WriteLine(Regex.Replace(line.Replace("package", "dependency"), @" targetFramework=""[\w]+""", ""));
            }

            writer.WriteLine("</dependencies>");
            writer.WriteLine("<tags>C# ASP.NET DAL SQL-Server MySQL Oracle</tags>");
            writer.WriteLine("</metadata>");
            writer.WriteLine("</package>");
        }
Esempio n. 4
0
        internal static IReadOnlyCollection <(string id, IReadOnlyList <byte[]> packages)> CreateEwlNuGetPackages(
            DevelopmentInstallation installation, PackagingConfiguration packagingConfiguration, bool useDebugAssembly, string outputFolderPath,
            IEnumerable <bool?> prereleaseValues)
        {
            var now      = DateTime.Now;
            var packages = new List <(string, IReadOnlyList <byte[]>)>();

            var mainId       = packagingConfiguration.SystemShortName;
            var mainPackages = prereleaseValues.Select(
                prerelease => {
                var localExportDateAndTime = prerelease.HasValue ? (DateTime?)null : now;

                IoMethods.ExecuteWithTempFolder(
                    folderPath => {
                    var ewlOutputFolderPath = EwlStatics.CombinePaths(
                        installation.GeneralLogic.Path,
                        EwlStatics.CoreProjectName,
                        EwlStatics.GetProjectOutputFolderPath(useDebugAssembly));
                    var libFolderPath = EwlStatics.CombinePaths(folderPath, @"lib\net472-full");
                    foreach (var fileName in new[] { "dll", "pdb", "xml" }.Select(i => "EnterpriseWebLibrary." + i))
                    {
                        IoMethods.CopyFile(EwlStatics.CombinePaths(ewlOutputFolderPath, fileName), EwlStatics.CombinePaths(libFolderPath, fileName));
                    }

                    IoMethods.CopyFile(
                        EwlStatics.CombinePaths(installation.GeneralLogic.Path, @"Development Utility\Package Manager Console Commands.ps1"),
                        EwlStatics.CombinePaths(folderPath, @"tools\init.ps1"));

                    IoMethods.CopyFolder(
                        EwlStatics.CombinePaths(installation.GeneralLogic.Path, EwlStatics.CoreProjectName, StaticFile.FrameworkStaticFilesSourceFolderPath),
                        EwlStatics.CombinePaths(folderPath, InstallationFileStatics.WebFrameworkStaticFilesFolderName),
                        false);
                    IoMethods.DeleteFolder(
                        EwlStatics.CombinePaths(folderPath, InstallationFileStatics.WebFrameworkStaticFilesFolderName, AppStatics.StaticFileLogicFolderName));

                    const string duProjectAndFolderName = "Development Utility";
                    IoMethods.CopyFolder(
                        EwlStatics.CombinePaths(installation.GeneralLogic.Path, duProjectAndFolderName, EwlStatics.GetProjectOutputFolderPath(useDebugAssembly)),
                        EwlStatics.CombinePaths(folderPath, duProjectAndFolderName),
                        false);
                    packageGeneralFiles(installation, folderPath, false);
                    IoMethods.CopyFolder(
                        EwlStatics.CombinePaths(
                            installation.ExistingInstallationLogic.RuntimeConfiguration.ConfigurationFolderPath,
                            InstallationConfiguration.InstallationConfigurationFolderName,
                            InstallationConfiguration.InstallationsFolderName,
                            !prerelease.HasValue || prerelease.Value ? "Testing" : "Live"),
                        EwlStatics.CombinePaths(
                            folderPath,
                            InstallationConfiguration.ConfigurationFolderName,
                            InstallationConfiguration.InstallationConfigurationFolderName),
                        false);
                    if (File.Exists(installation.ExistingInstallationLogic.RuntimeConfiguration.InstallationSharedConfigurationFilePath))
                    {
                        IoMethods.CopyFile(
                            installation.ExistingInstallationLogic.RuntimeConfiguration.InstallationSharedConfigurationFilePath,
                            EwlStatics.CombinePaths(
                                folderPath,
                                InstallationConfiguration.ConfigurationFolderName,
                                InstallationConfiguration.InstallationConfigurationFolderName,
                                InstallationConfiguration.InstallationSharedConfigurationFileName));
                    }

                    var manifestPath = EwlStatics.CombinePaths(folderPath, "Package.nuspec");
                    using (var writer = IoMethods.GetTextWriterForWrite(manifestPath))
                        writeNuGetPackageManifest(
                            writer,
                            installation,
                            mainId,
                            "",
                            w => {
                            var lines = from line in File.ReadAllLines(
                                EwlStatics.CombinePaths(installation.GeneralLogic.Path, EwlStatics.CoreProjectName, "packages.config"))
                                        let trimmedLine = line.Trim()
                                                          where trimmedLine.StartsWith("<package ")
                                                          select trimmedLine;
                            foreach (var line in lines)
                            {
                                w.WriteLine(Regex.Replace(line.Replace("package", "dependency"), @" targetFramework=""[\w]+""", ""));
                            }
                        },
                            prerelease,
                            localExportDateAndTime);

                    StatusStatics.SetStatus(
                        TewlContrib.ProcessTools.RunProgram(
                            EwlStatics.CombinePaths(installation.GeneralLogic.Path, @"Solution Files\nuget"),
                            "pack \"" + manifestPath + "\" -OutputDirectory \"" + outputFolderPath + "\"",
                            "",
                            true));
                });

                return(File.ReadAllBytes(
                           EwlStatics.CombinePaths(
                               outputFolderPath,
                               EwlNuGetPackageSpecificationStatics.GetNuGetPackageFileName(
                                   mainId,
                                   installation.CurrentMajorVersion,
                                   !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                                   localExportDateAndTime: localExportDateAndTime))));
            })
                               .MaterializeAsList();

            packages.Add((mainId, mainPackages));

            var samlId       = mainId + ".Saml";
            var samlPackages = prereleaseValues.Select(
                prerelease => {
                var localExportDateAndTime = prerelease.HasValue ? (DateTime?)null : now;

                IoMethods.ExecuteWithTempFolder(
                    folderPath => {
                    foreach (var fileName in new[] { "dll", "pdb" }.Select(i => "EnterpriseWebLibrary.Saml." + i))
                    {
                        IoMethods.CopyFile(
                            EwlStatics.CombinePaths(
                                installation.GeneralLogic.Path,
                                EwlStatics.SamlProviderProjectPath,
                                EwlStatics.GetProjectOutputFolderPath(useDebugAssembly),
                                fileName),
                            EwlStatics.CombinePaths(folderPath, @"lib\net472-full", fileName));
                    }

                    var manifestPath = EwlStatics.CombinePaths(folderPath, "Package.nuspec");
                    using (var writer = IoMethods.GetTextWriterForWrite(manifestPath))
                        writeNuGetPackageManifest(
                            writer,
                            installation,
                            samlId,
                            "SAML Provider",
                            w => {
                            w.WriteLine(
                                "<dependency id=\"{0}\" version=\"[{1}]\" />".FormatWith(
                                    mainId,
                                    EwlNuGetPackageSpecificationStatics.GetNuGetPackageVersionString(
                                        installation.CurrentMajorVersion,
                                        !prerelease.HasValue || prerelease.Value ? (int?)installation.NextBuildNumber : null,
                                        localExportDateAndTime: localExportDateAndTime)));
                            w.WriteLine("<dependency id=\"ComponentSpace.Saml2.Net.Licensed\" version=\"5.0.0\" />");
                        },
                            prerelease,
                            localExportDateAndTime);

                    StatusStatics.SetStatus(
                        TewlContrib.ProcessTools.RunProgram(
                            EwlStatics.CombinePaths(installation.GeneralLogic.Path, @"Solution Files\nuget"),
                            "pack \"" + manifestPath + "\" -OutputDirectory \"" + outputFolderPath + "\"",
                            "",
                            true));
                });

                return(File.ReadAllBytes(
                           EwlStatics.CombinePaths(
                               outputFolderPath,
                               EwlNuGetPackageSpecificationStatics.GetNuGetPackageFileName(
                                   samlId,
                                   installation.CurrentMajorVersion,
                                   !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                                   localExportDateAndTime: localExportDateAndTime))));
            })
                               .MaterializeAsList();

            packages.Add((samlId, samlPackages));

            return(packages);
        }
        internal static byte[] CreateEwlNuGetPackage(
            DevelopmentInstallation installation, PackagingConfiguration packagingConfiguration, bool useDebugAssembly, string outputFolderPath, bool?prerelease)
        {
            var localExportDateAndTime = prerelease.HasValue ? null as DateTime? : DateTime.Now;

            IoMethods.ExecuteWithTempFolder(
                folderPath => {
                var ewlOutputFolderPath = EwlStatics.CombinePaths(
                    installation.GeneralLogic.Path,
                    AppStatics.CoreProjectName,
                    EwlStatics.GetProjectOutputFolderPath(useDebugAssembly));
                var libFolderPath = EwlStatics.CombinePaths(folderPath, @"lib\net472-full");
                foreach (var fileName in new[] { "dll", "pdb", "xml" }.Select(i => "EnterpriseWebLibrary." + i))
                {
                    IoMethods.CopyFile(EwlStatics.CombinePaths(ewlOutputFolderPath, fileName), EwlStatics.CombinePaths(libFolderPath, fileName));
                }

                IoMethods.CopyFile(
                    EwlStatics.CombinePaths(installation.GeneralLogic.Path, @"Development Utility\Package Manager Console Commands.ps1"),
                    EwlStatics.CombinePaths(folderPath, @"tools\init.ps1"));

                var webSitePath = EwlStatics.CombinePaths(installation.GeneralLogic.Path, "Web Site");
                var webProjectFilesFolderPath = EwlStatics.CombinePaths(folderPath, AppStatics.WebProjectFilesFolderName);
                IoMethods.CopyFolder(
                    EwlStatics.CombinePaths(webSitePath, StaticFileHandler.EwfFolderName),
                    EwlStatics.CombinePaths(webProjectFilesFolderPath, StaticFileHandler.EwfFolderName),
                    false);
                IoMethods.CopyFile(
                    EwlStatics.CombinePaths(webSitePath, AppStatics.StandardLibraryFilesFileName),
                    EwlStatics.CombinePaths(webProjectFilesFolderPath, AppStatics.StandardLibraryFilesFileName));

                const string duProjectAndFolderName = "Development Utility";
                IoMethods.CopyFolder(
                    EwlStatics.CombinePaths(installation.GeneralLogic.Path, duProjectAndFolderName, EwlStatics.GetProjectOutputFolderPath(useDebugAssembly)),
                    EwlStatics.CombinePaths(folderPath, duProjectAndFolderName),
                    false);
                packageGeneralFiles(installation, folderPath, false);
                IoMethods.CopyFolder(
                    EwlStatics.CombinePaths(
                        installation.ExistingInstallationLogic.RuntimeConfiguration.ConfigurationFolderPath,
                        InstallationConfiguration.InstallationConfigurationFolderName,
                        InstallationConfiguration.InstallationsFolderName,
                        !prerelease.HasValue || prerelease.Value ? "Testing" : "Live"),
                    EwlStatics.CombinePaths(
                        folderPath,
                        InstallationConfiguration.ConfigurationFolderName,
                        InstallationConfiguration.InstallationConfigurationFolderName),
                    false);
                if (File.Exists(installation.ExistingInstallationLogic.RuntimeConfiguration.InstallationSharedConfigurationFilePath))
                {
                    IoMethods.CopyFile(
                        installation.ExistingInstallationLogic.RuntimeConfiguration.InstallationSharedConfigurationFilePath,
                        EwlStatics.CombinePaths(
                            folderPath,
                            InstallationConfiguration.ConfigurationFolderName,
                            InstallationConfiguration.InstallationConfigurationFolderName,
                            InstallationConfiguration.InstallationSharedConfigurationFileName));
                }

                var manifestPath = EwlStatics.CombinePaths(folderPath, "Package.nuspec");
                using (var writer = IoMethods.GetTextWriterForWrite(manifestPath))
                    writeNuGetPackageManifest(installation, packagingConfiguration, prerelease, localExportDateAndTime, writer);

                StatusStatics.SetStatus(
                    TewlContrib.ProcessTools.RunProgram(
                        EwlStatics.CombinePaths(installation.GeneralLogic.Path, @"Solution Files\nuget"),
                        "pack \"" + manifestPath + "\" -OutputDirectory \"" + outputFolderPath + "\"",
                        "",
                        true));
            });

            return(File.ReadAllBytes(
                       EwlStatics.CombinePaths(
                           outputFolderPath,
                           EwlNuGetPackageSpecificationStatics.GetNuGetPackageFileName(
                               packagingConfiguration.SystemShortName,
                               installation.CurrentMajorVersion,
                               !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                               localExportDateAndTime: localExportDateAndTime))));
        }