Skip to content

Commit

Permalink
THRIFT-4350: enable dotnet-2.0.0-sdk in ubuntu xenial, update netcore
Browse files Browse the repository at this point in the history
projects, get them running with make cross
Client: netcore

This closes apache#1379
  • Loading branch information
jeking3 committed Oct 10, 2017
1 parent 9f9e30b commit b628736
Show file tree
Hide file tree
Showing 46 changed files with 361 additions and 621 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ project.lock.json
/test/netcore/**/obj
/test/netcore/**/gen-*
/test/netcore/Thrift
/test/php/php_ext_dir/
/test/rs/Cargo.lock
/test/rs/src/thrift_test.rs
/test/rs/bin/
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ empty :=
space := $(empty) $(empty)
comma := ,

CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ @MAYBE_RS@
CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ @MAYBE_RS@ @MAYBE_DOTNETCORE@
CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS))

if WITH_PY3
Expand Down
15 changes: 7 additions & 8 deletions build/docker/ubuntu-xenial/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
# Known missing or disabled libraries:
# - d: deimos for libevent and openssl omitted - not compatible / build errors
# - dotnetcore, because netcore is for 1.0.0-preview and 2.0.0 is out

FROM buildpack-deps:xenial-scm
MAINTAINER Apache Thrift <[email protected]>
Expand All @@ -38,9 +37,9 @@ RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &
curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
sed -i /etc/apt/sources.list.d/dart_stable.list -e 's/https:/http:/g'

# dotnet (core) 2.0.0 - project isn't ready for this yet:
# RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
# echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list
# dotnet (core) 2.0.0
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list

# node.js (this step runs apt-get update internally)
# note: node 8.5 introduced some issues with directory handling / jsdoc / something... using 7.x for now
Expand Down Expand Up @@ -108,10 +107,9 @@ RUN apt-get install -y --no-install-recommends \
dart
ENV PATH /usr/lib/dart/bin:$PATH

# project isn't ready for this quite yet:
# RUN apt-get install -y --no-install-recommends \
# `# dotnet core dependencies` \
# dotnet-sdk-2.0.0
RUN apt-get install -y --no-install-recommends \
`# dotnet core dependencies` \
dotnet-sdk-2.0.0

RUN apt-get install -y --no-install-recommends \
`# Erlang dependencies` \
Expand Down Expand Up @@ -233,6 +231,7 @@ RUN rm -rf /var/cache/apt/* && \
rm -rf /tmp/* && \
rm -rf /var/tmp/*

ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
ENV THRIFT_ROOT /thrift
RUN mkdir -p $THRIFT_ROOT/src
COPY Dockerfile $THRIFT_ROOT/
Expand Down
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ AX_THRIFT_LIB(dotnetcore, [.NET Core], yes)
if test "$with_dotnetcore" = "yes"; then
AC_PATH_PROG([DOTNETCORE], [dotnet])
if [[ -x "$DOTNETCORE" ]] ; then
AX_PROG_DOTNETCORE_VERSION( [1.0.0], have_dotnetcore="yes", have_dotnetcore="no")
AX_PROG_DOTNETCORE_VERSION( [2.0.0], have_dotnetcore="yes", have_dotnetcore="no")
fi
fi
AM_CONDITIONAL(WITH_DOTNETCORE, [test "$have_dotnetcore" = "yes"])
Expand Down Expand Up @@ -897,6 +897,8 @@ if test "$have_lua" = "yes" ; then MAYBE_LUA="lua" ; else MAYBE_LUA="" ; fi
AC_SUBST([MAYBE_LUA])
if test "$have_rs" = "yes" ; then MAYBE_RS="rs" ; else MAYBE_RS="" ; fi
AC_SUBST([MAYBE_RS])
if test "$have_dotnetcore" = "yes" ; then MAYBE_DOTNETCORE="netcore" ; else MAYBE_DOTNETCORE="" ; fi
AC_SUBST([MAYBE_DOTNETCORE])

AC_OUTPUT

Expand Down
7 changes: 1 addition & 6 deletions lib/netcore/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ Thrift.dll: $(THRIFTCODE)
$(THRIFT) -gen netcore:wcf -r -out $(GENDIR) $(top_srcdir)/contrib/fb303/if/fb303.thrift
$(DOTNETCORE) --info
$(DOTNETCORE) restore
$(DOTNETCORE) build **/*/project.json -r win10-x64
$(DOTNETCORE) build **/*/project.json -r osx.10.11-x64
$(DOTNETCORE) build **/*/project.json -r ubuntu.16.04-x64
$(DOTNETCORE) build

clean-local:
$(RM) Thrift.dll
Expand All @@ -99,10 +97,7 @@ clean-local:

EXTRA_DIST = \
$(THRIFTCODE) \
global.json \
Thrift.sln \
Thrift/project.json \
Thrift/Thrift.xproj \
Tests \
README.md

30 changes: 8 additions & 22 deletions lib/netcore/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Apache Thrift net-core-lib
# Apache Thrift netcore

Thrift client library ported to Microsoft .Net Core

Expand All @@ -7,29 +7,15 @@ Thrift client library ported to Microsoft .Net Core
- Thrift - Thrift library

# Reused components
- NET Core Standard 1.6 (SDK 1.0.0-preview2-003121)
- NET Core App 1.1
- .NET Standard 1.6 (SDK 2.0.0)

# How to build
# How to build on Windows
- Open the Thrift.sln project with Visual Studio and build.

- Download and install .NET Core SDK for your platform https://www.microsoft.com/net/core#windowsvs2015
- Ensure that you have thrift.exe which supports netcore lib and it added to PATH
- Go to current folder
- Run **build.sh** or **build.cmd** from the root of cloned repository
- Check tests in **src/Tests** folder
- Continue with /tutorials/netcore

