{"id":21969467,"url":"https://github.com/rnett/compiler-plugin-utils","last_synced_at":"2026-03-09T18:11:55.938Z","repository":{"id":57722429,"uuid":"334825195","full_name":"rnett/compiler-plugin-utils","owner":"rnett","description":"A Compiler plugin for writing compiler plugins","archived":false,"fork":false,"pushed_at":"2022-02-11T03:30:13.000Z","size":7846,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-30T23:41:57.215Z","etag":null,"topics":["ir-utilities","kotlin","kotlin-compiler-plugin","stdlib"],"latest_commit_sha":null,"homepage":"https://rnett.github.io/compiler-plugin-utils/release/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rnett.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-01T04:02:03.000Z","updated_at":"2024-06-24T09:50:19.000Z","dependencies_parsed_at":"2022-08-29T22:32:15.757Z","dependency_job_id":null,"html_url":"https://github.com/rnett/compiler-plugin-utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rnett/compiler-plugin-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnett%2Fcompiler-plugin-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnett%2Fcompiler-plugin-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnett%2Fcompiler-plugin-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnett%2Fcompiler-plugin-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rnett","download_url":"https://codeload.github.com/rnett/compiler-plugin-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnett%2Fcompiler-plugin-utils/sbom","scorecard":{"id":779380,"data":{"date":"2025-08-11","repo":{"name":"github.com/rnett/compiler-plugin-utils","commit":"e74bd3c52b82a4f3bcce9aefd1b06d656b927c67"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:84: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:96: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:109: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:116: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/rnett/compiler-plugin-utils/ci.yml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T04:32:15.849Z","repository_id":57722429,"created_at":"2025-08-23T04:32:15.849Z","updated_at":"2025-08-23T04:32:15.849Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30306228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T17:35:44.120Z","status":"ssl_error","status_checked_at":"2026-03-09T17:35:43.707Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ir-utilities","kotlin","kotlin-compiler-plugin","stdlib"],"created_at":"2024-11-29T14:20:49.906Z","updated_at":"2026-03-09T18:11:55.896Z","avatar_url":"https://github.com/rnett.png","language":"Kotlin","readme":"# Kotlin Compiler Plugin Utils\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.rnett.compiler-plugin-utils/compiler-plugin-utils)](https://search.maven.org/artifact/com.github.rnett.compiler-plugin-utils/compiler-plugin-utils)\n[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/com.github.rnett.compiler-plugin-utils/compiler-plugin-utils?server=https%3A%2F%2Foss.sonatype.org)](https://oss.sonatype.org/content/repositories/snapshots/com/github/rnett/compiler-plugin-utils/)\n\nUtilities for writing Kotlin compiler plugins.\n\n### Artifacts\n\n* Library: `com.github.rnett.compiler-plugin-utils:compiler-plugin-utils`\n    * Native: `compiler-plugin-utils-native` for native compiler plugins. It will have to be shaded in.\n      Uses `kotlin-compiler` instead of\n      `kotlin-compiler-embedable`.\n* Compiler plugin (actually the gradle plugin for it): `com.github.rnett.compiler-plugin-utils`\n\nThe compiler plugin is optional, but is required for some features (it is explicitly noted when required).\n\nReleases are on maven central, snapshots are on `https://oss.sonatype.org/content/repositories/snapshots`.\n\n### [Docs](https://rnett.github.io/compiler-plugin-utils/release/)\n\n[For latest SNAPSHOT build](https://rnett.github.io/compiler-plugin-utils/snapshot/)\n\n## Features\n\n**Names and stdlib builders are deprecated, and will be replaced by a reference generator I'm working on**\n\nStdlib is fully tested on JVM, as is Naming. IR utilities are mostly tested.\n\nThe usage of Naming and some of the IR utilities can be seen in\nthe [stdlib code](compiler-plugin-utils/src/main/kotlin/com/rnett/plugin/stdlib).\n\nUsing the Stdlib builders on JS may cause `Not found Idx for public kotlin/to|9142910121690433229[0]` like errors. These\nare because the return types of `irCall`s are not sufficiently specified. Make an issue here and I'll see what I can do.\nTesting JS linking is not feasible ATM, so I can't guarantee you won't run into these, but they shouldn't happen too\noften. As a workaround, you can use the IR utility `inferReturnType` or implement something similar yourself.\n\n### IR Utilities\n\nThe `com.rnett.plugin.ir` package contains a number of utilities for working with IR. This includes basic utilities such\nas `CompilerConfiguration.messageCollector`, `IrClass.addAnonymousInitializer`, `IrType.raiseTo`,\nand `IrClass.typeWith(List\u003cIrTypeArgument\u003e)`, all of which are available as extension functions.\n\nMany utilities require a `IrPluginContext`, so in lieu of multiple receivers, they are put in `HasContext` which has\na `val context: IrPluginContext`. It can be easily implemented by `IrElementTransformer`s. Of special note are\nthe `IrBuilderWithScope.buildLambda` and `lambdaArgument` functions.\n\n`KnowsCurrentFile` is a similar interface, but requires a `IrFile` and provides extensions for getting message locations\nfrom `IrElement`s using said file.\n\nBoth of these are implemented by `IrTransformer`, which is usable as a replacement for `IrElementTransformerVoid`\nor `IrElementTransformerVoidWithContext`. In addition to implementing `IrElementTransformerVoidWithContext`\n, `KnowsCurrentFile`, and `HasContext`, it modifies the file transformer so that new declarations can be added to the\ncurrent file without running into `ConcurrentModificationException` (it does so by running transforms on a copy of the\ndeclaration list, and then on newly added declarations until no more are added).\n\n### Naming\n\n**Is deprecated, will be replaced by a reference generator.**\n\nThe `com.rnett.plugin.naming` package provides ways to get `FqName`s and IR symbols for declarations. It primarily\nprovides a structured method based on nested objects, but also provides direct access. Each of these reference types\nexposes the `FqName` of the element, and can be resolved with an `IrPluginContext`. Function, property, and constructor\nreferences all accept filters (essentially `(IrSimpleFunction) -\u003e Boolean` lambdas or the equivalent, but with some\nhelper methods for common conditions) to disambiguate overloads. Some utility functions are provided in `HasContext` for\nworking with references in IR, such as `irCall(FunctionRef)` or `ClassRef.resolveTypeWith`.\n\n#### Structured\n\nThe structured name resolution can be seen in\nthe [stdlib names](compiler-plugin-utils/src/main/kotlin/com/rnett/plugin/stdlib/Names.kt). Objects\nextending `RootPackage`, `PackageRef`, and `ClassRef` can be nested, each auto-detecting the name from the object named\nand adding its parent's name as a prefix to its own.  **This requires the compiler plugin** since there is\nno `inner object` or object delegation. However, if both `name`\nand `parent` are specified the compiler plugin is unnecessary. Property, function, and constructor references can be\ncreated inside of class or package references (with constructor references in packages requiring the class name). Note\nthat just like in IR, extension receivers are not part of an element's `FqName`, only dispatch receivers.\n\n#### Direct\n\nMethods to directly get references are also provided for classes, functions, properties, and constructors. Literal\nversions are also provided, that take a class, function, property, or class literal, respectively.  **Using the literal\nversions requires the compiler plugin**, since the `FqName`s of the literals will be resolved at compile time.\nThe `getFqName(literal)` and `literal.fqName()` functions work similarly, **and also require the compiler plugin**. Note\nthat all of these literal functions only work with literal arguments for the declaration being resolved (thus the name),\nnot variables or parameters.\n\n#### Types\n\n`typeOf()`-like type resolution methods are also provided. They enable getting a `TypeRef` from a type literal\nwith `typeRef\u003cT\u003e()`, which can be resolved to an `IrType` later with an `IrPluginContext` or `HasContext`. They can also\nbe compared to `IrType`s without resolving using `eq`. Methods using `eq` such as `IrType.isType\u003cT\u003e()`\nand `IrType.isClassifierOf\u003cT\u003e()` are also provided. The `classifier` of a `TypeRef` is a `ClassRef`, which provides\nanother method for resolving classes.\n\n### Stdlib\n\n**Is deprecated, will be replaced by a reference generator.**\n\nThe `com.rnett.plugin.stdlib` package provides builders for common standard library functions, using the Naming and IR\nUtilities features (and providing good examples of how to use them). Collections, `toString` and `hashCode`, `typeOf`,\nscope functions, numbers, and common exceptions are included. All builder methods are tested. Note that unlike for\nNaming, extension functions are members of their extension receiver, i.e. `Map.getValue`. In some cases, builders will\nresolve their functions based on the types of arguments, such as for number operators or nullable `toString`\nand `hashCode`. The receiver arguments are type checked (in IR) in most cases, the other arguments aren't.\n\n**Note that using a lot of these functions is a bad idea.**  If you find yourself generating a lot of code using these\nmethods, you should probably create a utility function and call it from IR instead. The number of builders is there to\nprovide breadth, not depth.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnett%2Fcompiler-plugin-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnett%2Fcompiler-plugin-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnett%2Fcompiler-plugin-utils/lists"}