@tahminator/pipeline 1.0.78-beta.2a7182af → 1.0.78-beta.3ef6aac5

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 CHANGED
@@ -234,6 +234,8 @@ The publisher generates `go.mod` using the deepest shared directory of the gener
234
234
 
235
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.
236
236
 
237
+ 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.
238
+
237
239
  ### `NPMClient`
238
240
 
239
241
  Interface with NPM registry in order to publish packages to `npmjs.com`
@@ -3,8 +3,8 @@ 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 } from "../versions";
6
7
  import { ArtifactKeeperGoPublisher } from "./go";
7
- const DEFAULT_PROTOBUF_JAVA_VERSION = "4.32.1";
8
8
  const DEFAULT_PROST_VERSION = "0.14";
9
9
  export class ArtifactKeeperProtobufCompilerBackend {
10
10
  config;
@@ -67,7 +67,12 @@ export class ArtifactKeeperProtobufCompilerBackend {
67
67
  writeFile(path.join(generatedDirectory, "Cargo.toml"), this.createCargoToml(options)),
68
68
  writeFile(path.join(generatedDirectory, "src", "lib.rs"), this.createRustLibrary(generatedFiles)),
69
69
  ]);
70
- await $ `cargo publish --registry cargo --token ${this.config.token} --config ${`registries.cargo.index=${this.cargoIndexUrl}`}`.cwd(generatedDirectory);
70
+ await $.env({
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);
71
76
  }
72
77
  async moveJavaSources(generatedDirectory) {
73
78
  const sourceDirectory = path.join(generatedDirectory, "src", "main", "java");
@@ -233,6 +238,6 @@ prost = "${prostVersion}"
233
238
  return `${this.artifactKeeperUrl}/maven/maven/`;
234
239
  }
235
240
  get cargoIndexUrl() {
236
- return `${this.artifactKeeperUrl}/cargo/cargo/index`;
241
+ return `sparse+${this.artifactKeeperUrl}/cargo/cargo/`;
237
242
  }
238
243
  }
@@ -8,7 +8,7 @@ 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]: () => new JavaProtobufTargetLanguageStrategy(),
11
+ [ProtobufTargetLanguage.JAVA]: (targets) => new JavaProtobufTargetLanguageStrategy(targets[ProtobufTargetLanguage.JAVA]?.protobufJavaVersion),
12
12
  [ProtobufTargetLanguage.GO]: () => new GoProtobufTargetLanguageStrategy(),
13
13
  [ProtobufTargetLanguage.RUST]: () => new RustProtobufTargetLanguageStrategy(),
14
14
  };
@@ -80,7 +80,7 @@ export class ProtobufCompilerClient {
80
80
  return this.getConfiguredTargetLanguages(targetLanguages).map(([language, options]) => ({
81
81
  language,
82
82
  options,
83
- strategy: TARGET_LANGUAGE_STRATEGY_FACTORIES[language](),
83
+ strategy: TARGET_LANGUAGE_STRATEGY_FACTORIES[language](targetLanguages),
84
84
  }));
85
85
  }
86
86
  getConfiguredTargetLanguages(targetLanguages) {
@@ -1,5 +1,6 @@
1
1
  import type { IProtobufTargetLanguageStrategy } from "./types";
2
2
  export declare class JavaProtobufTargetLanguageStrategy implements IProtobufTargetLanguageStrategy {
3
3
  readonly outputDirectoryName = "java";
4
- readonly remotePlugin = "buf.build/protocolbuffers/java";
4
+ readonly remotePlugin: string;
5
+ constructor(runtimeVersion?: string);
5
6
  }
@@ -1,4 +1,8 @@
1
+ import { DEFAULT_PROTOBUF_JAVA_VERSION, javaGeneratorVersion, } from "../versions";
1
2
  export class JavaProtobufTargetLanguageStrategy {
2
3
  outputDirectoryName = "java";
3
- remotePlugin = "buf.build/protocolbuffers/java";
4
+ remotePlugin;
5
+ constructor(runtimeVersion = DEFAULT_PROTOBUF_JAVA_VERSION) {
6
+ this.remotePlugin = `buf.build/protocolbuffers/java:v${javaGeneratorVersion(runtimeVersion)}`;
7
+ }
4
8
  }
@@ -22,6 +22,7 @@ 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. */
25
26
  protobufJavaVersion?: string;
26
27
  }
27
28
  export interface ProtobufRustTargetLanguageOptions {
@@ -0,0 +1,3 @@
1
+ export declare const DEFAULT_PROTOBUF_JAVA_VERSION = "4.32.1";
2
+ /** Java runtime releases include a language major absent from modern protoc tags. */
3
+ export declare function javaGeneratorVersion(runtimeVersion: string): string;
@@ -0,0 +1,13 @@
1
+ export const DEFAULT_PROTOBUF_JAVA_VERSION = "4.32.1";
2
+ /** Java runtime releases include a language major absent from modern protoc tags. */
3
+ export function javaGeneratorVersion(runtimeVersion) {
4
+ const match = /^(3|4)\.(\d+)\.(\d+)$/.exec(runtimeVersion);
5
+ if (!match) {
6
+ throw new Error("protobufJavaVersion must be an exact stable 3.x or 4.x version.");
7
+ }
8
+ const [, major, minor, patch] = match;
9
+ // Before protoc 21, compiler and Java runtime used the same 3.x version.
10
+ return major === "3" && Number(minor) < 21 ?
11
+ runtimeVersion
12
+ : `${minor}.${patch}`;
13
+ }
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.2a7182af",
6
+ "version": "1.0.78-beta.3ef6aac5",
7
7
  "repository": {
8
8
  "url": "git+https://github.com/tahminator/pipeline.git"
9
9
  },