Skip to content

Commit 984ba73

Browse files
author
Dave Bartolomeo
committed
Merge from master
2 parents f2c525b + c4aa9d9 commit 984ba73

File tree

9 files changed

+61
-26
lines changed

9 files changed

+61
-26
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
os: [ubuntu-latest, windows-latest]
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v1
13+
uses: actions/checkout@v2
1414
with:
1515
fetch-depth: 1
1616

@@ -46,7 +46,7 @@ jobs:
4646
os: [ubuntu-latest, windows-latest]
4747
steps:
4848
- name: Checkout
49-
uses: actions/checkout@v1
49+
uses: actions/checkout@v2
5050
with:
5151
fetch-depth: 1
5252

.github/workflows/release.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,12 @@ jobs:
2727
# TODO Share steps with the main workflow.
2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@master
30+
uses: actions/checkout@v2
3131

3232
- uses: actions/setup-node@v1
3333
with:
3434
node-version: '10.18.1'
3535

36-
# The checkout action does not fetch the master branch.
37-
# Fetch the master branch so that we can base the version bump PR against master.
38-
- name: Fetch master branch
39-
run: |
40-
git fetch --depth=1 origin master:master
41-
4236
- name: Build
4337
run: |
4438
cd build
@@ -99,6 +93,13 @@ jobs:
9993
asset_name: ${{ format('vscode-codeql-{0}.vsix', steps.prepare-artifacts.outputs.ref_name) }}
10094
asset_content_type: application/zip
10195

96+
# The checkout action does not fetch the master branch.
97+
# Fetch the master branch so that we can base the version bump PR against master.
98+
- name: Fetch master branch
99+
run: |
100+
git fetch --depth=1 origin master:master
101+
git checkout master
102+
102103
- name: Bump patch version
103104
id: bump-patch-version
104105
if: success()
@@ -110,7 +111,7 @@ jobs:
110111
echo "::set-output name=next_version::$NEXT_VERSION"
111112
112113
- name: Create version bump PR
113-
uses: peter-evans/create-pull-request@c202684c928d4c9f18394b2ad11df905c5d8b40c # v2.1.2
114+
uses: peter-evans/create-pull-request@c7b64af0a489eae91f7890f2c1b63d13cc2d8ab7 # v2.4.2
114115
if: success()
115116
with:
116117
token: ${{ secrets.GITHUB_TOKEN }}

extensions/ql-vscode/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CodeQL for Visual Studio Code: Changelog
22

3+
## 1.0.6 - 28 February 2020
4+
5+
- Add command to restart query server.
6+
- Enable support for future minor upgrades to the CodeQL CLI.
7+
38
## 1.0.5 - 13 February 2020
49

510
- Add an icon next to any failed query runs in the query history

extensions/ql-vscode/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"onCommand:codeQLDatabases.chooseDatabase",
3333
"onCommand:codeQLDatabases.setCurrentDatabase",
3434
"onCommand:codeQL.quickQuery",
35+
"onCommand:codeQL.restartQueryServer",
3536
"onWebviewPanel:resultsView",
3637
"onFileSystem:codeql-zip-archive"
3738
],
@@ -219,6 +220,10 @@
219220
"command": "codeQLQueryHistory.setLabel",
220221
"title": "Set Label"
221222
},
223+
{
224+
"command": "codeQL.restartQueryServer",
225+
"title": "CodeQL: Restart Query Server"
226+
},
222227
{
223228
"command": "codeQLTests.showOutputDifferences",
224229
"title": "CodeQL: Show Test Output Differences"

extensions/ql-vscode/src/distribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ const DEFAULT_DISTRIBUTION_REPOSITORY_NAME = "codeql-cli-binaries";
3939
* This applies to both extension-managed and CLI distributions.
4040
*/
4141
export const DEFAULT_DISTRIBUTION_VERSION_CONSTRAINT: VersionConstraint = {
42-
description: "2.0.*",
42+
description: "2.*.*",
4343
isVersionCompatible: (v: Version) => {
44-
return v.majorVersion === 2 && v.minorVersion === 0
44+
return v.majorVersion === 2 && v.minorVersion >= 0
4545
}
4646
}
4747

extensions/ql-vscode/src/extension.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,13 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
321321
ctx.subscriptions.push(commands.registerCommand('codeQL.runQuery', async (uri: Uri | undefined) => await compileAndRunQuery(false, uri)));
322322
ctx.subscriptions.push(commands.registerCommand('codeQL.quickEval', async (uri: Uri | undefined) => await compileAndRunQuery(true, uri)));
323323
ctx.subscriptions.push(commands.registerCommand('codeQL.quickQuery', async () => displayQuickQuery(ctx, cliServer, databaseUI)));
324+
ctx.subscriptions.push(commands.registerCommand('codeQL.restartQueryServer', async () => {
325+
await qs.restartQueryServer();
326+
const response = await Window.showInformationMessage('CodeQL Query Server restarted.', 'Show Log');
327+
if (response === 'Show Log') {
328+
qs.showLog();
329+
}
330+
}));
324331

325332
ctx.subscriptions.push(client.start());
326333
}

extensions/ql-vscode/src/logging.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ export interface Logger {
66
log(message: string): void;
77
/** Writes the given log message, not followed by a newline. */
88
logWithoutTrailingNewline(message: string): void;
9+
/**
10+
* Reveal this channel in the UI.
11+
*
12+
* @param preserveFocus When `true` the channel will not take focus.
13+
*/
14+
show(preserveFocus?: boolean): void;
915
}
1016

