-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
/// <summary>A cake task to generate the MailKit package.</summary> | ||
public sealed class PackageMailKit : FrostingTask<Context> | ||
{ | ||
/// <inheritdoc/> | ||
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<XmlNode>() | ||
.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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<dotnetnuke type="Package" version="5.0"> | ||
<packages> | ||
<package name="DotNetNuke.MailKit" type="Library" version="2.10.1"> | ||
<friendlyName>MailKit Components</friendlyName> | ||
<description>Libraries required for MailKit.</description> | ||
<dependencies/> | ||
<owner> | ||
<name>DNN</name> | ||
<organization>.NET Foundation</organization> | ||
<url>https://dnncommunity.org</url> | ||
<email>info@dnncommunity.org</email> | ||
</owner> | ||
<license>License.txt</license> | ||
<releaseNotes> | ||
This package includes MailKit assembly version 2.10.1. | ||
Please go to http://www.mimekit.com/ to view release notes on this particular version.</releaseNotes> | ||
<components> | ||
<component type="Assembly"> | ||
<assemblies> | ||
<assembly> | ||
<path>bin</path> | ||
<name>MailKit.dll</name> | ||
<version>2.10.1</version> | ||
</assembly> | ||
<assembly> | ||
<path>bin</path> | ||
<name>MimeKit.dll</name> | ||
<version>2.10.1</version> | ||
</assembly> | ||
<assembly> | ||
<path>bin</path> | ||
<name>BouncyCastle.Crypto.dll</name> | ||
<version>1.8.8</version> | ||
</assembly> | ||
<assembly> | ||
<path>bin</path> | ||
<name>System.Buffers.dll</name> | ||
<version>4.5.1</version> | ||
</assembly> | ||
</assemblies> | ||
</component> | ||
</components> | ||
</package> | ||
</packages> | ||
</dotnetnuke> |