Skip to content

Commit

Permalink
Merge branch 'release/2.16.0'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Catel.Fody/Weaving/Argument/ArgumentInstructionSequenceBuilder.cs
  • Loading branch information
GeertvanHorrik committed Apr 25, 2017
2 parents 9ecee0c + 85e1a9e commit 4452e36
Show file tree
Hide file tree
Showing 52 changed files with 584 additions and 486 deletions.
2 changes: 1 addition & 1 deletion deployment/NuGet/template/Catel.Fody/Catel.Fody.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<iconUrl>http://www.catenalogic.com/catel.png</iconUrl>

<dependencies>
<dependency id="Fody" version="1.29.4" />
<dependency id="Fody" version="2.0.2" />
<!--<dependency id="Catel.Core"/>-->
</dependencies>
</metadata>
Expand Down
8 changes: 8 additions & 0 deletions src/Catel.Fody.TestAssembly/CTL908.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public CTL908(object obj)
Argument.IsNotNull(() => obj);
}
}

public class CTL908_Expected
{
public CTL908_Expected(object obj)
{
Argument.IsNotNull("obj", obj);
}
}
}
12 changes: 5 additions & 7 deletions src/Catel.Fody.TestAssembly/Catel.Fody.TestAssembly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Catel.Core, Version=4.5.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.Core.4.5.3\lib\net40\Catel.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="Catel.Core, Version=4.5.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.Core.4.5.4\lib\net40\Catel.Core.dll</HintPath>
</Reference>
<Reference Include="Catel.MVVM, Version=4.5.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.MVVM.4.5.3\lib\net40\Catel.MVVM.dll</HintPath>
<Private>True</Private>
<Reference Include="Catel.MVVM, Version=4.5.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.MVVM.4.5.4\lib\net40\Catel.MVVM.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\..\lib\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
Expand Down Expand Up @@ -67,7 +65,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.MVVM.4.5.3\lib\net40\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\..\lib\Catel.MVVM.4.5.4\lib\net40\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
Expand Down
4 changes: 2 additions & 2 deletions src/Catel.Fody.TestAssembly/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Catel.Core" version="4.5.3" targetFramework="net40" />
<package id="Catel.MVVM" version="4.5.3" targetFramework="net40" />
<package id="Catel.Core" version="4.5.4" targetFramework="net40" />
<package id="Catel.MVVM" version="4.5.4" targetFramework="net40" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net4" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net4" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Catel.Core, Version=4.5.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.Core.4.5.3\lib\net40\Catel.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="Catel.Core, Version=4.5.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.Core.4.5.4\lib\net40\Catel.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\..\lib\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Catel.Fody.TestExternalTypesAssembly/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Catel.Core" version="4.5.3" targetFramework="net40" />
<package id="Catel.Core" version="4.5.4" targetFramework="net40" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net4" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net4" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net4" />
Expand Down
102 changes: 51 additions & 51 deletions src/Catel.Fody.Tests/ArgumentExpressionFacts.cs

Large diffs are not rendered by default.

96 changes: 48 additions & 48 deletions src/Catel.Fody.Tests/ArgumentFacts.cs

Large diffs are not rendered by default.

67 changes: 48 additions & 19 deletions src/Catel.Fody.Tests/AssemblyWeaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,70 @@
using Catel.Reflection;
using Mono.Cecil;

