Skip to content

Commit

Permalink
Merge pull request #6193 from dnnsoftware/release/9.13.5
Browse files Browse the repository at this point in the history
Merged `release/9.13.5` into `mater` to release `v9.13.5`
  • Loading branch information
valadas authored Nov 5, 2024
2 parents b53b76e + 409529e commit a382b29
Show file tree
Hide file tree
Showing 363 changed files with 11,776 additions and 9,519 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/image-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Create Pull Request
if: | # If it's not a Pull Request then commit any changes as a new PR.
github.event_name != 'pull_request' && steps.compress_images.outputs.markdown != ''
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
title: Auto Compress Images
branch-suffix: timestamp
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/updateVersions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: yarn install --mode=update-lockfile --no-immutable

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
commit-message: Updates versions as per release candidate creation
title: Updates versions as per release candidate creation
Expand Down
4 changes: 2 additions & 2 deletions Build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<PackageReference Include="Cake.FileHelpers" Version="7.0.0" />
<PackageReference Include="Cake.Frosting" Version="4.0.0" />
<PackageReference Include="Cake.Frosting.Git" Version="4.0.0" />
<PackageReference Include="Cake.Issues" Version="4.6.0" />
<PackageReference Include="Cake.Frosting.Issues.MsBuild" Version="4.6.0" />
<PackageReference Include="Cake.Issues" Version="4.10.1" />
<PackageReference Include="Cake.Frosting.Issues.MsBuild" Version="4.10.1" />
<PackageReference Include="Cake.Json" Version="7.0.1" />
<PackageReference Include="Cake.XdtTransform" Version="2.0.0" />
<PackageReference Include="Dnn.CakeUtils" Version="2.0.2" />
Expand Down
22 changes: 22 additions & 0 deletions Build/ContextExtensions.cs
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;
}
}
69 changes: 7 additions & 62 deletions Build/Tasks/PackageAspNetMvc.cs
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);
}
}
}
69 changes: 7 additions & 62 deletions Build/Tasks/PackageAspNetWebApi.cs
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);
}
}
}
69 changes: 7 additions & 62 deletions Build/Tasks/PackageAspNetWebPages.cs
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);
}
}
}
87 changes: 87 additions & 0 deletions Build/Tasks/PackageComponentTask.cs
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);
}
}
Loading

0 comments on commit a382b29

Please # to comment.