diff options
author | Jon Skeet <jonskeet@google.com> | 2017-05-04 08:51:46 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2017-05-24 09:07:33 +0100 |
commit | f26e8c2ae0a490399f7e77d96193f2851b185b56 (patch) | |
tree | 2d3f4f182126b69148d55a2fd306a4842c64161f /csharp/compatibility_tests/v3.0.0 | |
parent | 40da1ed572d60e9c7cc2fe1ca4175e30682f5a9d (diff) | |
download | protobuf-f26e8c2ae0a490399f7e77d96193f2851b185b56.tar.gz protobuf-f26e8c2ae0a490399f7e77d96193f2851b185b56.tar.bz2 protobuf-f26e8c2ae0a490399f7e77d96193f2851b185b56.zip |
Convert C# projects to MSBuild (csproj) format
This has one important packaging change: the netstandard version now
depends (implicitly) on netstandard1.6.1 rather than on individual
packages. This is the preferred style of dependency, and shouldn't
affect any users - see http://stackoverflow.com/questions/42946951
for details.
The tests are still NUnit, but NUnit doesn't support "dotnet test"
yet; the test project is now an executable using NUnitLite. (When
NUnit supports dotnet test, we can adapt to it.)
Note that the project will now only work in Visual Studio 2017 (and
Visual Studio Code, and from the command line with the .NET Core
1.0.0 SDK); Visual Studio 2015 does *not* support this project file
format.
Diffstat (limited to 'csharp/compatibility_tests/v3.0.0')
5 files changed, 82 insertions, 66 deletions
diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj new file mode 100644 index 00000000..06d07b9f --- /dev/null +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj @@ -0,0 +1,30 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks> + <AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile> + <SignAssembly>true</SignAssembly> + <PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign> + <IsPackable>False</IsPackable> + </PropertyGroup> + + <ItemGroup> + <ProjectReference Include="..\Google.Protobuf\Google.Protobuf.csproj" /> + </ItemGroup> + + <ItemGroup> + <PackageReference Include="NUnit" Version="3.6.1" /> + <PackageReference Include="NUnitLite" Version="3.6.1" /> + </ItemGroup> + + <!-- + - Override target frameworks on non-Windows to just .NET Core + - Doing this conditionally in the initial PropertyGroup confuses + - Visual Studio. + --> + <PropertyGroup Condition="'$(OS)' != 'Windows_NT'"> + <TargetFrameworks>netcoreapp1.0</TargetFrameworks> + </PropertyGroup> + +</Project> diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj deleted file mode 100644 index a9a1cc04..00000000 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> - <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> - </PropertyGroup> - <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> - <PropertyGroup Label="Globals"> - <ProjectGuid>580eb013-d3c7-4578-b845-015f4a3b0591</ProjectGuid> - <RootNamespace>Google.Protobuf.Test</RootNamespace> - <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> - <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> - </PropertyGroup> - - <PropertyGroup> - <SchemaVersion>2.0</SchemaVersion> - </PropertyGroup> - <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" /> -</Project>
\ No newline at end of file diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs new file mode 100644 index 00000000..9078e59b --- /dev/null +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs @@ -0,0 +1,47 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using NUnitLite; +using System.Reflection; + +// Note: this file wasn't in the actual 3.0, but is required due to build +// system changes + +namespace Google.Protobuf.Test +{ + class Program + { + public static int Main(string[] args) + { + return new AutoRun(typeof(Program).GetTypeInfo().Assembly).Execute(args); + } + } +}
\ No newline at end of file diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/project.json b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/project.json deleted file mode 100644 index 87b732c9..00000000 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/project.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "buildOptions": { - "debugType": "portable", - "keyFile": "../../keys/Google.Protobuf.snk" - }, - - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "DEBUG", "TRACE" ] - } - }, - "Release": { - "buildOptions": { - "define": [ "RELEASE", "TRACE" ], - "optimize": true - } - } - }, - - "dependencies": { - "Google.Protobuf": { "target": "project" }, - "NUnit": "3.4.0", - "dotnet-test-nunit": "3.4.0-alpha-2", - }, - - "testRunner": "nunit", - - "frameworks": { - "netcoreapp1.0": { - "imports" : [ "dnxcore50", "netcoreapp1.0", "portable-net45+win8" ], - "buildOptions": { - "define": [ "PCL" ] - }, - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.0.0", - "type": "platform" - }, - "System.Console": "4.0.0" - } - } - } -}
\ No newline at end of file diff --git a/csharp/compatibility_tests/v3.0.0/test.sh b/csharp/compatibility_tests/v3.0.0/test.sh index bb04fc2c..54d28dfc 100755 --- a/csharp/compatibility_tests/v3.0.0/test.sh +++ b/csharp/compatibility_tests/v3.0.0/test.sh @@ -18,8 +18,11 @@ function run_test() { protos/src/google/protobuf/map_unittest_proto3.proto # Build and test. - dotnet build -c release src/Google.Protobuf src/Google.Protobuf.Test - dotnet test -c release -f netcoreapp1.0 src/Google.Protobuf.Test + dotnet restore src/Google.Protobuf/Google.Protobuf.csproj + dotnet restore src/Google.Protobuf.Test/Google.Protobuf.Test.csproj + dotnet build -c Release src/Google.Protobuf/Google.Protobuf.csproj + dotnet build -c Release src/Google.Protobuf.Test/Google.Protobuf.Test.csproj + dotnet run -c Release -f netcoreapp1.0 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj } set -ex @@ -72,7 +75,6 @@ chmod +x old_protoc # Copy the new runtime and keys. cp ../../src/Google.Protobuf src/Google.Protobuf -r cp ../../keys . -r -dotnet restore # Test A.1: # proto set 1: use old version |