Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfb7d99c20 | ||
|
|
7ba8aa8181 | ||
|
|
233907a19f | ||
|
|
018e9c0ae7 | ||
|
|
585b694f52 | ||
|
|
2c4cf1bab3 | ||
|
|
4eeedb6ad4 | ||
|
|
895398fe40 | ||
|
|
9c129f53ea | ||
|
|
54039823d3 | ||
|
|
ef0623c605 | ||
|
|
7429af3e27 | ||
|
|
88033c12f1 | ||
|
|
71898ac4ce | ||
|
|
e57a685424 | ||
|
|
54fc90a673 | ||
|
|
ca67d30810 | ||
|
|
457ae9a611 | ||
|
|
b9d9d239c8 |
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
|
||||
21
.github/workflows/release.yml
vendored
21
.github/workflows/release.yml
vendored
@@ -27,18 +27,12 @@ jobs:
|
||||
# TODO Share steps with the main workflow.
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '10.18.1'
|
||||
|
||||
# The checkout action does not fetch the master branch.
|
||||
# Fetch the master branch so that we can base the version bump PR against master.
|
||||
- name: Fetch master branch
|
||||
run: |
|
||||
git fetch --depth=1 origin master:master
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd build
|
||||
@@ -57,8 +51,8 @@ jobs:
|
||||
VSIX_PATH="$(ls dist/*.vsix)"
|
||||
echo "::set-output name=vsix_path::$VSIX_PATH"
|
||||
# Transform the GitHub ref so it can be used in a filename.
|
||||
# This is mainly needed for testing branches that modify this workflow.
|
||||
REF_NAME="$(echo ${{ github.ref }} | sed -e 's:/:-:g')"
|
||||
# The last sed invocation is used for testing branches that modify this workflow.
|
||||
REF_NAME="$(echo ${{ github.ref }} | sed -e 's:^refs/tags/::' | sed -e 's:/:-:g')"
|
||||
echo "::set-output name=ref_name::$REF_NAME"
|
||||
|
||||
# Uploading artifacts is not necessary to create a release.
|
||||
@@ -99,6 +93,13 @@ jobs:
|
||||
asset_name: ${{ format('vscode-codeql-{0}.vsix', steps.prepare-artifacts.outputs.ref_name) }}
|
||||
asset_content_type: application/zip
|
||||
|
||||
# The checkout action does not fetch the master branch.
|
||||
# Fetch the master branch so that we can base the version bump PR against master.
|
||||
- name: Fetch master branch
|
||||
run: |
|
||||
git fetch --depth=1 origin master:master
|
||||
git checkout master
|
||||
|
||||
- name: Bump patch version
|
||||
id: bump-patch-version
|
||||
if: success()
|
||||
@@ -110,7 +111,7 @@ jobs:
|
||||
echo "::set-output name=next_version::$NEXT_VERSION"
|
||||
|
||||
- name: Create version bump PR
|
||||
uses: peter-evans/create-pull-request@c202684c928d4c9f18394b2ad11df905c5d8b40c # v2.1.2
|
||||
uses: peter-evans/create-pull-request@c7b64af0a489eae91f7890f2c1b63d13cc2d8ab7 # v2.4.2
|
||||
if: success()
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# CodeQL for Visual Studio Code: Changelog
|
||||
|
||||
## 1.0.6 - 28 February 2020
|
||||
|
||||
- Add command to restart query server.
|
||||
- Enable support for future minor upgrades to the CodeQL CLI.
|
||||
|
||||
## 1.0.5 - 13 February 2020
|
||||
|
||||
- Add an icon next to any failed query runs in the query history
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "CodeQL for Visual Studio Code",
|
||||
"author": "GitHub",
|
||||
"private": true,
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"publisher": "GitHub",
|
||||
"license": "MIT",
|
||||
"icon": "media/VS-marketplace-CodeQL-icon.png",
|
||||
@@ -28,6 +28,7 @@
|
||||
"onCommand:codeQLDatabases.chooseDatabase",
|
||||
"onCommand:codeQLDatabases.setCurrentDatabase",
|
||||
"onCommand:codeQL.quickQuery",
|
||||
"onCommand:codeQL.restartQueryServer",
|
||||
"onWebviewPanel:resultsView",
|
||||
"onFileSystem:codeql-zip-archive"
|
||||
],
|
||||
@@ -206,6 +207,10 @@
|
||||
{
|
||||
"command": "codeQLQueryHistory.setLabel",
|
||||
"title": "Set Label"
|
||||
},
|
||||
{
|
||||
"command": "codeQL.restartQueryServer",
|
||||
"title": "CodeQL: Restart Query Server"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
|
||||
@@ -39,9 +39,9 @@ const DEFAULT_DISTRIBUTION_REPOSITORY_NAME = "codeql-cli-binaries";
|
||||
* This applies to both extension-managed and CLI distributions.
|
||||
*/
|
||||
export const DEFAULT_DISTRIBUTION_VERSION_CONSTRAINT: VersionConstraint = {
|
||||
description: "2.0.*",
|
||||
description: "2.*.*",
|
||||
isVersionCompatible: (v: Version) => {
|
||||
return v.majorVersion === 2 && v.minorVersion === 0
|
||||
return v.majorVersion === 2 && v.minorVersion >= 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -308,6 +308,13 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
|
||||
ctx.subscriptions.push(commands.registerCommand('codeQL.runQuery', async (uri: Uri | undefined) => await compileAndRunQuery(false, uri)));
|
||||
ctx.subscriptions.push(commands.registerCommand('codeQL.quickEval', async (uri: Uri | undefined) => await compileAndRunQuery(true, uri)));
|
||||
ctx.subscriptions.push(commands.registerCommand('codeQL.quickQuery', async () => displayQuickQuery(ctx, cliServer, databaseUI)));
|
||||
ctx.subscriptions.push(commands.registerCommand('codeQL.restartQueryServer', async () => {
|
||||
await qs.restartQueryServer();
|
||||
const response = await Window.showInformationMessage('CodeQL Query Server restarted.', 'Show Log');
|
||||
if (response === 'Show Log') {
|
||||
qs.showLog();
|
||||
}
|
||||
}));
|
||||
|
||||
ctx.subscriptions.push(client.start());
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ export interface Logger {
|
||||
log(message: string): void;
|
||||
/** Writes the given log message, not followed by a newline. */
|
||||
logWithoutTrailingNewline(message: string): void;
|
||||
/**
|
||||
* Reveal this channel in the UI.
|
||||
*
|
||||
* @param preserveFocus When `true` the channel will not take focus.
|
||||
*/
|
||||
show(preserveFocus?: boolean): void;
|
||||
}
|
||||
|
||||
export type ProgressReporter = Progress<{ message: string }>;
|
||||
@@ -28,6 +34,9 @@ export class OutputChannelLogger extends DisposableObject implements Logger {
|
||||
this.outputChannel.append(message);
|
||||
}
|
||||
|
||||
show(preserveFocus?: boolean) {
|
||||
this.outputChannel.show(preserveFocus);
|
||||
}
|
||||
}
|
||||
|
||||
/** The global logger for the extension. */
|
||||
|
||||
@@ -56,7 +56,10 @@ export class QueryServerClient extends DisposableObject {
|
||||
super();
|
||||
// When the query server configuration changes, restart the query server.
|
||||
if (config.onDidChangeQueryServerConfiguration !== undefined) {
|
||||
this.push(config.onDidChangeQueryServerConfiguration(async () => await this.restartQueryServer(), this));
|
||||
this.push(config.onDidChangeQueryServerConfiguration(async () => {
|
||||
this.logger.log('Restarting query server due to configuration changes...');
|
||||
await this.restartQueryServer();
|
||||
}, this));
|
||||
}
|
||||
this.withProgressReporting = withProgressReporting;
|
||||
this.nextCallback = 0;
|
||||
@@ -77,12 +80,15 @@ export class QueryServerClient extends DisposableObject {
|
||||
}
|
||||
|
||||
/** Restarts the query server by disposing of the current server process and then starting a new one. */
|
||||
private async restartQueryServer() {
|
||||
this.logger.log('Restarting query server due to configuration changes...');
|
||||
async restartQueryServer() {
|
||||
this.stopQueryServer();
|
||||
await this.startQueryServer();
|
||||
}
|
||||
|
||||
async showLog() {
|
||||
this.logger.show();
|
||||
}
|
||||
|
||||
/** Starts a new query server process, sending progress messages to the status bar. */
|
||||
async startQueryServer() {
|
||||
// Use an arrow function to preserve the value of `this`.
|
||||
|
||||
@@ -10,7 +10,7 @@ import { CancellationTokenSource } from 'vscode-jsonrpc';
|
||||
import * as messages from '../../src/messages';
|
||||
import * as qsClient from '../../src/queryserver-client';
|
||||
import * as cli from '../../src/cli';
|
||||
import { ProgressReporter } from '../../src/logging';
|
||||
import { ProgressReporter, Logger } from '../../src/logging';
|
||||
|
||||
|
||||
declare module "url" {
|
||||
@@ -75,8 +75,8 @@ const queryTestCases: QueryTestCase[] = [
|
||||
}
|
||||
];
|
||||
|
||||
describe('using the query server', function () {
|
||||
before(function () {
|
||||
describe('using the query server', function() {
|
||||
before(function() {
|
||||
if (process.env["CODEQL_PATH"] === undefined) {
|
||||
console.log('The environment variable CODEQL_PATH is not set. The query server tests, which require the CodeQL CLI, will be skipped.');
|
||||
this.skip();
|
||||
@@ -100,13 +100,14 @@ describe('using the query server', function () {
|
||||
}
|
||||
});
|
||||
|
||||
it('should be able to start the query server', async function () {
|
||||
it('should be able to start the query server', async function() {
|
||||
const consoleProgressReporter: ProgressReporter = {
|
||||
report: (v: {message: string}) => console.log(`progress reporter says ${v.message}`)
|
||||
report: (v: { message: string }) => console.log(`progress reporter says ${v.message}`)
|
||||
};
|
||||
const logger = {
|
||||
const logger: Logger = {
|
||||
log: (s: string) => console.log('logger says', s),
|
||||
logWithoutTrailingNewline: (s: string) => console.log('logger says', s)
|
||||
logWithoutTrailingNewline: (s: string) => console.log('logger says', s),
|
||||
show: () => { },
|
||||
};
|
||||
cliServer = new cli.CodeQLCliServer({
|
||||
async getCodeQlPathWithoutVersionCheck(): Promise<string | undefined> {
|
||||
@@ -137,7 +138,7 @@ describe('using the query server', function () {
|
||||
const evaluationSucceeded = new Checkpoint<void>();
|
||||
const parsedResults = new Checkpoint<void>();
|
||||
|
||||
it(`should be able to compile query ${queryName}`, async function () {
|
||||
it(`should be able to compile query ${queryName}`, async function() {
|
||||
await queryServerStarted.done();
|
||||
expect(fs.existsSync(queryTestCase.queryPath)).to.be.true;
|
||||
try {
|
||||
@@ -169,7 +170,7 @@ describe('using the query server', function () {
|
||||
}
|
||||
});
|
||||
|
||||
it(`should be able to run query ${queryName}`, async function () {
|
||||
it(`should be able to run query ${queryName}`, async function() {
|
||||
try {
|
||||
await compilationSucceeded.done();
|
||||
const callbackId = qs.registerCallback(_res => {
|
||||
@@ -201,7 +202,7 @@ describe('using the query server', function () {
|
||||
});
|
||||
|
||||
const actualResultSets: ResultSets = {};
|
||||
it(`should be able to parse results of query ${queryName}`, async function () {
|
||||
it(`should be able to parse results of query ${queryName}`, async function() {
|
||||
let fileReader: FileReader | undefined;
|
||||
try {
|
||||
await evaluationSucceeded.done();
|
||||
@@ -222,7 +223,7 @@ describe('using the query server', function () {
|
||||
}
|
||||
});
|
||||
|
||||
it(`should have correct results for query ${queryName}`, async function () {
|
||||
it(`should have correct results for query ${queryName}`, async function() {
|
||||
await parsedResults.done();
|
||||
expect(actualResultSets!).not.to.be.empty;
|
||||
expect(Object.keys(actualResultSets!).sort()).to.eql(Object.keys(queryTestCase.expectedResultSets).sort());
|
||||
|
||||
Reference in New Issue
Block a user