Skip to content

Commit

Permalink
Merge pull request amaggiulli#231 from potatman/develop
Browse files Browse the repository at this point in the history
Making all projects dotnet standard/coreapp.  (Changes minimum framework to net 4.5.1)
  • Loading branch information
amaggiulli authored May 3, 2019
2 parents 6d0024d + 37dfa23 commit 1c28fa0
Show file tree
Hide file tree
Showing 95 changed files with 634 additions and 653 deletions.
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
nuget:
disable_publish_on_pr: true
before_build:
- cmd: "choco install msbuild-sonarqube-runner --version 2.3 -y\ndotnet restore qlnet.sln\ndotnet clean qlnet.sln\nSET runner_args=\"\"\nif \"%APPVEYOR_PULL_REQUEST_NUMBER%\"==\"\" SET runner_args=%sonar_commit% \nif not \"%APPVEYOR_PULL_REQUEST_NUMBER%\"==\"\" SET runner_args=%sonar_pr% \nMSBuild.SonarQube.Runner.exe begin %runner_args%\nmsbuild qlnet.sln /p:TargetFrameworkVersion=v4.5 /p:TargetFrameworks=net45 /p:Configuration=Debug /logger:\"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll\" /target:src\\qlnet > log.txt\nMSBuild.SonarQube.Runner.exe end /d:\"sonar.login=%sonar_token%\""
- cmd: "choco install msbuild-sonarqube-runner --version 2.3 -y\ndotnet restore qlnet.sln\ndotnet clean qlnet.sln\nSET runner_args=\"\"\nif \"%APPVEYOR_PULL_REQUEST_NUMBER%\"==\"\" SET runner_args=%sonar_commit% \nif not \"%APPVEYOR_PULL_REQUEST_NUMBER%\"==\"\" SET runner_args=%sonar_pr% \nMSBuild.SonarQube.Runner.exe begin %runner_args%\nmsbuild qlnet.sln /p:TargetFrameworkVersion=v4.5.2 /p:TargetFrameworks=net452 /p:Configuration=Debug /logger:\"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll\" /target:src\\qlnet > log.txt\nMSBuild.SonarQube.Runner.exe end /d:\"sonar.login=%sonar_token%\""
build:
project: QLNet.sln
verbosity: minimal
Expand All @@ -79,7 +79,7 @@
file_version: '{version}'
informational_version: '{version}'
test_script:
- cmd: vstest.console /logger:Appveyor /TestCaseFilter:"TestCategory!=LongRun" "c:\projects\qlnet_develop\tests\QLNet.Tests\bin\Debug\net45\QLNet.Tests.dll"
- cmd: vstest.console /logger:Appveyor /TestCaseFilter:"TestCategory!=LongRun" "c:\projects\qlnet_develop\tests\QLNet.Tests\bin\Debug\net452\QLNet.Tests.dll"
deploy:
- provider: NuGet
api_key:
Expand Down
2 changes: 1 addition & 1 deletion src/BermudanSwaption/BermudanSwaption.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>BermudanSwaption</AssemblyName>
<PackageId>BermudanSwaption</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/Bonds/Bonds.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>Bonds</AssemblyName>
<PackageId>Bonds</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/CVAIRS/CVAIRS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>CVAIRS</AssemblyName>
<PackageId>CVAIRS</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/CallableBonds/CallableBonds.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>CallableBonds</AssemblyName>
<PackageId>CallableBonds</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/ConvertibleBonds/ConvertibleBonds.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>ConvertibleBonds</AssemblyName>
<PackageId>ConvertibleBonds</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/EquityOption/EquityOption.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>EquityOption</AssemblyName>
<PackageId>EquityOption</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/FRA/FRA.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>FRA</AssemblyName>
<PackageId>FRA</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/FittedBondCurve/FittedBondCurve.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>FittedBondCurve</AssemblyName>
<PackageId>FittedBondCurve</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/QLNet/Patterns/FastActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static class DynamicModuleLambdaCompiler
Expression<Func<T>> expr = () => new T();
NewExpression newExpr = (NewExpression)expr.Body;

#if NET40 || NET45
#if NET452
var method = new DynamicMethod(
name: "lambda",
returnType: newExpr.Type,
Expand Down
6 changes: 3 additions & 3 deletions src/QLNet/Patterns/WeakEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private static OpenEventHandler CreateOpenHandler(MethodInfo method)
public WeakDelegate(Delegate handler)
{
_weakTarget = handler.Target != null ? new WeakReference(handler.Target) : null;
#if NET40 || NET45
#if NET452
_method = handler.Method;
#else
_method = handler.GetMethodInfo();
Expand All @@ -141,7 +141,7 @@ public bool Invoke()

public bool IsMatch(Callback handler)
{
#if NET40 || NET45
#if NET452
return _weakTarget.Target != null && (ReferenceEquals(handler.Target, _weakTarget.Target)
&& handler.Method.Equals(_method));
#else
Expand All @@ -152,4 +152,4 @@ public bool IsMatch(Callback handler)
}
}
}
}
}
22 changes: 2 additions & 20 deletions src/QLNet/QLNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

