From f26e8c2ae0a490399f7e77d96193f2851b185b56 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Thu, 4 May 2017 08:51:46 +0100 Subject: [PATCH] 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. --- .travis.yml | 3 + Makefile.am | 21 +++--- appveyor.bat | 8 ++- appveyor.yml | 3 +- csharp/build_packages.bat | 4 +- csharp/buildall.sh | 5 +- .../Google.Protobuf.Test.csproj | 30 +++++++++ .../Google.Protobuf.Test.xproj | 19 ------ .../src/Google.Protobuf.Test/Program.cs | 47 ++++++++++++++ .../src/Google.Protobuf.Test/project.json | 44 ------------- csharp/compatibility_tests/v3.0.0/test.sh | 8 ++- csharp/global.json | 5 ++ csharp/src/AddressBook/AddressBook.csproj | 14 ++++ csharp/src/AddressBook/AddressBook.xproj | 19 ------ csharp/src/AddressBook/project.json | 20 ------ .../Google.Protobuf.Conformance.csproj | 14 ++++ .../Google.Protobuf.Conformance.xproj | 19 ------ .../Google.Protobuf.Conformance/project.json | 21 ------ .../Google.Protobuf.JsonDump.csproj | 13 ++++ .../Google.Protobuf.JsonDump.xproj | 19 ------ .../src/Google.Protobuf.JsonDump/project.json | 19 ------ .../Google.Protobuf.Test.csproj | 30 +++++++++ .../Google.Protobuf.Test.xproj | 21 ------ csharp/src/Google.Protobuf.Test/Program.cs | 44 +++++++++++++ csharp/src/Google.Protobuf.Test/project.json | 45 ------------- csharp/src/Google.Protobuf.sln | 16 ++--- .../Google.Protobuf/Google.Protobuf.csproj | 32 +++++++++ .../src/Google.Protobuf/Google.Protobuf.xproj | 19 ------ csharp/src/Google.Protobuf/project.json | 65 ------------------- csharp/src/global.json | 5 -- csharp/src/packages/repositories.config | 4 -- jenkins/docker/Dockerfile | 2 +- tests.sh | 19 +----- 33 files changed, 269 insertions(+), 388 deletions(-) create mode 100644 csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj delete mode 100644 csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj create mode 100644 csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs delete mode 100644 csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/project.json create mode 100644 csharp/global.json create mode 100644 csharp/src/AddressBook/AddressBook.csproj delete mode 100644 csharp/src/AddressBook/AddressBook.xproj delete mode 100644 csharp/src/AddressBook/project.json create mode 100644 csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj delete mode 100644 csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj delete mode 100644 csharp/src/Google.Protobuf.Conformance/project.json create mode 100644 csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj delete mode 100644 csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj delete mode 100644 csharp/src/Google.Protobuf.JsonDump/project.json create mode 100644 csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj delete mode 100644 csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj create mode 100644 csharp/src/Google.Protobuf.Test/Program.cs delete mode 100644 csharp/src/Google.Protobuf.Test/project.json create mode 100644 csharp/src/Google.Protobuf/Google.Protobuf.csproj delete mode 100644 csharp/src/Google.Protobuf/Google.Protobuf.xproj delete mode 100644 csharp/src/Google.Protobuf/project.json delete mode 100644 csharp/src/global.json delete mode 100644 csharp/src/packages/repositories.config diff --git a/.travis.yml b/.travis.yml index 8f6f90de62..d49e0a7131 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,10 @@ matrix: # autogenerated matrix. - os: linux env: CONFIG=csharp + language: csharp dist: trusty + dotnet: 1.0.1 + mono: none # This test is kept on travis because it doesn't play nicely with other # tests on jenkins running in parallel. - os: linux diff --git a/Makefile.am b/Makefile.am index 023afa4059..3c3ca13dab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,6 +57,7 @@ csharp_EXTRA_DIST= \ csharp/build_tools.sh \ csharp/buildall.sh \ csharp/generate_protos.sh \ + csharp/global.json \ csharp/keys/Google.Protobuf.public.snk \ csharp/keys/Google.Protobuf.snk \ csharp/keys/README.md \ @@ -64,18 +65,15 @@ csharp_EXTRA_DIST= \ csharp/protos/unittest_issues.proto \ csharp/src/AddressBook/AddPerson.cs \ csharp/src/AddressBook/Addressbook.cs \ - csharp/src/AddressBook/AddressBook.xproj \ + csharp/src/AddressBook/AddressBook.csproj \ csharp/src/AddressBook/ListPeople.cs \ csharp/src/AddressBook/Program.cs \ csharp/src/AddressBook/SampleUsage.cs \ - csharp/src/AddressBook/project.json \ csharp/src/Google.Protobuf.Conformance/Conformance.cs \ - csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj \ + csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj \ csharp/src/Google.Protobuf.Conformance/Program.cs \ - csharp/src/Google.Protobuf.Conformance/project.json \ - csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj \ + csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj \ csharp/src/Google.Protobuf.JsonDump/Program.cs \ - csharp/src/Google.Protobuf.JsonDump/project.json \ csharp/src/Google.Protobuf.Test/ByteStringTest.cs \ csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs \ csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs \ @@ -89,11 +87,12 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/EqualityTester.cs \ csharp/src/Google.Protobuf.Test/FieldCodecTest.cs \ csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs \ - csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj \ + csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj \ csharp/src/Google.Protobuf.Test/IssuesTest.cs \ csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs \ csharp/src/Google.Protobuf.Test/JsonParserTest.cs \ csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs \ + csharp/src/Google.Protobuf.Test/Program.cs \ csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs \ @@ -115,7 +114,6 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs \ - csharp/src/Google.Protobuf.Test/project.json \ csharp/src/Google.Protobuf.sln \ csharp/src/Google.Protobuf/ByteArray.cs \ csharp/src/Google.Protobuf/ByteString.cs \ @@ -130,7 +128,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs \ csharp/src/Google.Protobuf/FieldCodec.cs \ csharp/src/Google.Protobuf/FrameworkPortability.cs \ - csharp/src/Google.Protobuf/Google.Protobuf.xproj \ + csharp/src/Google.Protobuf/Google.Protobuf.csproj \ csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs \ csharp/src/Google.Protobuf/IDeepCloneable.cs \ csharp/src/Google.Protobuf/IMessage.cs \ @@ -190,10 +188,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs \ csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs \ csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs \ - csharp/src/Google.Protobuf/WireFormat.cs \ - csharp/src/Google.Protobuf/project.json \ - csharp/src/global.json \ - csharp/src/packages/repositories.config + csharp/src/Google.Protobuf/WireFormat.cs java_EXTRA_DIST= \ java/README.md \ diff --git a/appveyor.bat b/appveyor.bat index 916f4434fe..ca88b25c3e 100644 --- a/appveyor.bat +++ b/appveyor.bat @@ -19,11 +19,15 @@ goto :EOF :build_csharp echo Building C# cd csharp\src +REM The platform environment variable is implicitly used by msbuild; +REM we don't want it. +set platform= dotnet restore -dotnet build -c %configuration% Google.Protobuf Google.Protobuf.Test Google.Protobuf.Conformance || goto error +dotnet build -c %configuration% || goto error echo Testing C# -dotnet test -c %configuration% Google.Protobuf.Test || goto error +dotnet run -c %configuration% -f netcoreapp1.0 -p Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error +dotnet run -c %configuration% -f net451 -p Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error goto :EOF diff --git a/appveyor.yml b/appveyor.yml index 08d087b699..8b440b6396 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,6 +14,7 @@ environment: UNICODE: ON - language: csharp + image: Visual Studio 2017 # Our build scripts run tests automatically; we don't want AppVeyor # to try to detect them itself. @@ -29,8 +30,6 @@ install: - del /Q release-1.7.0.zip - rename googletest-release-1.7.0 gtest - move gtest gmock - - curl -L -o dotnetsdk.exe "https://go.microsoft.com/fwlink/?LinkID=809122" - - dotnetsdk.exe /install /quiet /norestart before_build: - if %platform%==Win32 set generator=Visual Studio 12 diff --git a/csharp/build_packages.bat b/csharp/build_packages.bat index 37732e7c66..d7205659f1 100644 --- a/csharp/build_packages.bat +++ b/csharp/build_packages.bat @@ -1,7 +1,7 @@ @rem Builds Google.Protobuf NuGet packages -dotnet restore src -dotnet pack -c Release src\Google.Protobuf || goto :error +dotnet restore src/Google.Protobuf.sln +dotnet pack -c Release src/Google.Protobuf.sln || goto :error goto :EOF diff --git a/csharp/buildall.sh b/csharp/buildall.sh index cab3222992..dd4b463ddf 100755 --- a/csharp/buildall.sh +++ b/csharp/buildall.sh @@ -6,11 +6,12 @@ SRC=$(dirname $0)/src set -ex echo Building relevant projects. -dotnet build -c $CONFIG $SRC/Google.Protobuf $SRC/Google.Protobuf.Test $SRC/Google.Protobuf.Conformance +dotnet restore $SRC/Google.Protobuf.sln +dotnet build -c $CONFIG $SRC/Google.Protobuf.sln echo Running tests. # Only test netcoreapp1.0, which uses the .NET Core runtime. # If we want to test the .NET 4.5 version separately, we could # run Mono explicitly. However, we don't have any differences between # the .NET 4.5 and netstandard1.0 assemblies. -dotnet test -c $CONFIG -f netcoreapp1.0 $SRC/Google.Protobuf.Test +dotnet run -c $CONFIG -f netcoreapp1.0 -p $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj 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 0000000000..06d07b9f4a --- /dev/null +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj @@ -0,0 +1,30 @@ + + + + Exe + net451;netcoreapp1.0 + ../../keys/Google.Protobuf.snk + true + true + False + + + + + + + + + + + + + + netcoreapp1.0 + + + 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 a9a1cc0495..0000000000 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 580eb013-d3c7-4578-b845-015f4a3b0591 - Google.Protobuf.Test - .\obj - .\bin\ - - - - 2.0 - - - \ 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 0000000000..9078e59b1d --- /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 87b732c9b5..0000000000 --- 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 bb04fc2c59..54d28dfc26 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 diff --git a/csharp/global.json b/csharp/global.json new file mode 100644 index 0000000000..3622b56494 --- /dev/null +++ b/csharp/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "1.0.0" + } +} diff --git a/csharp/src/AddressBook/AddressBook.csproj b/csharp/src/AddressBook/AddressBook.csproj new file mode 100644 index 0000000000..6edfdcabb3 --- /dev/null +++ b/csharp/src/AddressBook/AddressBook.csproj @@ -0,0 +1,14 @@ + + + + netcoreapp1.0 + Exe + Google.Protobuf.Examples.AddressBook.Program + False + + + + + + + diff --git a/csharp/src/AddressBook/AddressBook.xproj b/csharp/src/AddressBook/AddressBook.xproj deleted file mode 100644 index 4c9925e83d..0000000000 --- a/csharp/src/AddressBook/AddressBook.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - afb63919-1e05-43b4-802a-8fb8c9b2f463 - AddressBook - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/csharp/src/AddressBook/project.json b/csharp/src/AddressBook/project.json deleted file mode 100644 index c500bdc296..0000000000 --- a/csharp/src/AddressBook/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "buildOptions": { - "debugType": "portable", - "emitEntryPoint": true, - "additionalArguments": [ "/main:Google.Protobuf.Examples.AddressBook.Program" ] - }, - "dependencies": { - "Google.Protobuf": { "target": "project" } - }, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj new file mode 100644 index 0000000000..b654c0b2cf --- /dev/null +++ b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj @@ -0,0 +1,14 @@ + + + + netcoreapp1.0 + Exe + False + + + + + + + + diff --git a/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj deleted file mode 100644 index 99ff146538..0000000000 --- a/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - dddc055b-e185-4181-bab0-072f0f984569 - Google.Protobuf.Conformance - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/csharp/src/Google.Protobuf.Conformance/project.json b/csharp/src/Google.Protobuf.Conformance/project.json deleted file mode 100644 index 4cf0523135..0000000000 --- a/csharp/src/Google.Protobuf.Conformance/project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "buildOptions": { - "debugType": "portable", - "emitEntryPoint": true - }, - "dependencies": { - "Google.Protobuf": { "target": "project" }, - "Google.Protobuf.Test": { "target": "project" } - }, - "frameworks": { - "netcoreapp1.0": { - "imports": [ "dnxcore50", "netcoreapp1.0", "portable-net45+win8" ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj b/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj new file mode 100644 index 0000000000..4eda641ad6 --- /dev/null +++ b/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj @@ -0,0 +1,13 @@ + + + + netcoreapp1.0 + Exe + False + + + + + + + diff --git a/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj b/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj deleted file mode 100644 index 27095be5b3..0000000000 --- a/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 9695e08f-9829-497d-b95c-b38f28d48690 - Google.Protobuf.JsonDump - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/csharp/src/Google.Protobuf.JsonDump/project.json b/csharp/src/Google.Protobuf.JsonDump/project.json deleted file mode 100644 index 84b23c456d..0000000000 --- a/csharp/src/Google.Protobuf.JsonDump/project.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "buildOptions": { - "debugType": "portable", - "emitEntryPoint": true - }, - "dependencies": { - "Google.Protobuf": { "target": "project" } - }, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj new file mode 100644 index 0000000000..06d07b9f4a --- /dev/null +++ b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj @@ -0,0 +1,30 @@ + + + + Exe + net451;netcoreapp1.0 + ../../keys/Google.Protobuf.snk + true + true + False + + + + + + + + + + + + + + netcoreapp1.0 + + + diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj deleted file mode 100644 index 6370441ebb..0000000000 --- a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 580eb013-d3c7-4578-b845-015f4a3b0591 - Google.Protobuf.Test - .\obj - .\bin\ - - - 2.0 - - - - - - \ No newline at end of file diff --git a/csharp/src/Google.Protobuf.Test/Program.cs b/csharp/src/Google.Protobuf.Test/Program.cs new file mode 100644 index 0000000000..6e4daac93e --- /dev/null +++ b/csharp/src/Google.Protobuf.Test/Program.cs @@ -0,0 +1,44 @@ +#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; + +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/src/Google.Protobuf.Test/project.json b/csharp/src/Google.Protobuf.Test/project.json deleted file mode 100644 index dff0ab7309..0000000000 --- a/csharp/src/Google.Protobuf.Test/project.json +++ /dev/null @@ -1,45 +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" }, - "dotnet-test-nunit": "3.4.0-beta-3", - "NUnit": "3.6.0" - }, - - "testRunner": "nunit", - - "frameworks": { - "net451": {}, - "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" - } - } - } -} diff --git a/csharp/src/Google.Protobuf.sln b/csharp/src/Google.Protobuf.sln index 3c62bba334..443ee3e93e 100644 --- a/csharp/src/Google.Protobuf.sln +++ b/csharp/src/Google.Protobuf.sln @@ -1,16 +1,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 14.0.24720.0 -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AddressBook", "AddressBook\AddressBook.xproj", "{AFB63919-1E05-43B4-802A-8FB8C9B2F463}" +# Visual Studio 15 +VisualStudioVersion = 15.0.26114.2 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddressBook", "AddressBook\AddressBook.csproj", "{AFB63919-1E05-43B4-802A-8FB8C9B2F463}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf", "Google.Protobuf\Google.Protobuf.xproj", "{9B576380-726D-4142-8238-60A43AB0E35A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf", "Google.Protobuf\Google.Protobuf.csproj", "{9B576380-726D-4142-8238-60A43AB0E35A}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf.Test", "Google.Protobuf.Test\Google.Protobuf.Test.xproj", "{580EB013-D3C7-4578-B845-015F4A3B0591}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.Test", "Google.Protobuf.Test\Google.Protobuf.Test.csproj", "{580EB013-D3C7-4578-B845-015F4A3B0591}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf.Conformance", "Google.Protobuf.Conformance\Google.Protobuf.Conformance.xproj", "{DDDC055B-E185-4181-BAB0-072F0F984569}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.Conformance", "Google.Protobuf.Conformance\Google.Protobuf.Conformance.csproj", "{DDDC055B-E185-4181-BAB0-072F0F984569}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf.JsonDump", "Google.Protobuf.JsonDump\Google.Protobuf.JsonDump.xproj", "{9695E08F-9829-497D-B95C-B38F28D48690}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.JsonDump", "Google.Protobuf.JsonDump\Google.Protobuf.JsonDump.csproj", "{9695E08F-9829-497D-B95C-B38F28D48690}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj new file mode 100644 index 0000000000..cf30e4a84e --- /dev/null +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -0,0 +1,32 @@ + + + + C# runtime library for Protocol Buffers - Google's data interchange format. + Copyright 2015, Google Inc. + Google Protocol Buffers + 3.3.0 + Google Inc. + netstandard1.0;net451 + true + ../../keys/Google.Protobuf.snk + true + true + Protocol;Buffers;Binary;Serialization;Format;Google;proto;proto3 + C# proto3 support + https://github.com/google/protobuf + https://github.com/google/protobuf/blob/master/LICENSE + git + https://github.com/nodatime/nodatime.git + true + + + + + netstandard1.0 + + + diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.xproj b/csharp/src/Google.Protobuf/Google.Protobuf.xproj deleted file mode 100644 index c68e0db31a..0000000000 --- a/csharp/src/Google.Protobuf/Google.Protobuf.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 9b576380-726d-4142-8238-60a43ab0e35a - Google.Protobuf - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/csharp/src/Google.Protobuf/project.json b/csharp/src/Google.Protobuf/project.json deleted file mode 100644 index f437623895..0000000000 --- a/csharp/src/Google.Protobuf/project.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "version": "3.3.0", - "title": "Google Protocol Buffers", - "description": "See project site for more info.", - "authors": [ "Google Inc." ], - "copyright": "Copyright 2015, Google Inc.", - - "packOptions": { - "summary": "C# runtime library for Protocol Buffers - Google's data interchange format.", - "tags": [ "Protocol", "Buffers", "Binary", "Serialization", "Format", "Google", "proto", "proto3" ], - "owners": [ "protobuf-packages" ], - "licenseUrl": "https://github.com/google/protobuf/blob/master/LICENSE", - "projectUrl": "https://github.com/google/protobuf", - "releaseNotes": "C# proto3 support", - "requireLicenseAcceptance": false, - "repository": { - "url": "https://github.com/nodatime/nodatime.git" - } - }, - - "buildOptions": { - "debugType": "portable", - "keyFile": "../../keys/Google.Protobuf.snk", - "xmlDoc": true - }, - - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "DEBUG", "TRACE" ] - } - }, - "Release": { - "buildOptions": { - "define": [ "RELEASE", "TRACE" ], - "optimize": true - } - } - }, - - "frameworks": { - // This target allows the package to be installed in a .NET 4.5+ - // project without asking for myriad other dependencies. - "net45": { - }, - "netstandard1.0": { - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11" - } - } - } -} diff --git a/csharp/src/global.json b/csharp/src/global.json deleted file mode 100644 index 9d5558b1a3..0000000000 --- a/csharp/src/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sdk": { - "version": "1.0.0-preview2-003131" - } -} diff --git a/csharp/src/packages/repositories.config b/csharp/src/packages/repositories.config deleted file mode 100644 index 7037941299..0000000000 --- a/csharp/src/packages/repositories.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/jenkins/docker/Dockerfile b/jenkins/docker/Dockerfile index 9c9ee56b8c..6a9e7e479e 100644 --- a/jenkins/docker/Dockerfile +++ b/jenkins/docker/Dockerfile @@ -30,7 +30,7 @@ RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main" | tee /etc # Install dotnet SDK based on https://www.microsoft.com/net/core#debian # (Ubuntu instructions need apt to support https) RUN apt-get update && apt-get install -y --force-yes curl libunwind8 gettext && \ - curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 && \ + curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=847105 && \ mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet && \ ln -s /opt/dotnet/dotnet /usr/local/bin diff --git a/tests.sh b/tests.sh index 96550cb964..710389bc40 100755 --- a/tests.sh +++ b/tests.sh @@ -93,30 +93,17 @@ build_csharp() { internal_build_cpp NUGET=/usr/local/bin/nuget.exe - if [ "$TRAVIS" == "true" ]; then - # Install latest version of Mono - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551 - echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list - sudo apt-get update -qq - sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit - - # Then install the dotnet SDK as per Ubuntu 14.04 instructions on dot.net. - sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' - sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 - sudo apt-get update -qq - sudo apt-get install -qq dotnet-dev-1.0.0-preview2-003121 - fi - # Perform "dotnet new" once to get the setup preprocessing out of the # way. That spews a lot of output (including backspaces) into logs # otherwise, and can cause problems. It doesn't matter if this step # is performed multiple times; it's cheap after the first time anyway. + # (It also doesn't matter if it's unnecessary, which it will be on some + # systems. It's necessary on Jenkins in order to avoid unprintable + # characters appearing in the JUnit output.) mkdir dotnettmp (cd dotnettmp; dotnet new > /dev/null) rm -rf dotnettmp - (cd csharp/src; dotnet restore) csharp/buildall.sh cd conformance && make test_csharp && cd ..