diff --git a/src/commands/scanner/run/dfa.ts b/src/commands/scanner/run/dfa.ts index 05c0cb2b8..fe3ef4584 100644 --- a/src/commands/scanner/run/dfa.ts +++ b/src/commands/scanner/run/dfa.ts @@ -69,7 +69,19 @@ export default class Dfa extends ScannerRunCommand { summary: getMessage(BundleName.RunDfa, 'flags.pathexplimitSummary'), description: getMessage(BundleName.RunDfa, 'flags.pathexplimitDescription'), env: 'SFGE_PATH_EXPANSION_LIMIT' - }) + }), + 'enablecaching': Flags.boolean({ + summary: '', + description: '', + env: 'SFGE_ENABLE_CACHING', + hidden: true + }), + 'cachepath': Flags.string({ + summary: '', + description: '', + env: 'SFGE_FILES_TO_ENTRIES_CACHE_LOCATION', + hidden: true + }), // END: Config-overrideable engine flags. }; diff --git a/src/lib/EngineOptionsFactory.ts b/src/lib/EngineOptionsFactory.ts index d159586a1..45a6f84f5 100644 --- a/src/lib/EngineOptionsFactory.ts +++ b/src/lib/EngineOptionsFactory.ts @@ -114,6 +114,12 @@ export class RunDfaEngineOptionsFactory extends CommonEngineOptionsFactory { if (inputs['pathexplimit'] != null) { sfgeConfig.pathexplimit = inputs['pathexplimit'] as number; } + if (inputs['enablecaching'] != null) { + sfgeConfig.enablecaching = inputs['enablecaching'] as boolean; + } + if (inputs['cachepath'] != null) { + sfgeConfig.cachepath = inputs['cachepath'] as string; + } sfgeConfig.ruleDisableWarningViolation = getBooleanEngineOption(inputs, RULE_DISABLE_WARNING_VIOLATION_FLAG); engineOptions.set(CUSTOM_CONFIG.SfgeConfig, JSON.stringify(sfgeConfig)); diff --git a/src/lib/sfge/SfgeWrapper.ts b/src/lib/sfge/SfgeWrapper.ts index b9bb64871..7ab08294f 100644 --- a/src/lib/sfge/SfgeWrapper.ts +++ b/src/lib/sfge/SfgeWrapper.ts @@ -46,6 +46,8 @@ type SfgeExecuteOptions = SfgeWrapperOptions & { ruleThreadCount?: number; ruleThreadTimeout?: number; ruleDisableWarningViolation?: boolean; + enablecaching?: boolean; + cachepath?: string; } type SfgeTarget = { @@ -57,6 +59,8 @@ type SfgeInput = { targets: SfgeTarget[]; projectDirs: string[]; rulesToRun: string[]; + enablecaching?: boolean; + cachepath?: string; }; class SfgeSpinnerManager extends AsyncCreatable implements SpinnerManager { @@ -209,6 +213,8 @@ export class SfgeExecuteWrapper extends AbstractSfgeWrapper { private ruleThreadCount: number; private ruleThreadTimeout: number; private ruleDisableWarningViolation: boolean; + private enablecaching: boolean; + private cachepath: string; constructor(options: SfgeExecuteOptions) { super(options); @@ -218,6 +224,8 @@ export class SfgeExecuteWrapper extends AbstractSfgeWrapper { this.ruleThreadCount = options.ruleThreadCount; this.ruleThreadTimeout = options.ruleThreadTimeout; this.ruleDisableWarningViolation = options.ruleDisableWarningViolation; + this.enablecaching = options.enablecaching; + this.cachepath = options.cachepath; } protected getSupplementalFlags(): string[] { @@ -231,6 +239,12 @@ export class SfgeExecuteWrapper extends AbstractSfgeWrapper { if (this.ruleDisableWarningViolation != null) { flags.push(`-DSFGE_RULE_DISABLE_WARNING_VIOLATION=${this.ruleDisableWarningViolation.toString()}`); } + if (this.enablecaching != null && this.enablecaching) { + flags.push(`-DSFGE_DISABLE_CACHING=false`); + } + if (this.cachepath != null) { + flags.push(`-DSFGE_FILES_TO_ENTRIES_CACHE_LOCATION=${this.cachepath}`); + } return flags; } @@ -291,7 +305,9 @@ export class SfgeExecuteWrapper extends AbstractSfgeWrapper { pathExpLimit: sfgeConfig.pathexplimit, ruleThreadCount: sfgeConfig.ruleThreadCount, ruleThreadTimeout: sfgeConfig.ruleThreadTimeout, - ruleDisableWarningViolation: sfgeConfig.ruleDisableWarningViolation + ruleDisableWarningViolation: sfgeConfig.ruleDisableWarningViolation, + cachepath: sfgeConfig.cachepath, + enablecaching: sfgeConfig.enablecaching }); return wrapper.execute(); } diff --git a/src/types.ts b/src/types.ts index 21d9da770..bec41e4f5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -204,4 +204,6 @@ export type SfgeConfig = { ruleDisableWarningViolation?: boolean; jvmArgs?: string; pathexplimit?: number; + enablecaching?: boolean; + cachepath?: string; };