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

Fix build issues for NetBeans Language Server VSCode extension on Windows platform #7709

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions java/java.lsp.server/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
-->
<project basedir="." default="netbeans" name="java/java.lsp.server">
<description>Builds, tests, and runs the project org.netbeans.modules.java.lsp.server</description>
<condition property="cmd.suffix" value=".cmd" else="">
<os family="windows"/>
</condition>
<import file="../../nbbuild/templates/projectized.xml"/>
<target name="proxy-setup" depends="test-init">
<taskdef name="autoupdate" classname="org.netbeans.nbbuild.AutoUpdate" classpath="${nbantext.jar}"/>
Expand Down Expand Up @@ -77,17 +80,17 @@
</condition>
<property name="vsix.version" value="0.1.0"/>

<exec executable="npm" failonerror="true" dir="vscode">
<exec executable="npm${cmd.suffix}" failonerror="true" dir="vscode">
<arg value="--allow-same-version"/>
<arg value="version" />
<arg value="${vsix.version}" />
</exec>

<exec executable="npm" failonerror="true" dir="vscode">
<exec executable="npm${cmd.suffix}" failonerror="true" dir="vscode">
<arg value="install" />
</exec>

<exec executable="npm" failonerror="true" dir="vscode">
<exec executable="npm${cmd.suffix}" failonerror="true" dir="vscode">
<arg value="run" />
<arg value="compile" />
</exec>
Expand All @@ -97,15 +100,15 @@
<copy file="vscode/package.json" todir="${build.dir}/bundles/package" />
<copy file="vscode/package-lock.json" todir="${build.dir}/bundles/package" />

<exec executable="mvn" failonerror="true" dir="${nb_all}/nbbuild/misc/prepare-bundles">
<exec executable="mvn${cmd.suffix}" failonerror="true" dir="${nb_all}/nbbuild/misc/prepare-bundles">
<arg value="package" />
<arg value="exec:java" />
<arg value="-Dexec.mainClass=org.netbeans.prepare.bundles.PrepareBundles" />
<arg value="-Dexec.args=${build.dir}/bundles ${nb_all}" />
</exec>

<mkdir dir="${build.dir}/vsce" />
<exec executable="npm" failonerror="true" dir="${build.dir}/vsce">
<exec executable="npm${cmd.suffix}" failonerror="true" dir="${build.dir}/vsce">
<arg value="install" />
<arg value="--save" />
<arg value="@vscode/vsce@2.19.0" />
Expand Down Expand Up @@ -152,12 +155,12 @@
</target>

<target name="test-vscode-ext" depends="test-lsp-server" description="Tests the Visual Studio Code extension built by 'build-vscode-ext' target.">
<exec executable="npm" failonerror="true" dir="vscode">
<exec executable="npm${cmd.suffix}" failonerror="true" dir="vscode">
<arg value="--allow-same-version"/>
<arg value="run" />
<arg value="test" />
</exec>
<exec executable="npm" failonerror="true" dir="vscode">
<exec executable="npm${cmd.suffix}" failonerror="true" dir="vscode">
<arg value="--allow-same-version"/>
<arg value="run" />
<arg value="apisupport" />
Expand Down
2 changes: 1 addition & 1 deletion java/java.lsp.server/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./; node ./esbuild.js",
"compile": "tsc -p ./ && node ./esbuild.js",
"watch": "tsc -watch -p ./ | node ./esbuild.js --watch",
"test": "node ./out/test/runTest.js",
"nbcode": "node ./out/nbcode.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ public static void main(String... args) throws IOException, InterruptedException

Path targetDir = Paths.get(args[0]);
Path packagesDir = targetDir.resolve("package");
new ProcessBuilder("npm", "install").directory(packagesDir.toFile()).inheritIO().start().waitFor();
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("windows")) {
new ProcessBuilder("npm.cmd", "install").directory(packagesDir.toFile()).inheritIO().start().waitFor();
} else{
new ProcessBuilder("npm", "install").directory(packagesDir.toFile()).inheritIO().start().waitFor();
}
Path bundlesDir = targetDir.resolve("bundles");
Files.createDirectories(bundlesDir);
try (DirectoryStream<Path> ds = Files.newDirectoryStream(bundlesDir)) {
Expand Down
Loading