@tahminator/pipeline 1.0.81-beta.d684dda2 → 1.0.81
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
|
@@ -236,7 +236,7 @@ Every target enables both message and service generation by default:
|
|
|
236
236
|
| Go | `<Service>Server`, `Unimplemented<Service>Server`, `<Service>Client` | Resolved by `go mod tidy` into the generated module |
|
|
237
237
|
| Rust | Tonic `<service>_server` traits and `<service>_client` clients | `prost`, `prost-types`, `tonic`, `tonic-prost` |
|
|
238
238
|
|
|
239
|
-
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.
|
|
239
|
+
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.
|
|
240
240
|
|
|
241
241
|
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.
|
|
242
242
|
|
|
@@ -19,8 +19,6 @@ export declare class ArtifactKeeperJavaPublisher {
|
|
|
19
19
|
private publishMaven;
|
|
20
20
|
private publishGradle;
|
|
21
21
|
private moveSources;
|
|
22
|
-
private resolveProtobufJavaVersion;
|
|
23
|
-
private findGeneratedProtobufJavaVersion;
|
|
24
22
|
createMavenPom(options: ProtobufJavaTargetLanguageOptions): string;
|
|
25
23
|
private createMavenSettings;
|
|
26
24
|
createGradleBuild(options: ProtobufJavaTargetLanguageOptions): string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { $ } from "bun";
|
|
2
|
-
import { mkdir, mkdtemp,
|
|
2
|
+
import { mkdir, mkdtemp, readdir, rename, rm, writeFile, } from "node:fs/promises";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import semver from "semver";
|
|
6
5
|
import { DEFAULT_PROTOBUF_JAVA_VERSION, GRPC_JAVA_VERSION, } from "../../versions";
|
|
7
6
|
/**
|
|
8
7
|
* Publish generated Java code to the Maven repository in Artifact Keeper.
|
|
@@ -25,22 +24,11 @@ export class ArtifactKeeperJavaPublisher {
|
|
|
25
24
|
* Java build tools expect sources in src/main/java.
|
|
26
25
|
*/
|
|
27
26
|
await this.moveSources(generatedDirectory);
|
|
28
|
-
|
|
29
|
-
generatedDirectory,
|
|
30
|
-
options,
|
|
31
|
-
});
|
|
32
|
-
switch (resolvedOptions.buildTool) {
|
|
27
|
+
switch (options.buildTool) {
|
|
33
28
|
case "gradle":
|
|
34
|
-
return await this.publishGradle({
|
|
35
|
-
generatedDirectory,
|
|
36
|
-
options: resolvedOptions,
|
|
37
|
-
});
|
|
29
|
+
return await this.publishGradle({ generatedDirectory, options });
|
|
38
30
|
case "maven":
|
|
39
|
-
|
|
40
|
-
return await this.publishMaven({
|
|
41
|
-
generatedDirectory,
|
|
42
|
-
options: resolvedOptions,
|
|
43
|
-
});
|
|
31
|
+
return await this.publishMaven({ generatedDirectory, options });
|
|
44
32
|
}
|
|
45
33
|
}
|
|
46
34
|
async publishMaven({ generatedDirectory, options, }) {
|
|
@@ -89,41 +77,6 @@ export class ArtifactKeeperJavaPublisher {
|
|
|
89
77
|
await rename(path.join(generatedDirectory, entry.name), path.join(sourceDirectory, entry.name));
|
|
90
78
|
}
|
|
91
79
|
}
|
|
92
|
-
async resolveProtobufJavaVersion({ generatedDirectory, options, }) {
|
|
93
|
-
const generatedVersion = await this.findGeneratedProtobufJavaVersion(path.join(generatedDirectory, "src", "main", "java"));
|
|
94
|
-
if (!generatedVersion)
|
|
95
|
-
return options;
|
|
96
|
-
/*
|
|
97
|
-
* Local Java generation uses the protoc version on the runner.
|
|
98
|
-
* The generated files say which protobuf-java runtime they need.
|
|
99
|
-
* Use that version unless the caller supplied a compatible newer one.
|
|
100
|
-
*/
|
|
101
|
-
if (!options.protobufJavaVersion) {
|
|
102
|
-
return { ...options, protobufJavaVersion: generatedVersion };
|
|
103
|
-
}
|
|
104
|
-
if (semver.lt(options.protobufJavaVersion, generatedVersion)) {
|
|
105
|
-
throw new Error(`Generated Java code requires protobuf-java ${generatedVersion}, but protobufJavaVersion is ${options.protobufJavaVersion}.`);
|
|
106
|
-
}
|
|
107
|
-
return options;
|
|
108
|
-
}
|
|
109
|
-
async findGeneratedProtobufJavaVersion(directory) {
|
|
110
|
-
const versions = [];
|
|
111
|
-
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
112
|
-
const filePath = path.join(directory, entry.name);
|
|
113
|
-
if (entry.isDirectory()) {
|
|
114
|
-
const version = await this.findGeneratedProtobufJavaVersion(filePath);
|
|
115
|
-
if (version)
|
|
116
|
-
versions.push(version);
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
if (!entry.isFile() || !entry.name.endsWith(".java"))
|
|
120
|
-
continue;
|
|
121
|
-
const match = /Protobuf Java Version:\s*(\S+)/.exec(await readFile(filePath, "utf8"));
|
|
122
|
-
if (match?.[1] && semver.valid(match[1]))
|
|
123
|
-
versions.push(match[1]);
|
|
124
|
-
}
|
|
125
|
-
return versions.sort(semver.rcompare)[0];
|
|
126
|
-
}
|
|
127
80
|
/*
|
|
128
81
|
* Keep this public for tests.
|
|
129
82
|
* It is generated here because Buf does not write Maven project 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.81
|
|
6
|
+
"version": "1.0.81",
|
|
7
7
|
"repository": {
|
|
8
8
|
"url": "git+https://github.com/tahminator/pipeline.git"
|
|
9
9
|
},
|