Skip to content

Commit

Permalink
change gradle daemons log method
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiaaming committed May 28, 2024
1 parent 1daab91 commit db0d9c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { GradleExecution } from "./GradleExecution";
import { execAsync } from "../../../util/execAsync";
import { getConfigJavaImportGradleJavaHome } from "../../../util/config";
import * as vscode from "vscode";
import { logger } from "../../../logger";

export class GradleLocalInstallation implements GradleExecution {
private gradleHomePath: string;
private outputChannel: vscode.OutputChannel;

constructor(gradleHomePath: string) {
this.gradleHomePath = gradleHomePath;
}
Expand All @@ -23,8 +23,7 @@ export class GradleLocalInstallation implements GradleExecution {

const { stdout, stderr } = await execAsync(command, { env });
if (stderr) {
this.outputChannel.appendLine(`${stderr}`);
this.outputChannel.show();
logger.warn(stderr);
}
return stdout;
} catch (error) {
Expand Down
9 changes: 2 additions & 7 deletions extension/src/views/gradleDaemons/services/GradleWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ import { execAsync } from "../../../util/execAsync";
import { GradleExecution } from "./GradleExecution";
import * as path from "path";
import { getConfigJavaImportGradleJavaHome } from "../../../util/config";
import * as vscode from "vscode";

import { logger } from "../../../logger";
export class GradleWrapper implements GradleExecution {
private gradleWrapperPath: string;
private outputChannel: vscode.OutputChannel;

constructor(private projectRoot: string) {
const wrapperName = process.platform === "win32" ? "gradlew.bat" : "gradlew";
this.gradleWrapperPath = path.join(projectRoot, wrapperName);
this.outputChannel = vscode.window.createOutputChannel("Gradle Wrapper");
}

public async exec(args: string[]): Promise<string> {
Expand All @@ -24,11 +21,9 @@ export class GradleWrapper implements GradleExecution {
try {
const jdkPath = getConfigJavaImportGradleJavaHome();
const env = jdkPath ? { ...process.env, JAVA_HOME: jdkPath } : process.env;

const { stdout, stderr } = await execAsync(command, { cwd: this.projectRoot, env });
if (stderr) {
this.outputChannel.appendLine(`${stderr}`);
this.outputChannel.show();
logger.warn(stderr);
}
return stdout;
} catch (error) {
Expand Down

0 comments on commit db0d9c3

Please sign in to comment.