#Notes

- Migration to .NET Standard 2.0 planned for later (Q1 2017) according to https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/
- Possible adding additional platforms after stabilization of .NET Core (runtimes, platforms (Red Haat Linux, OpenSuse, etc.)

#Known issues
# How to build on Unix
- Ensure you have .NET Core 2.0.0 SDK installed or use the Ubuntu Xenial docker image
- Follow common build practice for Thrift: bootstrap, configure, and make

# Known issues
- In trace logging mode you can see some not important internal exceptions
- Ubuntu 16.10 still not supported fully
- There is some problems with .NET Core CLI and usage specific -r|--runtime for building and publishing projects with different target frameworks (netstandard1.6 and netcoreapp1.1)

# Troubleshouting

It's possible to change dotnet SDK version for building for solution (in **global.json**). Just run **dotnet --info** to check your current version (or check your dotnet sdk folder for installed versions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>Thrift.PublicInterfaces.Compile.Tests</AssemblyName>
<PackageId>Thrift.PublicInterfaces.Compile.Tests</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../../Thrift/Thrift.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.ServiceModel.Primitives" Version="[4.1.0,)" />
</ItemGroup>

</Project>

This file was deleted.

This file was deleted.

57 changes: 37 additions & 20 deletions lib/netcore/Thrift.sln
Original file line number Diff line number Diff line change
@@ -1,38 +1,55 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Thrift", "Thrift\Thrift.xproj", "{6850CF46-5467-4C65-BD78-871581C539FC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F043FC17-16B7-4497-B975-ABC12180F351}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{F51FC4DA-CAC0-48B1-A069-B1712BCAA5BE}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Thrift.PublicInterfaces.Compile.Tests", "Tests\Thrift.PublicInterfaces.Compile.Tests\Thrift.PublicInterfaces.Compile.Tests.xproj", "{D0D3706B-FED5-4CF5-B984-04F448DE9D7B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thrift.PublicInterfaces.Compile.Tests", "Tests\Thrift.PublicInterfaces.Compile.Tests\Thrift.PublicInterfaces.Compile.Tests.csproj", "{0676962B-98C2-49EC-B4C4-7A0451D0640B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thrift", "Thrift\Thrift.csproj", "{D85F572F-7D80-40A4-9A9B-2731ED187C24}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6850CF46-5467-4C65-BD78-871581C539FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6850CF46-5467-4C65-BD78-871581C539FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6850CF46-5467-4C65-BD78-871581C539FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6850CF46-5467-4C65-BD78-871581C539FC}.Release|Any CPU.Build.0 = Release|Any CPU
{D0D3706B-FED5-4CF5-B984-04F448DE9D7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0D3706B-FED5-4CF5-B984-04F448DE9D7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0D3706B-FED5-4CF5-B984-04F448DE9D7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0D3706B-FED5-4CF5-B984-04F448DE9D7B}.Release|Any CPU.Build.0 = Release|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Debug|x64.ActiveCfg = Debug|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Debug|x64.Build.0 = Debug|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Debug|x86.ActiveCfg = Debug|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Debug|x86.Build.0 = Debug|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Release|Any CPU.Build.0 = Release|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Release|x64.ActiveCfg = Release|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Release|x64.Build.0 = Release|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Release|x86.ActiveCfg = Release|Any CPU
{0676962B-98C2-49EC-B4C4-7A0451D0640B}.Release|x86.Build.0 = Release|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|x64.ActiveCfg = Debug|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|x64.Build.0 = Debug|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|x86.ActiveCfg = Debug|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|x86.Build.0 = Debug|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|Any CPU.Build.0 = Release|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|x64.ActiveCfg = Release|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|x64.Build.0 = Release|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|x86.ActiveCfg = Release|Any CPU
{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D0D3706B-FED5-4CF5-B984-04F448DE9D7B} = {F51FC4DA-CAC0-48B1-A069-B1712BCAA5BE}
{0676962B-98C2-49EC-B4C4-7A0451D0640B} = {F51FC4DA-CAC0-48B1-A069-B1712BCAA5BE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FD20BC4A-0109-41D8-8C0C-893E784D7EF9}
EndGlobalSection
EndGlobal
7 changes: 5 additions & 2 deletions lib/netcore/Thrift/TBaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ protected TBaseClient(TProtocol inputProtocol, TProtocol outputProtocol)

public TProtocol OutputProtocol => _outputProtocol;

public int SeqId => _seqId;
public int SeqId
{
get { return ++_seqId; }
}

public virtual async Task OpenTransportAsync()
{
Expand Down Expand Up @@ -96,4 +99,4 @@ protected virtual void Dispose(bool disposing)
_isDisposed = true;
}
}
}
}
30 changes: 30 additions & 0 deletions lib/netcore/Thrift/Thrift.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Thrift</AssemblyName>
<PackageId>Thrift</PackageId>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="[2.0,)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="[2.0,)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="[2.0,)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="[2.0,)" />
<PackageReference Include="System.IO.Pipes" Version="[4.3,)" />
<PackageReference Include="System.Net.NameResolution" Version="[4.3,)" />
<PackageReference Include="System.Net.Requests" Version="[4.3,)" />
<PackageReference Include="System.Net.Security" Version="[4.3,)" />
</ItemGroup>

</Project>
21 changes: 0 additions & 21 deletions lib/netcore/Thrift/Thrift.xproj

This file was deleted.

19 changes: 0 additions & 19 deletions lib/netcore/Thrift/project.json

This file was deleted.

Loading

0 comments on commit b628736

Please sign in to comment.