Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store and use single file kani path #121

Closed
wants to merge 2 commits into from
Closed
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
13 changes: 4 additions & 9 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
try {
// GET binary path
const globalConfig = GlobalConfig.getInstance();
const kaniBinaryPath = await getKaniPath('cargo-kani');
globalConfig.setFilePath(kaniBinaryPath);

vscode.window.showInformationMessage(
`Kani located at ${kaniBinaryPath} being used for verification`,
);

// GET Version number and display to user
await getKaniVersion(globalConfig.getFilePath());
const CargoKaniBinaryPath = await getKaniPath('cargo-kani');
const KaniPath = await getKaniPath('kani');
globalConfig.setFilePath(CargoKaniBinaryPath);
globalConfig.setKanifilePath(KaniPath);
} catch (error) {
showErrorWithReportIssueButton(
'The Kani executable was not found in PATH. Please install it using the instructions at https://model-checking.github.io/kani/install-guide.html and/or make sure it is in your PATH.',
Expand Down
14 changes: 12 additions & 2 deletions src/globalConfig.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
class GlobalConfig {
private static instance: GlobalConfig;
private filePath: string;
public static instance: GlobalConfig;
public filePath: string;
public KanifilePath = '';

private constructor() {
this.filePath = '';
this.KanifilePath = '';
}

public static getInstance(): GlobalConfig {
Expand All @@ -22,6 +24,14 @@
public getFilePath(): string {
return this.filePath;
}

public setKanifilePath(filePath: string): void {
this.KanifilePath = filePath;
}

public getKanifilePath() {

Check warning on line 32 in src/globalConfig.ts

View workflow job for this annotation

GitHub Actions / format-check

Missing return type on function

Check warning on line 32 in src/globalConfig.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Missing return type on function

Check warning on line 32 in src/globalConfig.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Missing return type on function
return this.KanifilePath;
}
}

export default GlobalConfig;
Loading