Skip to content

Commit

Permalink
ARROW-4839: [C#] Add NuGet package metadata and instructions.
Browse files Browse the repository at this point in the history
This change adds the necessary changes for creating the `Apache.Arrow` nuget package.

1. I've updated the `.csproj` with what I think is the correct package metadata. Please take a look and give any feedback on what I got wrong.
2. I've added instructions to the README on how to build the NuGet package. By default, this will produce a `-preview` version of the package. You need to explicitly opt into creating a "stable" version by passing in `-p:VersionSuffix=''`.
3. I've enabled strong naming on the library, which is a recommendation according to the [.NET Open-source library guidance](https://docs.microsoft.com/en-us/dotnet/standard/library-guidance/strong-naming).
    - Note that "strong naming" isn't a security feature - it is just about creating a unique identity for the library.

/cc @stephentoub @ericstj @pgovind @chutchinson @wesm

Author: Eric Erhardt <eric.erhardt@microsoft.com>

Closes #3891 from eerhardt/NuGetPackage and squashes the following commits:

8c0f680 <Eric Erhardt> PR feedback
89f630b <Eric Erhardt> Remove pack call from CI
b3c6ab8 <Eric Erhardt> Respond to PR feedback.
f4bb193 <Eric Erhardt> fix up prepare script to escape correctly
1566f40 <Eric Erhardt> PR feedback
c7a9d8d <Eric Erhardt> Enable strong naming on the Apache.Arrow C# library.
5c31e1d <Eric Erhardt> ARROW-4839:  Add NuGet package metadata and instructions.
  • Loading branch information
eerhardt authored and kou committed Mar 17, 2019
1 parent cc33723 commit ad69ecb
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 28 deletions.
Binary file added csharp/ApacheArrow.snk
Binary file not shown.
41 changes: 41 additions & 0 deletions csharp/Directory.Build.props
@@ -0,0 +1,41 @@
<Project>

<!-- Common repo directories -->
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)../</RepoRoot>
<CSharpDir>$(MSBuildThisFileDirectory)</CSharpDir>
<BaseOutputPath>$(CSharpDir)/artifacts/$(MSBuildProjectName)</BaseOutputPath>
</PropertyGroup>

<!-- AssemblyInfo properties -->
<PropertyGroup>
<Product>Apache Arrow library</Product>
<Copyright>2018 Apache Software Foundation</Copyright>
<Company>Apache</Company>
<Version>0.13.0-SNAPSHOT</Version>
</PropertyGroup>

<PropertyGroup>
<LangVersion>7.2</LangVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(CSharpDir)ApacheArrow.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<!-- NuGet properties -->
<PropertyGroup>
<Authors>Apache</Authors>
<PackageIconUrl>https://www.apache.org/images/feather.png</PackageIconUrl>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageProjectUrl>https://arrow.apache.org/</PackageProjectUrl>
<PackageTags>apache arrow</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/apache/arrow</RepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup Condition="'$(IsPackable)' == 'true'">
<Content Include="$(RepoRoot)LICENSE.txt" Pack="true" PackagePath="" />
</ItemGroup>

</Project>
28 changes: 25 additions & 3 deletions csharp/README.md
Expand Up @@ -135,17 +135,39 @@ This implementation is under development and may not be suitable for use in prod

# Build

Install the latest `.NET Core SDK` from https://dotnet.microsoft.com/download.

dotnet build

# Docker Build
## NuGet Build

To build the NuGet package run the following command to build a debug flavor, preview package into the **artifacts** folder.

dotnet pack

When building the officially released version run: (see Note below about current `git` repository)

dotnet pack -c Release

Which will build the final/stable package.

NOTE: When building the officially released version, ensure that your `git` repository has the `origin` remote set to `https://github.com/apache/arrow.git`, which will ensure Source Link is set correctly. See https://github.com/dotnet/sourcelink/blob/master/docs/README.md for more information.

