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

Test on Java 15 #752

Merged
merged 14 commits into from
Oct 12, 2020
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Java 8
with:
fetch-depth: 0 # required by sonarqube
- name: Use Java 11
uses: actions/setup-java@v1
with:
java-version: "8"
java-version: "11"
architecture: x64
- name: Use Node 12.16.2
uses: actions/setup-node@v1
Expand Down Expand Up @@ -75,7 +77,7 @@ jobs:
strategy:
matrix:
node-version: [12.16.2]
java-version: ["8", "11"]
java-version: ["8", "11", "15"]
os: [ubuntu-latest, windows-latest]
# os: [ubuntu-latest, windows-latest, macos-latest]
steps:
Expand Down
2 changes: 1 addition & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@
"lint:fix": "npm run lint:fix:prettier && npm run lint:eslint -- --fix",
"lint:fix:prettier": "prettier --write '**/*.{ts,js,json,svg,md,yml}'",
"compile": "rollup -c rollup.config.js",
"compile:test": "tsc -p ./",
"compile:test": "tsc -p .",
"install:ext": "code --install-extension vscode-gradle-0.0.0.vsix --force",
"preinstall:ext": "vsce package",
"snyk-protect": "snyk protect",
Expand Down
31 changes: 17 additions & 14 deletions extension/src/extension/Extension.ts → extension/src/Extension.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
import * as vscode from 'vscode';
import { logger, LogVerbosity, Logger } from '../logger';
import { Api } from '../api';
import { GradleClient } from '../client';
import { GradleServer } from '../server';
import { Icons } from '../icons';
import { getConfigFocusTaskInExplorer, getConfigIsDebugEnabled } from '../util';
import { logger, LogVerbosity, Logger } from './logger';
import { Api } from './api';
import { GradleClient } from './client';
import { GradleServer } from './server';
import { Icons } from './icons';
import {
GradleDaemonsTreeDataProvider,
PinnedTasksTreeDataProvider,
RecentTasksTreeDataProvider,
GradleTasksTreeDataProvider,
} from '../views';
} from './views';
import {
PinnedTasksStore,
RecentTasksStore,
TaskTerminalsStore,
RootProjectsStore,
} from '../stores';
} from './stores';
import {
GradleTaskProvider,
GradleTaskManager,
GradleTaskDefinition,
} from '../tasks';
} from './tasks';
import {
GRADLE_TASKS_VIEW,
PINNED_TASKS_VIEW,
GRADLE_DAEMONS_VIEW,
RECENT_TASKS_VIEW,
} from '../views/constants';
import { focusTaskInGradleTasksTree } from '../views/viewUtil';
import { FileWatcher } from '../util';
import { COMMAND_RENDER_TASK, COMMAND_REFRESH } from '../commands';
import { Commands } from '../commands/Commands';
} from './views/constants';
import { focusTaskInGradleTasksTree } from './views/viewUtil';
import { COMMAND_RENDER_TASK, COMMAND_REFRESH } from './commands';
import { Commands } from './commands/Commands';
import {
getConfigIsDebugEnabled,
getConfigFocusTaskInExplorer,
} from './util/config';
import { FileWatcher } from './util/FileWatcher';

