Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"type": "node",
"request": "attach",
"name": "Attach to Server",
"port": 6009,
"port": 6010,
"restart": true,
"sourceMaps": true,
"outFiles": [
Expand Down
Binary file not shown.
40 changes: 32 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@fabric8-analytics/fabric8-analytics-lsp-server": "^0.10.0",
"@fabric8-analytics/fabric8-analytics-lsp-server": "^0.10.1",
"@redhat-developer/vscode-redhat-telemetry": "^0.8.0",
"@trustification/exhort-api-spec": "^1.0.13",
"@trustification/exhort-javascript-api": "^0.1.1",
"@trustification/exhort-javascript-api": "^0.2.1-ea.0",
"fs": "^0.0.1-security",
"path": "^0.12.7",
"vscode-languageclient": "^8.1.0"
Expand Down
27 changes: 5 additions & 22 deletions src/exhortServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import * as vscode from 'vscode';
import exhort from '@trustification/exhort-javascript-api';
import { execSync } from 'child_process';

import { IImageRef, IOptions } from './imageAnalysis';

Expand All @@ -13,28 +12,12 @@ import { IImageRef, IOptions } from './imageAnalysis';
* @returns A Promise resolving to the analysis response in HTML format.
*/
async function imageAnalysisService(images: IImageRef[], options: IOptions): Promise<any> {
const jarPath = `${__dirname}/../javaApiAdapter/exhort-java-api-adapter-1.0-SNAPSHOT-jar-with-dependencies.jar`;
const reportType = 'html';
let parameters = '';
let properties = '';

images.forEach(image => {
if (image.platform) {
parameters += ` ${image.image}^^${image.platform}`;
} else {
parameters += ` ${image.image}`;
}
});

for (const setting in options) {
if (options[setting]) {
properties += ` -D${setting}=${options[setting]}`;
return await exhort.imageAnalysis(images.map(img => {
if (img.platform) {
return `${img.image}^^${img.platform}`;
}
}

return execSync(`java${properties} -jar ${jarPath} ${reportType}${parameters}`, {
maxBuffer: 1000 * 1000 * 10, // 10 MB
}).toString();
return img.image;
}), true, options);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export function activate(context: vscode.ExtensionContext) {
path.join('dist', 'server.js')
);
// The debug options for the server
// --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] };
// --inspect=6010: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
const debugOptions = { execArgv: ['--nolazy', '--inspect=6010'] };

// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
Expand Down