{"id":13681922,"url":"https://github.com/AppsFlyer/lein-protodeps","last_synced_at":"2025-04-30T06:32:48.734Z","repository":{"id":38400557,"uuid":"373444199","full_name":"AppsFlyer/lein-protodeps","owner":"AppsFlyer","description":"Leiningen plugin for consuming and compiling protobuf schemas","archived":false,"fork":false,"pushed_at":"2022-12-07T19:59:31.000Z","size":76,"stargazers_count":26,"open_issues_count":1,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-02T07:42:08.244Z","etag":null,"topics":["clojure","leiningen","leiningen-plugin","protobuf","protocol-buffers"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AppsFlyer.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}},"created_at":"2021-06-03T09:00:42.000Z","updated_at":"2024-05-07T13:45:49.000Z","dependencies_parsed_at":"2022-08-25T06:11:40.533Z","dependency_job_id":null,"html_url":"https://github.com/AppsFlyer/lein-protodeps","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppsFlyer%2Flein-protodeps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppsFlyer%2Flein-protodeps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppsFlyer%2Flein-protodeps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppsFlyer%2Flein-protodeps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AppsFlyer","download_url":"https://codeload.github.com/AppsFlyer/lein-protodeps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224201775,"owners_count":17272642,"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":["clojure","leiningen","leiningen-plugin","protobuf","protocol-buffers"],"created_at":"2024-08-02T13:01:37.773Z","updated_at":"2024-11-12T01:30:41.643Z","avatar_url":"https://github.com/AppsFlyer.png","language":"Clojure","readme":"# lein-protodeps\n\n[![Clojars Project](https://img.shields.io/clojars/v/com.appsflyer/lein-protodeps.svg)](https://clojars.org/com.appsflyer/lein-protodeps)\n\nA Leiningen plugin to automate compilation of Protobuf and gRPC stubs.\n\nThis plugin allows to define your project's protobuf dependencies, by stating\ntheir source location. These locations can currently point to a git repository, or a local filesystem.\n\nWhen run, the plugin will resolve these locations and compile the desired `.proto` files (and their dependencies)\nusing the correct protoc compiler and gRPC plugin, according to the versions specified\nin your project's configuration. The plugin will automatically download the correct versions if they\nare not already installed.\n\n\u003c!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --\u003e\n**Table of Contents**\n\n- [Usage](#usage)\n- [Cross-repository compilation](#cross-repository-compilation)\n- [Git HTTP authentication](#git-http-authentication)\n- [protoc and gRPC binaries retrieval](#protoc-and-grpc-binaries-retrieval)\n- [Configuration Reference](#configuration-reference)\n    - [Plugin options](#plugin-configuration-options)\n    - [Repo Options](#repo-options)\n    - [Proto options](#proto-options)\n\n\u003c!-- markdown-toc end --\u003e\n\n\n\n## Usage\n\nPut `[com.appsflyer/lein-protodeps \"1.0.5\"]` into the `:plugins` vector of your project.clj.\n\nOnce installed, run `lein protodeps generate` to run the plugin.\n\nThe plugin requires some configuration in your `project.clj` in order to run.\n\nAn example configuration:\n\n```clj\n(def proto-version \"3.12.4\") ;; protobuf version -- should be used when declaring protobuf dependencies\n(def grpc-version \"1.30.2\")  ;; gRPC version -- should be used when declaring gRPC dependencies\n\n(defproject my-cool-project \"0.1.0\"\n  ...\n  ...\n  ;; plugin configuration\n  :lein-protodeps {:output-path   \"src/java/generated\" ;; where to place the generated files? Should reside within your `java-source-paths`\n                   :proto-version ~proto-version\n                   :grpc-version  ~grpc-version\n                   :compile-grpc? true ;; whether to activate the gRPC plugin during the stub generation process\n                   ;; Repositories configuration. Each entry in this map is an entry mapping a logical repository name\n                   ;; to its configuration.\n                   :repos         {:af-schemas {:repo-type :git ;; a git repo\n                                                :config   {:clone-url   \"git@localhost:test/repo.git\" ;; url to clone from\n                                                           ;; rev - can point to a commit hash, tag name or branch name. The repo will be cloned\n                                                           ;; to this version of itself. If unspecified, will point to origin's HEAD (i.e, master).\n                                                           :rev         \"mybranch\"}\n                                                ;; a vector of proto-paths relative to the directory root. May use an empty string if the root\n                                                ;; level is a proto path in itself.\n                                                :proto-paths [\"products\"]\n                                                ;; a vector of dependencies which control what stubs to compile. Each dependency vector\n                                                ;; contains a directory under one of the proto paths. All files in this directory and their\n                                                ;; dependencies will be compiled.\n                                                :dependencies [products/events\n                                                               products/adrevenue]}\n\n                                   :some-other-schemas {:repo-type    :filesystem ;; read files directly from filesystem instead of git.\n                                                        :config       {:path \"../schemas\"} ;; path, either relative or absolute\n                                                        :proto-paths  [\"products\"]\n                                                        :dependencies [products/foo\n                                                                       products/bar]}}}\n```\n\n## Cross-repository compilation\n\n`lein-protodeps` also supports cross-repo compilation, for example when a `.proto` file dependency in one repo imports a file\nresiding in a different repo.\n\nTo enable cross-repo compilation, simply add both repos to the `:repos` config map.\n\n## Git HTTP authentication\n\nTo use HTTP authentication using username and password, provide them in the clone url: `\"https://\u003cmyuser\u003e:\u003cmypass\u003e@github.com/whatever/cool_repo.git\"`\n\nIt is recommended to use environment variables rather than hardcoding their values in plaintext. Environment variables are accessible via the `${:env/\u003cvar_name\u003e}` interpolation syntax, which allows us to write the former as: `\"https://${:env/GIT_USERNAME}:${:env/GIT_PASSWORD}@github.com/whatever/cool_repo.git\"`.\n\n## protoc and gRPC binaries retrieval\n\nThe plugin will download the protoc and gRPC plugin binaries according to the versions set in `:proto-version` and `:grpc-version`, respectively, and install them under \n`~/.lein-protodeps/`. \n\nBy default, the plugin will use `https://github.com/protocolbuffers/protobuf/releases/download/` for protoc and `https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/` for gRPC.\nHowever, it is possible to override these to other endpoints by setting `:protoc-zip-url-template` and `:grpc-exe-url-template` options in the plugin configuration.\n\nThe values of these options are URL templates that will be interpolated at runtime with the following variables to produce download URLs:\n\n* `:os-name` host OS (i.e, `linux`, `osx`)\n* `:os-arch` host architecture (i.e, `x86_64`, `aarch64`)\n* `:semver` version string as defined in `:protoc-version` or `:grpc-version`\n* `:major` major part of `:semver`\n* `:minor` minor part of `:semver`\n* `:patch` patch part of `:semver`\n\nFor example, to override the gRPC URL you may set `:grpc-exe-url-template` to `https://some-other-place.com/artifacts/grpc/${:semver}/protoc-gen-grpc-java-${:semver}-${:os-name}-${:os-arch}`. Note that\ncurrently this feature does not support any method of authentication, in case your endpoints require it.\n\n\n## Configuration Reference\n\n#### Plugin Configuration Options\n| Key                        | Type    | Req?     | Notes                                                                                                                                                    |\n|----------------------------|---------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `:output-path`             | string  | required | Path to which to compile stubs. This usually needs to be under `:java-source-paths`                                                                      |\n| `:proto-version`           | string  | required | Version of protoc to use                                                                                                                                 |\n| `:grpc-version`            | string  | optional | Version of gRPC plugin to use. Required if `:compile-grpc?` is `true`                                                                                    |\n| `:compile-grpc?`           | boolean | optional | Whether to compile gRPC stubs. Defaults to `false`                                                                                                       |\n| `:protoc-zip-url-template` | string  | optional | URL template from which to retrieve protoc's zip release (if needed). See also [protoc and gRPC binaries retrieval](#protoc-and-grpc-binaries-retrieval) |\n| `:grpc-exe-url-template`  | string  | optional | URL template from which to retrieve gRPC's executable release (if needed). See also [protoc and gRPC binaries retrieval](#protoc-and-grpc-binaries-retrieval)   |\n\n\n#### Repo Options\n| Key                              | Type                 | Req?                            | Notes                                                                                                                                     |\n|----------------------------------|----------------------|---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| `\u003c:repo-name\u003e.:repo-type`        | `:git` `:filesystem` | required                        |                                                                                                                                           |\n| `\u003c:repo-name\u003e.:config.:clone-url` | string               | required (for git repos)        | Either SSH or HTTP endpoints are supported, see also [Git HTTP authentication](#git-http-authentication)                                  |\n| `\u003c:repo-name\u003e.:config.:rev`      | string               | optional (for git repos)        | commit hash/tag name/branch name. Not specifying a rev will default to cloning the main branch (it is generally encouraged to use a fixed version) |\n| `\u003c:repo-name\u003e.:config.:path`     | string               | required (for filesystem repos) | path to directory containing files (absolute or relative to project directory)                                                            |\n\n#### Proto options\n| Key                          | Type              | Req?     | Notes                                                                                                                                                                                                            |\n|------------------------------|-------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `\u003c:repo-name\u003e.:proto-paths`  | vector of strings | required | Relative proto paths to the directory root (where `protoc` will search for imports, see `protoc --help` for more information)                                                                                    |\n| `\u003c:repo-name\u003e.:dependencies` | vector of symbols | optional | List of paths which contain files to compile to stubs. Each of these paths needs to be prefixed with one of the proto paths defined under `:proto-paths`, see [example](#usage) above. If unspecified or empty, nothing in this repo will be compiled, but it may still be used for finding imports required by other repos. See also [cross-repository compilation](#cross-repository-compilation)                |\n\n\n\n","funding_links":[],"categories":["Clojure","Protocol Buffers and gRPC"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAppsFlyer%2Flein-protodeps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAppsFlyer%2Flein-protodeps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAppsFlyer%2Flein-protodeps/lists"}