There are two output artifacts:
1. `Apache.Arrow.<version>.nupkg` - this contains the exectuable assemblies
2. `Apache.Arrow.<version>.snupkg` - this contains the debug symbols files

Both of these artifacts can then be uploaded to https://www.nuget.org/packages/manage/upload.

## Docker Build

Build from the Apache Arrow project root.

docker build -f csharp/build/docker/Dockerfile .

# Testing
## Testing

dotnet test test/Apache.Arrow.Tests
dotnet test

All build artifacts are placed in the **artifacts** folder in the project root.

Expand Down
5 changes: 0 additions & 5 deletions csharp/build/Common.props

This file was deleted.

21 changes: 6 additions & 15 deletions csharp/src/Apache.Arrow/Apache.Arrow.csproj
@@ -1,28 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../../build/Common.props" />

<PropertyGroup>
<TargetFrameworks>netstandard1.3;netcoreapp2.1</TargetFrameworks>
<LangVersion>7.2</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Authors>Apache</Authors>
<Product>Apache Arrow library</Product>
<Copyright>2018 Apache Software Foundation</Copyright>
<PackageProjectUrl>https://fzcorp.visualstudio.com/digital-products</PackageProjectUrl>
<RepositoryUrl>https://fzcorp.visualstudio.com/digital-products/_git/fz-arrow</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>apache arrow</PackageTags>
<Company>Apache</Company>
<Version>0.0.1</Version>
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER;BYTEBUFFER_NO_BOUNDS_CHECK;ENABLE_SPAN_T</DefineConstants>

<Description>Apache Arrow is a cross-language development platform for in-memory data. It specifies a standardized language-independent columnar memory format for flat and hierarchical data, organized for efficient analytic operations on modern hardware.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Memory" Version="4.5.1" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.1" />
<PackageReference Include="System.Text.Encoding" Version="4.3.0" />
<PackageReference Include="System.Memory" Version="4.5.2" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />

<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions csharp/test/Apache.Arrow.Tests/Apache.Arrow.Tests.csproj
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../../build/Common.props" />

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>7.3</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
9 changes: 9 additions & 0 deletions csharp/test/Directory.Build.props
@@ -0,0 +1,9 @@
<Project>

<Import Project="..\Directory.Build.props" />

<PropertyGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>

</Project>
8 changes: 8 additions & 0 deletions dev/release/00-prepare.sh
Expand Up @@ -56,6 +56,14 @@ update_versions() {
git add configure.ac meson.build
cd -

cd "${SOURCE_DIR}/../../csharp"
sed -i.bak -E -e \
"s/^ <Version>.+<\/Version>/ <Version>${version}<\/Version>/" \
Directory.Build.props
rm -f Directory.Build.props.bak
git add Directory.Build.props
cd -

# We can enable this when Arrow JS uses the same version.
# cd "${SOURCE_DIR}/../../js"
# sed -i.bak -E -e \
Expand Down
3 changes: 2 additions & 1 deletion dev/release/rat_exclude_files.txt
Expand Up @@ -166,14 +166,15 @@ c_glib/doc/plasma-glib/plasma-glib-overrides.txt
c_glib/gtk-doc.make
csharp/.gitattributes
csharp/src/Apache.Arrow/Flatbuf/*
csharp/build/Common.props
csharp/Apache.Arrow.sln
csharp/Directory.Build.props
csharp/src/Apache.Arrow/Apache.Arrow.csproj
csharp/src/Apache.Arrow/Properties/Resources.Designer.cs
csharp/src/Apache.Arrow/Properties/Resources.resx
csharp/test/Apache.Arrow.Benchmarks/Apache.Arrow.Benchmarks.csproj
csharp/test/Apache.Arrow.Tests/Apache.Arrow.Tests.csproj
csharp/test/Apache.Arrow.Tests/app.config
csharp/test/Directory.Build.props
*.html
*.sgml
*.css
Expand Down

0 comments on commit ad69ecb

Please sign in to comment.