diff --git a/Build/Tasks/OtherPackages.cs b/Build/Tasks/OtherPackages.cs index 86815a3f454..a2bfa75fdd2 100644 --- a/Build/Tasks/OtherPackages.cs +++ b/Build/Tasks/OtherPackages.cs @@ -17,6 +17,7 @@ namespace DotNetNuke.Build.Tasks /// A cake task to include other 3rd party packages. [Dependency(typeof(PackageNewtonsoft))] + [Dependency(typeof(PackageMailKit))] public sealed class OtherPackages : FrostingTask { /// diff --git a/Build/Tasks/PackageMailKit.cs b/Build/Tasks/PackageMailKit.cs new file mode 100644 index 00000000000..8955b228de6 --- /dev/null +++ b/Build/Tasks/PackageMailKit.cs @@ -0,0 +1,68 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information +namespace DotNetNuke.Build.Tasks +{ + using System; + using System.Diagnostics; + using System.Linq; + using System.Reflection; + using System.Xml; + + using Cake.Common.Diagnostics; + using Cake.Common.IO; + using Cake.Frosting; + using Dnn.CakeUtils; + + /// A cake task to generate the MailKit package. + public sealed class PackageMailKit : FrostingTask + { + /// + public override void Run(Context context) + { + var binDir = context.WebsiteDir.Path.Combine("bin"); + var mailKitPath = binDir.CombineWithFilePath("MailKit.dll"); + var packageVersion = FileVersionInfo.GetVersionInfo(context.MakeAbsolute(mailKitPath).FullPath).FileVersion; + + var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/MailKit_{packageVersion}_Install.zip"); + var packageDir = context.Directory("DNN Platform/Components/MailKit"); + + context.Information($"Creating {packageZip}"); + context.Zip( + packageDir.ToString(), + packageZip, + context.GetFilesByPatterns(packageDir, new[] { "*" }, new[] { "*.dnn" })); + + var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single(); + context.Information($"Reading manifest from {manifestPath}"); + var manifest = new XmlDocument(); + manifest.LoadXml(context.ReadFile(manifestPath)); + var assemblies = + from XmlNode assemblyNode in manifest.SelectNodes("//assembly") + from XmlNode childNode in assemblyNode.ChildNodes + where childNode.LocalName.Equals("name") + select childNode; + + foreach (var assemblyNameNode in assemblies) + { + var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText); + context.Information($"Adding {assemblyPath} to {packageZip}"); + context.AddFilesToZip( + packageZip, + context.MakeAbsolute(context.WebsiteDir.Path), + context.GetFiles(assemblyPath.ToString()), + append: true); + + var versionNode = assemblyNameNode.ParentNode.ChildNodes.Cast() + .SingleOrDefault(childNode => childNode.LocalName.Equals("version")); + if (versionNode != null) + { + versionNode.InnerText = FileVersionInfo.GetVersionInfo(context.MakeAbsolute(assemblyPath).FullPath).FileVersion; + context.Information($"Set {assemblyPath} version to {versionNode.InnerText}"); + } + } + + context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true); + } + } +} diff --git a/Build/Tasks/packaging.json b/Build/Tasks/packaging.json index 99c4046a3b7..aa407956f1a 100644 --- a/Build/Tasks/packaging.json +++ b/Build/Tasks/packaging.json @@ -23,6 +23,9 @@ "/bin/System.IdentityModel.Tokens.Jwt.*", "/bin/Telerik.Web.UI.dll", "/bin/Telerik.Web.UI.Skins.dll", + "/bin/BouncyCastle.Crypto.dll", + "/bin/MailKit.dll", + "/bin/MimeKit.dll", "/Install/Module/DNNCE_Website.Deprecated_*_Install.zip" ], "installInclude": ["/Install/InstallWizard.aspx.cs"], diff --git a/DNN Platform/Components/MailKit/License.txt b/DNN Platform/Components/MailKit/License.txt new file mode 100644 index 00000000000..7614a032f34 --- /dev/null +++ b/DNN Platform/Components/MailKit/License.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (C) 2012-2020 .NET Foundation and Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/DNN Platform/Components/MailKit/MailKit.dnn b/DNN Platform/Components/MailKit/MailKit.dnn new file mode 100644 index 00000000000..abf742ba321 --- /dev/null +++ b/DNN Platform/Components/MailKit/MailKit.dnn @@ -0,0 +1,45 @@ + + + + MailKit Components + Libraries required for MailKit. + + + DNN + .NET Foundation + https://dnncommunity.org + info@dnncommunity.org + + License.txt + + This package includes MailKit assembly version 2.10.1. + Please go to http://www.mimekit.com/ to view release notes on this particular version. + + + + + bin + MailKit.dll + 2.10.1 + + + bin + MimeKit.dll + 2.10.1 + + + bin + BouncyCastle.Crypto.dll + 1.8.8 + + + bin + System.Buffers.dll + 4.5.1 + + + + + + +