-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Gradle daemon view shows nothing when using local Gradle install…
…ation (#957)
- Loading branch information
Showing
14 changed files
with
241 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
import * as vscode from 'vscode'; | ||
|
||
export function getSpecificVersionStatus(): boolean { | ||
const versionConfig = vscode.workspace | ||
.getConfiguration('java') | ||
.get<string | null>('import.gradle.version'); | ||
const wrapperConfig = vscode.workspace | ||
.getConfiguration('java') | ||
.get<boolean | undefined>('import.gradle.wrapper.enabled'); | ||
return ( | ||
wrapperConfig === false && versionConfig !== null && versionConfig !== '' | ||
); | ||
} |
12 changes: 6 additions & 6 deletions
12
gradle-server/src/main/java/com/github/badsyntax/gradle/DaemonStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
gradle-server/src/main/java/com/github/badsyntax/gradle/GradleExecution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Microsoft Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Microsoft Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package com.github.badsyntax.gradle; | ||
|
||
import com.github.badsyntax.gradle.exceptions.GradleExecutionException; | ||
|
||
public interface GradleExecution { | ||
public String exec(String... args) throws GradleExecutionException; | ||
} |
54 changes: 54 additions & 0 deletions
54
gradle-server/src/main/java/com/github/badsyntax/gradle/GradleLocalInstallation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Microsoft Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Microsoft Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package com.github.badsyntax.gradle; | ||
|
||
import com.github.badsyntax.gradle.exceptions.GradleExecutionException; | ||
import com.github.badsyntax.gradle.exceptions.ProcessException; | ||
import com.github.badsyntax.gradle.process.Process; | ||
import com.github.badsyntax.gradle.process.ProcessOutput; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.stream.Collectors; | ||
|
||
public class GradleLocalInstallation implements GradleExecution { | ||
private File localInstallation; | ||
private static final String GRADLE_EXECUTION_UNIX = "gradle"; | ||
private static final String GRADLE_EXECUTION_WINDOWS = "gradle.bat"; | ||
|
||
public GradleLocalInstallation(File localInstallation) { | ||
this.localInstallation = localInstallation; | ||
} | ||
|
||
public synchronized String exec(String... args) throws GradleExecutionException { | ||
try { | ||
if (args.length == 0) { | ||
throw new GradleExecutionException("No gradle args supplied"); | ||
} | ||
File binFolder = localInstallation.toPath().resolve("bin").toFile(); | ||
Process process = new Process(binFolder); | ||
process.setUnixCommand(GRADLE_EXECUTION_UNIX); | ||
process.setWindowsCommand(GRADLE_EXECUTION_WINDOWS); | ||
process.exec(args); | ||
ProcessOutput processOutput = process.getProcessOutput(); | ||
String stdErrString = processOutput.getStdErr().lines().collect(Collectors.joining("\n")); | ||
String stdOutString = processOutput.getStdOut().lines().collect(Collectors.joining("\n")); | ||
process.close(); | ||
if (stdErrString.length() > 0) { | ||
throw new GradleExecutionException(String.format("Error running gradle: %s", stdErrString)); | ||
} | ||
return stdOutString; | ||
} catch (IOException | ProcessException e) { | ||
throw new GradleExecutionException(String.format("Error running gradle: %s", e.getMessage())); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
gradle-server/src/main/java/com/github/badsyntax/gradle/GradleProjectConnectionType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Microsoft Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Microsoft Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package com.github.badsyntax.gradle; | ||
|
||
public enum GradleProjectConnectionType { | ||
WRAPPER, | ||
SPECIFICVERSION, | ||
LOCALINSTALLATION, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...server/src/main/java/com/github/badsyntax/gradle/exceptions/GradleExecutionException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.github.badsyntax.gradle.exceptions; | ||
|
||
public class GradleExecutionException extends Exception { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public GradleExecutionException(String message) { | ||
super(message); | ||
} | ||
|
||
public GradleExecutionException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
...e-server/src/main/java/com/github/badsyntax/gradle/exceptions/GradleWrapperException.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.