<PropertyGroup>
<VersionPrefix>1.11.2</VersionPrefix>
<TargetFrameworks>net45;net40;netstandard2.0;netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>net452;netstandard1.2;netstandard2.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>QLNet</AssemblyName>
<PackageId>QLNet</PackageId>
<PackageVersion>1.11.2</PackageVersion>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard1.6' ">1.6.0</NetStandardImplicitPackageVersion>
<Authors>Andrea Maggiulli</Authors>
<Company />
<Description>A free/open-source library for quantitative finance</Description>
Expand All @@ -18,24 +16,8 @@
<PackageTags>QLNet QuantLib quantitative finance financial</PackageTags>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System.Numerics" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
<Reference Include="System.Numerics" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.0.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<ItemGroup>
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/QLNet/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static MethodInfo GetMethodInfo(Object t, String function, Type[] types
MethodInfo methodInfo;
if (types == null)
types = new Type[0];
#if NET40 || NET45
#if NET452
methodInfo = t.GetType().GetMethod(function, types);
#else
methodInfo = t.GetType().GetRuntimeMethod(function, types);
Expand Down
2 changes: 1 addition & 1 deletion src/Repo/Repo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>Repo</AssemblyName>
<PackageId>Repo</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/Swap/Swap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionPrefix>1.11.0</VersionPrefix>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<DefineConstants>$(DefineConstants);QL_NEGATIVE_RATES</DefineConstants>
<AssemblyName>Swap</AssemblyName>
<PackageId>Swap</PackageId>
Expand Down
3 changes: 1 addition & 2 deletions tests/QLNet.Tests/QLNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

<PropertyGroup>
<VersionPrefix>1.10.0</VersionPrefix>
<TargetFramework>net45</TargetFramework>
<TargetFrameworks>net452</TargetFrameworks>
<AssemblyName>QLNet.Tests</AssemblyName>
<PackageId>QLNet.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
20 changes: 10 additions & 10 deletions tests/QLNet.Tests/T_AmericanOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ under the terms of the QLNet license. You should have received a
using System;
using System.Collections.Generic;
using System.Linq;
#if NET40 || NET45
#if NET452
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using Xunit;
Expand Down Expand Up @@ -60,7 +60,7 @@ public AmericanOptionData(Option.Type type_,
result = result_;
}
}
#if NET40 || NET45
#if NET452
[TestClass()]
#endif
public class T_AmericanOption
Expand Down Expand Up @@ -140,7 +140,7 @@ Journal of Derivatives Winter 1999
new AmericanOptionData(Option.Type.Call, 100.00, 120.00, 0.03, 0.07, 3.0, 0.3, 37.177)
};

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -244,7 +244,7 @@ The following values were replicated only up to the second digit
}
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -319,7 +319,7 @@ public void testBjerksundStenslandValues()
}
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -375,7 +375,7 @@ public void testJuValues()
}
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -558,7 +558,7 @@ public void testFdValues()
}
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand All @@ -569,7 +569,7 @@ public void testFdAmericanGreeks()
testFdGreeks<FDAmericanEngine>();
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -599,7 +599,7 @@ void REPORT_FAILURE(string greekName, StrikedTypePayoff payoff, Exercise exercis
+ " tolerance: " + tolerance);
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -635,7 +635,7 @@ public void testFdImpliedVol()
QAssert.Fail(string.Format("Implied volatility calculation failed. Expected {0}. Actual {1}", volatility, impliedVol));
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down
14 changes: 7 additions & 7 deletions tests/QLNet.Tests/T_AsianOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ under the terms of the QLNet license. You should have received a
using System;
using System.Collections.Generic;
using System.Linq;
#if NET40 || NET45
#if NET452
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using Xunit;
Expand All @@ -30,7 +30,7 @@ under the terms of the QLNet license. You should have received a

namespace TestSuite
{
#if NET40 || NET45
#if NET452
[TestClass()]
#endif
public class T_AsianOptions
Expand Down Expand Up @@ -79,7 +79,7 @@ public string averageTypeToString(Average.Type averageType)
return String.Empty;
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -162,7 +162,7 @@ public void testAnalyticContinuousGeometricAveragePrice()

}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -327,7 +327,7 @@ public void testAnalyticContinuousGeometricAveragePriceGreeks()
}
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -390,7 +390,7 @@ public void testAnalyticDiscreteGeometricAveragePrice()
}
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down Expand Up @@ -522,7 +522,7 @@ public void testMCDiscreteGeometricAveragePrice()
}
}

#if NET40 || NET45
#if NET452
[TestMethod()]
#else
[Fact]
Expand Down
Loading

0 comments on commit 1c28fa0

Please sign in to comment.