Skip to content

Commit

Permalink
feat(client-gen): .NET client code generator (rust native lib)
Browse files Browse the repository at this point in the history
  • Loading branch information
vobradovich authored Nov 15, 2024
1 parent fa10414 commit 816550e
Show file tree
Hide file tree
Showing 49 changed files with 4,571 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
*.ts text
*.json text
yarn.lock merge=union

# Verify
*.verified.txt text eol=lf working-tree-encoding=UTF-8
*.verified.xml text eol=lf working-tree-encoding=UTF-8
*.verified.json text eol=lf working-tree-encoding=UTF-8
*.verified.cs text eol=lf working-tree-encoding=UTF-8
97 changes: 97 additions & 0 deletions .github/workflows/net-build-client-gen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: '[net] Build client-gen-dotnet'

on:
push:
branches:
- master
paths:
- '.github/workflows/net-build-client-gen.yml'
- 'net/rs/**'

pull_request:
paths:
- '.github/workflows/net-build-client-gen.yml'
- 'net/rs/**'

jobs:
win-x64:
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- run: cargo build --manifest-path net/rs/Cargo.toml --release
- uses: actions/upload-artifact@v4
with:
name: win-x64
path: ./net/rs/target/release/sails_net_client_gen.dll
retention-days: 1
overwrite: true

linux-x64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo build --manifest-path net/rs/Cargo.toml --release
- uses: actions/upload-artifact@v4
with:
name: linux-x64
path: ./net/rs/target/release/libsails_net_client_gen.so
retention-days: 1
overwrite: true

osx-x64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: rustup target add x86_64-apple-darwin
- run: cargo build --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin
- uses: actions/upload-artifact@v4
with:
name: osx-x64
path: ./net/rs/target/x86_64-apple-darwin/release/libsails_net_client_gen.dylib
retention-days: 1
overwrite: true

osx-arm64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: rustup target add aarch64-apple-darwin
- run: cargo build --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin
- uses: actions/upload-artifact@v4
with:
name: osx-arm64
path: ./net/rs/target/aarch64-apple-darwin/release/libsails_net_client_gen.dylib
retention-days: 1
overwrite: true

build-nuget-package:
needs:
- win-x64
- linux-x64
- osx-x64
- osx-arm64
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download native libraries
uses: actions/download-artifact@v4
with:
path: native-libraries

- name: Build
run: dotnet build ./net/src/Sails.ClientGenerator/ -c Release -p:LibraryRoot=${{ github.workspace }}/native-libraries -p:Version=0.6.3-rc

- name: Pack
run: dotnet pack ./net/src/Sails.ClientGenerator/ -c Release --no-build -p:Version=0.6.3-rc -o ./publish

