From fb90c45b7f6eaee6f6877dcee5dd597ae650277f Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Thu, 30 Nov 2023 16:37:03 +0100 Subject: [PATCH] Making sure tests can be run and pass, on Linux and Mac OS/X --- .github/workflows/main.yml | 9 ++++- BUILD.md | 19 ++------- build.xml | 52 ++++++++++++++++++------- patches/6771.diff | 13 +++++++ vscode/src/test/suite/extension.test.ts | 5 +++ 5 files changed, 69 insertions(+), 29 deletions(-) create mode 100644 patches/6771.diff diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3a3966526b71..a46c6607aa28 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,12 +37,13 @@ jobs: # artifact is only produced once in the matrix base-build: name: Base Build - runs-on: ubuntu-latest timeout-minutes: 60 strategy: matrix: java: [ '17' ] + os: [ ubuntu-latest ] fail-fast: false + runs-on: ${{ matrix.os }} steps: - name: Set up JDK ${{ matrix.java }} @@ -71,3 +72,9 @@ jobs: - name: Build the Visual Studio Extension run: ant build-vscode-ext + + - name: Install virtual X server + run: sudo apt install -y xvfb + + - name: Basic tests for the Visual Studio Extension + run: xvfb-run -a ant test-vscode-ext diff --git a/BUILD.md b/BUILD.md index 3ff1821f1726..b9528c329cbd 100644 --- a/BUILD.md +++ b/BUILD.md @@ -40,23 +40,12 @@ $ git clone https://github.com/apache/netbeans.git $ cd netbeans/ $ git checkout f48f91e6c197d8a40bd82fc2f2d12a4e71242afe $ cd .. -# see below for Mac OS specific instruction +# the following target requires git executable to be on PATH: $ ant apply-patches $ ant build-netbeans ``` -*Note for Mac OS* - -"apply-patches" task does not work properly on Mac OS. On Mac OS, -NetBeans patches can be applied using the following commands: - -```bash -$ cd netbeans/ -$ git apply ../patches/* - -``` - ## Building VS Code extension To build the VS Code extension invoke: @@ -97,14 +86,14 @@ that there are VS Code integration tests - those launch VS Code with the VS extension and check behavior of the TypeScript integration code: ```bash -java.lsp.server$ ant build-vscode-ext # first and then -java.lsp.server$ ant test-vscode-ext +$ ant build-vscode-ext # first and then +$ ant test-vscode-ext ``` In case you are behind a proxy, you may want to run the tests with ```bash -java.lsp.server$ npm_config_https_proxy=http://your.proxy.com:port ant test-vscode-ext +$ npm_config_https_proxy=http://your.proxy.com:port ant test-vscode-ext ``` when executing the tests for the first time. That shall overcome the proxy diff --git a/build.xml b/build.xml index 4dc1b35aa7b1..174c2cb120bc 100644 --- a/build.xml +++ b/build.xml @@ -31,6 +31,7 @@ + @@ -141,7 +142,11 @@ - + + + + + @@ -168,21 +173,42 @@ - - - - - - + + + + + + - - - - - - + + + import java.util.Arrays; + import java.util.Collections; + import java.util.List; + import java.util.stream.Collectors; + public class Reverse { + public static void main(String[] args) { + List<String> patches = Arrays.asList(args[0].split(" ")); + Collections.reverse(patches); + System.out.print(patches.stream().collect(Collectors.joining(" "))); + } + } + + + + + ${reverse.patches} + + + + + + + diff --git a/patches/6771.diff b/patches/6771.diff new file mode 100644 index 000000000000..6e543d73eeb9 --- /dev/null +++ b/patches/6771.diff @@ -0,0 +1,13 @@ +diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/SurroundWithHint.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/SurroundWithHint.java +index d893783f6995..3f90097b6053 100644 +--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/SurroundWithHint.java ++++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/SurroundWithHint.java +@@ -80,7 +80,7 @@ + public final class SurroundWithHint extends CodeActionsProvider { + + private static final String COMMAND_INSERT_SNIPPET = "editor.action.insertSnippet"; +- private static final String COMMAND_SURROUND_WITH = "surround.with"; ++ private static final String COMMAND_SURROUND_WITH = "nbls.surround.with"; + private static final String DOTS = "..."; + private static final String SNIPPET = "snippet"; + private static final String SELECTION_VAR = "${selection}"; diff --git a/vscode/src/test/suite/extension.test.ts b/vscode/src/test/suite/extension.test.ts index 50fa02b48178..6ff8bc191f8e 100644 --- a/vscode/src/test/suite/extension.test.ts +++ b/vscode/src/test/suite/extension.test.ts @@ -167,6 +167,11 @@ suite('Extension Test Suite', function () { if (refactorActions && refactorActions.length > 0) { for await (const action of refactorActions) { if (action.command && action.command.arguments) { + if (action.command.command === myExtension.COMMAND_PREFIX + ".surround.with") { + //this action has a popup where the user needs to + //select a template that should be used for the surround: + continue; + } await commands.executeCommand(action.command.command, ...action.command.arguments); await commands.executeCommand('undo'); }