Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

fix(apexlink): direct conversion to json breaks on large packages #1306

Merged
merged 1 commit into from
May 12, 2023
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
63 changes: 59 additions & 4 deletions packages/apexlink/package-lock.json

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

3 changes: 2 additions & 1 deletion packages/apexlink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"dependencies": {
"@dxatscale/sfdx-process-wrapper": "0.1.0",
"@dxatscale/sfp-logger": "1.2.0",
"find-java-home": "2.0.0"
"find-java-home": "2.0.0",
"fs-extra": "11.1.1"
},
"devDependencies": {
"@babel/core": "7.18.2",
Expand Down
17 changes: 10 additions & 7 deletions packages/apexlink/src/ApexDepedencyCheckImpl.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import findJavaHome from 'find-java-home';
import ExecuteCommand from '@dxatscale/sfdx-process-wrapper/lib/commandExecutor/ExecuteCommand';
import { Logger, LoggerLevel } from '@dxatscale/sfp-logger';
import path from 'path';
import SFPLogger from '@dxatscale/sfp-logger';
import { ConsoleLogger } from '@dxatscale/sfp-logger';
import * as fs from 'fs-extra';
import path from 'path';

const jarFile = path.join(__dirname, '..', 'jars', 'apexlink-2.3.7.jar');
export default class ApexDepedencyCheckImpl {
Expand All @@ -13,19 +14,21 @@ export default class ApexDepedencyCheckImpl {

let apexLinkProcessExecutor = new ExecuteCommand(this.logger, LoggerLevel.INFO, false);
let generatedCommand = await this.getGeneratedCommandWithParams();
let result = await apexLinkProcessExecutor.execCommand(

await apexLinkProcessExecutor.execCommand(
generatedCommand,
process.cwd()
);
return JSON.parse(result);
let result = fs.readJSONSync(`${this.projectDirectory}/apexlink.json`)
return result;
}

private async getGeneratedCommandWithParams() {
let javaHome = await this.getJavaHome();

let javaHome:string = await this.getJavaHome();
//Replace Program Files with Progra~1 in Windows
javaHome = javaHome.replace(/Program Files/, "Progra~1");
let command = `${path.join(javaHome, 'bin', 'java')} -jar ${jarFile} -depends -json ${
this.projectDirectory
}`;
this.projectDirectory } > ${this.projectDirectory}/apexlink.json`;
return command;
}

Expand Down
Loading