Skip to content

Commit

Permalink
Merge pull request #1785 from jskeet/merge-csharp
Browse files Browse the repository at this point in the history
Merge C# changes from master to 3.0.0-beta4
  • Loading branch information
jskeet authored Jul 14, 2016
2 parents 4e0d051 + b5ce525 commit e1f146b
Show file tree
Hide file tree
Showing 46 changed files with 538 additions and 881 deletions.
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ script:
env:
- CONFIG=cpp
- CONFIG=cpp_distcheck
- CONFIG=csharp
- CONFIG=golang
- CONFIG=java_jdk6
- CONFIG=java_jdk7
Expand Down Expand Up @@ -52,10 +51,6 @@ matrix:
env: CONFIG=javanano_jdk7
- os: osx
env: CONFIG=javanano_oracle7
# Requires installing mono, currently travis.sh is doing that with apt-get
# which doesn't work on OS X.
- os: osx
env: CONFIG=csharp
# Requires installing golang, currently travis.sh is doing that with apt-get
# which doesn't work on OS X.
- os: osx
Expand All @@ -70,6 +65,13 @@ matrix:
env: CONFIG=objectivec_osx
- os: linux
env: CONFIG=objectivec_cocoapods_integration
# The dotnet environment requires Ubuntu 14.04 or 16.04. This
# configuration is effectively an "extra" one, outside the
# autogenerated matrix.
include:
- os: linux
env: CONFIG=csharp
dist: trusty
allow_failures:
# These currently do not work on OS X but are being worked on by @haberman.
- os: osx
Expand Down
26 changes: 10 additions & 16 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,19 @@ csharp_EXTRA_DIST= \
csharp/keys/README.md \
csharp/protos/unittest_issues.proto \
csharp/src/AddressBook/AddPerson.cs \
csharp/src/AddressBook/AddressBook.csproj \
csharp/src/AddressBook/Addressbook.cs \
csharp/src/AddressBook/AddressBook.xproj \
csharp/src/AddressBook/ListPeople.cs \
csharp/src/AddressBook/Program.cs \
csharp/src/AddressBook/Properties/AssemblyInfo.cs \
csharp/src/AddressBook/SampleUsage.cs \
csharp/src/AddressBook/app.config \
csharp/src/Google.Protobuf.Conformance/App.config \
csharp/src/AddressBook/project.json \
csharp/src/Google.Protobuf.Conformance/Conformance.cs \
csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj \
csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj \
csharp/src/Google.Protobuf.Conformance/Program.cs \
csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs \
csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj \
csharp/src/Google.Protobuf.Conformance/project.json \
csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj \
csharp/src/Google.Protobuf.JsonDump/Program.cs \
csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs \
csharp/src/Google.Protobuf.JsonDump/app.config \
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 \
Expand All @@ -87,13 +84,11 @@ 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.csproj \
csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj \
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/Properties/AppManifest.xml \
csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs \
csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs \
csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs \
csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs \
Expand All @@ -110,7 +105,7 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs \
csharp/src/Google.Protobuf.Test/packages.config \
csharp/src/Google.Protobuf.Test/project.json \
csharp/src/Google.Protobuf.sln \
csharp/src/Google.Protobuf/ByteArray.cs \
csharp/src/Google.Protobuf/ByteString.cs \
Expand All @@ -124,8 +119,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.csproj \
csharp/src/Google.Protobuf/Google.Protobuf.nuspec \
csharp/src/Google.Protobuf/Google.Protobuf.xproj \
csharp/src/Google.Protobuf/IDeepCloneable.cs \
csharp/src/Google.Protobuf/IMessage.cs \
csharp/src/Google.Protobuf/InvalidJsonException.cs \
Expand Down Expand Up @@ -183,7 +177,7 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs \
csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs \
csharp/src/Google.Protobuf/WireFormat.cs \
csharp/src/Google.Protobuf/packages.config \
csharp/src/Google.Protobuf/project.json \
csharp/src/packages/repositories.config

java_EXTRA_DIST= \
Expand Down
9 changes: 6 additions & 3 deletions appveyor.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ goto :EOF
:build_csharp
echo Building C#
cd csharp\src
nuget restore
msbuild Google.Protobuf.sln /p:Platform="Any CPU" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || goto error
nunit-console Google.Protobuf.Test\bin\%configuration%\Google.Protobuf.Test.dll || goto error
dotnet restore
dotnet build -c %configuration% Google.Protobuf Google.Protobuf.Test Google.Protobuf.Conformance || goto error

echo Testing C#
dotnet test -c %configuration% Google.Protobuf.Test || goto error

goto :EOF