public static class AssemblyWeaver
public class AssemblyWeaver
{
#region Constants
public static Assembly Assembly;
public Assembly Assembly;
public string BeforeAssemblyPath;
public string AfterAssemblyPath;

public static string BeforeAssemblyPath;
public static string AfterAssemblyPath;

public static List<string> Errors = new List<string>();
public List<string> Errors = new List<string>();
#endregion

#region Constructors
static AssemblyWeaver()
{
Instance = new AssemblyWeaver();
}

public AssemblyWeaver(List<string> referenceAssemblyPaths = null)
{
if (referenceAssemblyPaths == null)
{
referenceAssemblyPaths = new List<string>();
}

//Force ref since MSTest is a POS
var type = typeof (ViewModelBaseTest);
var type = typeof(ViewModelBaseTest);

BeforeAssemblyPath = type.GetAssemblyEx().Location;
//BeforeAssemblyPath = Path.GetFullPath("Catel.Fody.TestAssembly.dll");
AfterAssemblyPath = BeforeAssemblyPath.Replace(".dll", "2.dll");

Debug.WriteLine("Weaving assembly on-demand from '{0}' to '{1}'", BeforeAssemblyPath, AfterAssemblyPath);
var oldPdb = Path.ChangeExtension(BeforeAssemblyPath, "pdb");
var newPdb = Path.ChangeExtension(AfterAssemblyPath, "pdb");
if (File.Exists(oldPdb))
{
File.Copy(oldPdb, newPdb, true);
}

File.Copy(BeforeAssemblyPath, AfterAssemblyPath, true);
Debug.WriteLine("Weaving assembly on-demand from '{0}' to '{1}'", BeforeAssemblyPath, AfterAssemblyPath);

var assemblyResolver = new MockAssemblyResolver();
var moduleDefinition = ModuleDefinition.ReadModule(AfterAssemblyPath);
foreach (var referenceAssemblyPath in referenceAssemblyPaths)
{
//var directoryName = Path.GetDirectoryName(referenceAssemblyPath);
//assemblyResolver.AddSearchDirectory(directoryName);
}

var weavingTask = new ModuleWeaver
var readerParameters = new ReaderParameters
{
ModuleDefinition = moduleDefinition,
AssemblyResolver = assemblyResolver,
LogError = LogError,
ReadSymbols = File.Exists(oldPdb),
};

weavingTask.Execute();
moduleDefinition.Write(AfterAssemblyPath);
using (var moduleDefinition = ModuleDefinition.ReadModule(BeforeAssemblyPath, readerParameters))
{
var weavingTask = new ModuleWeaver
{
ModuleDefinition = moduleDefinition,
AssemblyResolver = assemblyResolver,
LogError = LogError,
};

weavingTask.Execute();
moduleDefinition.Write(AfterAssemblyPath);
}

if (Debugger.IsAttached)
{
Expand All @@ -69,12 +96,14 @@ static AssemblyWeaver()

Assembly = Assembly.LoadFile(AfterAssemblyPath);
}
#endregion
#endregion

#region Methods
private static void LogError(string error)
public static AssemblyWeaver Instance { get; private set; }

#region Methods
private void LogError(string error)
{
Errors.Add(error);
}
#endregion
#endregion
}
4 changes: 2 additions & 2 deletions src/Catel.Fody.Tests/CSharp6Facts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class CSharp6Facts
[TestCase]
public void AutoPropertyInitializer()
{
var type = AssemblyWeaver.Assembly.GetType("Catel.Fody.TestAssembly.CSharp6_AutoPropertyInitializer");
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.CSharp6_AutoPropertyInitializer");
var obj = (dynamic)Activator.CreateInstance(type);

Assert.IsNotNull(obj.SimpleModels);
Expand All @@ -18,7 +18,7 @@ public void AutoPropertyInitializer()
[TestCase]
public void AutoPropertyInitializer_Generic()
{
var type = AssemblyWeaver.Assembly.GetType("Catel.Fody.TestAssembly.CSharp6_AutoPropertyInitializer_Generic");
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.CSharp6_AutoPropertyInitializer_Generic");
var obj = (dynamic)Activator.CreateInstance(type);

Assert.IsNotNull(obj.SimpleModels);
Expand Down
2 changes: 1 addition & 1 deletion src/Catel.Fody.Tests/CTL504.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class CTL504
[TestCase]
public void PropertyWeavingDoesNotThrowException()
{
var type = AssemblyWeaver.Assembly.GetType("Catel.Fody.TestAssembly.CTL504_Model");
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.CTL504_Model");

var model = Activator.CreateInstance(type);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Catel.Fody.Tests/CTL569.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class CTL569
[TestCase]
public void WeavingCalculatedPropertiesWithExistingOverride()
{
var type = AssemblyWeaver.Assembly.GetType("Catel.Fody.TestAssembly.CTL569_ViewModel");
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.CTL569_ViewModel");

var vm = (INotifyPropertyChanged)Activator.CreateInstance(type);

Expand Down
2 changes: 1 addition & 1 deletion src/Catel.Fody.Tests/CTL768.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CTL768
[TestCase]
public void WeavingConstructors()
{
var type = AssemblyWeaver.Assembly.GetType("Catel.Fody.TestAssembly.CTL768_Model");
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.CTL768_Model");

var model = (INotifyPropertyChanged) Activator.CreateInstance(type, new [] { "test" });

Expand Down
4 changes: 2 additions & 2 deletions src/Catel.Fody.Tests/CTL908.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CTL908TestFixture
[TestCase]
public void WeavingConstructorWithString()
{
var type = AssemblyWeaver.Assembly.GetType("Catel.Fody.TestAssembly.CTL908");
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.CTL908");

var model = Activator.CreateInstance(type, new[] {"test"});

Expand All @@ -27,7 +27,7 @@ public void WeavingConstructorWithString()
[TestCase]
public void WeavingConstructorWithObject()
{
var type = AssemblyWeaver.Assembly.GetType("Catel.Fody.TestAssembly.CTL908");
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.CTL908");

var model = Activator.CreateInstance(type, new[] { new object() });

Expand Down
39 changes: 16 additions & 23 deletions src/Catel.Fody.Tests/Catel.Fody.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,26 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Catel.Core, Version=4.5.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.Core.4.5.3\lib\net45\Catel.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="Catel.Core, Version=4.5.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.Core.4.5.4\lib\net45\Catel.Core.dll</HintPath>
</Reference>
<Reference Include="Catel.MVVM, Version=4.5.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.MVVM.4.5.3\lib\net45\Catel.MVVM.dll</HintPath>
<Private>True</Private>
<Reference Include="Catel.MVVM, Version=4.5.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.MVVM.4.5.4\lib\net45\Catel.MVVM.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll</HintPath>
<Private>True</Private>
<Reference Include="Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll</HintPath>
<Private>True</Private>
<Reference Include="Mono.Cecil.Mdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll</HintPath>
<Private>True</Private>
<Reference Include="Mono.Cecil.Pdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll</HintPath>
<Private>True</Private>
<Reference Include="Mono.Cecil.Rocks, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\lib\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
Expand All @@ -74,7 +65,7 @@
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\lib\Catel.MVVM.4.5.3\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\..\lib\Catel.MVVM.4.5.4\lib\net45\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml" />
Expand Down Expand Up @@ -105,7 +96,9 @@
<Compile Include="ModelBaseFacts.cs" />
<Compile Include="ModelWithDoubleValuesFacts.cs" />
<Compile Include="NoWeavingFacts.cs" />
<Compile Include="PeVerifyFacts.cs" />
<Compile Include="TestClasses\MyEventArgs.cs" />
<Compile Include="Verifier.cs" />
<Compile Include="ViewModelBaseFacts.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading

0 comments on commit 4452e36

Please sign in to comment.