export class Extension {
private readonly client: GradleClient;
Expand Down
4 changes: 2 additions & 2 deletions extension/src/client/GradleClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ import {

import { GradleClient as GrpcClient } from '../proto/gradle_grpc_pb';
import { logger, LoggerStream, LogVerbosity, Logger } from '../logger';
import { EventWaiter } from '../util';
import { GradleServer } from '../server';
import { ProgressHandler } from '../progress';
import { getGradleConfig, getConfigJavaDebug } from '../util';
import { removeCancellingTask, restartQueuedTask } from '../tasks/taskUtil';
import {
COMMAND_REFRESH_DAEMON_STATUS,
Expand All @@ -38,6 +36,8 @@ import {
} from '../commands';
import { RootProject } from '../rootProject/RootProject';
import { getBuildCancellationKey } from './CancellationKeys';
import { EventWaiter } from '../util/EventWaiter';
import { getGradleConfig, getConfigJavaDebug } from '../util/config';

function logBuildEnvironment(environment: Environment): void {
const javaEnv = environment.getJavaEnvironment()!;
Expand Down
1 change: 0 additions & 1 deletion extension/src/extension/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion extension/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from 'vscode';

import { Api } from './api';
import { Extension } from './extension';
import { Extension } from './Extension';

export function activate(context: vscode.ExtensionContext): Api {
return new Extension(context).getApi();
Expand Down
2 changes: 1 addition & 1 deletion extension/src/rootProject/RootProject.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import { Environment } from '../proto/gradle_pb';
import { JavaDebug } from '../util';
import { JavaDebug } from '../util/config';

export class RootProject {
private environment?: Environment;
Expand Down
2 changes: 1 addition & 1 deletion extension/src/server/serverUtil.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getConfigGradleJavaHome } from '../util';
import { getConfigGradleJavaHome } from '../util/config';

export function getGradleServerCommand(): string {
const platform = process.platform;
Expand Down
2 changes: 1 addition & 1 deletion extension/src/stores/EventedStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { debounce } from '../util';
import { debounce } from '../util/decorators';

export abstract class EventedStore<V> implements vscode.Disposable {
private readonly _onDidChange: vscode.EventEmitter<V | null> = new vscode.EventEmitter<
Expand Down
2 changes: 1 addition & 1 deletion extension/src/stores/RootProjectsStore.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import * as path from 'path';
import { getNestedProjectsConfig, getConfigJavaDebug } from '../util';
import { getNestedProjectsConfig, getConfigJavaDebug } from '../util/config';
import { StoreMap } from '.';
import { isGradleRootProject } from '../util';
import { RootProject } from '../rootProject/RootProject';
Expand Down
4 changes: 2 additions & 2 deletions extension/src/tasks/GradleTaskProvider.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as vscode from 'vscode';
import { EventWaiter } from '../util';
import { GradleTaskDefinition } from '.';
import { logger } from '../logger';
import { createTaskFromDefinition, loadTasksForProjectRoots } from './taskUtil';
import { TaskId } from '../stores/types';
import { RootProjectsStore, TaskTerminalsStore } from '../stores';
import { RootProject } from '../rootProject/RootProject';
import { getConfigJavaDebug, getConfigReuseTerminals } from '../util';
import { GradleClient } from '../client';
import { getConfigJavaDebug, getConfigReuseTerminals } from '../util/config';
import { EventWaiter } from '../util/EventWaiter';

export class GradleTaskProvider
implements vscode.TaskProvider, vscode.Disposable {
Expand Down
12 changes: 6 additions & 6 deletions extension/src/tasks/taskUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import { TaskArgs } from '../stores/types';
import { GradleTaskDefinition } from '.';
import { GradleRunnerTerminal } from '../terminal';
import { logger } from '../logger';
import {
getGradleConfig,
getConfigIsAutoDetectionEnabled,
getConfigReuseTerminals,
ReuseTerminalsValue,
} from '../util';
import {
getJavaLanguageSupportExtension,
getJavaDebuggerExtension,
Expand All @@ -25,6 +19,12 @@ import { RootProject } from '../rootProject/RootProject';
import { getRunTaskCommandCancellationKey } from '../client/CancellationKeys';
import { GradleClient } from '../client';
import { RootProjectsStore, TaskTerminalsStore } from '../stores';
import {
ReuseTerminalsValue,
getConfigReuseTerminals,
getGradleConfig,
getConfigIsAutoDetectionEnabled,
} from '../util/config';

const cancellingTasks: Map<string, vscode.Task> = new Map();
const restartingTasks: Map<string, vscode.Task> = new Map();
Expand Down
15 changes: 10 additions & 5 deletions extension/src/test/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as os from 'os';
import * as fs from 'fs-extra';

import { runTests, downloadAndUnzipVSCode } from 'vscode-test';
import { VSCODE_TEST_VERSION } from './vscode-version';
import { VSCODE_TEST_VERSIONS } from './vscode-version';

const extensionDevelopmentPath = path.resolve(__dirname, '../../');

Expand Down Expand Up @@ -171,15 +171,14 @@ function runTestsWithMultiProject(
});
}

async function main(): Promise<void> {
async function runTestsForVsCodeVersion(version: string): Promise<void> {
console.log(`Running tests for VsCode version: ${version}`);
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-user'));
fs.copySync(
path.resolve(__dirname, '../../test-fixtures/vscode-user/User'),
path.join(tmpDir, 'User')
);
const vscodeExecutablePath = await downloadAndUnzipVSCode(
VSCODE_TEST_VERSION
);
const vscodeExecutablePath = await downloadAndUnzipVSCode(version);

let hasErr = false;

Expand All @@ -202,6 +201,12 @@ async function main(): Promise<void> {
}
}

async function main(): Promise<void> {
for (const version of VSCODE_TEST_VERSIONS) {
await runTestsForVsCodeVersion(version);
}
}

main().then(
() => {
console.log('Finished running tests');
Expand Down
2 changes: 1 addition & 1 deletion extension/src/test/vscode-version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VSCODE_TEST_VERSION = '1.50.0';
export const VSCODE_TEST_VERSIONS = ['1.45.0'];
8 changes: 0 additions & 8 deletions extension/src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,3 @@ export function isWorkspaceFolder(
): value is vscode.WorkspaceFolder {
return value && typeof value !== 'number';
}

export * from './compat';
export * from './config';
export * from './decorators';
export * from './Deferred';
export * from './EventWaiter';
export * from './input';
export * from './FileWatcher';
2 changes: 1 addition & 1 deletion extension/src/util/input.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as vscode from 'vscode';
import { TaskArgs } from '../stores/types';
import { getDisableConfirmations } from '../util';
import { RootProject } from '../rootProject/RootProject';
import { RootProjectsStore } from '../stores';
import { getDisableConfirmations } from './config';

function returnTrimmedInput(value: string | undefined): string | undefined {
if (value !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as vscode from 'vscode';
import { GradleDaemonTreeItem } from '.';
import { Deferred } from '../../util';
import { RootProjectsStore } from '../../stores';
import { GradleClient } from '../../client';
import { Deferred } from '../../util/Deferred';

export class GradleDaemonsTreeDataProvider
implements vscode.TreeDataProvider<vscode.TreeItem> {
Expand Down
2 changes: 1 addition & 1 deletion extension/src/views/gradleTasks/GradleTaskTreeItem.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import { JavaDebug } from '../../util';
import { Icons } from '../../icons';
import { JavaDebug } from '../../util/config';
import { TASK_STATE_RUNNING_REGEX } from '../constants';
import { getTreeItemState } from '../viewUtil';

Expand Down
2 changes: 1 addition & 1 deletion extension/src/views/recentTasks/RecentTaskTreeItem.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as vscode from 'vscode';
import { GradleTaskTreeItem } from '..';
import { JavaDebug } from '../../util';
import { Icons } from '../../icons';
import { TaskTerminalsStore } from '../../stores';
import { GradleTaskDefinition } from '../../tasks';
import { JavaDebug } from '../../util/config';
import { getTreeItemState } from '../viewUtil';

function getRecentTaskTreeItemState(
Expand Down
2 changes: 1 addition & 1 deletion extension/src/views/viewUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from './constants';
import { GradleTaskDefinition } from '../tasks';
import { logger } from '../logger';
import { JavaDebug } from '../util';
import { TaskArgs } from '../stores/types';
import { isTaskCancelling, isTaskRunning } from '../tasks/taskUtil';
import {
Expand All @@ -21,6 +20,7 @@ import {
PinnedTasksTreeDataProvider,
RecentTasksTreeDataProvider,
} from '.';
import { JavaDebug } from '../util/config';

export function treeItemSortCompareFunc(
a: vscode.TreeItem,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 2 additions & 1 deletion extension/test-fixtures/vscode-user/User/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"update.mode": "none"
"update.mode": "none",
"window.restoreWindows": "none"
}
14 changes: 8 additions & 6 deletions gradle-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@ plugins {

description = 'vscode-gradle :: gradle-server'

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

dependencies {
compile "org.gradle:gradle-tooling-api:${gradlingToolingApi}"
compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
implementation "org.gradle:gradle-tooling-api:${gradlingToolingApi}"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
runtimeOnly "io.grpc:grpc-netty:${grpcVersion}"
runtimeOnly 'org.slf4j:slf4j-simple:2.0.0-alpha1'
testImplementation "io.grpc:grpc-testing:${grpcVersion}"
testImplementation 'junit:junit:4.13'
testCompile 'org.powermock:powermock-module-junit4:2.0.7'
testCompile 'org.powermock:powermock-api-mockito2:2.0.7'
testImplementation 'org.powermock:powermock-module-junit4:2.0.7'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.7'
}

def mainJavaDir = 'src/main/java';
Expand Down
2 changes: 1 addition & 1 deletion npm-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"npm": "^6.10.3"
},
"scripts": {
"compile": "tsc -p ./"
"compile": "tsc -p ."
},
"dependencies": {
"@grpc/grpc-js": "^1.1.7",
Expand Down