diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 00000000..79d97d0d --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: MIT + +name: SonarQube +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 21 + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 + with: + java-version: 21 + distribution: 'zulu' + - name: Cache SonarQube packages + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=bernardladenthin_java-llama.cpp diff --git a/pom.xml b/pom.xml index d34fd107..8385d506 100644 --- a/pom.xml +++ b/pom.xml @@ -49,6 +49,7 @@ SPDX-License-Identifier: MIT + bernardladenthin 5.19.0 1.0.0 1.18.46 diff --git a/src/main/java/net/ladenthin/llama/LlamaModel.java b/src/main/java/net/ladenthin/llama/LlamaModel.java index eacd589d..71ee21c1 100644 --- a/src/main/java/net/ladenthin/llama/LlamaModel.java +++ b/src/main/java/net/ladenthin/llama/LlamaModel.java @@ -158,19 +158,6 @@ public CompletionResult completeWithStats(InferenceParameters parameters) { return completionParser.parseCompletionResult(json); } - /** - * Cancellable variant of {@link #complete(InferenceParameters)}. Runs in streaming mode - * internally so the inference loop can observe a {@link net.ladenthin.llama.callback.CancellationToken#cancel()} call - * from another thread and return early with whatever text was accumulated so far. - *

- * The token is rebound to this call (any prior {@code cancel} state is cleared on entry). - * On return — whether by natural stop or cancellation — the token is unbound. - *

- * - * @param parameters the inference configuration (its {@code stream} flag will be set to true) - * @param token cancellation handle; {@link net.ladenthin.llama.callback.CancellationToken#cancel()} aborts the loop - * @return the text generated up to the point of stop or cancellation - */ /** * Dispatch a list of completion requests in parallel and return the generated texts * in the same order. Each request is sent immediately; the native scheduler dispatches