private void copyServerSideProject(DevelopmentInstallation installation, string serverSideLogicFolderPath, string project)
 {
     IoMethods.CopyFolder(
         EwlStatics.CombinePaths(installation.GeneralLogic.Path, project, EwlStatics.GetProjectOutputFolderPath(false)),
         EwlStatics.CombinePaths(serverSideLogicFolderPath, project),
         false);
 }
 private static IEnumerable <string> getAssemblyPaths(DevelopmentInstallation installation, bool debug)
 {
     return(EwlStatics
            .CombinePaths(
                installation.DevelopmentInstallationLogic.LibraryPath,
                EwlStatics.GetProjectOutputFolderPath(debug),
                installation.DevelopmentInstallationLogic.DevelopmentConfiguration.LibraryNamespaceAndAssemblyName + ".dll")
            .ToCollection()
            .Concat(
                from i in installation.DevelopmentInstallationLogic.DevelopmentConfiguration.webProjects ?? new WebProject[0]
                select EwlStatics.CombinePaths(installation.GeneralLogic.Path, i.name, "bin", i.NamespaceAndAssemblyName + ".dll"))
            .Concat(
                from i in installation.ExistingInstallationLogic.RuntimeConfiguration.WindowsServices
                select EwlStatics.CombinePaths(
                    installation.ExistingInstallationLogic.GetWindowsServiceFolderPath(i, debug),
                    i.NamespaceAndAssemblyName + ".exe"))
            .Concat(
                from i in installation.DevelopmentInstallationLogic.DevelopmentConfiguration.ServerSideConsoleProjectsNonNullable
                select EwlStatics.CombinePaths(
                    installation.GeneralLogic.Path,
                    i.Name,
                    EwlStatics.GetProjectOutputFolderPath(debug),
                    i.NamespaceAndAssemblyName + ".exe"))
            .Concat(
                installation.DevelopmentInstallationLogic.DevelopmentConfiguration.clientSideAppProject != null
                                         ? EwlStatics.CombinePaths(
                    installation.GeneralLogic.Path,
                    installation.DevelopmentInstallationLogic.DevelopmentConfiguration.clientSideAppProject.name,
                    EwlStatics.GetProjectOutputFolderPath(debug),
                    installation.DevelopmentInstallationLogic.DevelopmentConfiguration.clientSideAppProject.assemblyName + ".exe")
                .ToCollection()
                                         : new string[0]));
 }
 private void packageClientSideApp(DevelopmentInstallation installation, string clientSideAppFolder)
 {
     IoMethods.CopyFolder(
         EwlStatics.CombinePaths(
             installation.GeneralLogic.Path,
             installation.DevelopmentInstallationLogic.DevelopmentConfiguration.clientSideAppProject.name,
             EwlStatics.GetProjectOutputFolderPath(false)),
         EwlStatics.CombinePaths(clientSideAppFolder, installation.DevelopmentInstallationLogic.DevelopmentConfiguration.clientSideAppProject.name),
         false);
 }
Example #4
0
        public string GetWindowsServiceFolderPath(WindowsService service, bool useDebugFolderIfDevelopmentInstallation)
        {
            var path = EwlStatics.CombinePaths(generalInstallationLogic.Path, service.Name);

            if (runtimeConfiguration.InstallationType == InstallationType.Development)
            {
                path = EwlStatics.CombinePaths(path, EwlStatics.GetProjectOutputFolderPath(useDebugFolderIfDevelopmentInstallation));
            }
            return(path);
        }
        internal static byte[] CreateEwlNuGetPackage(DevelopmentInstallation installation, 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\net451-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);

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

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

            return
                (File.ReadAllBytes(
                     EwlStatics.CombinePaths(
                         outputFolderPath,
                         EwlNuGetPackageSpecificationStatics.GetNuGetPackageFileName(
                             installation.ExistingInstallationLogic.RuntimeConfiguration.SystemShortName,
                             installation.CurrentMajorVersion,
                             !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                             localExportDateAndTime: localExportDateAndTime))));
        }
Example #6
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);
        }