1117
export type ProgressReporter = Progress<{ message: string }>;
@@ -27,6 +33,10 @@ export class OutputChannelLogger extends DisposableObject implements Logger {
2733
logWithoutTrailingNewline(message: string) {
2834
this.outputChannel.append(message);
2935
}
36+
37+
show(preserveFocus?: boolean) {
38+
this.outputChannel.show(preserveFocus);
39+
}
3040
}
3141

3242
/** The global logger for the extension. */

extensions/ql-vscode/src/queryserver-client.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ export class QueryServerClient extends DisposableObject {
5858
super();
5959
// When the query server configuration changes, restart the query server.
6060
if (config.onDidChangeQueryServerConfiguration !== undefined) {
61-
this.push(config.onDidChangeQueryServerConfiguration(async () => await this.restartQueryServer(), this));
61+
this.push(config.onDidChangeQueryServerConfiguration(async () => {
62+
this.logger.log('Restarting query server due to configuration changes...');
63+
await this.restartQueryServer();
64+
}, this));
6265
}
6366
this.withProgressReporting = withProgressReporting;
6467
this.nextCallback = 0;
@@ -79,12 +82,15 @@ export class QueryServerClient extends DisposableObject {
7982
}
8083

8184
/** Restarts the query server by disposing of the current server process and then starting a new one. */
82-
private async restartQueryServer() {
83-
this.logger.log('Restarting query server due to configuration changes...');
85+
async restartQueryServer() {
8486
this.stopQueryServer();
8587
await this.startQueryServer();
8688
}
8789

90+
async showLog() {
91+
this.logger.show();
92+
}
93+
8894
/** Starts a new query server process, sending progress messages to the status bar. */
8995
async startQueryServer() {
9096
// Use an arrow function to preserve the value of `this`.

extensions/ql-vscode/test/pure-tests/query-test.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { CancellationTokenSource } from 'vscode-jsonrpc';
1010
import * as messages from '../../src/messages';
1111
import * as qsClient from '../../src/queryserver-client';
1212
import * as cli from '../../src/cli';
13-
import { ProgressReporter } from '../../src/logging';
13+
import { ProgressReporter, Logger } from '../../src/logging';
1414

1515

1616
declare module "url" {
@@ -75,8 +75,8 @@ const queryTestCases: QueryTestCase[] = [
7575
}
7676
];
7777

78-
describe('using the query server', function () {
79-
before(function () {
78+
describe('using the query server', function() {
79+
before(function() {
8080
if (process.env["CODEQL_PATH"] === undefined) {
8181
console.log('The environment variable CODEQL_PATH is not set. The query server tests, which require the CodeQL CLI, will be skipped.');
8282
this.skip();
@@ -100,13 +100,14 @@ describe('using the query server', function () {
100100
}
101101
});
102102

103-
it('should be able to start the query server', async function () {
103+
it('should be able to start the query server', async function() {
104104
const consoleProgressReporter: ProgressReporter = {
105-
report: (v: {message: string}) => console.log(`progress reporter says ${v.message}`)
105+
report: (v: { message: string }) => console.log(`progress reporter says ${v.message}`)
106106
};
107-
const logger = {
107+
const logger: Logger = {
108108
log: (s: string) => console.log('logger says', s),
109-
logWithoutTrailingNewline: (s: string) => console.log('logger says', s)
109+
logWithoutTrailingNewline: (s: string) => console.log('logger says', s),
110+
show: () => { },
110111
};
111112
cliServer = new cli.CodeQLCliServer({
112113
async getCodeQlPathWithoutVersionCheck(): Promise<string | undefined> {
@@ -137,7 +138,7 @@ describe('using the query server', function () {
137138
const evaluationSucceeded = new Checkpoint<void>();
138139
const parsedResults = new Checkpoint<void>();
139140

140-
it(`should be able to compile query ${queryName}`, async function () {
141+
it(`should be able to compile query ${queryName}`, async function() {
141142
await queryServerStarted.done();
142143
expect(fs.existsSync(queryTestCase.queryPath)).to.be.true;
143144
try {
@@ -169,7 +170,7 @@ describe('using the query server', function () {
169170
}
170171
});
171172

172-
it(`should be able to run query ${queryName}`, async function () {
173+
it(`should be able to run query ${queryName}`, async function() {
173174
try {
174175
await compilationSucceeded.done();
175176
const callbackId = qs.registerCallback(_res => {
@@ -201,7 +202,7 @@ describe('using the query server', function () {
201202
});
202203

203204
const actualResultSets: ResultSets = {};
204-
it(`should be able to parse results of query ${queryName}`, async function () {
205+
it(`should be able to parse results of query ${queryName}`, async function() {
205206
let fileReader: FileReader | undefined;
206207
try {
207208
await evaluationSucceeded.done();
@@ -222,7 +223,7 @@ describe('using the query server', function () {
222223
}
223224
});
224225

225-
it(`should have correct results for query ${queryName}`, async function () {
226+
it(`should have correct results for query ${queryName}`, async function() {
226227
await parsedResults.done();
227228
expect(actualResultSets!).not.to.be.empty;
228229
expect(Object.keys(actualResultSets!).sort()).to.eql(Object.keys(queryTestCase.expectedResultSets).sort());

0 commit comments

Comments
 (0)