Skip to content

Commit f56d14a

Browse files
authored
Merge pull request #4582 from bclothier/DeploymentEnhancement
Deployment enhancements - hopefully make it easier for contributors to ... *contribute*.
2 parents 0d2da9a + 25c817d commit f56d14a

35 files changed

+1645
-527
lines changed

Rubberduck.Deployment/Builders/RegistryEntryBuilder.cs renamed to Rubberduck.Deployment.Build/Builders/RegistryEntryBuilder.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
using System.Runtime.InteropServices.ComTypes;
55
using System.Xml;
66
using Microsoft.Win32;
7-
using Rubberduck.Deployment.Structs;
7+
using Rubberduck.Deployment.Build.Structs;
88

9-
namespace Rubberduck.Deployment.Builders
9+
namespace Rubberduck.Deployment.Build.Builders
1010
{
1111
public class RegistryEntryBuilder
1212
{
@@ -92,11 +92,11 @@ public TypeLibMap ExtractTypeLib(XmlNode node)
9292
@="C:\\Github\\Rubberduck\\Rubberduck\\RetailCoder.VBE\\bin\\Debug"
9393
*/
9494
const string basePath = baseFolder + @"TypeLib\";
95-
var libGuid = node.Attributes["Id"].Value;
96-
var libDesc = node.Attributes["Description"].Value;
97-
var language = node.Attributes["Language"].Value;
98-
var major = node.Attributes["MajorVersion"].Value;
99-
var minor = node.Attributes["MinorVersion"].Value;
95+
var libGuid = node.Attributes["Id"].Value; //mandatory; it should throw if we don't have it.
96+
var libDesc = node.Attributes["Description"]?.Value ?? string.Empty;
97+
var language = node.Attributes["Language"]?.Value ?? "0";
98+
var major = node.Attributes["MajorVersion"]?.Value ?? "1";
99+
var minor = node.Attributes["MinorVersion"]?.Value ?? "0";
100100
var version = major + "." + minor;
101101

102102
var flags = 0;

Rubberduck.Deployment/IdlGeneration/IdlGenerator.cs renamed to Rubberduck.Deployment.Build/IdlGeneration/IdlGenerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using System;
2-
using Org.Benf.OleWoo;
3-
using Org.Benf.OleWoo.Typelib;
42
using System.IO;
53
using System.Reflection;
64
using System.Runtime.InteropServices;
75
using System.Runtime.InteropServices.ComTypes;
6+
using Org.Benf.OleWoo;
7+
using Org.Benf.OleWoo.Typelib;
88

9-
namespace Rubberduck.Deployment.IdlGeneration
9+
namespace Rubberduck.Deployment.Build.IdlGeneration
1010
{
1111
public class IdlGenerator
1212
{

Rubberduck.Deployment/IdlGeneration/IdlListener.cs renamed to Rubberduck.Deployment.Build/IdlGeneration/IdlListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Org.Benf.OleWoo.Listeners;
22
using Org.Benf.OleWoo.Typelib;
33

4-
namespace Rubberduck.Deployment.IdlGeneration
4+
namespace Rubberduck.Deployment.Build.IdlGeneration
55
{
66
public class IdlListener : TypeLibListenerBase
77
{
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using System.Diagnostics;
3+
using Microsoft.Build.Framework;
4+
5+
namespace Rubberduck.Deployment.Build
6+
{
7+
[Serializable]
8+
internal class RubberduckBuildEventArgs : BuildMessageEventArgs
9+
{
10+
// Default MSBuild verbosity is minimal; meaning that a normal message will not be shown.
11+
// Hence, we use high importance to ensure that it will still show in the build log at the
12+
// default verbosity level.
13+
internal RubberduckBuildEventArgs(string message, string helpKeyword, string senderName) :
14+
base(message, helpKeyword, senderName, MessageImportance.High) { }
15+
}
16+
17+
internal static class LogHelper
18+
{
19+
internal static void LogError(this ITask sender, Exception ex)
20+
{
21+
var stackTrace = new StackTrace(ex, true);
22+
var frame = stackTrace.GetFrame(0);
23+
var code = frame.GetMethod().Name;
24+
var file = frame.GetFileName();
25+
var lineNumber = frame.GetFileLineNumber();
26+
var columnNumber = frame.GetFileColumnNumber();
27+
var message = ex.Message;
28+
var helpKeyword = ex.HelpLink;
29+
var senderName = sender.GetType().FullName;
30+
31+
var args = new BuildErrorEventArgs(
32+
subcategory: "Quack!",
33+
code: code,
34+
file: file,
35+
lineNumber: lineNumber,
36+
columnNumber: columnNumber,
37+
endLineNumber: lineNumber,
38+
endColumnNumber: columnNumber,
39+
message: message,
40+
helpKeyword: helpKeyword,
41+
senderName: senderName);
42+
43+
sender.BuildEngine.LogErrorEvent(args);
44+
}
45+
46+
internal static void LogMessage(this ITask sender, string message, string helpKeyword = null)
47+
{
48+
var senderName = sender.GetType().FullName;
49+
50+
var args = new RubberduckBuildEventArgs(message, helpKeyword, senderName);
51+
sender.BuildEngine.LogMessageEvent(args);
52+
}
53+
}
54+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Runtime.InteropServices;
2+
3+
// Setting ComVisible to false makes the types in this assembly not visible
4+
// to COM components. If you need to access a type in this assembly from
5+
// COM, set the ComVisible attribute to true on that type.
6+
[assembly: ComVisible(false)]
7+
8+
// The following GUID is for the ID of the typelib if this project is exposed to COM
9+
[assembly: Guid("372FC06C-E745-4FBF-91BB-3565D8F19D62")]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Sunburst.NET.Sdk.WPF/1.0.47">
3+
<PropertyGroup>
4+
<Product>Rubberduck.Deployment.Build</Product>
5+
<Copyright>Copyright © 2018</Copyright>
6+
<ProjectGuid>{3A3E3535-FF24-40BD-A4D4-5C88AF6DB1BA}</ProjectGuid>
7+
<RootNamespace>Rubberduck.Deployment.Build</RootNamespace>
8+
<AssemblyName>Rubberduck.Deployment.Build</AssemblyName>
9+
</PropertyGroup>
10+
<Import Project="..\RubberduckBaseMetaProject.csproj" />
11+
<ItemGroup>
12+
<Reference Include="Microsoft.Build.Framework" />
13+
<Reference Include="Microsoft.Build.Tasks.v4.0" />
14+
<Reference Include="Microsoft.Build.Utilities.v4.0">
15+
<HintPath>$(MSBuildBinPath)\Microsoft.Build.Utilities.v4.0.dll</HintPath>
16+
</Reference>
17+
<Reference Include="Microsoft.VisualStudio.Setup.Configuration.Interop">
18+
<HintPath>VisualStudioSetup\Microsoft.VisualStudio.Setup.Configuration.Interop.dll</HintPath>
19+
</Reference>
20+
<Reference Include="olewoo">
21+
<HintPath>OleWoo\olewoo.dll</HintPath>
22+
</Reference>
23+
<Reference Include="olewoo_interop">
24+
<HintPath>OleWoo\olewoo_interop.dll</HintPath>
25+
</Reference>
26+
</ItemGroup>
27+
</Project>

0 commit comments

Comments
 (0)