From aa36b19cff238fbcd4639aa1731d2e21b3d2fb57 Mon Sep 17 00:00:00 2001 From: David Coe Date: Tue, 28 Nov 2023 14:26:24 -0500 Subject: [PATCH] add support for building nuget packages on Windows --- csharp/.gitignore | 1 + csharp/Apache.Arrow.Adbc.sln | 8 +++- csharp/Directory.Build.props | 2 +- csharp/global.json | 7 ++++ csharp/scripts/Build-All.ps1 | 42 +++++++++++++++++++ .../Apache.Arrow.Adbc.csproj | 13 +++++- csharp/src/Apache.Arrow.Adbc/readme.md | 25 +++++++++++ .../Client/Apache.Arrow.Adbc.Client.csproj | 8 ++++ .../Apache.Arrow.Adbc.Drivers.BigQuery.csproj | 8 ++++ ...rrow.Adbc.Drivers.Interop.Snowflake.csproj | 35 ++++++++++++++++ .../Snowflake/Build-SnowflakeDriver.ps1 | 30 +++++++++++++ csharp/src/Drivers/Snowflake/readme.md | 27 ++++++++++++ 12 files changed, 203 insertions(+), 3 deletions(-) create mode 100644 csharp/global.json create mode 100644 csharp/scripts/Build-All.ps1 create mode 100644 csharp/src/Apache.Arrow.Adbc/readme.md create mode 100644 csharp/src/Drivers/Snowflake/Apache.Arrow.Adbc.Drivers.Interop.Snowflake.csproj create mode 100644 csharp/src/Drivers/Snowflake/Build-SnowflakeDriver.ps1 create mode 100644 csharp/src/Drivers/Snowflake/readme.md diff --git a/csharp/.gitignore b/csharp/.gitignore index e2b09a58d0..7f944a653e 100644 --- a/csharp/.gitignore +++ b/csharp/.gitignore @@ -29,3 +29,4 @@ x64 artifacts/ TestResults/ +nugets/ diff --git a/csharp/Apache.Arrow.Adbc.sln b/csharp/Apache.Arrow.Adbc.sln index 5dee7405ae..64cbcf3691 100644 --- a/csharp/Apache.Arrow.Adbc.sln +++ b/csharp/Apache.Arrow.Adbc.sln @@ -1,4 +1,3 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.4.33403.182 @@ -31,6 +30,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Drivers.B EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Tests.Drivers.BigQuery", "test\Drivers\BigQuery\Apache.Arrow.Adbc.Tests.Drivers.BigQuery.csproj", "{EA43BB7C-BC00-4701-BDF4-367880C2495C}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Drivers.Interop.Snowflake", "src\Drivers\Snowflake\Apache.Arrow.Adbc.Drivers.Interop.Snowflake.csproj", "{5F707F02-EB23-42B0-9430-0938C1BA1E96}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -73,6 +74,10 @@ Global {EA43BB7C-BC00-4701-BDF4-367880C2495C}.Debug|Any CPU.Build.0 = Debug|Any CPU {EA43BB7C-BC00-4701-BDF4-367880C2495C}.Release|Any CPU.ActiveCfg = Release|Any CPU {EA43BB7C-BC00-4701-BDF4-367880C2495C}.Release|Any CPU.Build.0 = Release|Any CPU + {5F707F02-EB23-42B0-9430-0938C1BA1E96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F707F02-EB23-42B0-9430-0938C1BA1E96}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F707F02-EB23-42B0-9430-0938C1BA1E96}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F707F02-EB23-42B0-9430-0938C1BA1E96}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -87,6 +92,7 @@ Global {DEE943D1-A2D0-40CD-ABE0-2CB38E7CA156} = {C7290227-E925-47E7-8B6B-A8B171645D58} {A748041C-EF9A-4E88-B6FB-9F2D6CB79170} = {FEB257A0-4FD3-495E-9A47-9E1649755445} {EA43BB7C-BC00-4701-BDF4-367880C2495C} = {C7290227-E925-47E7-8B6B-A8B171645D58} + {5F707F02-EB23-42B0-9430-0938C1BA1E96} = {FEB257A0-4FD3-495E-9A47-9E1649755445} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4795CF16-0FDB-4BE0-9768-5CF31564DC03} diff --git a/csharp/Directory.Build.props b/csharp/Directory.Build.props index 92ba53253a..ad3ee48621 100644 --- a/csharp/Directory.Build.props +++ b/csharp/Directory.Build.props @@ -29,7 +29,7 @@ Apache Arrow ADBC library Copyright 2022-2023 The Apache Software Foundation The Apache Software Foundation - 0.5.0 + 0.8.0 diff --git a/csharp/global.json b/csharp/global.json new file mode 100644 index 0000000000..9f9fa9ed07 --- /dev/null +++ b/csharp/global.json @@ -0,0 +1,7 @@ +{ + "msbuild-sdks": { + "Microsoft.Build.CentralPackageVersions" : "2.1.3", + "Microsoft.Build.Traversal": "3.4.0", + "Microsoft.Build.NoTargets": "3.7.0" + } +} diff --git a/csharp/scripts/Build-All.ps1 b/csharp/scripts/Build-All.ps1 new file mode 100644 index 0000000000..8202d6bee5 --- /dev/null +++ b/csharp/scripts/Build-All.ps1 @@ -0,0 +1,42 @@ +# 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. + +# This does the following: + +# 1.) Builds each managed library as a nuget package using `dotnet pack` +# 2.) Builds each interop library and packages it in to a nuget using `nuget pack` +# 3.) Copies them all to a single folder +# 4.) Need to run tests using the nuget packages (dotnet test ?) + +param ( + [string]$destination=".\nugets" +) + +$location = Get-Location + +Write-Host "Building Snowflake Go driver" + +cd ..\src\Drivers\Snowflake + +powershell -ExecutionPolicy Unrestricted -File .\Build-SnowflakeDriver.ps1 + +cd $location + +cd .. + +Write-Host "Running dotnet pack" + +dotnet pack -o $destination diff --git a/csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj b/csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj index c49113e729..31335c21f9 100644 --- a/csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj +++ b/csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj @@ -3,8 +3,13 @@ netstandard2.0;net6.0 true + readme.md + + + + @@ -12,5 +17,11 @@ - + + + true + \ + PreserveNewest + + diff --git a/csharp/src/Apache.Arrow.Adbc/readme.md b/csharp/src/Apache.Arrow.Adbc/readme.md new file mode 100644 index 0000000000..c02d08d22a --- /dev/null +++ b/csharp/src/Apache.Arrow.Adbc/readme.md @@ -0,0 +1,25 @@ + +# About + +This is a C# implementation of the ADBC spec. It is designed so drivers can be written in any C-based language and leveraged from .NET. + +Current C#-implemented drivers include BigQuery and FlightSQL. + +The Snowflake Go driver can also be used from .NET. diff --git a/csharp/src/Client/Apache.Arrow.Adbc.Client.csproj b/csharp/src/Client/Apache.Arrow.Adbc.Client.csproj index 013c4a53d5..f44be6f229 100644 --- a/csharp/src/Client/Apache.Arrow.Adbc.Client.csproj +++ b/csharp/src/Client/Apache.Arrow.Adbc.Client.csproj @@ -1,8 +1,16 @@ netstandard2.0;net6.0 + readme.md + + + true + \ + PreserveNewest + + diff --git a/csharp/src/Drivers/BigQuery/Apache.Arrow.Adbc.Drivers.BigQuery.csproj b/csharp/src/Drivers/BigQuery/Apache.Arrow.Adbc.Drivers.BigQuery.csproj index 368ff8181e..a7451c7bd1 100644 --- a/csharp/src/Drivers/BigQuery/Apache.Arrow.Adbc.Drivers.BigQuery.csproj +++ b/csharp/src/Drivers/BigQuery/Apache.Arrow.Adbc.Drivers.BigQuery.csproj @@ -1,6 +1,7 @@ netstandard2.0;net6.0 + readme.md @@ -11,4 +12,11 @@ + + + true + \ + PreserveNewest + + diff --git a/csharp/src/Drivers/Snowflake/Apache.Arrow.Adbc.Drivers.Interop.Snowflake.csproj b/csharp/src/Drivers/Snowflake/Apache.Arrow.Adbc.Drivers.Interop.Snowflake.csproj new file mode 100644 index 0000000000..6c803e36cb --- /dev/null +++ b/csharp/src/Drivers/Snowflake/Apache.Arrow.Adbc.Drivers.Interop.Snowflake.csproj @@ -0,0 +1,35 @@ + + + netstandard2.0;net6.0 + readme.md + + + + + + + + + + true + lib\netstandard2.0 + PreserveNewest + + + + + true + lib\net6.0 + PreserveNewest + + + + + true + \ + PreserveNewest + + + diff --git a/csharp/src/Drivers/Snowflake/Build-SnowflakeDriver.ps1 b/csharp/src/Drivers/Snowflake/Build-SnowflakeDriver.ps1 new file mode 100644 index 0000000000..3edd6ada3b --- /dev/null +++ b/csharp/src/Drivers/Snowflake/Build-SnowflakeDriver.ps1 @@ -0,0 +1,30 @@ +# 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 ( +# [string]$netversion +#) + +#Write-Host "Building for $netversion" + +$location = Get-Location + +$file = "libadbc_driver_snowflake.dll" + +cd ..\..\..\..\go\adbc\pkg +del $file +go build -tags driverlib -o $file -buildmode=c-shared -ldflags "-s -w" ./snowflake +COPY $file $location diff --git a/csharp/src/Drivers/Snowflake/readme.md b/csharp/src/Drivers/Snowflake/readme.md new file mode 100644 index 0000000000..68e506e028 --- /dev/null +++ b/csharp/src/Drivers/Snowflake/readme.md @@ -0,0 +1,27 @@ + + +# About +This project generates a NuGet package containing the Snowflake ADBC Go Driver for use in other .NET projects. + +For details, see: + +[Snowflake Driver](https://arrow.apache.org/adbc/main/driver/snowflake.html) for docs + +[GitHub](https://github.com/apache/arrow-adbc/tree/main/go/adbc/driver/snowflake) for source code