{"id":13450595,"url":"https://github.com/GerritCodeReview/bazlets","last_synced_at":"2025-03-23T16:31:47.740Z","repository":{"id":84111614,"uuid":"76442585","full_name":"GerritCodeReview/bazlets","owner":"GerritCodeReview","description":"Re-usable building blocks for Bazel build tool  - (mirror of https://gerrit.googlesource.com/./bazlets)","archived":false,"fork":false,"pushed_at":"2024-07-01T18:48:08.000Z","size":1045,"stargazers_count":13,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-31T07:15:42.985Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gerrit.googlesource.com/./bazlets","language":"Starlark","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/GerritCodeReview.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2016-12-14T09:02:36.000Z","updated_at":"2024-07-01T18:48:11.000Z","dependencies_parsed_at":"2023-03-10T20:00:17.456Z","dependency_job_id":"900befef-3f51-4a4f-a5df-34c7ba35cd30","html_url":"https://github.com/GerritCodeReview/bazlets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fbazlets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fbazlets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fbazlets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fbazlets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GerritCodeReview","download_url":"https://codeload.github.com/GerritCodeReview/bazlets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221856418,"owners_count":16892439,"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":[],"created_at":"2024-07-31T07:00:36.512Z","updated_at":"2024-10-28T16:31:37.333Z","avatar_url":"https://github.com/GerritCodeReview.png","language":"Starlark","readme":"# Gerrit Code Review Rules for Bazel\n\n\u003cdiv class=\"toc\"\u003e\n  \u003ch2\u003eRules\u003c/h2\u003e\n  \u003cul\u003e\n    \u003cli\u003e\u003ca href=\"#gerrit_plugin\"\u003egerrit_plugin\u003c/a\u003e\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/div\u003e\n\n## Overview\n\nThese build rules are used for building [Gerrit Code Review](https://www.gerritcodereview.com/)\nplugins with Bazel. Plugins are compiled as `.jar` files containing plugin code and\ndependencies.\n\n\u003ca name=\"setup\"\u003e\u003c/a\u003e\n## Setup\n\nTo be able to use the Gerrit rules, you must provide bindings for the plugin\nAPI jars. The easiest way to do so is to add the following to your `WORKSPACE`\nfile, which will give you default versions for Gerrit plugin API.\n\n```python\ngit_repository(\n  name = \"com_googlesource_gerrit_bazlets\",\n  remote = \"https://gerrit.googlesource.com/bazlets\",\n  commit = \"928c928345646ae958b946e9bbdb462f58dd1384\",\n)\nload(\"@com_googlesource_gerrit_bazlets//:gerrit_api.bzl\", \"gerrit_api\")\ngerrit_api()\n```\n\nThe `version` parameter allows to override the default API. For release version\nnumbers, make sure to also provide artifacts' SHA1 sums via the\n`plugin_api_sha1` and `acceptance_framework_sha1` parameters:\n\n```python\nload(\"@com_googlesource_gerrit_bazlets//:gerrit_api.bzl\", \"gerrit_api\")\ngerrit_api(version = \"3.2.1\",\n           plugin_api_sha1 = \"47019cf43ef7e6e8d2d5c0aeba0407d23c93699c\",\n           acceptance_framework_sha1 = \"6252cab6d1f76202e57858fcffb428424e90b128\")\n```\n\nIf the version ends in `-SNAPSHOT`, the jars are consumed from the local\nMaven repository (`~/.m2`) per default assumed to be and the SHA1 sums can be\nomitted:\n\n```python\nload(\"@com_googlesource_gerrit_bazlets//:gerrit_api.bzl\", \"gerrit_api\")\ngerrit_api(version = \"3.3.0-SNAPSHOT\")\n```\n\n\u003ca name=\"basic-example\"\u003e\u003c/a\u003e\n## Basic Example\n\nSuppose you have the following directory structure for a simple plugin:\n\n```\n[workspace]/\n├── src\n│   └── main\n│       ├── java\n│       └── resources\n├── BUILD\n└── WORKSPACE\n```\n\nTo build this plugin, your `BUILD` can look like this:\n\n```python\nload(\"//tools/bzl:plugin.bzl\", \"gerrit_plugin\")\n\ngerrit_plugin(\n    name = \"reviewers\",\n    srcs = glob([\"src/main/java/**/*.java\"]),\n    manifest_entries = [\n        \"Gerrit-PluginName: reviewers\",\n        \"Gerrit-Module: com.googlesource.gerrit.plugins.reviewers.Module\",\n    ],\n    resources = glob([\"src/main/**/*\"]),\n)\n```\n\nNow, you can build the Gerrit plugin by running\n`bazel build \u003cplugin\u003e`.\n\nFor a real world example, see the\n[`reviewers`](https://gerrit.googlesource.com/plugins/reviewers) plugin.\n\n\u003ca name=\"gerrit_plugin\"\u003e\u003c/a\u003e\n## gerrit_plugin\n\n```python\ngerrit_plugin(name, srcs, resources, deps, manifest_entries):\n```\n\n### Implicit output target\n\n * `\u003cname\u003e.jar`: library containing built plugin jar\n\n\u003ctable class=\"table table-condensed table-bordered table-params\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"param-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth colspan=\"2\"\u003eAttributes\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ccode\u003eName, required\u003c/code\u003e\n        \u003cp\u003eA unique name for this rule.\u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003esrcs\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ccode\u003eList of labels, optional\u003c/code\u003e\n        \u003cp\u003e\n          List of .java source files that will be compiled.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eresources\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ccode\u003eList of labels, optional\u003c/code\u003e\n        \u003cp\u003e\n          List of resource files that will be passed on the classpath to the Java\n          compiler.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003edeps\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ccode\u003eList of labels, optional\u003c/code\u003e\n        \u003cp\u003e\n          List of other java_libraries on which the plugin depends.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003emanifest_entries\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ccode\u003eList of strings, optional\u003c/code\u003e\n        \u003cp\u003e\n          A list of lines to add to the META-INF/manifest.mf file\n\t\t  generated for the *_deploy.jar target.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n","funding_links":[],"categories":["Tooling"],"sub_categories":["General"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGerritCodeReview%2Fbazlets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGerritCodeReview%2Fbazlets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGerritCodeReview%2Fbazlets/lists"}