@tahminator/pipeline 1.0.78-beta.1fe28066 → 1.0.78-beta.2a7182af
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -17
- package/dist/protobuf/backend/artifact-keeper.d.ts +1 -0
- package/dist/protobuf/backend/artifact-keeper.js +20 -34
- package/dist/protobuf/client.js +6 -7
- package/dist/protobuf/strategy/go.d.ts +1 -3
- package/dist/protobuf/strategy/go.js +1 -4
- package/dist/protobuf/strategy/java.d.ts +1 -4
- package/dist/protobuf/strategy/java.js +1 -10
- package/dist/protobuf/strategy/rust.d.ts +1 -8
- package/dist/protobuf/strategy/rust.js +1 -18
- package/dist/protobuf/strategy/types.d.ts +1 -5
- package/dist/protobuf/types.d.ts +0 -2
- package/package.json +1 -1
- package/dist/protobuf/backend/rust-library.d.ts +0 -2
- package/dist/protobuf/backend/rust-library.js +0 -35
- package/dist/protobuf/versions.d.ts +0 -7
- package/dist/protobuf/versions.js +0 -17
package/README.md
CHANGED
|
@@ -185,7 +185,7 @@ await client.promoteDockerImage({
|
|
|
185
185
|
|
|
186
186
|
### `ProtobufCompilerClient`
|
|
187
187
|
|
|
188
|
-
Generate protobuf
|
|
188
|
+
Generate protobuf clients with the [Buf CLI](https://buf.build/docs/installation/) and its remote plugins. Java, Rust, and Go targets can be published to Artifact Keeper with Maven/Gradle, Cargo, or Go module uploads. The client installs Buf globally with npm when necessary.
|
|
189
189
|
|
|
190
190
|
```ts
|
|
191
191
|
const protobuf = new ProtobufCompilerClient();
|
|
@@ -220,20 +220,6 @@ option java_multiple_files = true;
|
|
|
220
220
|
|
|
221
221
|
`go_package` is required for Go generation with this client. Java package options are recommended; `java_outer_classname` is optional. Rust generation needs no language-specific file options. CI target options such as Java `groupId`/`artifactId` and Rust `crateName` are publishing metadata, not generated-code package names. Go's former unused `modulePath` option has been removed.
|
|
222
222
|
|
|
223
|
-
Every target enables both message and service generation by default:
|
|
224
|
-
|
|
225
|
-
| Target | Generated service API | Published runtime dependencies |
|
|
226
|
-
| ----------------------- | -------------------------------------------------------------------- | --------------------------------------------------- |
|
|
227
|
-
| Java (Maven and Gradle) | `<Service>Grpc.<Service>ImplBase` and client stubs | `protobuf-java`, `grpc-protobuf`, `grpc-stub` |
|
|
228
|
-
| Go | `<Service>Server`, `Unimplemented<Service>Server`, `<Service>Client` | Resolved by `go mod tidy` into the generated module |
|
|
229
|
-
| Rust | Tonic `<service>_server` traits and `<service>_client` clients | `prost`, `prost-types`, `tonic`, `tonic-prost` |
|
|
230
|
-
|
|
231
|
-
Applications implement the generated service interfaces and supply server startup, endpoints, authentication, and transport configuration. Java applications must add a transport implementation such as `io.grpc:grpc-netty-shaded:1.75.0`; the generated SDK does not choose one. Gradle publishes public runtime types as `api` dependencies so they are visible on consumers' compile classpaths.
|
|
232
|
-
|
|
233
|
-
Imported schemas are generated alongside the selected input, except standard well-known types, which use the runtime libraries. This produces self-contained schema output rather than relying on separately published schema packages. Go publishing still requires those package paths to share a valid module root.
|
|
234
|
-
|
|
235
|
-
Rust's Prost and Tonic plugins are pinned to `v0.5.0`, paired with the `0.14` runtime series. `prostVersion` overrides must remain within `0.14`. The published crate preserves proto package hierarchy (for example, `example.v1` becomes `example::v1`) and includes Tonic stubs in the same module as their messages. This replaces the previous flattened Rust module names.
|
|
236
|
-
|
|
237
223
|
For Go publishing, only the release version is needed:
|
|
238
224
|
|
|
239
225
|
```ts
|
|
@@ -248,8 +234,6 @@ The publisher generates `go.mod` using the deepest shared directory of the gener
|
|
|
248
234
|
|
|
249
235
|
Go publishing requires `go` and `zip` on PATH. It stages generated packages without changing the original output, runs `go mod init` and `go mod tidy` to generate dependency metadata, and uploads `.mod` and `.zip` artifacts to the hosted `go` repository at `<backend.url>/go/go`. It does not lint, build, or test generated code. Dependency resolution may require network access. Versions may include a leading `v`; v2+ modules require the corresponding major-version module path suffix.
|
|
250
236
|
|
|
251
|
-
Java generation is pinned to the compiler release matching `protobufJavaVersion` (default runtime `4.32.1`, Buf Java plugin `v32.1`). The same runtime version is used in both Maven and Gradle metadata. Overrides must be exact stable versions, not ranges, and the corresponding plugin must exist in the Buf registry.
|
|
252
|
-
|
|
253
237
|
### `NPMClient`
|
|
254
238
|
|
|
255
239
|
Interface with NPM registry in order to publish packages to `npmjs.com`
|
|
@@ -14,6 +14,7 @@ export declare class ArtifactKeeperProtobufCompilerBackend implements IProtobufC
|
|
|
14
14
|
private createMavenSettings;
|
|
15
15
|
private createGradleBuild;
|
|
16
16
|
private createCargoToml;
|
|
17
|
+
private createRustLibrary;
|
|
17
18
|
private escapeXml;
|
|
18
19
|
private get artifactKeeperUrl();
|
|
19
20
|
private get mavenRepositoryUrl();
|
|
@@ -3,9 +3,9 @@ import { mkdir, mkdtemp, readdir, rename, rm, writeFile, } from "node:fs/promise
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { ProtobufTargetLanguage, } from "../types";
|
|
6
|
-
import { DEFAULT_PROTOBUF_JAVA_VERSION, DEFAULT_PROST_VERSION, GRPC_JAVA_VERSION, TONIC_VERSION, } from "../versions";
|
|
7
6
|
import { ArtifactKeeperGoPublisher } from "./go";
|
|
8
|
-
|
|
7
|
+
const DEFAULT_PROTOBUF_JAVA_VERSION = "4.32.1";
|
|
8
|
+
const DEFAULT_PROST_VERSION = "0.14";
|
|
9
9
|
export class ArtifactKeeperProtobufCompilerBackend {
|
|
10
10
|
config;
|
|
11
11
|
constructor(config) {
|
|
@@ -65,14 +65,9 @@ export class ArtifactKeeperProtobufCompilerBackend {
|
|
|
65
65
|
await mkdir(path.join(generatedDirectory, "src"), { recursive: true });
|
|
66
66
|
await Promise.all([
|
|
67
67
|
writeFile(path.join(generatedDirectory, "Cargo.toml"), this.createCargoToml(options)),
|
|
68
|
-
writeFile(path.join(generatedDirectory, "src", "lib.rs"), createRustLibrary(generatedFiles)),
|
|
68
|
+
writeFile(path.join(generatedDirectory, "src", "lib.rs"), this.createRustLibrary(generatedFiles)),
|
|
69
69
|
]);
|
|
70
|
-
await
|
|
71
|
-
...process.env,
|
|
72
|
-
CARGO_REGISTRIES_CARGO_INDEX: this.cargoIndexUrl,
|
|
73
|
-
CARGO_REGISTRIES_CARGO_TOKEN: this.config.token,
|
|
74
|
-
CARGO_REGISTRIES_CARGO_CREDENTIAL_PROVIDER: "cargo:token",
|
|
75
|
-
}) `cargo publish --registry cargo`.cwd(generatedDirectory);
|
|
70
|
+
await $ `cargo publish --registry cargo --token ${this.config.token} --config ${`registries.cargo.index=${this.cargoIndexUrl}`}`.cwd(generatedDirectory);
|
|
76
71
|
}
|
|
77
72
|
async moveJavaSources(generatedDirectory) {
|
|
78
73
|
const sourceDirectory = path.join(generatedDirectory, "src", "main", "java");
|
|
@@ -124,22 +119,6 @@ export class ArtifactKeeperProtobufCompilerBackend {
|
|
|
124
119
|
<artifactId>protobuf-java</artifactId>
|
|
125
120
|
<version>${this.escapeXml(protobufVersion)}</version>
|
|
126
121
|
</dependency>
|
|
127
|
-
<dependency>
|
|
128
|
-
<groupId>io.grpc</groupId>
|
|
129
|
-
<artifactId>grpc-protobuf</artifactId>
|
|
130
|
-
<version>${GRPC_JAVA_VERSION}</version>
|
|
131
|
-
</dependency>
|
|
132
|
-
<dependency>
|
|
133
|
-
<groupId>io.grpc</groupId>
|
|
134
|
-
<artifactId>grpc-stub</artifactId>
|
|
135
|
-
<version>${GRPC_JAVA_VERSION}</version>
|
|
136
|
-
</dependency>
|
|
137
|
-
<dependency>
|
|
138
|
-
<groupId>javax.annotation</groupId>
|
|
139
|
-
<artifactId>javax.annotation-api</artifactId>
|
|
140
|
-
<version>1.3.2</version>
|
|
141
|
-
<scope>provided</scope>
|
|
142
|
-
</dependency>
|
|
143
122
|
</dependencies>
|
|
144
123
|
<distributionManagement>
|
|
145
124
|
<repository>
|
|
@@ -165,7 +144,7 @@ export class ArtifactKeeperProtobufCompilerBackend {
|
|
|
165
144
|
createGradleBuild(options) {
|
|
166
145
|
const protobufVersion = options.protobufJavaVersion ?? DEFAULT_PROTOBUF_JAVA_VERSION;
|
|
167
146
|
return `plugins {
|
|
168
|
-
id "java
|
|
147
|
+
id "java"
|
|
169
148
|
id "maven-publish"
|
|
170
149
|
}
|
|
171
150
|
|
|
@@ -177,10 +156,7 @@ repositories {
|
|
|
177
156
|
}
|
|
178
157
|
|
|
179
158
|
dependencies {
|
|
180
|
-
|
|
181
|
-
api "io.grpc:grpc-protobuf:${GRPC_JAVA_VERSION}"
|
|
182
|
-
api "io.grpc:grpc-stub:${GRPC_JAVA_VERSION}"
|
|
183
|
-
compileOnly "javax.annotation:javax.annotation-api:1.3.2"
|
|
159
|
+
implementation "com.google.protobuf:protobuf-java:${protobufVersion}"
|
|
184
160
|
}
|
|
185
161
|
|
|
186
162
|
java {
|
|
@@ -217,11 +193,21 @@ edition = "2021"
|
|
|
217
193
|
|
|
218
194
|
[dependencies]
|
|
219
195
|
prost = "${prostVersion}"
|
|
220
|
-
prost-types = "${prostVersion}"
|
|
221
|
-
tonic = "${TONIC_VERSION}"
|
|
222
|
-
tonic-prost = "${TONIC_VERSION}"
|
|
223
196
|
`;
|
|
224
197
|
}
|
|
198
|
+
createRustLibrary(generatedFiles) {
|
|
199
|
+
return generatedFiles
|
|
200
|
+
.map((relativePath) => {
|
|
201
|
+
const moduleName = relativePath
|
|
202
|
+
.replace(/\.rs$/, "")
|
|
203
|
+
.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
204
|
+
return `pub mod ${moduleName} {
|
|
205
|
+
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/${relativePath}"));
|
|
206
|
+
}
|
|
207
|
+
`;
|
|
208
|
+
})
|
|
209
|
+
.join("\n");
|
|
210
|
+
}
|
|
225
211
|
escapeXml(value) {
|
|
226
212
|
return value.replace(/[<>&'"]/g, (character) => {
|
|
227
213
|
switch (character) {
|
|
@@ -247,6 +233,6 @@ tonic-prost = "${TONIC_VERSION}"
|
|
|
247
233
|
return `${this.artifactKeeperUrl}/maven/maven/`;
|
|
248
234
|
}
|
|
249
235
|
get cargoIndexUrl() {
|
|
250
|
-
return
|
|
236
|
+
return `${this.artifactKeeperUrl}/cargo/cargo/index`;
|
|
251
237
|
}
|
|
252
238
|
}
|
package/dist/protobuf/client.js
CHANGED
|
@@ -8,9 +8,9 @@ import { createProtobufCompilerBackendStrategy } from "./backend";
|
|
|
8
8
|
import { GoProtobufTargetLanguageStrategy, JavaProtobufTargetLanguageStrategy, RustProtobufTargetLanguageStrategy, } from "./strategy";
|
|
9
9
|
import { ProtobufTargetLanguage, } from "./types";
|
|
10
10
|
const TARGET_LANGUAGE_STRATEGY_FACTORIES = {
|
|
11
|
-
[ProtobufTargetLanguage.JAVA]: (
|
|
11
|
+
[ProtobufTargetLanguage.JAVA]: () => new JavaProtobufTargetLanguageStrategy(),
|
|
12
12
|
[ProtobufTargetLanguage.GO]: () => new GoProtobufTargetLanguageStrategy(),
|
|
13
|
-
[ProtobufTargetLanguage.RUST]: (
|
|
13
|
+
[ProtobufTargetLanguage.RUST]: () => new RustProtobufTargetLanguageStrategy(),
|
|
14
14
|
};
|
|
15
15
|
export class ProtobufCompilerClient {
|
|
16
16
|
async compile({ backend, bufToken, targetLanguages, protoFilesLocation, outputDirectory, }) {
|
|
@@ -58,11 +58,10 @@ export class ProtobufCompilerClient {
|
|
|
58
58
|
const pathFlag = pathFilter ? ["--path", pathFilter] : [];
|
|
59
59
|
await writeFile(templatePath, yaml.stringify({
|
|
60
60
|
version: "v2",
|
|
61
|
-
plugins: targetStrategies.
|
|
62
|
-
...plugin,
|
|
61
|
+
plugins: targetStrategies.map((strategy) => ({
|
|
63
62
|
out: strategy.outputDirectoryName,
|
|
64
|
-
|
|
65
|
-
}))
|
|
63
|
+
remote: strategy.remotePlugin,
|
|
64
|
+
})),
|
|
66
65
|
}));
|
|
67
66
|
try {
|
|
68
67
|
const command = bufToken ?
|
|
@@ -81,7 +80,7 @@ export class ProtobufCompilerClient {
|
|
|
81
80
|
return this.getConfiguredTargetLanguages(targetLanguages).map(([language, options]) => ({
|
|
82
81
|
language,
|
|
83
82
|
options,
|
|
84
|
-
strategy: TARGET_LANGUAGE_STRATEGY_FACTORIES[language](
|
|
83
|
+
strategy: TARGET_LANGUAGE_STRATEGY_FACTORIES[language](),
|
|
85
84
|
}));
|
|
86
85
|
}
|
|
87
86
|
getConfiguredTargetLanguages(targetLanguages) {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { IProtobufTargetLanguageStrategy } from "./types";
|
|
2
2
|
export declare class GoProtobufTargetLanguageStrategy implements IProtobufTargetLanguageStrategy {
|
|
3
3
|
readonly outputDirectoryName = "go";
|
|
4
|
-
readonly
|
|
5
|
-
remote: string;
|
|
6
|
-
}[];
|
|
4
|
+
readonly remotePlugin = "buf.build/protocolbuffers/go";
|
|
7
5
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { IProtobufTargetLanguageStrategy } from "./types";
|
|
2
2
|
export declare class JavaProtobufTargetLanguageStrategy implements IProtobufTargetLanguageStrategy {
|
|
3
3
|
readonly outputDirectoryName = "java";
|
|
4
|
-
readonly
|
|
5
|
-
remote: string;
|
|
6
|
-
}[];
|
|
7
|
-
constructor(runtimeVersion?: string);
|
|
4
|
+
readonly remotePlugin = "buf.build/protocolbuffers/java";
|
|
8
5
|
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PROTOBUF_JAVA_VERSION, GRPC_JAVA_VERSION, javaGeneratorVersion, } from "../versions";
|
|
2
1
|
export class JavaProtobufTargetLanguageStrategy {
|
|
3
2
|
outputDirectoryName = "java";
|
|
4
|
-
|
|
5
|
-
constructor(runtimeVersion = DEFAULT_PROTOBUF_JAVA_VERSION) {
|
|
6
|
-
this.plugins = [
|
|
7
|
-
{
|
|
8
|
-
remote: `buf.build/protocolbuffers/java:v${javaGeneratorVersion(runtimeVersion)}`,
|
|
9
|
-
},
|
|
10
|
-
{ remote: `buf.build/grpc/java:v${GRPC_JAVA_VERSION}` },
|
|
11
|
-
];
|
|
12
|
-
}
|
|
3
|
+
remotePlugin = "buf.build/protocolbuffers/java";
|
|
13
4
|
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import type { IProtobufTargetLanguageStrategy } from "./types";
|
|
2
2
|
export declare class RustProtobufTargetLanguageStrategy implements IProtobufTargetLanguageStrategy {
|
|
3
3
|
readonly outputDirectoryName = "rust";
|
|
4
|
-
readonly
|
|
5
|
-
remote: string;
|
|
6
|
-
opt?: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
remote: string;
|
|
9
|
-
opt: string[];
|
|
10
|
-
})[];
|
|
11
|
-
constructor(prostVersion?: string);
|
|
4
|
+
readonly remotePlugin = "buf.build/community/neoeinstein-prost";
|
|
12
5
|
}
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
import semver from "semver";
|
|
2
|
-
import { DEFAULT_PROST_VERSION, PROST_PLUGIN_VERSION } from "../versions";
|
|
3
1
|
export class RustProtobufTargetLanguageStrategy {
|
|
4
2
|
outputDirectoryName = "rust";
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
remote: `buf.build/community/neoeinstein-prost:v${PROST_PLUGIN_VERSION}`,
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
remote: `buf.build/community/neoeinstein-tonic:v${PROST_PLUGIN_VERSION}`,
|
|
11
|
-
// lib.rs includes messages and service stubs into the same package module.
|
|
12
|
-
opt: ["no_include=true"],
|
|
13
|
-
},
|
|
14
|
-
];
|
|
15
|
-
constructor(prostVersion = DEFAULT_PROST_VERSION) {
|
|
16
|
-
if (!semver.validRange(prostVersion) ||
|
|
17
|
-
!semver.subset(prostVersion, ">=0.14.0 <0.15.0")) {
|
|
18
|
-
throw new Error("The pinned Rust gRPC generators require prostVersion in the 0.14 release series.");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
3
|
+
remotePlugin = "buf.build/community/neoeinstein-prost";
|
|
21
4
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export interface ProtobufGeneratorPlugin {
|
|
2
|
-
readonly remote: string;
|
|
3
|
-
readonly opt?: string[];
|
|
4
|
-
}
|
|
5
1
|
export interface IProtobufTargetLanguageStrategy {
|
|
6
2
|
readonly outputDirectoryName: string;
|
|
7
|
-
readonly
|
|
3
|
+
readonly remotePlugin: string;
|
|
8
4
|
}
|
package/dist/protobuf/types.d.ts
CHANGED
|
@@ -22,13 +22,11 @@ export interface ProtobufJavaTargetLanguageOptions {
|
|
|
22
22
|
artifactId: string;
|
|
23
23
|
version: string;
|
|
24
24
|
buildTool?: "maven" | "gradle";
|
|
25
|
-
/** Exact stable Java runtime version; also pins the matching Buf generator. Defaults to 4.32.1. */
|
|
26
25
|
protobufJavaVersion?: string;
|
|
27
26
|
}
|
|
28
27
|
export interface ProtobufRustTargetLanguageOptions {
|
|
29
28
|
crateName: string;
|
|
30
29
|
version: string;
|
|
31
|
-
/** Prost runtime constraint within 0.14; matched to the pinned Prost/Tonic generators. */
|
|
32
30
|
prostVersion?: string;
|
|
33
31
|
}
|
|
34
32
|
/** Go import paths are configured with go_package in .proto files. */
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"author": "Tahmid Ahmed",
|
|
5
5
|
"description": "A collection of Bun shell scripts that can be re-used in various CICD pipelines.",
|
|
6
|
-
"version": "1.0.78-beta.
|
|
6
|
+
"version": "1.0.78-beta.2a7182af",
|
|
7
7
|
"repository": {
|
|
8
8
|
"url": "git+https://github.com/tahminator/pipeline.git"
|
|
9
9
|
},
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
/** Prost filenames encode proto packages; Tonic belongs in the same module. */
|
|
3
|
-
export function createRustLibrary(generatedFiles) {
|
|
4
|
-
const root = { files: [], children: new Map() };
|
|
5
|
-
for (const file of [...generatedFiles].sort()) {
|
|
6
|
-
const packageName = path.posix
|
|
7
|
-
.basename(file)
|
|
8
|
-
.replace(/(?:\.tonic)?\.rs$/, "");
|
|
9
|
-
let node = root;
|
|
10
|
-
for (const segment of packageName === "_" ? [] : packageName.split(".")) {
|
|
11
|
-
if (!/^(?:r#)?[a-zA-Z_][a-zA-Z0-9_]*$/.test(segment) ||
|
|
12
|
-
["self", "Self", "super", "crate"].includes(segment)) {
|
|
13
|
-
throw new Error(`Cannot represent Rust package module ${segment} from ${file}.`);
|
|
14
|
-
}
|
|
15
|
-
const name = segment.startsWith("r#") ? segment : `r#${segment}`;
|
|
16
|
-
let child = node.children.get(name);
|
|
17
|
-
if (!child) {
|
|
18
|
-
child = { files: [], children: new Map() };
|
|
19
|
-
node.children.set(name, child);
|
|
20
|
-
}
|
|
21
|
-
node = child;
|
|
22
|
-
}
|
|
23
|
-
node.files.push(file);
|
|
24
|
-
}
|
|
25
|
-
function render(node, indent = "") {
|
|
26
|
-
const includes = node.files
|
|
27
|
-
.map((file) => `${indent}include!(concat!(env!("CARGO_MANIFEST_DIR"), ${JSON.stringify(`/${file}`)}));\n`)
|
|
28
|
-
.join("");
|
|
29
|
-
const children = [...node.children]
|
|
30
|
-
.map(([name, child]) => `${indent}pub mod ${name} {\n${render(child, `${indent} `)}${indent}}\n`)
|
|
31
|
-
.join("");
|
|
32
|
-
return includes + children;
|
|
33
|
-
}
|
|
34
|
-
return render(root);
|
|
35
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_PROTOBUF_JAVA_VERSION = "4.32.1";
|
|
2
|
-
export declare const GRPC_JAVA_VERSION = "1.75.0";
|
|
3
|
-
export declare const PROST_PLUGIN_VERSION = "0.5.0";
|
|
4
|
-
export declare const DEFAULT_PROST_VERSION = "0.14.1";
|
|
5
|
-
export declare const TONIC_VERSION = "0.14.1";
|
|
6
|
-
/** Java runtime releases include a language major absent from modern protoc tags. */
|
|
7
|
-
export declare function javaGeneratorVersion(runtimeVersion: string): string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_PROTOBUF_JAVA_VERSION = "4.32.1";
|
|
2
|
-
export const GRPC_JAVA_VERSION = "1.75.0";
|
|
3
|
-
export const PROST_PLUGIN_VERSION = "0.5.0";
|
|
4
|
-
export const DEFAULT_PROST_VERSION = "0.14.1";
|
|
5
|
-
export const TONIC_VERSION = "0.14.1";
|
|
6
|
-
/** Java runtime releases include a language major absent from modern protoc tags. */
|
|
7
|
-
export function javaGeneratorVersion(runtimeVersion) {
|
|
8
|
-
const match = /^(3|4)\.(\d+)\.(\d+)$/.exec(runtimeVersion);
|
|
9
|
-
if (!match) {
|
|
10
|
-
throw new Error("protobufJavaVersion must be an exact stable 3.x or 4.x version.");
|
|
11
|
-
}
|
|
12
|
-
const [, major, minor, patch] = match;
|
|
13
|
-
// Before protoc 21, compiler and Java runtime used the same 3.x version.
|
|
14
|
-
return major === "3" && Number(minor) < 21 ?
|
|
15
|
-
runtimeVersion
|
|
16
|
-
: `${minor}.${patch}`;
|
|
17
|
-
}
|