Skip to content

Commit

Permalink
Merge pull request OpenCover#346 from OpenCover/master
Browse files Browse the repository at this point in the history
Create release candidate
  • Loading branch information
sawilde committed Sep 15, 2015
2 parents 6aa35fc + dc084c1 commit 25e57d7
Show file tree
Hide file tree
Showing 64 changed files with 2,333 additions and 580 deletions.
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,36 @@ The primary repo for the project is [on GitHub](https://github.com/opencover/ope
### Team communication
[![Join the chat at https://gitter.im/OpenCover/opencover](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/OpenCover/opencover?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Team communications can also be done via [slack](http://slack.com), raise an issue to request access (include your email - obfuscated if you wish) and we will send you an invite then just visit the [team page](https://opencover.slack.com/) to sign up and join the conversation.
### WIKI
Please review the [wiki pages](https://github.com/opencover/opencover/wiki/_pages) on how to use OpenCover and take particular interest in the [Usage guide](https://github.com/opencover/opencover/wiki/Usage).

### Issues
Please raise issues on GitHub, if you can repeat the issue then please provide a sample to make it easier for us to also repeat it and then implement a fix. Please do not hijack unrelated issues, I would rather you create a new issue than add noise to an unrelated issue.

[Dropbox](http://db.tt/VanqFDn) is very useful for sharing files alternatively you could create a [gist](https://gist.github.com/).

### Licence
All Original Software is licensed under the [MIT Licence](https://github.com/opencover/opencover/blob/master/License.md) and does not apply to any other 3rd party tools, utilities or code which may be used to develop this application.

If anyone is aware of any licence violations that this code may be making please inform the developers so that the issue can be investigated and rectified.

### WIKI
Please review the [wiki pages](https://github.com/opencover/opencover/wiki/_pages) on how to use OpenCover and take particular interest in the [Usage guide](https://github.com/opencover/opencover/wiki/Usage).
### Integration Test support
OpenCover was initially created to support unit testing techniques such as TDD and tools like NUnit and MSTest. Over time others have found ways to use OpenCover for integration testing especially in tricky scenarios such as IIS and Windows Services. I'll put links here as to how people have achieved this however as they say YMMV (You Mileage May Vary).

### Service support
Note that .zip and .nuget packages (at least) will not ACL files so that a low-privilege service can execute them -- manually add the service principal with read/execute privilege to the OpenCover.Profiler.dll ACLs, either through explorer properties or by a `Get-Acl`/`Set-Acl` PowerShell script.
#### IIS support
Please refer to the wiki - [IIS Support](https://github.com/OpenCover/opencover/wiki/IIS-Support)

Launching the profiling operation must be done with Administrator privilege -- this is required to even start the service, and is also needed to create the global objects and set the per-service environment that registers the COM object. Assuming that the COM objects have been pre-registered, the command line to use is like
#### DNX support
Please refer to the wiki - [DNX Support](https://github.com/OpenCover/opencover/wiki/DNX-Support)

OpenCover.console.exe -service:byname -target:<service name> -output:coverage.xml

As this is a blocking operation, launching the coverage gathering a separate process as
#### Win8/Win10 Application Support
Note yet [implemented](https://github.com/OpenCover/opencover/issues/144). Sorry no call for it I assume the WPF way of separating model and UI has led to people getting all they need from unit-tests; I know how that is how it works for me.

start-process OpenCover.console.exe @("-target:<service name>", "-service:byName", "-output:<service name>coverage.xml")

or equivalent in your test scripts.
#### Service support
please refer to the wiki - [Service Support](https://github.com/OpenCover/opencover/wiki/Service-Support)

The `byname` qualifier is used to prevent races if multiple services are being started concurrently by injecting the OpenCover profiling information to the service specific environment.

### Issues
Please raise issues on GitHub, if you can repeat the issue then please provide a sample to make it easier for us to also repeat it and then implement a fix. Please do not hijack unrelated issues, I would rather you create a new issue than add noise to an unrelated issue.

[Dropbox](http://db.tt/VanqFDn) is very useful for sharing files alternatively you could create a [gist](https://gist.github.com/).
#### Silverlight support
Please refer to wiki - [Silverlight support](https://github.com/OpenCover/opencover/wiki/Silverlight-Support)

### Building
You will need:
Expand Down Expand Up @@ -85,7 +86,7 @@ I would like to thank
* JetBrains for my Open Source [ReSharper licence](http://www.jetbrains.com/resharper/),
* [AppVeyor](https://ci.appveyor.com/project/sawilde/opencover) for allowing free build CI services for Open Source projects,
* [Coveralls](https://coveralls.io/r/OpenCover/opencover) for allowing free services for Open Source projects,
* NDepend for my [NDepend licence](http://www.ndepend.com/).
* NDepend for my [NDepend licence](http://www.ndepend.com/),
* the guys at [CodeBetter](http://codebetter.com/), [Devlicious](http://devlicio.us/) and [Los Techies](http://lostechies.com/) who orignally arranged my MSDN licence all those years ago without which I doubt I'd have been able to start OpenCover (now no longer needed as we can build OpenCover using the VS2013 Community Edition),
* the [NextGenUG](http://www.nxtgenug.net/) and their free swag from where I got lots of useful tools,

Expand Down
2 changes: 2 additions & 0 deletions ReleaseNotes.tmp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Version [[version]]
#282 exclude by process (feature)
#246 auto crash reports (feature)
#329 address ArgumentOutOfRangeException (potentially related to #274) (fix for VS2015)
#335 error on unrecognized arguments/prefixes (fix)
#328 exclude types when declaredtype is excluded (fix-feature)
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions main/.nuget/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CrashReporterdotNet" version="1.5" />
<package id="coveralls.io" version="1.3.4" />
<package id="curl" version="7.30.0.2" />
<package id="Mono.Gendarme" version="2.11.0.20121120" />
Expand Down
File renamed without changes.
52 changes: 52 additions & 0 deletions main/OpenCover.3rdParty.Signer/CrashReporterSigner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.IO;
using System.Linq;
using System.Reflection;
using Mono.Cecil;

namespace OpenCover.ThirdParty.Signer
{
internal static class CrashReporterSigner
{

private const string Version = "1.5";

private static readonly string GendarmeAssemblyName = string.Format("CrashReporterdotNet.{0}", Version);

public static readonly string TargetFolder = Path.Combine("..", "tools", "CrashReporterSigned");
private static readonly string SourceFolder = Path.Combine("packages", GendarmeAssemblyName, "lib", "net20");
private static readonly string StrongNameKey = Path.Combine("..", "build", "Version", "opencover.3rdparty.snk");


public static bool AlreadySigned(string baseFolder)
{
var frameworkAssembly = Path.Combine(baseFolder, TargetFolder, "CrashReporter.NET.dll");
if (File.Exists(frameworkAssembly))
{
try
{
var frameworkDefinition = AssemblyDefinition.ReadAssembly(frameworkAssembly);
return frameworkDefinition.Name.HasPublicKey;
}
catch
{
}
}
return false;
}

public static void SignAssembly(string baseFolder)
{
var key = Path.Combine(baseFolder, StrongNameKey);
var assembly = Path.Combine(baseFolder, SourceFolder, "CrashReporter.NET.dll");
var newAssembly = Path.Combine(baseFolder, TargetFolder, "CrashReporter.NET.dll");

assembly = Path.GetFullPath(assembly);
newAssembly = Path.GetFullPath(newAssembly);

File.Copy(assembly, newAssembly, true);
var definition = AssemblyDefinition.ReadAssembly(newAssembly);
var keyPair = new StrongNameKeyPair(new FileStream(key, FileMode.Open, FileAccess.Read));
definition.Write(newAssembly, new WriterParameters() { StrongNameKeyPair = keyPair });
}
}
}
Original file line number Diff line number Diff line change
@@ -1,48 +1,23 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Mono.Cecil;

namespace OpenCover.Gendarme.Signer
namespace OpenCover.ThirdParty.Signer
{
class Program
internal static class GendarmeSigner
{
private const string GendarmeVersion = "2.11.0.20121120";

private static readonly string GendarmeAssemblyName = string.Format("Mono.Gendarme.{0}", GendarmeVersion);
private const string GendarmeVersion = "2.11.0.20121120";

private static readonly string TargetFolder = Path.Combine("..", "tools", "GendarmeSigned");
private static readonly string SourceFolder = Path.Combine("packages", GendarmeAssemblyName, "tools");
private static readonly string StrongNameKey = Path.Combine("..", "build", "Version", "opencover.gendarme.snk");

static void Main(string[] args)
{
var assemblyLocation = Assembly.GetAssembly (typeof(Program)).Location;
var assemblyFolder = Path.GetDirectoryName(assemblyLocation);
var baseFolder = Path.Combine(assemblyFolder, "..", "..", "..");
private static readonly string GendarmeAssemblyName = string.Format("Mono.Gendarme.{0}", GendarmeVersion);

var targetDirectory = Path.Combine (baseFolder, TargetFolder);
if (!Directory.Exists(targetDirectory))
Directory.CreateDirectory (targetDirectory);

if (AlreadySigned(baseFolder))
{
Console.WriteLine("Gendarme Framework is already Signed");
return;
}

Console.WriteLine("Signing Gendarme Framework");
SignGendarmeFramework(baseFolder);
public static readonly string TargetFolder = Path.Combine("..", "tools", "GendarmeSigned");
private static readonly string SourceFolder = Path.Combine("packages", GendarmeAssemblyName, "tools");
private static readonly string StrongNameKey = Path.Combine("..", "build", "Version", "opencover.3rdparty.snk");

Console.WriteLine("Signing Gendarme Rules Maintainability");
SignGendarmeRulesMaintainability(baseFolder);
}

private static bool AlreadySigned(string baseFolder)
public static bool AlreadySigned(string baseFolder)
{
var frameworkAssembly = Path.Combine(baseFolder, TargetFolder, "Gendarme.Framework.dll");
if (File.Exists(frameworkAssembly))
Expand All @@ -59,7 +34,7 @@ private static bool AlreadySigned(string baseFolder)
return false;
}

private static void SignGendarmeRulesMaintainability(string baseFolder)
public static void SignGendarmeRulesMaintainability(string baseFolder)
{
var frameworkAssembly = Path.Combine(baseFolder, TargetFolder, "Gendarme.Framework.dll");
var frameworkDefinition = AssemblyDefinition.ReadAssembly(frameworkAssembly);
Expand Down Expand Up @@ -97,7 +72,7 @@ private static void SignGendarmeRulesMaintainability(string baseFolder)

}

private static void SignGendarmeFramework(string baseFolder)
public static void SignGendarmeFramework(string baseFolder)
{
var key = Path.Combine(baseFolder, StrongNameKey);
var assembly = Path.Combine(baseFolder, SourceFolder, "Gendarme.Framework.dll");
Expand All @@ -112,4 +87,4 @@ private static void SignGendarmeFramework(string baseFolder)
definition.Write(newAssembly, new WriterParameters() { StrongNameKeyPair = keyPair });
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{0B94C4BF-762B-4722-BF5A-30E7F6D2CB7E}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenCover.Gendarme.Signer</RootNamespace>
<AssemblyName>OpenCover.Gendarme.Signer</AssemblyName>
<RootNamespace>OpenCover.ThirdParty.Signer</RootNamespace>
<AssemblyName>OpenCover.3rdParty.Signer</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
Expand Down Expand Up @@ -65,6 +65,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CrashReporterSigner.cs" />
<Compile Include="GendarmeSigner.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand All @@ -79,6 +81,10 @@
$(SolutionDir)OpenCover.Gendarme.Signer\bin\$(ConfigurationName)\OpenCover.Gendarme.Signer.exe</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">mono OpenCover.Gendarme.Signer.exe</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>cd $(SolutionDir)OpenCover.3rdParty.Signer\bin\$(ConfigurationName)
$(SolutionDir)OpenCover.3rdParty.Signer\bin\$(ConfigurationName)\OpenCover.3rdParty.Signer.exe</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
56 changes: 56 additions & 0 deletions main/OpenCover.3rdParty.Signer/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using System.IO;
using System.Reflection;

namespace OpenCover.ThirdParty.Signer
{
class Program
{

static void Main(string[] args)
{
var assemblyLocation = Assembly.GetAssembly (typeof(Program)).Location;
var assemblyFolder = Path.GetDirectoryName(assemblyLocation) ?? string.Empty;
var baseFolder = Path.Combine(assemblyFolder, "..", "..", "..");

SignGendarme(baseFolder);
SignCrashReporter(baseFolder);
}

private static void SignGendarme(string baseFolder)
{
var targetDirectory = Path.Combine(baseFolder, GendarmeSigner.TargetFolder);
if (!Directory.Exists(targetDirectory))
Directory.CreateDirectory(targetDirectory);

if (GendarmeSigner.AlreadySigned(baseFolder))
{
Console.WriteLine("Gendarme Framework is already Signed");
return;
}

Console.WriteLine("Signing Gendarme Framework");
GendarmeSigner.SignGendarmeFramework(baseFolder);

Console.WriteLine("Signing Gendarme Rules Maintainability");
GendarmeSigner.SignGendarmeRulesMaintainability(baseFolder);
}

private static void SignCrashReporter(string baseFolder)
{
var targetDirectory = Path.Combine(baseFolder, CrashReporterSigner.TargetFolder);
if (!Directory.Exists(targetDirectory))
Directory.CreateDirectory(targetDirectory);

if (CrashReporterSigner.AlreadySigned(baseFolder))
{
Console.WriteLine("CrashReporter is already Signed");
return;
}

Console.WriteLine("Signing CrashReporter");
CrashReporterSigner.SignAssembly(baseFolder);

}
}
}
14 changes: 14 additions & 0 deletions main/OpenCover.Console/CrashReporter/AnonymousData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;

namespace OpenCover.Console.CrashReporter
{
/// <summary>
/// http://crashreporterdotnet.codeplex.com/SourceControl/latest#CrashReporter.NET/trunk/CrashReporter.NET/DrDump/AnonymousData.cs
/// </summary>
internal class AnonymousData
{
public Exception Exception { get; set; }
public string ToEmail { get; set; }
public Guid? ApplicationGuid { get; set; }
}
}
Loading

0 comments on commit 25e57d7

Please sign in to comment.