Skip to content

Commit

Permalink
Merge pull request #3123 from 1c-syntax/develop
Browse files Browse the repository at this point in the history
0.22.0
  • Loading branch information
nixel2007 authored Jul 30, 2023
2 parents fc23d36 + 00d2a4e commit 4709a94
Show file tree
Hide file tree
Showing 64 changed files with 549 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/build-jpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def build_image(base_dir, image_prefix, executable_file):
cmd_args.append('--type')
cmd_args.append('app-image')
cmd_args.append('--java-options')
cmd_args.append('-Xmx2g')
cmd_args.append('-Xmx3g')

cmd = ' '.join(cmd_args)
os.system(cmd)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java_version: ['11', '17', '20']
java_version: ['17', '20']
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ jobs:
distribution: 'temurin'
- name: SonarCloud Scan on PR
if: github.event.workflow_run.event == 'pull_request'
run: ./gradlew check sonarqube -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} -Dsonar.pullrequest.key=${{ fromJson(steps.get_pr_data.outputs.data).number }} -Dsonar.pullrequest.branch=${{ fromJson(steps.get_pr_data.outputs.data).head.ref }} -Dsonar.pullrequest.base=${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}
run: ./gradlew check sonar -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} -Dsonar.pullrequest.key=${{ fromJson(steps.get_pr_data.outputs.data).number }} -Dsonar.pullrequest.branch=${{ fromJson(steps.get_pr_data.outputs.data).head.ref }} -Dsonar.pullrequest.base=${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: SonarCloud Scan on push
if: github.event.workflow_run.event == 'push' && github.event.workflow_run.head_repository.full_name == github.event.repository.full_name
run: ./gradlew check sonarqube -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} -Dsonar.branch.name=${{ github.event.workflow_run.head_branch }}
run: ./gradlew check sonar -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} -Dsonar.branch.name=${{ github.event.workflow_run.head_branch }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2023.1.4
uses: JetBrains/qodana-action@v2023.2.1
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
with:
linter: jetbrains/qodana-jvm-community
- uses: github/codeql-action/upload-sarif@v2
Expand Down
37 changes: 20 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ plugins {
jacoco
signing
id("org.cadixdev.licenser") version "0.6.1"
id("org.sonarqube") version "4.0.0.2929"
id("io.freefair.lombok") version "6.6.1"
id("io.freefair.javadoc-links") version "6.6.1"
id("io.freefair.javadoc-utf-8") version "6.6.1"
id("io.freefair.aspectj.post-compile-weaving") version "6.6.1"
id("io.freefair.maven-central.validate-poms") version "6.6.1"
id("org.sonarqube") version "4.3.0.3225"
id("io.freefair.lombok") version "8.1.0"
id("io.freefair.javadoc-links") version "8.1.0"
id("io.freefair.javadoc-utf-8") version "8.1.0"
id("io.freefair.aspectj.post-compile-weaving") version "8.1.0"
id("io.freefair.maven-central.validate-poms") version "8.1.0"
id("me.qoomon.git-versioning") version "6.4.2"
id("com.github.ben-manes.versions") version "0.47.0"
id("org.springframework.boot") version "2.7.12"
id("io.spring.dependency-management") version "1.1.0"
id("io.github.1c-syntax.bslls-dev-tools") version "0.7.2"
id("org.springframework.boot") version "3.1.2"
id("io.spring.dependency-management") version "1.1.2"
id("io.github.1c-syntax.bslls-dev-tools") version "0.7.3"
id("ru.vyarus.pom") version "2.2.2"
id("com.gorylenko.gradle-git-properties") version "2.4.1"
id("io.codearte.nexus-staging") version "0.30.0"
Expand Down Expand Up @@ -56,7 +56,7 @@ val languageToolVersion = "6.1"

dependencyManagement {
imports {
mavenBom("io.sentry:sentry-bom:6.22.0")
mavenBom("io.sentry:sentry-bom:6.27.0")
}
}

Expand All @@ -71,10 +71,10 @@ dependencies {

// lsp4j core
api("org.eclipse.lsp4j", "org.eclipse.lsp4j", "0.21.0")
api("org.eclipse.lsp4j", "org.eclipse.lsp4j.websocket", "0.21.0")
api("org.eclipse.lsp4j", "org.eclipse.lsp4j.websocket.jakarta", "0.21.0")

// 1c-syntax
api("com.github.1c-syntax", "bsl-parser", "0.22.0") {
api("com.github.1c-syntax", "bsl-parser", "bba7c0b091aca562ec082829a49f525a9bb5d7ef") {
exclude("com.tunnelvisionlabs", "antlr4-annotations")
exclude("com.ibm.icu", "*")
exclude("org.antlr", "ST4")
Expand All @@ -88,7 +88,9 @@ dependencies {
api("io.github.1c-syntax", "supportconf", "0.1.1")

// JLanguageTool
implementation("org.languagetool", "languagetool-core", languageToolVersion)
implementation("org.languagetool", "languagetool-core", languageToolVersion){
exclude("commons-logging", "commons-logging")
}
implementation("org.languagetool", "language-en", languageToolVersion)
implementation("org.languagetool", "language-ru", languageToolVersion)

Expand All @@ -98,7 +100,9 @@ dependencies {
// commons utils
implementation("commons-io", "commons-io", "2.13.0")
implementation("org.apache.commons", "commons-lang3", "3.12.0")
implementation("commons-beanutils", "commons-beanutils", "1.9.4")
implementation("commons-beanutils", "commons-beanutils", "1.9.4"){
exclude("commons-logging", "commons-logging")
}
implementation("org.apache.commons", "commons-collections4", "4.4")
implementation("org.apache.commons", "commons-exec", "1.3")

Expand Down Expand Up @@ -150,8 +154,8 @@ jacoco {
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
Expand Down Expand Up @@ -237,7 +241,6 @@ tasks.generateDiagnosticDocs {
}

tasks.javadoc {
isFailOnError = false
options {
this as StandardJavadocDocletOptions
links(
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing/EnvironmentSetting.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Необходимое ПО

* Java Development Kit 11
* Java Development Kit 17
* [IntelliJ IDEA Community Edition](https://www.jetbrains.com/idea/download/)
* Плагины IntelliJ IDEA
* Lombok Plugin
Expand All @@ -14,7 +14,7 @@

### Настройки IntelliJ IDEA

* Настроить [Java SDK на JDK11](https://www.jetbrains.com/help/idea/sdk.html#manage_sdks)
* Настроить [Java SDK на JDK17](https://www.jetbrains.com/help/idea/sdk.html#manage_sdks)
* Включить обработку аннотаций: `File -> Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors -> Enable annotation processing`
* Выполнить настройки автоимпорта, подробно описано в [статье](https://www.jetbrains.com/help/idea/creating-and-optimizing-imports.html). Отдельно стоит обратить внимание на оптимизацию импорта.
* Не надо запускать оптимизацию импортов всего проекта, за этим следят мейнтейнеры. Если после оптимизации импортов появились измененные файлы, которые не менялись в процессе разработки, стоит уведомить мейнтейнеров и откатить эти изменения.
4 changes: 2 additions & 2 deletions docs/en/contributing/EnvironmentSetting.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Development is underway using [IntelliJ IDEA Community Edition](https://www.jetb

## Required Software

* Java Development Kit 11
* Java Development Kit 17
* [IntelliJ IDEA Community Edition](https://www.jetbrains.com/idea/download/)
* Plugins IntelliJ IDEA
* Lombok Plugin
Expand All @@ -14,7 +14,7 @@ Please note that plugins do not have to be installed - if you have Internet acce

### IntelliJ IDEA Settings

* Configure [Java SDK на JDK11](https://www.jetbrains.com/help/idea/sdk.html#manage_sdks)
* Configure [Java SDK на JDK17](https://www.jetbrains.com/help/idea/sdk.html#manage_sdks)
* Enable annotation processing: `File -> Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors -> Enable annotation processing`
* Configure auto import settings, details in the [article](https://www.jetbrains.com/help/idea/creating-and-optimizing-imports.html). Pay special attention to import optimization.
* There is no need to start optimization of imports of the entire project, this is followed by maintainers. If, after optimizing imports, changed files appeared that did not change during the development process, you should notify the maintainers and roll back these changes.
2 changes: 1 addition & 1 deletion docs/en/systemRequirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Using `BSL Language Server` has some limitations, listed bellow

`BSL Language Server` is a console Java application and requires the presence of a Java virtual machine on the computer.

The minimum supported version is Java 11, but as part of the build pipelines, a health check is performed when using more recent versions. Java versions 11 and 17 are currently supported.
The minimum supported version is Java 17, but as part of the build pipelines, a health check is performed when using more recent versions. Java versions 17 and 20 are currently supported.

JDK vendor is also interesting. Due to the changed licensing policy of Oracle, it is recommended to use open implementations of the `OpenJDK` virtual machine: AdoptOpenJDK, Liberica JDK.

Expand Down
2 changes: 1 addition & 1 deletion docs/systemRequirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

`BSL Language Server` представляет собой консольное Java приложение, соответственно, для его функционирования необходимо наличие виртуальной машины Java на компьютере.

На данный момент минимальной поддерживаемой версией является Java 11, но в рамках сборочных конвейеров происходит проверка работоспособности при использовании более свежих версий. На данный момент поддерживаются Java версий 11 и 17.
На данный момент минимальной поддерживаемой версией является Java 17, но в рамках сборочных конвейеров происходит проверка работоспособности при использовании более свежих версий. На данный момент поддерживаются Java версий 17 и 20.

Кроме версии Java интересен и вендор JDK. В связи с изменившейся политикой лицензирования Oracle, рекомендуется использование открытых реализаций виртуальной машины `OpenJDK`: AdoptOpenJDK, Liberica JDK.

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "1.0"
linter: jetbrains/qodana-jvm-community:2023.1
projectJDK: 17
profile:
name: qodana.starter
include:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.github._1c_syntax.bsl.languageserver.context.DocumentContext;
import com.github._1c_syntax.bsl.languageserver.context.events.ServerContextPopulatedEvent;
import com.github._1c_syntax.bsl.languageserver.providers.DiagnosticProvider;
import com.github._1c_syntax.bsl.languageserver.utils.NamedForkJoinWorkerThreadFactory;
import com.github._1c_syntax.bsl.languageserver.utils.Resources;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
Expand Down Expand Up @@ -63,7 +64,8 @@ public void handleEvent(ServerContextPopulatedEvent event) {
var progress = workDoneProgressHelper.createProgress(documentContexts.size(), getMessage("filesSuffix"));
progress.beginProgress(getMessage("analyzeProject"));

var executorService = new ForkJoinPool(ForkJoinPool.getCommonPoolParallelism());
var factory = new NamedForkJoinWorkerThreadFactory("analyze-on-start-");
var executorService = new ForkJoinPool(ForkJoinPool.getCommonPoolParallelism(), factory, null, true);

try {
executorService.submit(() ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
*/
package com.github._1c_syntax.bsl.languageserver;

import jakarta.annotation.PostConstruct;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.github._1c_syntax.bsl.languageserver.cli.WebsocketCommand;
import com.github._1c_syntax.utils.CaseInsensitivePattern;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
Expand Down Expand Up @@ -71,7 +70,7 @@
havingValue = "true",
matchIfMissing = true)
@RequiredArgsConstructor
public class BSLLSPLauncher implements Callable<Integer>, CommandLineRunner, ExitCodeGenerator {
public class BSLLSPLauncher implements Callable<Integer>, ExitCodeGenerator {

private static final String DEFAULT_COMMAND = "lsp";

Expand Down Expand Up @@ -106,15 +105,17 @@ public static void main(String[] args) {
var applicationContext = new SpringApplicationBuilder(BSLLSPLauncher.class)
.web(getWebApplicationType(args))
.run(args);

var launcher = applicationContext.getBean(BSLLSPLauncher.class);
launcher.run(args);

if (launcher.getExitCode() >= 0) {
System.exit(
SpringApplication.exit(applicationContext)
);
}
}

@Override
public void run(String... args) {
var cmd = new CommandLine(this, picocliFactory);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.github._1c_syntax.bsl.languageserver.jsonrpc.ProtocolExtension;
import com.github._1c_syntax.bsl.languageserver.providers.CommandProvider;
import com.github._1c_syntax.bsl.languageserver.providers.DocumentSymbolProvider;
import com.github._1c_syntax.bsl.languageserver.utils.NamedForkJoinWorkerThreadFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.lsp4j.CallHierarchyRegistrationOptions;
Expand Down Expand Up @@ -72,6 +73,7 @@
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;

@Slf4j
@Component
Expand All @@ -85,6 +87,7 @@ public class BSLLanguageServer implements LanguageServer, ProtocolExtension {
private final ClientCapabilitiesHolder clientCapabilitiesHolder;
private final ServerContext context;
private final ServerInfo serverInfo;

private boolean shutdownWasCalled;

@Override
Expand All @@ -93,7 +96,13 @@ public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
clientCapabilitiesHolder.setCapabilities(params.getCapabilities());

setConfigurationRoot(params);
CompletableFuture.runAsync(context::populateContext);

var factory = new NamedForkJoinWorkerThreadFactory("populate-context-");
var executorService = new ForkJoinPool(ForkJoinPool.getCommonPoolParallelism(), factory, null, true);
CompletableFuture
.runAsync(context::populateContext, executorService)
.thenAccept(unused -> executorService.shutdown())
;

var capabilities = new ServerCapabilities();
capabilities.setTextDocumentSync(getTextDocumentSyncOptions());
Expand Down
Loading

0 comments on commit 4709a94

Please sign in to comment.