From 3e5ad21fb40f3d3330fbc54acfc56adcf664c0cc Mon Sep 17 00:00:00 2001 From: Phillip Haydon Date: Thu, 2 Aug 2018 11:58:03 +0800 Subject: [PATCH] updated projects to NETStandard 2.0 and changed build to run dotnet --- NVelocity.sln | 20 +- appveyor.yml | 28 +- src/NVelocity.Tests/App.config | 6 - .../ArithmeticExpressionTestCase.cs | 2 +- src/NVelocity.Tests/Bugs/NVelocity14.cs | 15 +- src/NVelocity.Tests/NVelocity.Tests.csproj | 460 +----------------- .../Properties/AssemblyInfo.cs | 36 -- src/NVelocity.Tests/Test/BaseTestCase.cs | 2 +- .../Test/MethodCallTestCase.cs | 2 +- .../Test/ObjectComparisonTestCase.cs | 2 +- src/NVelocity.Tests/packages.config | 4 - src/NVelocity/NVelocity.csproj | 227 +-------- src/NVelocity/Properties/AssemblyInfo.cs | 34 -- src/NVelocity/SupportClass.cs | 1 - 14 files changed, 73 insertions(+), 766 deletions(-) delete mode 100644 src/NVelocity.Tests/App.config delete mode 100644 src/NVelocity.Tests/Properties/AssemblyInfo.cs delete mode 100644 src/NVelocity.Tests/packages.config delete mode 100644 src/NVelocity/Properties/AssemblyInfo.cs diff --git a/NVelocity.sln b/NVelocity.sln index 4533d93..aafc81b 100644 --- a/NVelocity.sln +++ b/NVelocity.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27703.2042 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NVelocity", "src\NVelocity\NVelocity.csproj", "{E7B5F916-2E69-4BC4-BED9-3141327D7730}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NVelocity", "src\NVelocity\NVelocity.csproj", "{79A9E773-83C9-461B-8373-57439AA28A1A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NVelocity.Tests", "src\NVelocity.Tests\NVelocity.Tests.csproj", "{83D27619-C248-4EA5-9646-5B5CCD8E6B17}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NVelocity.Tests", "src\NVelocity.Tests\NVelocity.Tests.csproj", "{FCB6BF26-25C1-4E45-A506-FD4343B03CF9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -12,14 +12,14 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E7B5F916-2E69-4BC4-BED9-3141327D7730}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E7B5F916-2E69-4BC4-BED9-3141327D7730}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E7B5F916-2E69-4BC4-BED9-3141327D7730}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E7B5F916-2E69-4BC4-BED9-3141327D7730}.Release|Any CPU.Build.0 = Release|Any CPU - {83D27619-C248-4EA5-9646-5B5CCD8E6B17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {83D27619-C248-4EA5-9646-5B5CCD8E6B17}.Debug|Any CPU.Build.0 = Debug|Any CPU - {83D27619-C248-4EA5-9646-5B5CCD8E6B17}.Release|Any CPU.ActiveCfg = Release|Any CPU - {83D27619-C248-4EA5-9646-5B5CCD8E6B17}.Release|Any CPU.Build.0 = Release|Any CPU + {79A9E773-83C9-461B-8373-57439AA28A1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {79A9E773-83C9-461B-8373-57439AA28A1A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {79A9E773-83C9-461B-8373-57439AA28A1A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {79A9E773-83C9-461B-8373-57439AA28A1A}.Release|Any CPU.Build.0 = Release|Any CPU + {FCB6BF26-25C1-4E45-A506-FD4343B03CF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCB6BF26-25C1-4E45-A506-FD4343B03CF9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCB6BF26-25C1-4E45-A506-FD4343B03CF9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCB6BF26-25C1-4E45-A506-FD4343B03CF9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/appveyor.yml b/appveyor.yml index 1e4885f..6574b4a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,23 @@ -image: Visual Studio 2017 +image: + - Visual Studio 2017 + - Ubuntu + +skip_tags: false -before_build: - - nuget restore +init: + - ps: >- + if ($env:APPVEYOR_REPO_TAG -eq "true") + { + Update-AppveyorBuild -Version ($env:APPVEYOR_REPO_TAG_NAME).TrimStart("v") + } -build: - verbosity: minimal - project: NVelocity.sln - publish_nuget: false +build_script: + - dotnet build ./NVelocity.sln -c Release + +test_script: + - dotnet test ./src/NVelocity.Tests + +artifacts: + - path: build/*.nupkg + name: nvelocity + \ No newline at end of file diff --git a/src/NVelocity.Tests/App.config b/src/NVelocity.Tests/App.config deleted file mode 100644 index 4efb832..0000000 --- a/src/NVelocity.Tests/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/NVelocity.Tests/ArithmeticExpressionTestCase.cs b/src/NVelocity.Tests/ArithmeticExpressionTestCase.cs index c7587ea..dfecf4a 100644 --- a/src/NVelocity.Tests/ArithmeticExpressionTestCase.cs +++ b/src/NVelocity.Tests/ArithmeticExpressionTestCase.cs @@ -27,7 +27,7 @@ public class ArithmeticExpressionTestCase private VelocityEngine velocityEngine; private VelocityContext context; - [TestFixtureSetUp] + [SetUp] public void BeforeAnyTest() { velocityEngine = new VelocityEngine(); diff --git a/src/NVelocity.Tests/Bugs/NVelocity14.cs b/src/NVelocity.Tests/Bugs/NVelocity14.cs index 96ccf48..4d65000 100644 --- a/src/NVelocity.Tests/Bugs/NVelocity14.cs +++ b/src/NVelocity.Tests/Bugs/NVelocity14.cs @@ -26,7 +26,7 @@ namespace NVelocity.Tests.Bugs [TestFixture] public class NVelocity14 : BaseTestCase { - [Test, ExpectedException(typeof(ParseErrorException))] + [Test] public void Test() { var velocityEngine = new VelocityEngine(); @@ -35,17 +35,8 @@ public void Test() extendedProperties.SetProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TemplateTest.FILE_RESOURCE_LOADER_PATH); velocityEngine.Init(extendedProperties); - - VelocityContext context = new VelocityContext(); - - Template template = velocityEngine.GetTemplate( - GetFileName(null, "nv14", TemplateTest.TMPL_FILE_EXT)); - - StringWriter writer = new StringWriter(); - - template.Merge(context, writer); - - Console.WriteLine(writer); + + Assert.Throws(() => velocityEngine.GetTemplate(GetFileName(null, "nv14", TemplateTest.TMPL_FILE_EXT))); } } } diff --git a/src/NVelocity.Tests/NVelocity.Tests.csproj b/src/NVelocity.Tests/NVelocity.Tests.csproj index ad54893..9b1c07c 100644 --- a/src/NVelocity.Tests/NVelocity.Tests.csproj +++ b/src/NVelocity.Tests/NVelocity.Tests.csproj @@ -1,451 +1,25 @@ - - - + + - Debug - AnyCPU - {83D27619-C248-4EA5-9646-5B5CCD8E6B17} - Library - Properties - NVelocity.Tests - NVelocity.Tests - v4.7.2 - 512 - - + netcoreapp2.0 + TargetFrameworkOverride + + true + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\packages\NUnit.2.6.7\lib\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - + + + + - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - + + - - {e7b5f916-2e69-4bc4-bed9-3141327d7730} - NVelocity - + - - \ No newline at end of file + + diff --git a/src/NVelocity.Tests/Properties/AssemblyInfo.cs b/src/NVelocity.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index a8d5620..0000000 --- a/src/NVelocity.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("NVelocity.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NVelocity.Tests")] -[assembly: AssemblyCopyright("Copyright © 2018")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("83d27619-c248-4ea5-9646-5b5ccd8e6b17")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/NVelocity.Tests/Test/BaseTestCase.cs b/src/NVelocity.Tests/Test/BaseTestCase.cs index dc62623..43dfc02 100644 --- a/src/NVelocity.Tests/Test/BaseTestCase.cs +++ b/src/NVelocity.Tests/Test/BaseTestCase.cs @@ -68,7 +68,7 @@ public struct TemplateTest static TemplateTest() { - FILE_RESOURCE_LOADER_PATH = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.Combine(ConfigurationManager.AppSettings["tests.src"], "templates")); + FILE_RESOURCE_LOADER_PATH = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "templates"); TEST_CASE_PROPERTIES = Path.Combine(FILE_RESOURCE_LOADER_PATH, "templates.properties"); RESULT_DIR = Path.Combine(FILE_RESOURCE_LOADER_PATH, "results"); COMPARE_DIR = Path.Combine(FILE_RESOURCE_LOADER_PATH, "compare"); diff --git a/src/NVelocity.Tests/Test/MethodCallTestCase.cs b/src/NVelocity.Tests/Test/MethodCallTestCase.cs index 7e17d97..0d4d809 100644 --- a/src/NVelocity.Tests/Test/MethodCallTestCase.cs +++ b/src/NVelocity.Tests/Test/MethodCallTestCase.cs @@ -28,7 +28,7 @@ public class MethodCallTestCase private VelocityEngine velocityEngine; private VelocityContext c; - [TestFixtureSetUp] + [SetUp] public void StartNVelocity() { velocityEngine = new VelocityEngine(); diff --git a/src/NVelocity.Tests/Test/ObjectComparisonTestCase.cs b/src/NVelocity.Tests/Test/ObjectComparisonTestCase.cs index 17e4a06..33c05cb 100644 --- a/src/NVelocity.Tests/Test/ObjectComparisonTestCase.cs +++ b/src/NVelocity.Tests/Test/ObjectComparisonTestCase.cs @@ -69,7 +69,7 @@ public class ObjectComparisonTestCase private VelocityEngine ve; private VelocityContext ctx; - [TestFixtureSetUp] + [SetUp] public void SetUp() { ve = new VelocityEngine(); diff --git a/src/NVelocity.Tests/packages.config b/src/NVelocity.Tests/packages.config deleted file mode 100644 index 2fa127a..0000000 --- a/src/NVelocity.Tests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/NVelocity/NVelocity.csproj b/src/NVelocity/NVelocity.csproj index df305a5..037fa5e 100644 --- a/src/NVelocity/NVelocity.csproj +++ b/src/NVelocity/NVelocity.csproj @@ -1,218 +1,27 @@ - - - + + - Debug - AnyCPU - {E7B5F916-2E69-4BC4-BED9-3141327D7730} - Library - Properties - NVelocity + NVelocity + 0.0.0 + $(APPVEYOR_BUILD_VERSION) + True + ../../build/ NVelocity - v4.7.2 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true + NVelocity + NVelocity + NVelocity is a port of the excellent Apache Jakarta Velocity project. It is a very simple, easy to learn and extensible template engine. + ..\..\buildscripts\CastleKey.snk + True + nvelocity + - ..\..\buildscripts\CastleKey.snk + netstandard2.0 - - - - - - - - - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - \ No newline at end of file + + diff --git a/src/NVelocity/Properties/AssemblyInfo.cs b/src/NVelocity/Properties/AssemblyInfo.cs deleted file mode 100644 index 0914d41..0000000 --- a/src/NVelocity/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("NVelocity")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyProduct("NVelocity")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("e7b5f916-2e69-4bc4-bed9-3141327d7730")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/NVelocity/SupportClass.cs b/src/NVelocity/SupportClass.cs index 83f7e61..771d635 100644 --- a/src/NVelocity/SupportClass.cs +++ b/src/NVelocity/SupportClass.cs @@ -17,7 +17,6 @@ namespace NVelocity using System; using System.Collections; using System.Data; - using System.Data.OleDb; using System.Globalization; using System.IO; using System.Reflection;