Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
79 changes: 34 additions & 45 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ plugins {
`java-library`
`maven-publish`
jacoco
id("cloud.rio.license") version "0.18.0"
id("com.diffplug.spotless") version "7.0.4"
id("me.qoomon.git-versioning") version "6.4.4"
id("io.freefair.lombok") version "9.1.0"
id("io.freefair.javadoc-links") version "9.1.0"
id("io.freefair.javadoc-utf-8") version "9.1.0"
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 All @@ -38,21 +38,21 @@ gitVersioning.apply {
refs {
describeTagFirstParent = false
tag("v(?<tagVersion>[0-9].*)") {
version = "\${ref.tagVersion}\${dirty}"
version = $$"${ref.tagVersion}${dirty}"
}

branch("develop") {
version = "\${describe.tag.version}." +
"\${describe.distance}-SNAPSHOT\${dirty}"
version = $$"${describe.tag.version}." +
$$"${describe.distance}-SNAPSHOT${dirty}"
}

branch(".+") {
version = "\${ref}-\${commit.short}\${dirty}"
version = $$"${ref}-${commit.short}${dirty}"
}
}

rev {
version = "\${commit.short}\${dirty}"
version = $$"${commit.short}${dirty}"
}
}

Expand Down Expand Up @@ -89,7 +89,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 +113,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 +129,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 @@ -193,9 +193,16 @@ tasks.bootJar {
archiveClassifier.set("exec")
}

tasks.named("sourcesJar") {
dependsOn(tasks.generateSentryDebugMetaPropertiesjava)
dependsOn(tasks.collectExternalDependenciesForSentry)
afterEvaluate {
tasks.named("spotlessJavaCheck") {
dependsOn(tasks.generateSentryDebugMetaPropertiesjava)
dependsOn(tasks.collectExternalDependenciesForSentry)
}

tasks.named("spotlessJavaApply") {
dependsOn(tasks.generateSentryDebugMetaPropertiesjava)
dependsOn(tasks.collectExternalDependenciesForSentry)
}
}

tasks.build {
Expand Down Expand Up @@ -248,16 +255,6 @@ tasks.check {
mustRunAfter(tasks.generateDiagnosticDocs)
}

tasks.named("licenseMain") {
dependsOn(tasks.generateSentryDebugMetaPropertiesjava)
dependsOn(tasks.collectExternalDependenciesForSentry)
}

tasks.named("licenseFormatMain") {
dependsOn(tasks.generateSentryDebugMetaPropertiesjava)
dependsOn(tasks.collectExternalDependenciesForSentry)
}

tasks.jacocoTestReport {
reports {
xml.required.set(true)
Expand All @@ -269,6 +266,10 @@ jmh {
jmhVersion = "1.37"
}

sentry {
includeSourceContext = true
}

tasks.processResources {
filteringCharset = "UTF-8"
// native2ascii gradle replacement
Expand Down Expand Up @@ -307,23 +308,11 @@ tasks.javadoc {
}
}

license {
header = rootProject.file("license/HEADER.txt")
skipExistingHeaders = false
strictCheck = true
ext["year"] = "2018-" + Calendar.getInstance().get(Calendar.YEAR)
ext["name"] = "Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]>"
ext["project"] = "BSL Language Server"
mapping("java", "SLASHSTAR_STYLE")
exclude("**/*.properties")
exclude("**/*.xml")
exclude("**/*.json")
exclude("**/*.bsl")
exclude("**/*.os")
exclude("**/*.txt")
exclude("**/*.java.orig")
exclude("**/*.impl")
exclude("**/*.mockito.plugins.MockMaker")
spotless {
java {
targetExclude("**/AbstractObjectPool.java")
licenseHeaderFile(rootProject.file("license/HEADER.txt"), "package ").updateYearWithLatest(true)
}
}

sonarqube {
Expand Down Expand Up @@ -453,9 +442,9 @@ tasks.withType<GenerateModuleMetadata> {
}

tasks.register("updateLicenses") {
description = "Wrapper for licenseFormat"
description = "Wrapper for spotlessApply"
group = "license"
dependsOn(tasks.licenseFormat)
dependsOn(tasks.spotlessApply)
}

fun buildTime(): String {
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
40 changes: 21 additions & 19 deletions license/HEADER.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
This file is a part of ${project}.

Copyright (c) ${year}
${name} and contributors

SPDX-License-Identifier: LGPL-3.0-or-later

${project} is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.

${project} is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with ${project}.
/*
* This file is a part of BSL Language Server.
*
* Copyright (c) 2018-$YEAR
* Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* BSL Language Server is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* BSL Language Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with BSL Language Server.
*/
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
Loading
Loading