Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
22 changes: 15 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ plugins {
id("io.freefair.aspectj.post-compile-weaving") version "9.1.0"
// id("io.freefair.maven-central.validate-poms") version "9.0.0" // TODO: Re-enable when compatible with Gradle 9
id("com.github.ben-manes.versions") version "0.53.0"
id("org.springframework.boot") version "3.5.9"
id("org.springframework.boot") version "4.0.1"
id("io.spring.dependency-management") version "1.1.7"
id("io.sentry.jvm.gradle") version "5.12.2"
id("io.sentry.jvm.gradle") version "6.0.0-rc.1"
id("io.github.1c-syntax.bslls-dev-tools") version "0.8.1"
id("ru.vyarus.pom") version "3.0.0"
id("org.jreleaser") version "1.21.0"
id("org.jreleaser") version "1.22.0"
id("org.sonarqube") version "7.2.2.6593"
id("me.champeau.jmh") version "0.7.3"
id("com.gorylenko.gradle-git-properties") version "2.5.4"
Expand Down Expand Up @@ -61,9 +61,13 @@ gitProperties {
}

val languageToolVersion = "6.7"
val sentryVersion = "8.29.0"

dependencies {

// BOM
// api(platform("io.sentry:sentry-bom:$sentryVersion"))

// RUNTIME

// spring
Expand All @@ -89,7 +93,7 @@ dependencies {
}
api("io.github.1c-syntax", "utils", "0.6.8")
api("io.github.1c-syntax", "mdclasses", "0.17.1")
api("io.github.1c-syntax", "bsl-common-library", "0.9.0")
api("io.github.1c-syntax", "bsl-common-library", "0.9.1")
api("io.github.1c-syntax", "supportconf", "0.15.0")

// nullability annotations
Expand All @@ -113,7 +117,7 @@ dependencies {
}

// AOP
implementation("org.aspectj", "aspectjrt", "1.9.25")
implementation("org.aspectj", "aspectjrt", "1.9.25.1")

// commons utils
implementation("commons-io", "commons-io", "2.21.0")
Expand All @@ -129,8 +133,8 @@ dependencies {
implementation("me.tongfei", "progressbar", "0.10.1")

// (de)serialization
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
implementation("tools.jackson.core:jackson-databind")
implementation("tools.jackson.dataformat:jackson-dataformat-xml")
implementation("io.leangen.geantyref:geantyref:2.0.1")

// graphs
Expand Down Expand Up @@ -269,6 +273,10 @@ jmh {
jmhVersion = "1.37"
}

sentry {
includeSourceContext = true
}

tasks.processResources {
filteringCharset = "UTF-8"
// native2ascii gradle replacement
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-9.2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void tick() {
}

var currentCounter = counter.incrementAndGet();
var message = String.format("%d/%d%s", currentCounter, size, messagePostfix);
var message = "%d/%d%s".formatted(currentCounter, size, messagePostfix);
var percentage = (double) currentCounter / size * 100;

tick(message, (int) percentage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
@NoArgsConstructor
public class MeasuresAspect {

@Setter(onMethod = @__({@Autowired}))
@Setter(onMethod_ ={@Autowired})
private @Nullable MeasureCollector measureCollector;

@PreDestroy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public class SentryAspect {

private ExecutorService executorService;

@Setter(onMethod = @__({@Autowired}))
@Setter(onMethod_ ={@Autowired})
@Nullable
private LanguageClientHolder languageClientHolder;

@Setter(onMethod = @__({@Autowired}))
@Setter(onMethod_ ={@Autowired})
private Resources resources;

@PostConstruct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void printMeasures() {
measures.entrySet().stream()
.map(entry -> Map.entry(entry.getKey(), entry.getValue().stream().mapToLong(value -> value).sum()))
.sorted(Comparator.comparingLong(Map.Entry::getValue))
.map(entry -> String.format("%s - %d", entry.getKey(), entry.getValue()))
.map(entry -> "%s - %d".formatted(entry.getKey(), entry.getValue()))
.forEach(LOGGER::info);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ protected AbstractCfgVisitor(ControlFlowGraph graph) {
* @param v начинает обход с указанной вершины
*/
public void visitVertex(CfgVertex v) {
if (v instanceof BranchingVertex) {
visitSuperclassingVertexType((BranchingVertex) v);
if (v instanceof BranchingVertex vertex) {
visitSuperclassingVertexType(vertex);
return;
}
dispatchVertex(v);
Expand Down Expand Up @@ -226,8 +226,8 @@ protected final void dispatchVertex(CfgVertex v) {
}

private void visitSuperclassingVertexType(BranchingVertex v) {
if (v instanceof LoopVertex) {
visitLoopVertex((LoopVertex) v);
if (v instanceof LoopVertex vertex) {
visitLoopVertex(vertex);
} else {
visitBranchingVertex(v);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public ConditionalVertex(BSLParser.ElsifBranchContext ctx) {
}

public BSLParser.ExpressionContext getExpression() {
if (ast instanceof BSLParser.IfBranchContext) {
return ((BSLParser.IfBranchContext) ast).expression();
} else if (ast instanceof BSLParser.ElsifBranchContext) {
return ((BSLParser.ElsifBranchContext) ast).expression();
if (ast instanceof BSLParser.IfBranchContext context1) {
return context1.expression();
} else if (ast instanceof BSLParser.ElsifBranchContext context) {
return context.expression();
}

throw new IllegalStateException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private List<TextEdit> createInRegionTextEdits(String diagnosticName, Token last
params.getRange().getStart().getLine(),
0
);
TextEdit disableTextEdit = new TextEdit(disableRange, String.format("// BSLLS%s-off%n", diagnosticName));
TextEdit disableTextEdit = new TextEdit(disableRange, "// BSLLS%s-off%n".formatted(diagnosticName));
edits.add(disableTextEdit);

Range enableRange = Ranges.create(
Expand All @@ -197,15 +197,15 @@ private List<TextEdit> createInRegionTextEdits(String diagnosticName, Token last
params.getRange().getEnd().getLine(),
last.getCharPositionInLine() + last.getText().length()
);
TextEdit enableTextEdit = new TextEdit(enableRange, String.format("%n// BSLLS%s-on%n", diagnosticName));
TextEdit enableTextEdit = new TextEdit(enableRange, "%n// BSLLS%s-on%n".formatted(diagnosticName));
edits.add(enableTextEdit);
return edits;
}

private List<TextEdit> createInFileTextEdits(String diagnosticName) {
TextEdit textEdit = new TextEdit(
Ranges.create(0, 0, 0, 0),
String.format("// BSLLS%s-off%n", diagnosticName)
"// BSLLS%s-off%n".formatted(diagnosticName)
);
return Collections.singletonList(textEdit);
}
Expand Down Expand Up @@ -238,7 +238,7 @@ private static List<TextEdit> createInLineTextEdits(String diagnosticName, Token
last.getCharPositionInLine() + last.getText().length()
);

TextEdit textEdit = new TextEdit(range, String.format(" // BSLLS%s-off", diagnosticName));
TextEdit textEdit = new TextEdit(range, " // BSLLS%s-off".formatted(diagnosticName));
return Collections.singletonList(textEdit);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public List<CodeAction> getCodeActions(CodeActionParams params, DocumentContext
separator = ", ";
}

var newText = String.format("%s%s.%s(\"%s\"%s%s);\n", indent, lValueName, insert, key, separator, value);
var newText = "%s%s.%s(\"%s\"%s%s);\n".formatted(indent, lValueName, insert, key, separator, value);
var textEdit = new TextEdit(range, newText);
changes.add(textEdit);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public List<CodeAction> getCodeActions(CodeActionParams params, DocumentContext
regionsLanguage == ScriptVariant.ENGLISH ? "#Region %s%n%n#EndRegion%n" : "#Область %s%n%n#КонецОбласти%n";

String result = neededStandardRegions.stream()
.map(s -> String.format(regionFormat, s))
.map(s -> regionFormat.formatted(s))
.collect(Collectors.joining("\n"));
var textEdit = new TextEdit(calculateFixRange(params.getRange()), result);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

import java.beans.ConstructorProperties;
import java.net.URI;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -115,13 +115,13 @@ public Class<DebugTestCodeLensSupplier.DebugTestCodeLensData> getCodeLensDataCla
@Override
public CodeLens resolve(DocumentContext documentContext, CodeLens unresolved, DebugTestCodeLensData data) {

var path = Paths.get(documentContext.getUri());
var path = Path.of(documentContext.getUri());
var testId = data.getTestId();

var options = configuration.getCodeLensOptions().getTestRunnerAdapterOptions();
var executable = options.getExecutableForCurrentOS();
String runText = executable + " " + options.getDebugTestArguments();
runText = String.format(runText, path, testId);
runText = runText.formatted(path, testId);

var command = new Command();
command.setTitle(resources.getResourceString(getClass(), "title"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -97,12 +97,12 @@ public List<CodeLens> getCodeLenses(DocumentContext documentContext) {
*/
@Override
public CodeLens resolve(DocumentContext documentContext, CodeLens unresolved, DefaultCodeLensData data) {
var path = Paths.get(documentContext.getUri());
var path = Path.of(documentContext.getUri());

var options = configuration.getCodeLensOptions().getTestRunnerAdapterOptions();
var executable = options.getExecutableForCurrentOS();
String runText = executable + " " + options.getRunAllTestsArguments();
runText = String.format(runText, path);
runText = runText.formatted(path);

var command = new Command();
command.setTitle(resources.getResourceString(getClass(), "runAllTests"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

import java.beans.ConstructorProperties;
import java.net.URI;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -112,13 +112,13 @@ public Class<RunTestCodeLensData> getCodeLensDataClass() {
@Override
public CodeLens resolve(DocumentContext documentContext, CodeLens unresolved, RunTestCodeLensData data) {

var path = Paths.get(documentContext.getUri());
var path = Path.of(documentContext.getUri());
var testId = data.getTestId();

var options = configuration.getCodeLensOptions().getTestRunnerAdapterOptions();
var executable = options.getExecutableForCurrentOS();
String runText = executable + " " + options.getRunTestArguments();
runText = String.format(runText, path, testId);
runText = runText.formatted(path, testId);

var command = new Command();
command.setTitle(resources.getResourceString(getClass(), "runTest"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -99,8 +99,8 @@ private List<String> computeTestIdsByTestRunner(DocumentContext documentContext)
var options = configuration.getCodeLensOptions().getTestRunnerAdapterOptions();

var executable = SystemUtils.IS_OS_WINDOWS ? options.getExecutableWin() : options.getExecutable();
var path = Paths.get(documentContext.getUri()).toString();
var arguments = String.format(options.getGetTestsArguments(), path);
var path = Path.of(documentContext.getUri()).toString();
var arguments = options.getGetTestsArguments().formatted(path);

var getTestsCommand = new CommandLine(executable).addArguments(arguments, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.json.JsonMapper;
import tools.jackson.databind.json.JsonMapper;
import com.github._1c_syntax.bsl.languageserver.configuration.capabilities.CapabilitiesOptions;
import com.github._1c_syntax.bsl.languageserver.configuration.codelens.CodeLensOptions;
import com.github._1c_syntax.bsl.languageserver.configuration.diagnostics.DiagnosticsOptions;
Expand Down Expand Up @@ -56,7 +56,7 @@
import java.nio.file.Files;
import java.nio.file.Path;

import static com.fasterxml.jackson.databind.MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS;
import static tools.jackson.databind.MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS;

/**
* Корневой класс конфигурации BSL Language Server.
Expand All @@ -67,7 +67,7 @@
@Data
@Component
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@AllArgsConstructor(onConstructor = @__({@JsonCreator(mode = JsonCreator.Mode.DISABLED)}))
@AllArgsConstructor(onConstructor_ ={@JsonCreator(mode = JsonCreator.Mode.DISABLED)})
@NoArgsConstructor
@Slf4j
@JsonIgnoreProperties(ignoreUnknown = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import tools.jackson.databind.annotation.JsonDeserialize;
import com.github._1c_syntax.bsl.languageserver.configuration.databind.ParametersDeserializer;
import lombok.AllArgsConstructor;
import lombok.Data;
Expand All @@ -38,7 +38,7 @@
* Корневой класс для настройки {@link com.github._1c_syntax.bsl.languageserver.providers.CodeLensProvider}
*/
@Data
@AllArgsConstructor(onConstructor = @__({@JsonCreator(mode = JsonCreator.Mode.DISABLED)}))
@AllArgsConstructor(onConstructor_ ={@JsonCreator(mode = JsonCreator.Mode.DISABLED)})
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class CodeLensOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import tools.jackson.databind.annotation.JsonDeserialize;
import com.github._1c_syntax.bsl.languageserver.configuration.databind.AnnotationsDeserializer;
import lombok.AllArgsConstructor;
import lombok.Data;
Expand All @@ -38,7 +38,7 @@
* Параметры запускателя тестового фреймворка.
*/
@Data
@AllArgsConstructor(onConstructor = @__({@JsonCreator(mode = JsonCreator.Mode.DISABLED)}))
@AllArgsConstructor(onConstructor_ ={@JsonCreator(mode = JsonCreator.Mode.DISABLED)})
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class TestRunnerAdapterOptions {
Expand Down
Loading
Loading