- name: Upload NuGet artifact
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: ./publish/*.nupkg
retention-days: 1
overwrite: true

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ js/test/demo/
!.yarn/sdks
!.yarn/versions
.npmrc

# Verify
*.received.*
*.received/
28 changes: 26 additions & 2 deletions Sails.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Substrate.Gear.Client", "net\src\Substrate.Gear.Client\Substrate.Gear.Client.csproj", "{1589D5A4-0CC4-4855-89E0-2E61BBC5E0B0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Substrate.Gear.Client.Tests", "net\tests\Substrate.Gear.Client.Tests\Substrate.Gear.Client.Tests.csproj", "{42B621CE-C2B4-4911-961C-5B087A514AF5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sails.Tests.Shared", "net\tests\Sails.Tests.Shared\Sails.Tests.Shared.csproj", "{382EBE9F-C60C-4D20-A585-B3272113F944}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sails.Remoting.Tests", "net\tests\Sails.Remoting.Tests\Sails.Remoting.Tests.csproj", "{DEEACFC0-EE4D-42E5-9616-232242913A39}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sails.ClientGenerator", "net\src\Sails.ClientGenerator\Sails.ClientGenerator.csproj", "{F93FFE42-71C1-44BD-9DBA-3559B307370C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sails.ClientGenerator.Tests", "net\tests\Sails.ClientGenerator.Tests\Sails.ClientGenerator.Tests.csproj", "{A6A2172B-8F8F-4BDC-B519-E7299FFCCA5F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{19594BCA-94DB-44AD-ACBC-2ACFED242E9F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Substrate.Gear.Client.Tests", "net\tests\Substrate.Gear.Client.Tests\Substrate.Gear.Client.Tests.csproj", "{42B621CE-C2B4-4911-961C-5B087A514AF5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sails.Client.Tests", "net\tests\Sails.Client.Tests\Sails.Client.Tests.csproj", "{BC248D44-14CD-4BB0-9AF9-4E0750574492}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -51,6 +59,14 @@ Global
{1589D5A4-0CC4-4855-89E0-2E61BBC5E0B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1589D5A4-0CC4-4855-89E0-2E61BBC5E0B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1589D5A4-0CC4-4855-89E0-2E61BBC5E0B0}.Release|Any CPU.Build.0 = Release|Any CPU
{F93FFE42-71C1-44BD-9DBA-3559B307370C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F93FFE42-71C1-44BD-9DBA-3559B307370C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F93FFE42-71C1-44BD-9DBA-3559B307370C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F93FFE42-71C1-44BD-9DBA-3559B307370C}.Release|Any CPU.Build.0 = Release|Any CPU
{A6A2172B-8F8F-4BDC-B519-E7299FFCCA5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6A2172B-8F8F-4BDC-B519-E7299FFCCA5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6A2172B-8F8F-4BDC-B519-E7299FFCCA5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6A2172B-8F8F-4BDC-B519-E7299FFCCA5F}.Release|Any CPU.Build.0 = Release|Any CPU
{42B621CE-C2B4-4911-961C-5B087A514AF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42B621CE-C2B4-4911-961C-5B087A514AF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42B621CE-C2B4-4911-961C-5B087A514AF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -63,10 +79,18 @@ Global
{DEEACFC0-EE4D-42E5-9616-232242913A39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEEACFC0-EE4D-42E5-9616-232242913A39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEEACFC0-EE4D-42E5-9616-232242913A39}.Release|Any CPU.Build.0 = Release|Any CPU
{BC248D44-14CD-4BB0-9AF9-4E0750574492}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC248D44-14CD-4BB0-9AF9-4E0750574492}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC248D44-14CD-4BB0-9AF9-4E0750574492}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC248D44-14CD-4BB0-9AF9-4E0750574492}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A6A2172B-8F8F-4BDC-B519-E7299FFCCA5F} = {19594BCA-94DB-44AD-ACBC-2ACFED242E9F}
{BC248D44-14CD-4BB0-9AF9-4E0750574492} = {19594BCA-94DB-44AD-ACBC-2ACFED242E9F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0894C08B-8BB9-401D-8471-26F5EB5A4EA2}
EndGlobalSection
Expand Down
10 changes: 10 additions & 0 deletions net/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -501,3 +501,13 @@ dotnet_diagnostic.IDE0060.severity = none
csharp_style_unused_value_assignment_preference = discard_variable:none
dotnet_diagnostic.IDE0059.severity = none
dotnet_diagnostic.CA1416.severity = warning

# Verify settings
[*.{received,verified}.{json,txt,xml,cs}]
charset = "utf-8-bom"
end_of_line = lf
indent_size = unset
indent_style = unset
insert_final_newline = false
tab_width = unset
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions net/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Ensure.That" Version="10.1.0" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.11.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="PolySharp" Version="1.14.1" />
<PackageVersion Include="Substrate.NET.API" Version="0.9.24-rc8" />
Expand All @@ -13,12 +14,17 @@
<!-- For Tests -->
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Nito.AsyncEx" Version="5.1.2" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="Testcontainers" Version="4.0.0" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.5.0" />
<PackageVersion Include="Verify.Xunit" Version="27.1.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<!-- For Code Analysis -->
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.12.9" />
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.12.9" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 816550e

Please sign in to comment.