Skip to content

Commit

Permalink
Fixes gradle running and the java build file.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThadHouse committed Mar 21, 2018
1 parent b9a8480 commit 9ccc6cf
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 193 deletions.
2 changes: 1 addition & 1 deletion vscode-wpilib-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vscode-wpilib-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-wpilib-core",
"displayName": "vscode-wpilib-core",
"description": "Base extension for WPILib Team Use",
"version": "0.0.24",
"version": "0.0.25",
"publisher": "wpifirst",
"engines": {
"vscode": "^1.20.0"
Expand Down
4 changes: 3 additions & 1 deletion vscode-wpilib-java/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ src/**
.gitignore
tsconfig.json
vsc-extension-quickstart.md
tslint.json
tslint.json
resources/gradlebase/bin/**
resources/gradlebase/.project
2 changes: 1 addition & 1 deletion vscode-wpilib-java/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vscode-wpilib-java/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-wpilib-java",
"displayName": "vscode-wpilib-java",
"description": "Vscode for WPILib Java",
"version": "0.0.11",
"version": "0.0.12",
"publisher": "wpifirst",
"engines": {
"vscode": "^1.20.0"
Expand Down
2 changes: 1 addition & 1 deletion vscode-wpilib-java/resources/gradlebase/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

def TEAM = 5333
def ROBOT_CLASS = "Robot"
def ROBOT_CLASS = "frc.robot.Robot"

if (project.hasProperty('teamNumber')) {
TEAM = teamNumber.toInteger()
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 1 addition & 9 deletions vscode-wpilib-java/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,14 @@ export async function activate(context: vscode.ExtensionContext) {

let allowDebug = true;

const promises = [];

const javaExtension = vscode.extensions.getExtension('vscjava.vscode-java-debug');
if (javaExtension === undefined) {
vscode.window.showInformationMessage('Could not find java extension. Debugging is disabled.');
allowDebug = false;
} else if (!javaExtension.isActive) {
promises.push(javaExtension.activate());
}

if (!coreExtension.isActive) {
promises.push(coreExtension.activate());
}

if (promises.length > 0) {
await Promise.all(promises);
await coreExtension.activate();
}

const coreExports: IExternalAPI = coreExtension.exports;
Expand Down
55 changes: 29 additions & 26 deletions vscode-wpilib-java/src/gradle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,41 @@ import * as vscode from 'vscode';
import * as child_process from 'child_process';

export interface OutputPair {
stdout: string;
stderr: string;
stdout: string;
stderr: string;
}

export function executeCommandAsync(command: string, rootDir: string, ow?: vscode.OutputChannel) : Promise<OutputPair> {
return new Promise(function (resolve, reject) {
const exec = child_process.exec;
const child = exec(command, {
cwd: rootDir
}, (err, stdout, stderr) => {
if (err) {
reject(err);
} else {
resolve({stdout: stdout, stderr: stderr});
}
});
export function executeCommandAsync(command: string, rootDir: string, ow?: vscode.OutputChannel): Promise<OutputPair> {
return new Promise(function (resolve, reject) {
const exec = child_process.exec;
const child = exec(command, {
cwd: rootDir
}, (err, stdout, stderr) => {
if (err) {
reject(err);
} else {
resolve({ stdout: stdout, stderr: stderr });
}
});

if (ow === undefined) {
return;
}
if (ow === undefined) {
return;
}

child.stdout.on('data', (data) => {
ow.append(data.toString());
});
child.stdout.on('data', (data) => {
ow.append(data.toString());
});

child.stderr.on('data', (data) => {
ow.append(data.toString());
});
});
child.stderr.on('data', (data) => {
ow.append(data.toString());
});
});
}

export async function gradleRun(args: string, rootDir: string, ow?: vscode.OutputChannel): Promise<OutputPair> {
const command = 'gradlew ' + args;
return await executeCommandAsync(command, rootDir, ow);
let command = 'gradlew ' + args;
if (process.platform !== 'win32') {
command = './' + command;
}
return await executeCommandAsync(command, rootDir, ow);
}

0 comments on commit 9ccc6cf

Please sign in to comment.