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 <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2026-02-03 00:09:52 +05:30
committed by GitHub
parent 0e5fe9b9ac
commit 455d2aa588
12 changed files with 80 additions and 11 deletions

View File

@@ -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

View File

@@ -11,6 +11,15 @@
<VersionPrefix>0.9.0</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT AND Apache-2.0 AND BSD-3-Clause</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/microsoft/regorus</PackageProjectUrl>
<RepositoryUrl>https://github.com/microsoft/regorus</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Authors>Microsoft</Authors>
<Company>Microsoft</Company>
<PackageTags>rego;policy;engine;authorization;opa;rust</PackageTags>
<Description>Fast, lightweight Rego interpreter and policy engine for .NET, powered by Rust.</Description>
<Copyright>Copyright (c) Microsoft Corporation.</Copyright>
</PropertyGroup>
<PropertyGroup>
@@ -46,10 +55,14 @@
<Error Text="$(RegorusFFIArtifactsDir)/x86_64-unknown-linux-gnu/$(RegorusFFIArtifactsProfile)/libregorus_ffi.so missing."
Condition="!Exists('$(RegorusFFIArtifactsDir)/x86_64-unknown-linux-gnu/$(RegorusFFIArtifactsProfile)/libregorus_ffi.so')" />
<Error Text="$(RegorusFFIArtifactsDir)/aarch64-apple-darwin/$(RegorusFFIArtifactsProfile)/libregorus_ffi.dylib missing."
Condition="!Exists('$(RegorusFFIArtifactsDir)/aarch64-apple-darwin/$(RegorusFFIArtifactsProfile)/libregorus_ffi.dylib')" />
</Target>
<ItemGroup>
<None Include="docs/README.md" Pack="true" PackagePath="/" />
<None Include="../../../LICENSE" Pack="true" PackagePath="/" />
<!-- Copy each binary to expected location within the package -->
<None Include="$(RegorusFFIArtifactsDir)/x86_64-pc-windows-msvc/$(RegorusFFIArtifactsProfile)/*.dll" Pack="true" PackagePath="runtimes/win-x64/native/" />

View File

@@ -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]

View File

@@ -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

View File

@@ -18,7 +18,15 @@
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/blog/license/mit</url>
<url>https://opensource.org/licenses/MIT</url>
</license>
<license>
<name>Apache License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
</license>
<license>
<name>BSD 3-Clause License</name>
<url>https://opensource.org/licenses/BSD-3-Clause</url>
</license>
</licenses>

View File

@@ -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"]

View File

@@ -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",

View File

@@ -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]

View File

@@ -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"

View File

@@ -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

View File

@@ -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() {

View File

@@ -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<String>,
/// 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<PathBuf>,
pub enforce_artifacts: bool,
pub repository_commit: Option<String>,
pub include_symbols: bool,
}
/// Result of a NuGet build, including generated artefacts.
@@ -86,6 +96,8 @@ pub fn build_nuget_package(config: &BuildNugetConfig) -> Result<BuildNugetResult
&profile,
!config.enforce_artifacts,
config.clean,
config.repository_commit.as_deref(),
config.include_symbols,
)?;
let packages = find_packages(&package_dir)?;
@@ -132,6 +144,8 @@ fn invoke_dotnet_pack(
profile: &str,
ignore_missing: bool,
clean: bool,
repository_commit: Option<&str>,
include_symbols: bool,
) -> Result<PathBuf> {
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)?;