Skip to content

Commit bc9c729

Browse files
bdukesdonker
andauthored
Remove DLLs from source code repository (#7182)
* Use Nuget for Microsoft.ApplicationBlocks.Data * Remove compiled DotNetNuke.Log4Net.dll * Use NuGet for Microsoft.CodeDom.Providers.DotNetCompilerPlatform Add as a package to DotNetNuke.Website, and pull DLLs and roslyn folder from there * Use base packaging task consistently * Use NuGet for Lucene * Use NuGet for WindowsAzure.Storage * Remove Yahoo.Yui.Compressor --------- Co-authored-by: Peter Donker <peter@bring2mind.net>
1 parent 9029ebf commit bc9c729

73 files changed

Lines changed: 206 additions & 56025 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Build/BuildScripts/AEPackage.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<CompressCss>True</CompressCss>
4+
<UseResourceZipWorkingDirectory>True</UseResourceZipWorkingDirectory>
55
</PropertyGroup>
66

77
<Import Project="Package.Targets" />

Build/BuildScripts/Package.targets

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<DotNetNukeMSBuildTasksLib>$(BuildScriptsPath)\DotNetNuke.MSBuild.Tasks.dll</DotNetNukeMSBuildTasksLib>
5-
<YuiLib>$(BuildScriptsPath)\Yahoo.Yui.Compressor.MsBuild.dll</YuiLib>
65
</PropertyGroup>
76

87
<UsingTask TaskName="ExtensionPackager" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
@@ -35,8 +34,6 @@
3534
</Code>
3635
</Task>
3736
</UsingTask>
38-
<UsingTask AssemblyFile="$(YuiLib)" TaskName="CssCompressorTask" />
39-
<!--<UsingTask AssemblyFile="$(YuiLib)" TaskName="JavaScriptCompressorTask" />-->
4037

4138
<Target Name="Package" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
4239
<XmlPeek Namespaces="&lt;Namespace Prefix='n' Uri='http://schemas.microsoft.com/developer/msbuild/2003' /&gt;"
@@ -49,9 +46,9 @@
4946
</Output>
5047
</ExtensionPackager>
5148

52-
<CallTarget Condition="'$(CompressCss)' == 'True'" Targets="Minification" />
49+
<CallTarget Condition="'$(UseResourceZipWorkingDirectory)' == 'True'" Targets="RezipResources" />
5350
<Copy SourceFiles="$(DNNFileName).dnn" DestinationFolder="$(MSBuildProjectDirectory)\Package" />
54-
<Zip Condition="'$(CompressCss)' != 'True'" Files="@(Resources)" WorkingDirectory="$(MSBuildProjectDirectory)" ZipFileName="$(MSBuildProjectDirectory)\Package\Resources.zip" />
51+
<Zip Condition="'$(UseResourceZipWorkingDirectory)' != 'True'" Files="@(Resources)" WorkingDirectory="$(MSBuildProjectDirectory)" ZipFileName="$(MSBuildProjectDirectory)\Package\Resources.zip" />
5552

5653
<ItemGroup>
5754
<LicenseFiles Include="license.txt"/>
@@ -74,37 +71,14 @@
7471
<RemoveDir Directories="$(MSBuildProjectDirectory)\Package" ContinueOnError="WarnAndContinue" />
7572
</Target>
7673

77-
<Target Name="Minification">
78-
74+
<Target Name="RezipResources">
7975
<MakeDir Directories="$(MSBuildProjectDirectory)\Package"/>
8076
<Zip Files="@(Resources)" WorkingDirectory="$(MSBuildProjectDirectory)" ZipFileName="$(MSBuildProjectDirectory)\Package\Resources.zip" />
8177
<Unzip ZipFileName="$(MSBuildProjectDirectory)\Package\Resources.zip" TargetDirectory="$(MSBuildProjectDirectory)\Package\Resources" />
8278
<Delete Files="$(MSBuildProjectDirectory)\Package\Resources.zip" />
8379
<ItemGroup>
84-
<!--<_JSFilesToMinify Include="$(MSBuildProjectDirectory)\Package\Resources\**\*.js" Exclude="$(MSBuildProjectDirectory)\Package\Resources\**\*.min.js" />-->
8580
<_Step2FilesToZip Include="$(MSBuildProjectDirectory)\Package\Resources\**\*" />
8681
</ItemGroup>
87-
<!--
88-
<Message Text="Compressing Javascript files" Importance="high" />
89-
<JavaScriptCompressorTask Files="@(_JSFilesToMinify)" ContinueOnError="WarnAndContinue" />
90-
-->
91-
92-
<ItemGroup>
93-
<_CSSFilesToCompress Include="$(MSBuildProjectDirectory)\*\*.css;$(MSBuildProjectDirectory)\*\*\*.css;$(MSBuildProjectDirectory)\*\*\*\*.css;$(MSBuildProjectDirectory)\*\*\*\*\*.css;" Exclude="Package\**\*;**\node_modules\**;**\WebApps\**" />
94-
</ItemGroup>
95-
<Message Text="Compressing the following CSS files:" Importance="high" />
96-
<Message Text="%(_CSSFilesToCompress.Identity)" Importance="high" />
97-
98-
<CssCompressorTask
99-
SourceFiles="@(_CSSFilesToCompress)"
100-
DeleteSourceFiles="false"
101-
OutputFile="$(MSBuildProjectDirectory)\Package\Resources\%(RecursiveDir)%(Filename)%(Extension)"
102-
CompressionType="Standard"
103-
LoggingType="Info"
104-
PreserveComments="false"
105-
LineBreakPosition="-1"
106-
Condition="@(_CSSFilesToCompress->Count())!=0"
107-
/>
10882

10983
<Zip Files="@(_Step2FilesToZip)" WorkingDirectory="$(ResourceZipWorkingDirectory)"
11084
ZipFileName="$(MSBuildProjectDirectory)\Package\Resources.zip" />
-20.5 KB
Binary file not shown.
-50 KB
Binary file not shown.

Build/Tasks/OtherPackages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace DotNetNuke.Build.Tasks
2727
[IsDependentOn(typeof(PackageSharpZipLib))]
2828
[IsDependentOn(typeof(PackageMicrosoftExtensionsDependencyInjection))]
2929
[IsDependentOn(typeof(PackageMicrosoftWebInfrastructure))]
30+
[IsDependentOn(typeof(PackageMicrosoftCodeDomProvidersDotNetCompilerPlatform))]
3031
public sealed class OtherPackages : FrostingTask<Context>
3132
{
3233
private static readonly string[] IncludeAll = ["**/*",];

Build/Tasks/PackageAspNetMvc.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@
44
namespace DotNetNuke.Build.Tasks;
55

66
/// <summary>A cake task to generate the ASP.NET MVC package.</summary>
7-
public sealed class PackageAspNetMvc : PackageComponentTask
8-
{
9-
/// <summary>Initializes a new instance of the <see cref="PackageAspNetMvc"/> class.</summary>
10-
public PackageAspNetMvc()
11-
: base("AspNetMvc", "System.Web.Mvc.dll", "Microsoft.AspNetMvc")
12-
{
13-
}
14-
}
7+
public sealed class PackageAspNetMvc()
8+
: PackageComponentTaskBase("AspNetMvc", "System.Web.Mvc.dll", "Microsoft.AspNetMvc");

Build/Tasks/PackageAspNetWebApi.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@
44
namespace DotNetNuke.Build.Tasks;
55

66
/// <summary>A cake task to generate the ASP.NET Web API package.</summary>
7-
public sealed class PackageAspNetWebApi : PackageComponentTask
8-
{
9-
/// <summary>Initializes a new instance of the <see cref="PackageAspNetWebApi"/> class.</summary>
10-
public PackageAspNetWebApi()
11-
: base("AspNetWebApi", "System.Web.Http.dll", "Microsoft.AspNetWebApi")
12-
{
13-
}
14-
}
7+
public sealed class PackageAspNetWebApi()
8+
: PackageComponentTaskBase("AspNetWebApi", "System.Web.Http.dll", "Microsoft.AspNetWebApi");

Build/Tasks/PackageAspNetWebPages.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@
44
namespace DotNetNuke.Build.Tasks;
55

66
/// <summary>A cake task to generate the ASP.NET Web Pages package.</summary>
7-
public sealed class PackageAspNetWebPages : PackageComponentTask
8-
{
9-
/// <summary>Initializes a new instance of the <see cref="PackageAspNetWebPages"/> class.</summary>
10-
public PackageAspNetWebPages()
11-
: base("AspNetWebPages", "System.Web.WebPages.dll", "Microsoft.AspNetWebPages")
12-
{
13-
}
14-
}
7+
public sealed class PackageAspNetWebPages()
8+
: PackageComponentTaskBase("AspNetWebPages", "System.Web.WebPages.dll", "Microsoft.AspNetWebPages");
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,121 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
2-
// The .NET Foundation licenses this file to you under the MIT license.
3-
// See the LICENSE file in the project root for more information
4-
5-
namespace DotNetNuke.Build.Tasks;
6-
7-
using System.IO;
8-
using System.Linq;
9-
using System.Xml;
10-
11-
using Cake.Common.Diagnostics;
12-
using Cake.Common.IO;
13-
using Cake.Core.IO;
14-
using Cake.Frosting;
15-
using Dnn.CakeUtils;
16-
17-
/// <summary>Provides the base functionality for packaging a folder inside Components.</summary>
18-
public abstract class PackageComponentTask : FrostingTask<Context>
19-
{
20-
private static readonly string[] AllFiles = ["*",];
21-
private static readonly string[] ManifestFiles = ["*.dnn",];
22-
23-
/// <summary>Initializes a new instance of the <see cref="PackageComponentTask"/> class.</summary>
24-
/// <param name="componentName">The name of the component.</param>
25-
/// <param name="primaryAssemblyName">The name of the primary assembly.</param>
26-
/// <param name="componentFolderName">The name of the folder in <c>DNN Platform/Components/</c>.</param>
27-
protected PackageComponentTask(string componentName, FilePath primaryAssemblyName = null, DirectoryPath componentFolderName = null)
28-
{
29-
this.ComponentName = componentName;
30-
this.ComponentFolderName = componentFolderName ?? componentName;
31-
this.PrimaryAssemblyName = primaryAssemblyName ?? $"{componentName}.dll";
32-
}
33-
34-
/// <summary>Gets the name of the component.</summary>
35-
public string ComponentName { get; }
36-
37-
/// <summary>Gets the name of the folder in <c>DNN Platform/Components/</c> where the component files are.</summary>
38-
public DirectoryPath ComponentFolderName { get; }
39-
40-
/// <summary>Gets the name of the primary assembly.</summary>
41-
public FilePath PrimaryAssemblyName { get; }
42-
43-
/// <inheritdoc />
44-
public override void Run(Context context)
45-
{
46-
var binDir = context.WebsiteDir.Path.Combine("bin");
47-
var mainAssemblyPath = binDir.CombineWithFilePath(this.PrimaryAssemblyName);
48-
var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath);
49-
50-
var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/{this.ComponentName}_{packageVersion}_Install.zip");
51-
var packageDir = context.Directory($"DNN Platform/Components/{this.ComponentFolderName}");
52-
53-
context.Information($"Creating {packageZip}");
54-
context.Zip(
55-
packageDir.ToString(),
56-
packageZip,
57-
context.GetFilesByPatterns(packageDir, AllFiles, ManifestFiles));
58-
59-
var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
60-
context.Information($"Reading manifest from {manifestPath}");
61-
var manifest = new XmlDocument();
62-
using (var manifestReader = XmlReader.Create(new StringReader(context.ReadFile(manifestPath)), new XmlReaderSettings { XmlResolver = null, }))
63-
{
64-
manifest.Load(manifestReader);
65-
}
66-
67-
var assemblies =
68-
from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
69-
from XmlNode childNode in assemblyNode.ChildNodes
70-
where childNode.LocalName.Equals("name", System.StringComparison.Ordinal)
71-
select childNode;
72-
73-
foreach (var assemblyNameNode in assemblies)
74-
{
75-
var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
76-
context.Information($"Adding {assemblyPath} to {packageZip}");
77-
context.AddFilesToZip(
78-
packageZip,
79-
context.MakeAbsolute(context.WebsiteDir.Path),
80-
context.GetFiles(assemblyPath.ToString()),
81-
append: true);
82-
83-
var versionNode = assemblyNameNode.ParentNode?.ChildNodes.Cast<XmlNode>()
84-
.SingleOrDefault(childNode => childNode.LocalName.Equals("version", System.StringComparison.Ordinal));
85-
if (versionNode != null)
86-
{
87-
versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
88-
context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
89-
}
90-
}
91-
92-
manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion;
93-
94-
context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
95-
}
96-
}
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information
4+
5+
namespace DotNetNuke.Build.Tasks;
6+
7+
using System.IO;
8+
using System.Linq;
9+
using System.Threading.Tasks;
10+
using System.Xml;
11+
12+
using Cake.Common.Diagnostics;
13+
using Cake.Common.IO;
14+
using Cake.Core.IO;
15+
using Cake.Frosting;
16+
using Dnn.CakeUtils;
17+
18+
/// <summary>Provides the base functionality for packaging a folder inside Components.</summary>
19+
public abstract class PackageComponentTaskBase : AsyncFrostingTask<Context>
20+
{
21+
private static readonly string[] AllFiles = ["*",];
22+
private static readonly string[] ManifestFiles = ["*.dnn",];
23+
24+
/// <summary>Initializes a new instance of the <see cref="PackageComponentTaskBase"/> class.</summary>
25+
/// <param name="componentName">The name of the component.</param>
26+
/// <param name="primaryAssemblyName">The name of the primary assembly.</param>
27+
/// <param name="componentFolderName">The name of the folder in <c>DNN Platform/Components/</c>.</param>
28+
protected PackageComponentTaskBase(string componentName, FilePath primaryAssemblyName = null, DirectoryPath componentFolderName = null)
29+
{
30+
this.ComponentName = componentName;
31+
this.ComponentFolderName = componentFolderName ?? componentName;
32+
this.PrimaryAssemblyName = primaryAssemblyName ?? $"{componentName}.dll";
33+
}
34+
35+
/// <summary>Gets the name of the component.</summary>
36+
public string ComponentName { get; }
37+
38+
/// <summary>Gets the name of the folder in <c>DNN Platform/Components/</c> where the component files are.</summary>
39+
public DirectoryPath ComponentFolderName { get; }
40+
41+
/// <summary>Gets the name of the primary assembly.</summary>
42+
public FilePath PrimaryAssemblyName { get; }
43+
44+
/// <inheritdoc />
45+
public override Task RunAsync(Context context)
46+
{
47+
var binDir = GetBinDir(context);
48+
var packageZip = this.GetPackageZipPath(context, binDir);
49+
var packageDir = context.Directory($"DNN Platform/Components/{this.ComponentFolderName}");
50+
51+
context.Information($"Creating {packageZip}");
52+
context.Zip(
53+
packageDir.ToString(),
54+
packageZip,
55+
context.GetFilesByPatterns(packageDir, AllFiles, ManifestFiles));
56+
57+
var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
58+
context.Information($"Reading manifest from {manifestPath}");
59+
var manifest = new XmlDocument();
60+
using (var manifestReader = XmlReader.Create(new StringReader(context.ReadFile(manifestPath)), new XmlReaderSettings { XmlResolver = null, }))
61+
{
62+
manifest.Load(manifestReader);
63+
}
64+
65+
var assemblies =
66+
from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
67+
where assemblyNode.Attributes?["action"]?.Value != "UnRegister"
68+
from XmlNode childNode in assemblyNode.ChildNodes
69+
where childNode.LocalName.Equals("name", System.StringComparison.Ordinal)
70+
select childNode;
71+
72+
foreach (var assemblyNameNode in assemblies)
73+
{
74+
var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
75+
context.Information($"Adding {assemblyPath} to {packageZip}");
76+
context.AddFilesToZip(
77+
packageZip,
78+
context.MakeAbsolute(context.WebsiteDir.Path),
79+
context.GetFiles(assemblyPath.ToString()),
80+
append: true);
81+
82+
var versionNode = assemblyNameNode.ParentNode?.ChildNodes.Cast<XmlNode>()
83+
.SingleOrDefault(childNode => childNode.LocalName.Equals("version", System.StringComparison.Ordinal));
84+
if (versionNode != null)
85+
{
86+
versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
87+
context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
88+
}
89+
}
90+
91+
manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = this.GetPackageVersion(context, binDir);
92+
93+
context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
94+
95+
return Task.CompletedTask;
96+
}
97+
98+
/// <summary>Get the path to the <c>bin</c> directory, from which to get DLLs.</summary>
99+
/// <param name="context">The context.</param>
100+
/// <returns>The path.</returns>
101+
protected static DirectoryPath GetBinDir(Context context)
102+
{
103+
return context.WebsiteDir.Path.Combine("bin");
104+
}
105+
106+
/// <summary>Gets the path to the <c>zip</c> file generated by this task.</summary>
107+
/// <param name="context">The context.</param>
108+
/// <param name="binDir">The path to the <c>bin</c> directory (from <see cref="GetBinDir"/>).</param>
109+
/// <returns>The file path.</returns>
110+
protected FilePath GetPackageZipPath(Context context, DirectoryPath binDir)
111+
{
112+
return context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/{this.ComponentName}_{this.GetPackageVersion(context, binDir)}_Install.zip");
113+
}
114+
115+
private string GetPackageVersion(Context context, DirectoryPath binDir)
116+
{
117+
var mainAssemblyPath = binDir.CombineWithFilePath(this.PrimaryAssemblyName);
118+
var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath);
119+
return packageVersion;
120+
}
121+
}

Build/Tasks/PackageHtmlSanitizer.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@
44
namespace DotNetNuke.Build.Tasks;
55

66
/// <summary>A cake task to generate the MailKit package.</summary>
7-
public sealed class PackageHtmlSanitizer : PackageComponentTask
8-
{
9-
/// <summary>Initializes a new instance of the <see cref="PackageHtmlSanitizer"/> class.</summary>
10-
public PackageHtmlSanitizer()
11-
: base("HtmlSanitizer")
12-
{
13-
}
14-
}
7+
public sealed class PackageHtmlSanitizer()
8+
: PackageComponentTaskBase("HtmlSanitizer");

0 commit comments

Comments
 (0)