Use the build
shell script to build the source code in this repository:
Linux or macOS
./build.sh --help
Windows
build.cmd -help
- Building from source
-
Rust
Install Rust using rustup. -
.NET SDK 8.0 and 9.0 (both are required)
Download the .NET SDKs from dotnet.microsoft.com. -
docfx (optional)
The IceRRC API reference is generated by docfx. You can install docfx as follows:dotnet tool update -g docfx
-
ReportGenerator (optional)
The code coverage reports are generated by ReportGenerator. You can install ReportGenerator as follows:dotnet tool install -g dotnet-reportgenerator-globaltool
flowchart LR
compiler(slicec-cs) --> slice-tools(IceRpc.Slice.Tools) --> icerpc(ZeroC.Slice<br>IceRpc.*)
protobuf-tools(IceRpc.Protobuf.Tools) --> icerpc
icerpc -- doc --> api(API reference)
icerpc -- publish --> nuget(NuGet packages) --> examples(Examples)
icerpc --> tests(Tests) -- coverage --> cov(Code coverage reports)
The Slice compiler for C# (slicec-cs) is written in Rust. Everything else is written in C#.
Linux or macOS
./build.sh --build
Windows
build.cmd -build
This command builds all the tools, sources and tests with the default config (debug).
The -build/--build action is optional since it's the default build action.
Select Tasks: Run Build Task...
from the command palette to run the build script from Visual Studio Code.
dotnet test
This command executes all tests known to the IceRpc.sln
solution. See
dotnet-test for additional options.
cd tools/slicec-cs
cargo test
This command runs the test suite for slicec-cs
.
Linux or macOS
./build.sh --publish
Windows
build.cmd -publish
This command creates all the NuGet packages and publishes them to your local global-packages
source.
Note This is an essential step if you want to use a local build with the examples.
By default, the NuGet package IceRpc.Slice.Tools
includes only the slicec-cs
compiler created by the local build.
If you set the MSBuild property SLICEC_CS_STAGING_PATH
, IceRpc.Slice.Tools
instead includes the slicec-cs
compiler
for all supported platforms. The expected layout of the staging directory is
<os-name>-<os-arch>/<compiler-executable>
, with the following subdirectories:
linux-x64
: Linux x86_64linux-arm64
: Linux ARM64macos-x64
: macOS x86_64macos-arm64
: macOS Apple siliconwindows-x64
: Windows x64
Make sure that all these compilers are available when you set SLICEC_CS_STAGING_PATH
.
Linux or macOS
./build.sh --doc
Windows
build.cmd -doc
This command generates the API reference into the docfx\_site
directory. Start a local web server to view this
API reference:
docfx serve docfx/_site
Linux or macOS
./build.sh --coverage
Windows
build.cmd -coverage
You may occasionally encounter errors when cleaning and building because background MSBuild servers use/lock the
IceRpc.Slice.Tools
assembly. When this happens, you can shutdown these MSBuild servers with:
dotnet build-server shutdown
The slice sub-directory is managed by a Git subtree and contains the contents of the icerpc-slice repository. Updates to the files in this sub-directory must be done in the icerpc-slice repository first and then the changes can be pulled.
The procedure to upgrade these files is as follows:
-
Open a PR (pull request) in the icerpc-slice repository with the desired changes. Once approved merge the PR in the icerpc-slice repository.
-
Create a companion PR for the required changes in the icerpc-csharp repository. Start by creating a branch for the PR and pulling the changes from icerpc-slice:
git checkout -b my-branch --track origin/main git subtree pull --prefix slice [email protected]:icerpc/icerpc-slice.git main git push <remote> my-branch
-
Make the necessary C# updates, open the PR in icerpc-csharp, and iterate until it's ready for merging. The "Check Slice Subtree Updates" workflow job is expected to fail at this point. This is the workflow ensuring that the contents of slice sub-directory are not updated with a PR.
-
Once you are ready to merge you need to first merge the icerpc-slice changes into the icerpc-csharp's main branch
git checkout -b main --track origin/main git pull git subtree pull --prefix slice [email protected]:icerpc/icerpc-slice.git main git push origin main
-
Then merge the main branch into your PR
git checkout my-branch git merge origin/main git push <remote> my-branch
-
Ensure that "Check Slice Subtree Updates" workflow job passes, and that no files under slice sub-directory are modified by the PR.
-
Finally merge your PR as usual.
Please ensure to replace <remote>
with the appropriate remote repository name where you want to push your changes.
Also, make sure to follow the instructions carefully, and adjust any repository and branch names as needed for your
specific setup.