Skip to content

Commit

Permalink
feat: Add a separate web SDK for clients without HTTP 2.0 (#568)
Browse files Browse the repository at this point in the history
* feat: Add a separate web SDK for clients without HTTP 2.0

Add a new Momento.Sdk.Web artifact that uses gRPC-Web so that users
without access to HTTP 2.0 can use the SDK. Building with the
USE_GRPC_WEB will generate the new Momento.Sdk.Web.dll. Note that this
will affect the unity build as well.

Add a pack and publish step to push the new artifact to nuget.

* Enable nuget publishing of the web SDK

Remove redundant build step.

Add comments above the standard and web SDK property groups.
  • Loading branch information
nand4011 authored Sep 6, 2024
1 parent 8f9eb8f commit 9457e15
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 14 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/on-push-to-release-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ jobs:
with:
dotnet-version: "6.0.x"

- name: Build
run: make build

- name: Pack and Publish
- name: Pack and Publish the standard SDK
run: |
set -x
pushd src/Momento.Sdk
Expand All @@ -57,6 +54,17 @@ jobs:
dotnet pack -c Release -p:Version=${VERSION}
dotnet nuget push ./bin/Release/Momento.Sdk.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key=${{secrets.NUGET_API_KEY}}
popd
- name: Pack and Publish the web SDK
run: |
set -x
pushd src/Momento.Sdk
VERSION="${{ needs.release.outputs.version }}"
echo "version: ${VERSION}"
dotnet build -p:DefineConstants=USE_GRPC_WEB --configuration Release
dotnet pack -p:DefineConstants=USE_GRPC_WEB -c Release -p:Version=${VERSION}
dotnet nuget push ./bin/Release/Momento.Sdk.Web.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key=${{secrets.NUGET_API_KEY}}
popd
- name: Build for Unity
run: |
Expand All @@ -68,7 +76,7 @@ jobs:
dotnet publish --configuration Release -f netstandard2.0 -p:DefineConstants=USE_GRPC_WEB -p:VersionPrefix=${VERSION}
mkdir ./bin/Release/netstandard2.0/MomentoSdkUnity
pushd ./bin/Release/netstandard2.0/publish/
cp Google.Protobuf.dll Grpc.Core.Api.dll Grpc.Net.Client.dll Grpc.Net.Client.Web.dll Grpc.Net.Common.dll JWT.dll Microsoft.Bcl.AsyncInterfaces.dll Microsoft.Extensions.Logging.Abstractions.dll Momento.Protos.dll Momento.Sdk.dll Newtonsoft.Json.dll System.Diagnostics.DiagnosticSource.dll System.Runtime.CompilerServices.Unsafe.dll System.Threading.Channels.dll ../MomentoSdkUnity/
cp Google.Protobuf.dll Grpc.Core.Api.dll Grpc.Net.Client.dll Grpc.Net.Client.Web.dll Grpc.Net.Common.dll JWT.dll Microsoft.Bcl.AsyncInterfaces.dll Microsoft.Extensions.Logging.Abstractions.dll Momento.Protos.dll Momento.Sdk.Web.dll Newtonsoft.Json.dll System.Diagnostics.DiagnosticSource.dll System.Runtime.CompilerServices.Unsafe.dll System.Threading.Channels.dll ../MomentoSdkUnity/
popd
zip -jr MomentoSdkUnity.zip bin/Release/netstandard2.0/MomentoSdkUnity/
ZIP_FILE=./MomentoSdkUnity.zip
Expand Down
37 changes: 28 additions & 9 deletions src/Momento.Sdk/Momento.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,43 @@
<IncludeSymbols>true</IncludeSymbols>
<!-- Publish the repository URL in the built .nupkg -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Package metadata -->
<PackageId>Momento.Sdk</PackageId>

<!-- Common package metadata -->
<Authors>Momento</Authors>
<Company>Momento Inc</Company>
<Description>
C# SDK for Momento, a serverless cache that automatically scales without any of the
operational overhead required by traditional caching solutions.

Check out our SDK example here: https://github.com/momentohq/client-sdk-dotnet/tree/main/examples
</Description>
<PackageTags>caching, cache, serverless, key value, simple caching service, distributedcache</PackageTags>
<Copyright>Copyright (c) Momento Inc 2022</Copyright>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/momentohq/client-sdk-dotnet</PackageProjectUrl>
<RepositoryUrl>https://github.com/momentohq/client-sdk-dotnet</RepositoryUrl>
</PropertyGroup>

<!-- The standard SDK package that builds by default -->
<PropertyGroup>
<PackageId>Momento.Sdk</PackageId>
<AssemblyName>Momento.Sdk</AssemblyName>
<Description>
C# SDK for Momento, a serverless cache that automatically scales without any of the
operational overhead required by traditional caching solutions.

Check out our SDK example here: https://github.com/momentohq/client-sdk-dotnet/tree/main/examples
</Description>
</PropertyGroup>

<!-- The web SDK package that builds instead of the standard if the gRPC web constant is defined -->
<PropertyGroup Condition=" $(DefineConstants.Contains('USE_GRPC_WEB')) ">
<PackageId>Momento.Sdk.Web</PackageId>
<AssemblyName>Momento.Sdk.Web</AssemblyName>
<Description>
C# Web SDK for Momento, a serverless cache that automatically scales without any of the
operational overhead required by traditional caching solutions.

This version of the SDK uses gRPC-Web and is for clients that don't have access to HTTP 2.0.

Check out our SDK example here: https://github.com/momentohq/client-sdk-dotnet/tree/main/examples
</Description>
</PropertyGroup>

<ItemGroup>
<None Remove="System.Threading.Channels" />
<None Remove="Internal\Middleware\" />
Expand Down Expand Up @@ -60,7 +80,6 @@
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition=" $(DefineConstants.Contains('USE_GRPC_WEB')) ">
<!-- Currently the Unity build needs gRPC-Web -->
<PackageReference Include="Grpc.Net.Client.Web" Version="2.63.0" />
</ItemGroup>
<ProjectExtensions>
Expand Down

0 comments on commit 9457e15

Please sign in to comment.