Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVRO-2112: Target .NET Standard/Core in C# #307

Merged
merged 15 commits into from
Jan 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lang/csharp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
/*.user
/*.suo
/_ReSharper.Avro
/.vs
obj/

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

Expand Down
35 changes: 0 additions & 35 deletions lang/csharp/Avro.nunit

This file was deleted.

47 changes: 33 additions & 14 deletions lang/csharp/Avro.sln
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.main", "src\apache\main\Avro.main.csproj", "{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.main", "src\apache\main\Avro.main.csproj", "{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.test", "src\apache\test\Avro.test.csproj", "{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.test", "src\apache\test\Avro.test.csproj", "{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.codegen", "src\apache\codegen\Avro.codegen.csproj", "{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.codegen", "src\apache\codegen\Avro.codegen.csproj", "{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.ipc", "src\apache\ipc\Avro.ipc.csproj", "{3B05043A-DC6C-49B6-85BF-9AB055D0B414}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.ipc", "src\apache\ipc\Avro.ipc.csproj", "{3B05043A-DC6C-49B6-85BF-9AB055D0B414}"
ProjectSection(ProjectDependencies) = postProject
{AEB22F94-4ECF-4008-B159-389B3F05D54B} = {AEB22F94-4ECF-4008-B159-389B3F05D54B}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.msbuild", "src\apache\msbuild\Avro.msbuild.csproj", "{AEB22F94-4ECF-4008-B159-389B3F05D54B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.msbuild", "src\apache\msbuild\Avro.msbuild.csproj", "{AEB22F94-4ECF-4008-B159-389B3F05D54B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.perf", "src\apache\perf\Avro.perf.csproj", "{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.perf", "src\apache\perf\Avro.perf.csproj", "{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.ipc.test", "src\apache\ipc.test\Avro.ipc.test.csproj", "{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -50,14 +54,14 @@ Global
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.ActiveCfg = Debug|x86
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.Build.0 = Debug|x86
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.ActiveCfg = Debug|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.Build.0 = Debug|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Any CPU.Build.0 = Release|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.ActiveCfg = Release|x86
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.Build.0 = Release|x86
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.ActiveCfg = Release|x86
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.Build.0 = Release|x86
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.ActiveCfg = Release|Any CPU
{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.Build.0 = Release|Any CPU
{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -88,8 +92,23 @@ Global
{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}.Release|x86.ActiveCfg = Release|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|x86.ActiveCfg = Debug|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|x86.Build.0 = Debug|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|Any CPU.Build.0 = Release|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|x86.ActiveCfg = Release|Any CPU
{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ACE75CE8-16B2-4C6E-A5BE-B6F6DB5FE095}
EndGlobalSection
EndGlobal
40 changes: 0 additions & 40 deletions lang/csharp/README

This file was deleted.

42 changes: 42 additions & 0 deletions lang/csharp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Avro C#

## Build & Test

### Windows

1. Install [Microsoft Visual Studio Community 2017](https://www.visualstudio.com/downloads/)
2. `./build.ps1 Test`

### Linux with Mono

1. Install [Mono v5.18+](https://www.mono-project.com/download/stable/). Install the **mono-devel**
and **mono-complete** packages.
2. `./build.sh test`

### Linux with .NET Core SDK

1. Install [.NET Core SDK 2.1+](https://www.microsoft.com/net/download/linux)
2. Build and run unit tests:
```
cd src/apache/test
dotnet test --framework netcoreapp2.0
```

## Target Frameworks

The table below shows the frameworks that the various projects target.

Project | Type | .NET Standard 2.0 | .NET Core 2.0 | .NET Framework 4.0
------------ | ------------ |:------------------:|:------------------:|:------------------:
Avro.codegen | Exe | | :heavy_check_mark: | :heavy_check_mark:
Avro.ipc | Library | | | :heavy_check_mark:
Avro.ipc.test | Unit Tests | | | :heavy_check_mark:
Avro.main | Exe | :heavy_check_mark: | | :heavy_check_mark:
Avro.msbuild | Library | :heavy_check_mark: | | :heavy_check_mark:
Avro.perf | Exe | | :heavy_check_mark: | :heavy_check_mark:
Avro.test | Unit Tests | | :heavy_check_mark: | :heavy_check_mark:


## Notes

The [LICENSE](./LICENSE) and [NOTICE](./NOTICE) files in the lang/csharp source directory are used to build the binary distribution. The [LICENSE.txt](../../LICENSE.txt) and [NOTICE.txt](../../NOTICE.txt) information for the Avro C# source distribution is in the root directory.
59 changes: 59 additions & 0 deletions lang/csharp/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env pwsh

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

param(
[Parameter(Position=0)]
[ValidateSet('Test')]
[string]
$Target = 'Test',

[Parameter()]
[ValidateSet('Release', 'Debug')]
[string]
$Configuration = 'Release'
)

# Catch any PowerShell errors and exit with a non-zero exit code.
$ErrorActionPreference = 'Stop'
trap {
$ErrorActionPreference = 'Continue'
Write-Error $_
exit 1
}

# Checks the LASTEXITCODE. If it is non-zero, exits with that code.
function checkExitCode {
if ($LASTEXITCODE) {
exit $LASTEXITCODE
}
}

try {
Push-Location $PSScriptRoot

switch ($Target) {
"Test" {
dotnet build --configuration $Configuration
checkExitCode

dotnet test --configuration $Configuration --no-build ./src/apache/test/Avro.test.csproj
checkExitCode
}
}
} finally {
Pop-Location
}
13 changes: 6 additions & 7 deletions lang/csharp/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,23 @@ cd `dirname "$0"` # connect to root
ROOT=../..
VERSION=`cat $ROOT/share/VERSION.txt`

export CONFIGURATION=Release
export TARGETFRAMEWORKVERSION=v3.5

case "$1" in

test)
xbuild
nunit-console Avro.nunit
msbuild /t:"restore;build" /p:"Configuration=Release"
mono ${HOME}/.nuget/packages/nunit.consolerunner/3.9.0/tools/nunit3-console.exe \
--noheader --labels=All \
src/apache/test/bin/Release/net40/Avro.test.dll
;;

perf)
xbuild
msbuild /t:"restore;build" /p:"Configuration=Release"
mono build/perf/Release/Avro.perf.exe
;;

dist)
# build binary tarball
xbuild
msbuild /t:"restore;build" /p:"Configuration=Release"
# add the binary LICENSE and NOTICE to the tarball
cp LICENSE NOTICE build/
mkdir -p $ROOT/dist/csharp
Expand Down
Binary file removed lang/csharp/lib/main/Castle.Core.dll
Binary file not shown.
Binary file removed lang/csharp/lib/main/Newtonsoft.Json.dll
Binary file not shown.
Binary file removed lang/csharp/lib/main/log4net.dll
Binary file not shown.
Binary file removed lang/csharp/lib/test/nunit.framework.dll
Binary file not shown.
Loading