Skip to content

Commit ab4d288

Browse files
authored
Merge pull request #3457 from 1c-syntax/develop
0.24.2
2 parents 003ccba + 2c84ffc commit ab4d288

File tree

19 files changed

+298
-63
lines changed

19 files changed

+298
-63
lines changed

.github/workflows/qa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- name: Download PR number artifact
1515
if: github.event.workflow_run.event == 'pull_request'
16-
uses: dawidd6/action-download-artifact@v8
16+
uses: dawidd6/action-download-artifact@v9
1717
with:
1818
workflow: ${{ github.event.workflow_run.name }}
1919
run_id: ${{ github.event.workflow_run.id }}

.github/workflows/sentry.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,24 @@ jobs:
2525
- name: Get version from Gradle
2626
id: get_version
2727
run: echo "RELEASE_VERSION=$(./gradlew version -q)" >> $GITHUB_ENV
28+
- name: Get Sentry environment from project version
29+
id: get_env
30+
run: |
31+
if [[ "${{ env.RELEASE_VERSION }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
32+
echo "ENVIRONMENT=production" >> $GITHUB_ENV
33+
elif [[ "${{ env.RELEASE_VERSION }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+-r[ca][0-9]+$ ]]; then
34+
echo "ENVIRONMENT=pre-release" >> $GITHUB_ENV
35+
elif [[ "${{ env.RELEASE_VERSION }}" == develop-* && ! "${{ env.RELEASE_VERSION }}" == *-DIRTY-* ]]; then
36+
echo "ENVIRONMENT=develop" >> $GITHUB_ENV
37+
else
38+
echo "ENVIRONMENT=feature" >> $GITHUB_ENV
39+
fi
2840
- name: Create Sentry release
29-
uses: getsentry/action-release@v1
41+
uses: getsentry/action-release@v3
3042
env:
3143
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
3244
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
3345
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
3446
with:
35-
environment: production
47+
environment: ${{ env.ENVIRONMENT }}
3648
version: ${{ env.RELEASE_VERSION }}

build.gradle.kts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ plugins {
99
jacoco
1010
signing
1111
id("org.cadixdev.licenser") version "0.6.1"
12-
id("org.sonarqube") version "6.0.1.5171"
13-
id("io.freefair.lombok") version "8.12.1"
14-
id("io.freefair.javadoc-links") version "8.12.1"
15-
id("io.freefair.javadoc-utf-8") version "8.12.1"
16-
id("io.freefair.aspectj.post-compile-weaving") version "8.12.1"
17-
id("io.freefair.maven-central.validate-poms") version "8.12.1"
12+
id("org.sonarqube") version "6.1.0.5360"
13+
id("io.freefair.lombok") version "8.13.1"
14+
id("io.freefair.javadoc-links") version "8.13.1"
15+
id("io.freefair.javadoc-utf-8") version "8.13.1"
16+
id("io.freefair.aspectj.post-compile-weaving") version "8.13.1"
17+
id("io.freefair.maven-central.validate-poms") version "8.13.1"
1818
id("me.qoomon.git-versioning") version "6.4.4"
1919
id("com.github.ben-manes.versions") version "0.52.0"
20-
id("org.springframework.boot") version "3.4.3"
20+
id("org.springframework.boot") version "3.4.4"
2121
id("io.spring.dependency-management") version "1.1.7"
22-
id("io.sentry.jvm.gradle") version "5.2.0"
22+
id("io.sentry.jvm.gradle") version "5.3.0"
2323
id("io.github.1c-syntax.bslls-dev-tools") version "0.8.1"
2424
id("ru.vyarus.pom") version "3.0.0"
25-
id("com.gorylenko.gradle-git-properties") version "2.4.2"
25+
id("com.gorylenko.gradle-git-properties") version "2.5.0"
2626
id("io.codearte.nexus-staging") version "0.30.0"
2727
id("me.champeau.jmh") version "0.7.3"
2828
}
@@ -68,8 +68,12 @@ dependencies {
6868
api("org.springframework.boot:spring-boot-starter")
6969
api("org.springframework.boot:spring-boot-starter-websocket")
7070
api("org.springframework.boot:spring-boot-starter-cache")
71+
7172
api("info.picocli:picocli-spring-boot-starter:4.7.6")
7273

74+
// кэширование
75+
api("com.github.ben-manes.caffeine", "caffeine", "3.2.0")
76+
7377
// lsp4j core
7478
api("org.eclipse.lsp4j", "org.eclipse.lsp4j", "0.24.0")
7579
api("org.eclipse.lsp4j", "org.eclipse.lsp4j.websocket.jakarta", "0.24.0")
@@ -128,7 +132,7 @@ dependencies {
128132
}
129133

130134
// COMPILE
131-
compileOnly("com.github.spotbugs:spotbugs-annotations:4.9.1")
135+
compileOnly("com.github.spotbugs:spotbugs-annotations:4.9.3")
132136

133137
// TEST
134138

docs/diagnostics/AllFunctionPathMustHaveReturn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
### Неправильно
1414

1515
```bsl
16-
// если ставка заполнена, но не НДС10 и не НДС10 - вернется Неопределено
16+
// если ставка заполнена, но не равна НДС20 и не равна НДС10 - вернется Неопределено
1717
// это может быть, как запланированное поведение,
1818
// так и ошибка проверки прочих вариантов.
1919
Функция ОпределитьСтавкуНДС(Знач Ставка)

gradle/wrapper/gradle-wrapper.jar

122 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ fi
205205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206206

207207
# Collect all arguments for the java command:
208-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209209
# and any embedded shellness will be escaped.
210210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211211
# treated as '${Hostname}' itself on the command line.

src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLSBinding.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.springframework.boot.WebApplicationType;
3232
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
3333
import org.springframework.boot.builder.SpringApplicationBuilder;
34+
import org.springframework.cache.annotation.EnableCaching;
3435
import org.springframework.context.ConfigurableApplicationContext;
3536
import org.springframework.context.annotation.ComponentScan;
3637
import org.springframework.core.io.DefaultResourceLoader;
@@ -40,6 +41,7 @@
4041

4142
@EnableAutoConfiguration
4243
@ComponentScan("com.github._1c_syntax.bsl.languageserver")
44+
@EnableCaching(proxyTargetClass = true)
4345
public class BSLLSBinding {
4446

4547
@Getter(lazy = true, value = AccessLevel.PRIVATE)
@@ -74,17 +76,22 @@ public static ServerContext getServerContext() {
7476
}
7577

7678
private static SpringApplication createApplication() {
77-
return new SpringApplicationBuilder(BSLLSBinding.class)
79+
var app = new SpringApplicationBuilder(BSLLSBinding.class)
7880
.bannerMode(Banner.Mode.OFF)
7981
.web(WebApplicationType.NONE)
8082
.logStartupInfo(false)
8183
.resourceLoader(new DefaultResourceLoader(BSLLSBinding.class.getClassLoader()))
8284
.lazyInitialization(true)
8385
.properties(Map.of(
8486
"app.command.line.runner.enabled", "false",
85-
"app.scheduling.enabled", "false"
87+
"app.scheduling.enabled", "false",
88+
"spring.cache.caffeine.spec", "maximumSize=500,expireAfterAccess=600s",
89+
"spring.cache.cache-names", "testIds,testSources"
8690
))
8791
.build();
92+
93+
app.setRegisterShutdownHook(false);
94+
return app;
8895
}
8996

9097
private static ConfigurableApplicationContext createContext() {

src/main/java/com/github/_1c_syntax/bsl/languageserver/ParentProcessWatcher.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public void watch() {
7070
.orElse(false);
7171

7272
if (!processIsAlive) {
73-
LOGGER.info("Parent process with pid {} is not found. Closing application...", parentProcessId);
73+
//noinspection StringConcatenationArgumentToLogCall - форматирование через {} не работает из-за NoClassDefException
74+
LOGGER.info("Parent process with pid " + parentProcessId + " is not found. Closing application...");
7475
languageServer.exit();
7576
}
7677
}

src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import jakarta.annotation.PostConstruct;
2929
import lombok.RequiredArgsConstructor;
3030
import org.eclipse.lsp4j.ServerInfo;
31+
import org.jetbrains.annotations.NotNull;
3132
import org.springframework.beans.factory.annotation.Value;
3233
import org.springframework.stereotype.Component;
3334

@@ -50,16 +51,13 @@ public class SentryScopeConfigurer {
5051
@Value("${sentry.dsn:}")
5152
private final String dsn;
5253

53-
@Value("${sentry.environment:dummy}")
54-
private final String environment;
55-
5654
@PostConstruct
5755
public void init() {
5856
if (dsn != null && !dsn.isEmpty()) {
5957
Sentry.init(options -> {
6058
options.setDsn(dsn);
61-
options.setEnvironment(environment);
62-
options.setRelease(serverInfo.getVersion());
59+
options.setEnvironment(getEnvironment());
60+
options.setRelease(getVersion());
6361
options.setAttachServerName(false);
6462
options.setServerName(getServerName());
6563
options.setBeforeSend(beforeSendCallback);
@@ -74,6 +72,26 @@ public void init() {
7472
});
7573
}
7674

75+
private String getEnvironment() {
76+
String version = getVersion();
77+
String environment;
78+
79+
if (version.matches("\\d+\\.\\d+\\.\\d+")) {
80+
environment = "production";
81+
} else if (version.matches("\\d+\\.\\d+\\.\\d+-r[ca]\\d+")) {
82+
environment = "pre-release";
83+
} else if (version.startsWith("develop-") && !version.contains("-DIRTY-")) {
84+
environment = "develop";
85+
} else {
86+
environment = "feature";
87+
}
88+
return environment;
89+
}
90+
91+
private String getVersion() {
92+
return serverInfo.getVersion();
93+
}
94+
7795
@Nullable
7896
private String getServerName() {
7997
try {

src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/CfgBuildingParseTreeVisitor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ public ParseTree visitIfStatement(BSLParser.IfStatementContext ctx) {
114114

115115
// тело true
116116
blocks.enterBlock();
117-
ctx.ifBranch().codeBlock().accept(this);
117+
if (ctx.ifBranch().codeBlock() != null) {
118+
ctx.ifBranch().codeBlock().accept(this);
119+
}
118120
var truePart = blocks.leaveBlock();
119121

120122
graph.addEdge(conditionStatement, truePart.begin(), CfgEdgeType.TRUE_BRANCH);

src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CacheConfiguration.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
*/
2222
package com.github._1c_syntax.bsl.languageserver.infrastructure;
2323

24+
import com.github.benmanes.caffeine.cache.Caffeine;
25+
import org.springframework.cache.CacheManager;
2426
import org.springframework.cache.annotation.EnableCaching;
27+
import org.springframework.cache.caffeine.CaffeineCacheManager;
28+
import org.springframework.context.annotation.Bean;
2529
import org.springframework.context.annotation.Configuration;
2630

2731
/**
@@ -30,4 +34,15 @@
3034
@Configuration
3135
@EnableCaching
3236
public class CacheConfiguration {
37+
@Bean
38+
public CacheManager cacheManager(Caffeine<Object, Object> caffeine) {
39+
var caffeineCacheManager = new CaffeineCacheManager();
40+
caffeineCacheManager.setCaffeine(caffeine);
41+
return caffeineCacheManager;
42+
}
43+
44+
@Bean
45+
public Caffeine<Object, Object> caffeineConfig() {
46+
return Caffeine.newBuilder();
47+
}
3348
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* This file is a part of BSL Language Server.
3+
*
4+
* Copyright (c) 2018-2025
5+
* Alexey Sosnoviy <labotamy@gmail.com>, Nikita Fedkin <nixel2007@gmail.com> and contributors
6+
*
7+
* SPDX-License-Identifier: LGPL-3.0-or-later
8+
*
9+
* BSL Language Server is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU Lesser General Public
11+
* License as published by the Free Software Foundation; either
12+
* version 3.0 of the License, or (at your option) any later version.
13+
*
14+
* BSL Language Server is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
* Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public
20+
* License along with BSL Language Server.
21+
*/
22+
package com.github._1c_syntax.bsl.languageserver.utils.expressiontree;
23+
24+
import lombok.EqualsAndHashCode;
25+
import lombok.ToString;
26+
import lombok.Value;
27+
import lombok.experimental.NonFinal;
28+
import org.antlr.v4.runtime.tree.ParseTree;
29+
30+
@Value
31+
@NonFinal
32+
@EqualsAndHashCode(callSuper = true)
33+
@ToString(callSuper = true)
34+
public class ErrorExpressionNode extends BslExpression {
35+
36+
protected ErrorExpressionNode() {
37+
super(ExpressionNodeType.ERROR);
38+
}
39+
40+
protected ErrorExpressionNode(ParseTree sourceCodeOperator) {
41+
super(ExpressionNodeType.ERROR, sourceCodeOperator, null);
42+
}
43+
44+
}

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionNodeType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ public enum ExpressionNodeType {
2828
UNARY_OP,
2929
CALL,
3030
TERNARY_OP,
31-
SKIPPED_CALL_ARG
31+
SKIPPED_CALL_ARG,
32+
ERROR
3233
}

0 commit comments

Comments
 (0)