From 455d2aa588753c3fbd2378371316949d53a7e726 Mon Sep 17 00:00:00 2001 From: Anand Krishnamoorthi <35780660+anakrish@users.noreply.github.com> Date: Tue, 3 Feb 2026 00:09:52 +0530 Subject: [PATCH] chore(nuget): Add support for macosx (#553) Additionally - Include more metadata in nuget package - Also generate snupkg for native symbols. We intentionally don't add the symbols for native rust shared library to the nuget package since that could increase the size of the nuget. We will revisit that later. - update licenses of all the bindings. closes #551 Signed-off-by: Anand Krishnamoorthi --- .github/workflows/test-csharp.yml | 21 +++++++++------- bindings/csharp/Regorus/Regorus.csproj | 13 ++++++++++ bindings/ffi/Cargo.toml | 1 + bindings/java/Cargo.toml | 1 + bindings/java/pom.xml | 10 +++++++- bindings/python/Cargo.toml | 1 + bindings/python/pyproject.toml | 4 +++ bindings/ruby/ext/regorusrb/Cargo.toml | 1 + bindings/ruby/regorusrb.gemspec | 2 +- bindings/wasm/Cargo.toml | 1 + xtask/src/tasks/bindings/all.rs | 2 ++ xtask/src/tasks/bindings/csharp.rs | 34 ++++++++++++++++++++++++++ 12 files changed, 80 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-csharp.yml b/.github/workflows/test-csharp.yml index 34bb195..f047b35 100644 --- a/.github/workflows/test-csharp.yml +++ b/.github/workflows/test-csharp.yml @@ -31,17 +31,18 @@ jobs: target: x86_64-unknown-linux-gnu libpath: | **/release/libregorus_ffi.so - # Disabled for now - #- os: macos-latest - # target: aarch64-apple-darwin - # libpath: | - # **/release/libregorus_ffi.dylib + - os: macos-latest + target: aarch64-apple-darwin + libpath: | + **/release/libregorus_ffi.dylib steps: - name: Checkout repository uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 with: fetch-depth: 0 - uses: ./.github/actions/toolchains/rust + with: + targets: ${{ matrix.runtime.target }} - name: Cache cargo uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 with: @@ -99,13 +100,15 @@ jobs: run: ls -R ./bindings/csharp/Regorus/tmp - name: Build Regorus nuget via xtask - run: cargo xtask build-csharp --release --clean --artifacts-dir ./bindings/csharp/Regorus/tmp/bindings/ffi/target --enforce-artifacts + run: cargo xtask build-csharp --release --clean --artifacts-dir ./bindings/csharp/Regorus/tmp/bindings/ffi/target --enforce-artifacts --repository-commit ${{ github.sha }} --include-symbols - name: Upload Regorus nuget uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: regorus-nuget - path: bindings/csharp/Regorus/bin/Release/Regorus*.nupkg + path: | + bindings/csharp/Regorus/bin/Release/Regorus*.nupkg + bindings/csharp/Regorus/bin/Release/Regorus*.snupkg if-no-files-found: error retention-days: 1 @@ -122,8 +125,8 @@ jobs: target: x86_64-pc-windows-msvc - os: ubuntu-latest target: x86_64-unknown-linux-gnu - #- os: macos-latest - # target: aarch64-apple-darwin + - os: macos-latest + target: aarch64-apple-darwin steps: - name: Checkout repository uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 diff --git a/bindings/csharp/Regorus/Regorus.csproj b/bindings/csharp/Regorus/Regorus.csproj index 136a469..dac5ef6 100644 --- a/bindings/csharp/Regorus/Regorus.csproj +++ b/bindings/csharp/Regorus/Regorus.csproj @@ -11,6 +11,15 @@ 0.9.0 $(VersionSuffix) README.md + MIT AND Apache-2.0 AND BSD-3-Clause + https://github.com/microsoft/regorus + https://github.com/microsoft/regorus + git + Microsoft + Microsoft + rego;policy;engine;authorization;opa;rust + Fast, lightweight Rego interpreter and policy engine for .NET, powered by Rust. + Copyright (c) Microsoft Corporation. @@ -46,10 +55,14 @@ + + + diff --git a/bindings/ffi/Cargo.toml b/bindings/ffi/Cargo.toml index d83f9ca..5c93b5c 100644 --- a/bindings/ffi/Cargo.toml +++ b/bindings/ffi/Cargo.toml @@ -4,6 +4,7 @@ name = "regorus-ffi" version = "0.9.0" edition = "2021" +license = "MIT AND Apache-2.0 AND BSD-3-Clause" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/bindings/java/Cargo.toml b/bindings/java/Cargo.toml index e443ee3..d15e637 100644 --- a/bindings/java/Cargo.toml +++ b/bindings/java/Cargo.toml @@ -6,6 +6,7 @@ version = "0.9.0" edition = "2021" repository = "https://github.com/microsoft/regorus/bindings/java" description = "Java bindings for Regorus - a fast, lightweight Rego interpreter written in Rust" +license = "MIT AND Apache-2.0 AND BSD-3-Clause" keywords = ["interpreter", "opa", "policy-as-code", "rego"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/bindings/java/pom.xml b/bindings/java/pom.xml index 2d2960e..a1124e6 100644 --- a/bindings/java/pom.xml +++ b/bindings/java/pom.xml @@ -18,7 +18,15 @@ MIT License - https://opensource.org/blog/license/mit + https://opensource.org/licenses/MIT + + + Apache License 2.0 + https://www.apache.org/licenses/LICENSE-2.0 + + + BSD 3-Clause License + https://opensource.org/licenses/BSD-3-Clause diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index d0e06e0..0b8bb56 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -6,6 +6,7 @@ version = "0.9.0" edition = "2021" repository = "https://github.com/microsoft/regorus/bindings/python" description = "Python bindings for Regorus - a fast, lightweight Rego interpreter written in Rust" +license = "MIT AND Apache-2.0 AND BSD-3-Clause" keywords = ["interpreter", "opa", "policy-as-code", "rego"] diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index f135e1e..082e440 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -5,7 +5,11 @@ build-backend = "maturin" [project] name = "regorus" requires-python = ">=3.8" +license = { text = "MIT AND Apache-2.0 AND BSD-3-Clause" } classifiers = [ + "License :: OSI Approved :: Apache Software License", + "License :: OSI Approved :: BSD License", + "License :: OSI Approved :: MIT License", "Programming Language :: Rust", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", diff --git a/bindings/ruby/ext/regorusrb/Cargo.toml b/bindings/ruby/ext/regorusrb/Cargo.toml index e0841be..5917dbd 100644 --- a/bindings/ruby/ext/regorusrb/Cargo.toml +++ b/bindings/ruby/ext/regorusrb/Cargo.toml @@ -3,6 +3,7 @@ name = "regorusrb" version = "0.9.0" edition = "2024" description = "Ruby bindings for Regorus - a fast, lightweight Rego interpreter written in Rust" +license = "MIT AND Apache-2.0 AND BSD-3-Clause" publish = false [lib] diff --git a/bindings/ruby/regorusrb.gemspec b/bindings/ruby/regorusrb.gemspec index 92b52c3..01f2281 100644 --- a/bindings/ruby/regorusrb.gemspec +++ b/bindings/ruby/regorusrb.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |spec| spec.summary = "Ruby bindings for Regorus - a fast, lightweight Rego interpreter written in Rust" spec.homepage = "https://github.com/microsoft/regorus/blob/main/bindings/ruby" - spec.license = "MIT" + spec.licenses = ["MIT", "Apache-2.0", "BSD-3-Clause"] spec.required_ruby_version = ">= 3.4.2" spec.required_rubygems_version = ">= 3.6.5" diff --git a/bindings/wasm/Cargo.toml b/bindings/wasm/Cargo.toml index ab66dc8..7cb797a 100644 --- a/bindings/wasm/Cargo.toml +++ b/bindings/wasm/Cargo.toml @@ -6,6 +6,7 @@ version = "0.9.0" edition = "2021" repository = "https://github.com/microsoft/regorus/bindings/wasm" description = "WASM bindings for Regorus - a fast, lightweight Rego interpreter written in Rust" +license = "MIT AND Apache-2.0 AND BSD-3-Clause" keywords = ["interpreter", "opa", "policy-as-code", "rego"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/xtask/src/tasks/bindings/all.rs b/xtask/src/tasks/bindings/all.rs index 4cbc344..1352c4d 100644 --- a/xtask/src/tasks/bindings/all.rs +++ b/xtask/src/tasks/bindings/all.rs @@ -36,6 +36,8 @@ impl BuildAllBindingsCommand { clean: false, artifacts_dir: Some(ffi_dir.clone()), enforce_artifacts: false, + repository_commit: None, + include_symbols: false, })?; if nuget_result.packages.is_empty() { diff --git a/xtask/src/tasks/bindings/csharp.rs b/xtask/src/tasks/bindings/csharp.rs index d9b7955..e12e758 100644 --- a/xtask/src/tasks/bindings/csharp.rs +++ b/xtask/src/tasks/bindings/csharp.rs @@ -35,6 +35,14 @@ pub struct BuildNugetCommand { /// Require all platform artefacts to exist before packing. #[arg(long)] pub enforce_artifacts: bool, + + /// Include repository commit metadata in the package. + #[arg(long = "repository-commit", value_name = "SHA")] + pub repository_commit: Option, + + /// Build a symbols package (snupkg). + #[arg(long)] + pub include_symbols: bool, } /// Parsed build options shared across tasks that need a NuGet package. @@ -45,6 +53,8 @@ pub struct BuildNugetConfig { pub clean: bool, pub artifacts_dir: Option, pub enforce_artifacts: bool, + pub repository_commit: Option, + pub include_symbols: bool, } /// Result of a NuGet build, including generated artefacts. @@ -86,6 +96,8 @@ pub fn build_nuget_package(config: &BuildNugetConfig) -> Result, + include_symbols: bool, ) -> Result { let project_dir = root.join("bindings/csharp/Regorus"); let artifacts_dir_str = artifacts_dir @@ -140,6 +154,12 @@ fn invoke_dotnet_pack( let profile_arg = format!("/p:RegorusFFIArtifactsProfile={}", profile); let dir_arg = format!("/p:RegorusFFIArtifactsDir={}", artifacts_dir_str); + let repo_commit_arg = repository_commit.map(|sha| format!("/p:RepositoryCommit={}", sha)); + let symbols_args = if include_symbols { + Some(("/p:IncludeSymbols=true", "/p:SymbolPackageFormat=snupkg")) + } else { + None + }; if clean { clean_msbuild_project(&project_dir)?; @@ -169,6 +189,9 @@ fn invoke_dotnet_pack( build.arg("minimal"); build.arg(&dir_arg); build.arg(&profile_arg); + if let Some(arg) = &repo_commit_arg { + build.arg(arg); + } if ignore_missing { build.arg("/p:IgnoreMissingArtifacts=true"); } @@ -182,6 +205,13 @@ fn invoke_dotnet_pack( pack.arg(configuration); pack.arg(&dir_arg); pack.arg(&profile_arg); + if let Some(arg) = &repo_commit_arg { + pack.arg(arg); + } + if let Some((include_symbols_arg, symbols_format_arg)) = symbols_args { + pack.arg(include_symbols_arg); + pack.arg(symbols_format_arg); + } if ignore_missing { pack.arg("/p:IgnoreMissingArtifacts=true"); } @@ -217,6 +247,8 @@ impl BuildNugetCommand { clean: self.clean, artifacts_dir: self.artifacts_dir.clone(), enforce_artifacts: self.enforce_artifacts, + repository_commit: self.repository_commit.clone(), + include_symbols: self.include_symbols, } } } @@ -307,6 +339,8 @@ impl TestCsharpCommand { clean: self.clean, artifacts_dir: self.artifacts_dir.clone(), enforce_artifacts: self.enforce_artifacts, + repository_commit: None, + include_symbols: false, }; let mut packages = find_packages(&package_dir)?;