-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6174 from dimarobert/patch-2
Update DotNetNuke.Newtonsoft.Json.dnn to reference version 13.0.3
- Loading branch information
Showing
12 changed files
with
168 additions
and
471 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 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; | ||
|
||
using System.Diagnostics; | ||
using Cake.Common.IO; | ||
using Cake.Core.IO; | ||
|
||
/// <summary>Provides extensions to <see cref="Context"/>.</summary> | ||
public static class ContextExtensions | ||
{ | ||
/// <summary>Gets the <see cref="FileVersionInfo.FileVersion"/> for an assembly.</summary> | ||
/// <param name="context">The cake context.</param> | ||
/// <param name="assemblyPath">The path to the assembly file.</param> | ||
/// <returns>The file version.</returns> | ||
public static string GetAssemblyFileVersion(this Context context, FilePath assemblyPath) | ||
{ | ||
return FileVersionInfo.GetVersionInfo(context.MakeAbsolute(assemblyPath).FullPath).FileVersion; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,69 +1,14 @@ | ||
// 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.Xml; | ||
|
||
using Cake.Common.Diagnostics; | ||
using Cake.Common.IO; | ||
using Cake.Frosting; | ||
using Dnn.CakeUtils; | ||
namespace DotNetNuke.Build.Tasks; | ||
|
||
/// <summary>A cake task to generate the ASP.NET MVC package.</summary> | ||
public sealed class PackageAspNetMvc : FrostingTask<Context> | ||
/// <summary>A cake task to generate the ASP.NET MVC package.</summary> | ||
public sealed class PackageAspNetMvc : PackageComponentTask | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="PackageAspNetMvc"/> class.</summary> | ||
public PackageAspNetMvc() | ||
: base("AspNetMvc", "System.Web.Mvc.dll", "Microsoft.AspNetMvc") | ||
{ | ||
/// <inheritdoc/> | ||
public override void Run(Context context) | ||
{ | ||
var binDir = context.WebsiteDir.Path.Combine("bin"); | ||
var mainAssemblyPath = binDir.CombineWithFilePath("System.Web.Mvc.dll"); | ||
var packageVersion = FileVersionInfo.GetVersionInfo(context.MakeAbsolute(mainAssemblyPath).FullPath).FileVersion; | ||
|
||
var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/AspNetMvc_{packageVersion}_Install.zip"); | ||
var packageDir = context.Directory("DNN Platform/Components/Microsoft.AspNetMvc"); | ||
|
||
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}"); | ||
} | ||
} | ||
|
||
manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,14 @@ | ||
// 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.Xml; | ||
|
||
using Cake.Common.Diagnostics; | ||
using Cake.Common.IO; | ||
using Cake.Frosting; | ||
using Dnn.CakeUtils; | ||
namespace DotNetNuke.Build.Tasks; | ||
|
||
/// <summary>A cake task to generate the ASP.NET Web API package.</summary> | ||
public sealed class PackageAspNetWebApi : FrostingTask<Context> | ||
/// <summary>A cake task to generate the ASP.NET Web API package.</summary> | ||
public sealed class PackageAspNetWebApi : PackageComponentTask | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="PackageAspNetWebApi"/> class.</summary> | ||
public PackageAspNetWebApi() | ||
: base("AspNetWebApi", "System.Web.Http.dll", "Microsoft.AspNetWebApi") | ||
{ | ||
/// <inheritdoc/> | ||
public override void Run(Context context) | ||
{ | ||
var binDir = context.WebsiteDir.Path.Combine("bin"); | ||
var mainAssemblyPath = binDir.CombineWithFilePath("System.Web.Http.dll"); | ||
var packageVersion = FileVersionInfo.GetVersionInfo(context.MakeAbsolute(mainAssemblyPath).FullPath).FileVersion; | ||
|
||
var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/AspNetWebApi_{packageVersion}_Install.zip"); | ||
var packageDir = context.Directory("DNN Platform/Components/Microsoft.AspNetWebApi"); | ||
|
||
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}"); | ||
} | ||
} | ||
|
||
manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,14 @@ | ||
// 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.Xml; | ||
|
||
using Cake.Common.Diagnostics; | ||
using Cake.Common.IO; | ||
using Cake.Frosting; | ||
using Dnn.CakeUtils; | ||
namespace DotNetNuke.Build.Tasks; | ||
|
||
/// <summary>A cake task to generate the ASP.NET Web Pages package.</summary> | ||
public sealed class PackageAspNetWebPages : FrostingTask<Context> | ||
/// <summary>A cake task to generate the ASP.NET Web Pages package.</summary> | ||
public sealed class PackageAspNetWebPages : PackageComponentTask | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="PackageAspNetWebPages"/> class.</summary> | ||
public PackageAspNetWebPages() | ||
: base("AspNetWebPages", "System.Web.WebPages.dll", "Microsoft.AspNetWebPages") | ||
{ | ||
/// <inheritdoc/> | ||
public override void Run(Context context) | ||
{ | ||
var binDir = context.WebsiteDir.Path.Combine("bin"); | ||
var mainAssemblyPath = binDir.CombineWithFilePath("System.Web.WebPages.dll"); | ||
var packageVersion = FileVersionInfo.GetVersionInfo(context.MakeAbsolute(mainAssemblyPath).FullPath).FileVersion; | ||
|
||
var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/AspNetWebPages_{packageVersion}_Install.zip"); | ||
var packageDir = context.Directory("DNN Platform/Components/Microsoft.AspNetWebPages"); | ||
|
||
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}"); | ||
} | ||
} | ||
|
||
manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// 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.Linq; | ||
using System.Xml; | ||
using Cake.Common.Diagnostics; | ||
using Cake.Common.IO; | ||
using Cake.Core.IO; | ||
using Cake.Frosting; | ||
using Dnn.CakeUtils; | ||
|
||
/// <summary>Provides the base functionality for packaging a folder inside Components.</summary> | ||
public abstract class PackageComponentTask : FrostingTask<Context> | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="PackageComponentTask"/> class.</summary> | ||
/// <param name="componentName">The name of the component.</param> | ||
/// <param name="primaryAssemblyName">The name of the primary assembly.</param> | ||
/// <param name="componentFolderName">The name of the folder in <c>DNN Platform/Components/</c>.</param> | ||
protected PackageComponentTask(string componentName, FilePath primaryAssemblyName = null, DirectoryPath componentFolderName = null) | ||
{ | ||
this.ComponentName = componentName; | ||
this.ComponentFolderName = componentFolderName ?? componentName; | ||
this.PrimaryAssemblyName = primaryAssemblyName ?? $"{componentName}.dll"; | ||
} | ||
|
||
/// <summary>Gets the name of the component.</summary> | ||
public string ComponentName { get; } | ||
|
||
/// <summary>Gets the name of the folder in <c>DNN Platform/Components/</c> where the component files are.</summary> | ||
public DirectoryPath ComponentFolderName { get; } | ||
|
||
/// <summary>Gets the name of the primary assembly.</summary> | ||
public FilePath PrimaryAssemblyName { get; } | ||
|
||
/// <inheritdoc /> | ||
public override void Run(Context context) | ||
{ | ||
var binDir = context.WebsiteDir.Path.Combine("bin"); | ||
var mainAssemblyPath = binDir.CombineWithFilePath(this.PrimaryAssemblyName); | ||
var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath); | ||
|
||
var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/{this.ComponentName}_{packageVersion}_Install.zip"); | ||
var packageDir = context.Directory($"DNN Platform/Components/{this.ComponentFolderName}"); | ||
|
||
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 = context.GetAssemblyFileVersion(assemblyPath); | ||
context.Information($"Set {assemblyPath} version to {versionNode.InnerText}"); | ||
} | ||
} | ||
|
||
manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion; | ||
|
||
context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true); | ||
} | ||
} |
Oops, something went wrong.