This is an automated email from the ASF dual-hosted git repository.

curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 14c5b8b98 ci(csharp): Introduce the option to pack csharp with version 
suffix (#1870)
14c5b8b98 is described below

commit 14c5b8b9821f2df5883c1250946f20a44d0dd8e5
Author: Julian Brandrick <[email protected]>
AuthorDate: Tue May 28 06:27:29 2024 -0700

    ci(csharp): Introduce the option to pack csharp with version suffix (#1870)
    
    Modifying the csharp_pack.ps1 script and csharp project to allow for
    version suffixes when packaging.
    - Default behaviour is unchanged: default package version is the
    VersionPrefix in csharp/Directory.Build.Props (eg: 1.0.0)
    - Can now specify a version suffix: _dotnet pack --version-suffix
    "prerelease-20240517"_ results in _1.0.0-prerelease-20240517_
    
    This can be used to regularly publish prerelease packages to an internal
    feed.
    
    ---------
    
    Co-authored-by: v-jbrandrick 
<[email protected]>
---
 ci/scripts/csharp_pack.ps1   | 23 +++++++++++++++--------
 ci/scripts/csharp_pack.sh    |  8 +++++++-
 csharp/Directory.Build.props |  3 ++-
 3 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/ci/scripts/csharp_pack.ps1 b/ci/scripts/csharp_pack.ps1
index b875b60dd..8d135cef9 100644
--- a/ci/scripts/csharp_pack.ps1
+++ b/ci/scripts/csharp_pack.ps1
@@ -15,18 +15,25 @@
 #  limitations under the License.
 
 param (
-    [string]$destination=$null
+    [string]$destination=$null,
+    [string]$versionSuffix=$null
 )
 
-$loc = Get-Location
+$csharpFolder = [IO.Path]::Combine($PSScriptRoot, "..", "..", "csharp") | 
Resolve-Path
+Write-Host "Setting Path: $csharpFolder"
+Set-Location $csharpFolder
 
-if ($loc.ToString().ToLower().EndsWith("csharp") -eq $False) {
-    cd ..\..\csharp
+Write-Host "Running dotnet pack -c Release"
+$packArgs = @{
+    "c" = "Release"
 }
-
 if ($destination) {
-    dotnet pack -c Release -o $destination
+    Write-Host " * Destination: $destination"
+    $packArgs["o"] = $destination
 }
-else {
-    dotnet pack -c Release
+if ($versionSuffix) {
+    Write-Host " * Version Suffix: $versionSuffix"
+    $packArgs["-version-suffix"] = $versionSuffix
 }
+
+dotnet pack @packArgs
diff --git a/ci/scripts/csharp_pack.sh b/ci/scripts/csharp_pack.sh
index e9dfc664e..c1390efec 100755
--- a/ci/scripts/csharp_pack.sh
+++ b/ci/scripts/csharp_pack.sh
@@ -22,5 +22,11 @@ set -eux
 source_dir=${1}/csharp
 
 pushd ${source_dir}
-dotnet pack -c Release
+
+if [ -z ${2-} ]; then
+    dotnet pack -c Release;
+else
+    dotnet pack -c Release --version-suffix ${2};
+fi
+
 popd
diff --git a/csharp/Directory.Build.props b/csharp/Directory.Build.props
index 1efc8e90b..4b63d46d6 100644
--- a/csharp/Directory.Build.props
+++ b/csharp/Directory.Build.props
@@ -29,7 +29,8 @@
     <Product>Apache Arrow ADBC library</Product>
     <Copyright>Copyright 2022-2024 The Apache Software Foundation</Copyright>
     <Company>The Apache Software Foundation</Company>
-    <Version>0.13.0</Version>
+    <VersionPrefix>0.13.0</VersionPrefix>
+    <VersionSuffix>SNAPSHOT</VersionSuffix>
   </PropertyGroup>
 
   <PropertyGroup>

Reply via email to