forked from apache/arrow-adbc
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(csharp): script build, test, package and smoke test (apache#1345)
Down payment toward apache#1121: - Structures the projects for NuGet packaging --------- Co-authored-by: David Coe <[email protected]>
- Loading branch information
Showing
36 changed files
with
466 additions
and
51 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ x64 | |
|
||
artifacts/ | ||
TestResults/ | ||
packages/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- | ||
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. | ||
--> | ||
|
||
<Project> | ||
|
||
<!-- The following works around https://github.com/dotnet/sourcelink/issues/572 --> | ||
<PropertyGroup> | ||
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/> | ||
<EmbeddedFiles Include="$(TargetFrameworkMonikerAssemblyAttributesPath)"/> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- | ||
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. | ||
--> | ||
# Apache Arrow ADBC | ||
|
||
An implementation of Arrow ADBC targeting .NET Standard 2.0 and .NET 6 or later. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks> | ||
<PackageReadmeFile>readme.md</PackageReadmeFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Apache.Arrow.Adbc\Apache.Arrow.Adbc.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="readme.md"> | ||
<Pack>true</Pack> | ||
<PackagePath>\</PackagePath> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
csharp/src/Drivers/Interop/Snowflake/Apache.Arrow.Adbc.Drivers.Interop.Snowflake.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net472;net6.0</TargetFrameworks> | ||
<PackageReadmeFile>readme.md</PackageReadmeFile> | ||
</PropertyGroup> | ||
<!-- use Build-SnowflakeDriver.ps1 to build the dll --> | ||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="$([MSBuild]::IsOSPlatform('Windows'))"> | ||
<Exec Command="powershell -ExecutionPolicy Unrestricted -File $(ProjectDir)Build-SnowflakeDriver.ps1" /> | ||
</Target> | ||
|
||
<!-- libadbc_driver_snowflake.dll is listed for each framework because $(TargetFramework) doesn't work here --> | ||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))"> | ||
<Content Include="libadbc_driver_snowflake.dll"> | ||
<Pack>true</Pack> | ||
<PackagePath>lib\netstandard2.0</PackagePath> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="libadbc_driver_snowflake.dll"> | ||
<Pack>true</Pack> | ||
<PackagePath>lib\net472</PackagePath> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="libadbc_driver_snowflake.dll"> | ||
<Pack>true</Pack> | ||
<PackagePath>lib\net6.0</PackagePath> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="readme.md"> | ||
<Pack>true</Pack> | ||
<PackagePath>\</PackagePath> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\Apache.Arrow.Adbc\Apache.Arrow.Adbc.csproj" /> | ||
</ItemGroup> | ||
</Project> |
36 changes: 36 additions & 0 deletions
36
csharp/src/Drivers/Interop/Snowflake/Build-SnowflakeDriver.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# 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. | ||
|
||
Write-Host "Building the Snowflake ADBC Go driver" | ||
|
||
$location = Get-Location | ||
|
||
$file = "libadbc_driver_snowflake.dll" | ||
|
||
cd ..\..\..\..\..\go\adbc\pkg | ||
|
||
if(Test-Path $file) | ||
{ | ||
#because each framework build will run the script, avoid building it each time | ||
$diff=((ls $file).LastWriteTime - (Get-Date)).TotalSeconds | ||
if ($diff -gt -30) | ||
{ | ||
Write-Output "Skipping build of $file because it is too recent" | ||
exit | ||
} | ||
} | ||
make $file | ||
COPY $file $location |
63 changes: 63 additions & 0 deletions
63
csharp/src/Drivers/Interop/Snowflake/SnowflakeDriverLoader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
using System.IO; | ||
using Apache.Arrow.Adbc.C; | ||
|
||
namespace Apache.Arrow.Adbc.Drivers.Interop.Snowflake | ||
{ | ||
/// <summary> | ||
/// Lightweight class for loading the Snowflake Go driver to .NET. | ||
/// </summary> | ||
public class SnowflakeDriverLoader | ||
{ | ||
/// <summary> | ||
/// Loads the Snowflake Go driver from the current directory using the default name and entry point. | ||
/// </summary> | ||
/// <returns>An <see cref="AdbcDriver"/> based on the Snowflake Go driver.</returns> | ||
/// <exception cref="FileNotFoundException"></exception> | ||
public static AdbcDriver LoadDriver() | ||
{ | ||
string file = "libadbc_driver_snowflake.dll"; | ||
|
||
if(File.Exists(file)) | ||
{ | ||
// get the full path because some .NET versions need it | ||
file = Path.GetFullPath(file); | ||
} | ||
else | ||
{ | ||
throw new FileNotFoundException($"Cound not find {file}"); | ||
} | ||
|
||
return LoadDriver(file, "SnowflakeDriverInit"); | ||
} | ||
|
||
/// <summary> | ||
/// Loads the Snowflake Go driver from the current directory using the default name and entry point. | ||
/// </summary> | ||
/// <param name="file">The file to load.</param> | ||
/// <param name="entryPoint">The entry point of the file.</param> | ||
/// <returns>An <see cref="AdbcDriver"/> based on the Snowflake Go driver.</returns> | ||
public static AdbcDriver LoadDriver(string file, string entryPoint) | ||
{ | ||
AdbcDriver snowflakeDriver = CAdbcDriverImporter.Load(file, entryPoint); | ||
|
||
return snowflakeDriver; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
--> | ||
|
||
# About | ||
This project generates a NuGet package containing the Snowflake ADBC Go Driver for use in other .NET projects. It contains a lightweight loader for loading the driver. | ||
|
||
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 | ||
|
||
## Build the Snowflake Driver | ||
Run the `Build-SnowflakeDriver.ps1` script to build the Snowflake driver. |
Oops, something went wrong.