Skip to content

Commit

Permalink
feat: add extra protocols in package manifest if any
Browse files Browse the repository at this point in the history
  • Loading branch information
notdryft committed Dec 13, 2024
1 parent 81716ba commit 876b5ba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/cli/src/commands/enterpriseDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default (program: Command): void => {

const { graalvmHome, jvmClasspath } = await resolveBundle({ gatlingHome });
await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations });
await enterprisePackage({ bundleFile, resourcesFolder, packageFile, postman, simulations });
await enterpriseDeploy({
graalvmHome,
jvmClasspath,
Expand Down
2 changes: 1 addition & 1 deletion js/cli/src/commands/enterprisePackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ export default (program: Command): void => {

await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });

await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations });
await enterprisePackage({ bundleFile, resourcesFolder, packageFile, postman, simulations });
});
};
2 changes: 1 addition & 1 deletion js/cli/src/commands/enterpriseStart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default (program: Command): void => {

const { graalvmHome, jvmClasspath } = await resolveBundle({ gatlingHome });
await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations });
await enterprisePackage({ bundleFile, resourcesFolder, packageFile, postman, simulations });
await enterpriseStart({
graalvmHome,
jvmClasspath,
Expand Down
9 changes: 7 additions & 2 deletions js/cli/src/enterprise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface EnterprisePackageOptions {
bundleFile: string;
resourcesFolder: string;
packageFile: string;
postman: string | undefined;
simulations: SimulationFile[];
}

Expand All @@ -20,7 +21,7 @@ export const enterprisePackage = async (options: EnterprisePackageOptions): Prom
- bundleFile: ${options.bundleFile}
- packageFile: ${options.packageFile}`);

const manifest = generateManifest(options.simulations.map((s) => s.name));
const manifest = generateManifest(options);

const output = fs.createWriteStream(options.packageFile);

Expand All @@ -42,7 +43,8 @@ export const enterprisePackage = async (options: EnterprisePackageOptions): Prom
logger.info(`Package for Gatling Enterprise created at ${options.packageFile}`);
};

const generateManifest = (simulationNames: string[]) => {
const generateManifest = (options: EnterprisePackageOptions) => {
const simulationNames: string[] = options.simulations.map((s) => s.name);
const utf8Encoder = new TextEncoder();
const eol = utf8Encoder.encode("\n");
const continuation = utf8Encoder.encode("\n ");
Expand All @@ -56,6 +58,9 @@ const generateManifest = (simulationNames: string[]) => {
`Gatling-Simulations: ${simulationNames.join(",")}`,
`Java-Version: ${versions.java.compilerRelease}`
];
if (options.postman !== undefined) {
lines.push("Gatling-Extra-Protocols: postman");
}
const pkg = getPackageNameAndVersion();
lines.push(`Implementation-Title: ${pkg.name}`);
if (pkg.version !== undefined) {
Expand Down

0 comments on commit 876b5ba

Please sign in to comment.