{"id":13787916,"url":"https://github.com/me-viper/OpaDotNet.Compilation","last_synced_at":"2025-05-12T02:30:42.632Z","repository":{"id":188658341,"uuid":"679162647","full_name":"me-viper/OpaDotNet.Compilation","owner":"me-viper","description":"Backend for packaging OPA policy and data files into bundles","archived":false,"fork":false,"pushed_at":"2025-03-13T04:55:59.000Z","size":141,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-13T05:29:37.837Z","etag":null,"topics":["dotnet-core","open-policy-agent"],"latest_commit_sha":null,"homepage":"https://me-viper.github.io/OpaDotNet/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/me-viper.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-16T08:27:47.000Z","updated_at":"2025-03-13T04:56:02.000Z","dependencies_parsed_at":"2023-08-16T10:23:28.792Z","dependency_job_id":"66fde00d-3328-4adc-a8d7-42909e8bb05f","html_url":"https://github.com/me-viper/OpaDotNet.Compilation","commit_stats":null,"previous_names":["me-viper/opadotnet.compilation"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-viper%2FOpaDotNet.Compilation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-viper%2FOpaDotNet.Compilation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-viper%2FOpaDotNet.Compilation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-viper%2FOpaDotNet.Compilation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/me-viper","download_url":"https://codeload.github.com/me-viper/OpaDotNet.Compilation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253662552,"owners_count":21944093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet-core","open-policy-agent"],"created_at":"2024-08-03T21:00:33.268Z","updated_at":"2025-05-12T02:30:42.616Z","avatar_url":"https://github.com/me-viper.png","language":"C#","readme":"\u003e [!CAUTION]\n\u003e This repository moved. Please use the new location: [OpaDotNet](https://github.com/me-viper/OpaDotNet/tree/main/src/Compilation)\n\n[![CI](https://github.com/me-viper/OpaDotNet.Compilation/actions/workflows/ci.yml/badge.svg)](https://github.com/me-viper/OpaDotNet.Compilation/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/me-viper/OpaDotNet.Compilation/badge.svg?branch=main)](https://coveralls.io/github/me-viper/OpaDotNet.Compilation?branch=main)\n![Static Badge](https://img.shields.io/badge/OPA-_v0.60.0-blue)\n\n\n# Open Policy Agent (OPA) Compilation Tools\n\nBackend for packaging OPA policy and data files into bundles for [OpaDotNet](https://github.com/me-viper/OpaDotNet) project.\n\n## NuGet Packages\n\n|                                       | Package  |\n|---------------------------------------|----------|\n| OpaDotNet.Compilation.Abstractions    | [![NuGet](https://img.shields.io/nuget/v/OpaDotNet.Compilation.Abstractions.svg)](https://www.nuget.org/packages/OpaDotNet.Compilation.Abstractions/) |\n| OpaDotNet.Compilation.Cli             | [![NuGet](https://img.shields.io/nuget/v/OpaDotNet.Compilation.Cli.svg)](https://www.nuget.org/packages/OpaDotNet.Compilation.Cli/) |\n| OpaDotNet.Compilation.Interop         | [![NuGet](https://img.shields.io/nuget/v/OpaDotNet.Compilation.Interop.svg)](https://www.nuget.org/packages/OpaDotNet.Compilation.Interop/) |\n\n## Getting Started\n\nWhich one you should be using?\n\nUse `OpaDotNet.Compilation.Cli` if you have `opa` CLI [tool](https://www.openpolicyagent.org/docs/latest/cli) installed or you need functionality besides compilation (running tests, syntax checking etc.). Suitable for web applications and/or applications running in Docker containers. See [README](./src/OpaDotNet.Compilation.Cli) for more details.\n\nUse `OpaDotNet.Compilation.Interop` if you need compilation only and want to avoid having external dependencies. Suitable for libraries, console application etc. See [README](./src/OpaDotNet.Compilation.Interop/README.md) for more details.\n\nFor more information you can check the [guide](https://me-viper.github.io/OpaDotNet/articles/compilation/compilation.html).\n\n### Cli\n\n#### Install OpaDotNet.Compilation.Cli nuget package\n\n```sh\ndotnet add package OpaDotNet.Compilation.Cli\n```\n\n#### Usage\n\n\u003e [!IMPORTANT]\n\u003e You will need `opa` cli tool v0.20.0+ to be in your PATH or provide full path in `RegoCliCompilerOptions`.\n\n```csharp\nusing OpaDotNet.Compilation.Abstractions;\nusing OpaDotNet.Compilation.Cli;\n\nIRegoCompiler compiler = new RegoCliCompiler();\nvar bundleStream = await compiler.CompileFile(\"example.rego\", new[] { \"example/hello\" });\n\n// Use compiled policy bundle.\n...\n```\n\n### Interop\n\n#### Install OpaDotNet.Compilation.Interop nuget package\n\n```sh\ndotnet add package OpaDotNet.Compilation.Interop\n```\n\n#### Usage\n\n```csharp\nusing OpaDotNet.Compilation.Abstractions;\nusing OpaDotNet.Compilation.Interop;\n\nIRegoCompiler compiler = new RegoInteropCompiler();\nvar bundleStream = await compiler.CompileFile(\"example.rego\", new[] { \"example/hello\" });\n\n// Use compiled policy bundle.\n...\n```\n\n## Building\n\n### Prerequisites\n\n- go lang v1.20\n- dotnet SDK 7.0\n- opa cli\n\n#### Linux (WSL)\n\n- `gcc` to compile `Opa.Interop.so`\n- `gcc-mingw-w64` to compile `Opa.Interop.dll`\n\n#### Windows\n\n\u003e [!NOTE]\n\u003e WSL 2.0 is required to compile `Opa.Interop.so` on windows.\n\n- Powershell Core 7.0+\n- WSL 2.0\n\n### Build and Test\n\n- Run `build.ps1` Compile [Opa.Interop](./interop/) libraries\n- Run `dotnet build` to build the project or use Visual Studio to build `OpaDotNet.Compilation.sln`\n- Run `dotnet test` to test the project or use Visual Studio test explorer.\n\n## 3rd Party Libraries and Contributions\n\n- [OPA SDK](https://pkg.go.dev/github.com/open-policy-agent/opa/sdk) - High-level API for embedding OPA inside of Go programs.\n","funding_links":[],"categories":["WebAssembly (Wasm)"],"sub_categories":["Typescript"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fme-viper%2FOpaDotNet.Compilation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fme-viper%2FOpaDotNet.Compilation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fme-viper%2FOpaDotNet.Compilation/lists"}