:error
Expand Down
6 changes: 6 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ environment:

- language: csharp

# Our build scripts run tests automatically; we don't want AppVeyor
# to try to detect them itself.
test: off

install:
- ps: Start-FileDownload https://googlemock.googlecode.com/files/gmock-1.7.0.zip
- 7z x gmock-1.7.0.zip
- rename gmock-1.7.0 gmock
- ps: Start-FileDownload https://go.microsoft.com/fwlink/?LinkID=809122 -FileName dotnetsdk.exe
- dotnetsdk.exe /install /quiet /norestart

before_build:
- if %platform%==Win32 set generator=Visual Studio 12
Expand Down
2 changes: 1 addition & 1 deletion conformance/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ conformance-java-lite: javac_middleman_lite
conformance-csharp: $(other_language_protoc_outputs)
@echo "Writing shortcut script conformance-csharp..."
@echo '#! /bin/sh' > conformance-csharp
@echo 'mono ../csharp/src/Google.Protobuf.Conformance/bin/Release/Google.Protobuf.Conformance.exe "$$@"' >> conformance-csharp
@echo 'dotnet ../csharp/src/Google.Protobuf.Conformance/bin/Release/netcoreapp1.0/Google.Protobuf.Conformance.dll "$$@"' >> conformance-csharp
@chmod +x conformance-csharp

# Targets for actually running tests.
Expand Down
21 changes: 8 additions & 13 deletions csharp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
#
# Untracked directories
#
src/AddressBook/bin
src/AddressBook/obj
src/Google.Protobuf/bin/
src/Google.Protobuf/obj/
src/Google.Protobuf.Conformance/bin/
src/Google.Protobuf.Conformance/obj/
src/Google.Protobuf.Test/bin/
src/Google.Protobuf.Test/obj/
src/Google.Protobuf.JsonDump/bin/
src/Google.Protobuf.JsonDump/obj/
# Output
bin
obj
project.lock.json
TestResult.xml

# Possibly legacy now?
mono/bin
mono/tmp
mono/protoc
Expand All @@ -23,6 +17,7 @@ lib/NUnit
#
# Untracked files
#
.vs
*.user
*.suo
*.nupkg
Expand Down
7 changes: 2 additions & 5 deletions csharp/build_packages.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
@rem Builds Google.Protobuf NuGet packages

@rem Adjust the location of nuget.exe
set NUGET=C:\nuget\nuget.exe

@rem Build src/Google.Protobuf.sln solution in Release configuration first.
%NUGET% pack src\Google.Protobuf\Google.Protobuf.nuspec -Symbols || goto :error
dotnet restore src
dotnet pack -c Release src\Google.Protobuf || goto :error

goto :EOF

Expand Down
15 changes: 7 additions & 8 deletions csharp/buildall.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#!/bin/bash
# Use mono to build solution and run all tests.

# Adjust these to reflect the location of nunit-console in your system.
NUNIT_CONSOLE=nunit-console

# The rest you can leave intact
CONFIG=Release
SRC=$(dirname $0)/src

set -ex

echo Building the solution.
xbuild /p:Configuration=$CONFIG $SRC/Google.Protobuf.sln
echo Building relevant projects.
dotnet build -c $CONFIG $SRC/Google.Protobuf $SRC/Google.Protobuf.Test $SRC/Google.Protobuf.Conformance

echo Running tests.
$NUNIT_CONSOLE $SRC/Google.Protobuf.Test/bin/$CONFIG/Google.Protobuf.Test.dll
# 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
75 changes: 0 additions & 75 deletions csharp/src/AddressBook/AddressBook.csproj

This file was deleted.

19 changes: 19 additions & 0 deletions csharp/src/AddressBook/AddressBook.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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>afb63919-1e05-43b4-802a-8fb8c9b2f463</ProjectGuid>
<RootNamespace>AddressBook</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>
18 changes: 0 additions & 18 deletions csharp/src/AddressBook/Properties/AssemblyInfo.cs

This file was deleted.

2 changes: 1 addition & 1 deletion csharp/src/AddressBook/SampleUsage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static void Main()
// The message performs a deep-comparison on equality:
if (restored.People.Count != 1 || !person.Equals(restored.People[0]))
{
throw new ApplicationException("There is a bad person in here!");
throw new Exception("There is a bad person in here!");
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions csharp/src/AddressBook/app.config

This file was deleted.

20 changes: 20 additions & 0 deletions csharp/src/AddressBook/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"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"
}
}
}
}
}
6 changes: 0 additions & 6 deletions csharp/src/Google.Protobuf.Conformance/App.config

This file was deleted.

Loading

0 comments on commit e1f146b

Please sign in to comment.