-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from Strumenta/windows-fixes
Windows fixes
- Loading branch information
Showing
1 changed file
with
10 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,9 @@ class LanguageServerPlugin : Plugin<Project?> { | |
} | ||
} | ||
|
||
fun isWindows(): Boolean { | ||
return System.getProperty("os.name").toLowerCase().contains("win") | ||
} | ||
private fun createVscodeExtension(project: Project) { | ||
val shadowJar = project.tasks.getByName("shadowJar") as ShadowJar | ||
val entryPoint = shadowJar.manifest.attributes["Main-Class"] as String | ||
|
@@ -199,7 +202,7 @@ class LanguageServerPlugin : Plugin<Project?> { | |
Files.writeString( | ||
Paths.get(configuration.outputPath.toString(), "client.js"), | ||
""" | ||
let {LanguageClient} = require("../node_modules/vscode-languageclient/node"); | ||
let {LanguageClient} = require("./node_modules/vscode-languageclient/node"); | ||
async function activate (context) | ||
{ | ||
|
@@ -218,8 +221,11 @@ class LanguageServerPlugin : Plugin<Project?> { | |
|
||
Files.copy(configuration.serverJarPath, Paths.get(configuration.outputPath.toString(), "server.jar"), StandardCopyOption.REPLACE_EXISTING) | ||
|
||
ProcessBuilder("npm", "install", "--prefix", "build", "vscode-languageclient").directory(project.projectDir).start().waitFor() | ||
ProcessBuilder("npx", "esbuild", "build/vscode/client.js", "--bundle", "--external:vscode", "--format=cjs", "--platform=node", "--outfile=build/vscode/client.js", "--allow-overwrite").directory(project.projectDir).start().waitFor() | ||
val npm = if(isWindows()) "npm.cmd" else "npm" | ||
val npx = if(isWindows()) "npx.cmd" else "npx" | ||
|
||
ProcessBuilder(npm, "install", "--prefix", "build/vscode/", "vscode-languageclient").directory(project.projectDir).start().waitFor() | ||
ProcessBuilder(npx, "esbuild", "build/vscode/client.js", "--bundle", "--external:vscode", "--format=cjs", "--platform=node", "--outfile=build/vscode/client.js", "--allow-overwrite").directory(project.projectDir).start().waitFor() | ||
|
||
if (Files.exists(configuration.textmateGrammarPath)) { | ||
Files.copy(configuration.textmateGrammarPath, Paths.get(configuration.outputPath.toString(), "grammar.tmLanguage"), StandardCopyOption.REPLACE_EXISTING) | ||
|
@@ -241,6 +247,6 @@ class LanguageServerPlugin : Plugin<Project?> { | |
ProcessBuilder("curl", "https://repo1.maven.org/maven2/org/apache/lucene/lucene-core/9.8.0/lucene-core-9.8.0.jar", "-o", Paths.get(configuration.outputPath.toString(), "lucene-core-9.8.0.jar").toString()).start().waitFor() | ||
ProcessBuilder("curl", "https://repo1.maven.org/maven2/org/apache/lucene/lucene-codecs/9.8.0/lucene-codecs-9.8.0.jar", "-o", Paths.get(configuration.outputPath.toString(), "lucene-codecs-9.8.0.jar").toString()).start().waitFor() | ||
|
||
ProcessBuilder("npx", "[email protected]", "package").directory(configuration.outputPath.toFile()).start().waitFor() | ||
ProcessBuilder(npx, "[email protected]", "package").directory(configuration.outputPath.toFile()).start().waitFor() | ||
} | ||
} |