Adjust Boot version validations to include Spring Runtime support
This commit is contained in:
@@ -13,7 +13,12 @@ package org.springframework.ide.vscode.boot.validation.generations;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.lsp4j.CodeAction;
|
||||
import org.eclipse.lsp4j.CodeActionKind;
|
||||
import org.eclipse.lsp4j.Command;
|
||||
import org.eclipse.lsp4j.Diagnostic;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.ShowDocumentParams;
|
||||
import org.springframework.ide.vscode.boot.validation.generations.json.Generation;
|
||||
import org.springframework.ide.vscode.boot.validation.generations.json.ResolvedSpringProject;
|
||||
import org.springframework.ide.vscode.boot.validation.generations.preferences.VersionValidationProblemType;
|
||||
@@ -26,6 +31,8 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class GenerationsValidator extends AbstractDiagnosticValidator {
|
||||
|
||||
private static String SPRING_COMMERCIAL_URL = "https://tanzu.vmware.com/spring-runtime";
|
||||
|
||||
private SpringProjectsProvider provider;
|
||||
|
||||
public GenerationsValidator(DiagnosticSeverityProvider diagnosticSeverityProvider, SpringProjectsProvider provider) {
|
||||
@@ -55,6 +62,9 @@ public class GenerationsValidator extends AbstractDiagnosticValidator {
|
||||
Generation javaProjectGen = getGenerationForJavaProject(javaProject, springProject);
|
||||
ImmutableList.Builder<Diagnostic> b = ImmutableList.builder();
|
||||
|
||||
boolean validCommercialSupport = VersionValidationUtils.isCommercialValid(javaProjectGen);
|
||||
|
||||
|
||||
if (VersionValidationUtils.isOssValid(javaProjectGen)) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("OSS support for Spring Boot ");
|
||||
@@ -75,14 +85,22 @@ public class GenerationsValidator extends AbstractDiagnosticValidator {
|
||||
message.append(javaProjectGen.getName());
|
||||
message.append(" no longer available, ended on: ");
|
||||
message.append(javaProjectGen.getOssSupportEndDate());
|
||||
if (validCommercialSupport) {
|
||||
message.append(", get commercial support until ");
|
||||
message.append(javaProjectGen.getCommercialSupportEndDate());
|
||||
message.append(" via Tanzu Spring Runtime at https://tanzu.vmware.com/spring-runtime");
|
||||
}
|
||||
}
|
||||
Diagnostic d = createDiagnostic(VersionValidationProblemType.UNSUPPORTED_OSS_VERSION, message.toString());
|
||||
if (validCommercialSupport) {
|
||||
d.setData(List.of(getCommercialSupportCodeAction()));
|
||||
}
|
||||
if (d != null) {
|
||||
b.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
if (VersionValidationUtils.isCommercialValid(javaProjectGen)) {
|
||||
if (validCommercialSupport) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("Commercial support for Spring Boot ");
|
||||
message.append(javaProjectGen.getName());
|
||||
@@ -121,5 +139,19 @@ public class GenerationsValidator extends AbstractDiagnosticValidator {
|
||||
VersionValidationProblemType.UNSUPPORTED_COMMERCIAL_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
private static CodeAction getCommercialSupportCodeAction() {
|
||||
CodeAction commercialSupportLink = new CodeAction();
|
||||
commercialSupportLink.setKind(CodeActionKind.QuickFix);
|
||||
commercialSupportLink.setTitle("Get commercial Spring Boot support via Tanzu Spring Runtime");
|
||||
ShowDocumentParams showDocumentParams = new ShowDocumentParams(SPRING_COMMERCIAL_URL);
|
||||
showDocumentParams.setExternal(true);
|
||||
showDocumentParams.setTakeFocus(true);
|
||||
showDocumentParams.setSelection(new Range());
|
||||
commercialSupportLink.setCommand(new Command("Get commercial Spring Boot support via Tanzu Spring Runtime", "sts/show/document",
|
||||
ImmutableList.of(showDocumentParams)));
|
||||
return commercialSupportLink;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.validation.generations.preferences;
|
||||
|
||||
import static org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity.HINT;
|
||||
import static org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity.IGNORE;
|
||||
import static org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity.INFO;
|
||||
import static org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity.WARNING;
|
||||
@@ -24,9 +23,9 @@ public enum VersionValidationProblemType implements ProblemType {
|
||||
|
||||
SUPPORTED_OSS_VERSION(IGNORE, "Supported OSS Boot Version", "Supported OSS Boot Version"),
|
||||
|
||||
UNSUPPORTED_OSS_VERSION(HINT, "Unsupported OSS Version", "Unsupported OSS Version"),
|
||||
UNSUPPORTED_OSS_VERSION(WARNING, "Unsupported OSS Version", "Unsupported OSS Version"),
|
||||
|
||||
UNSUPPORTED_COMMERCIAL_VERSION(HINT, "Unsupported Commercial Version", "Unsupported Commercial Version"),
|
||||
UNSUPPORTED_COMMERCIAL_VERSION(WARNING, "Unsupported Commercial Version", "Unsupported Commercial Version"),
|
||||
|
||||
SUPPORTED_COMMERCIAL_VERSION(IGNORE, "Supported Commercial Version", "Supported Commercial Version"),
|
||||
|
||||
|
||||
@@ -355,13 +355,13 @@
|
||||
"code": "UNSUPPORTED_OSS_VERSION",
|
||||
"label": "Unsupported OSS Version",
|
||||
"description": "Unsupported OSS Version",
|
||||
"defaultSeverity": "HINT"
|
||||
"defaultSeverity": "WARNING"
|
||||
},
|
||||
{
|
||||
"code": "UNSUPPORTED_COMMERCIAL_VERSION",
|
||||
"label": "Unsupported Commercial Version",
|
||||
"description": "Unsupported Commercial Version",
|
||||
"defaultSeverity": "HINT"
|
||||
"defaultSeverity": "WARNING"
|
||||
},
|
||||
{
|
||||
"code": "SUPPORTED_COMMERCIAL_VERSION",
|
||||
|
||||
@@ -924,7 +924,7 @@
|
||||
},
|
||||
"spring-boot.ls.problem.version-validation.UNSUPPORTED_OSS_VERSION": {
|
||||
"type": "string",
|
||||
"default": "HINT",
|
||||
"default": "WARNING",
|
||||
"description": "Unsupported OSS Version",
|
||||
"enum": [
|
||||
"IGNORE",
|
||||
@@ -936,7 +936,7 @@
|
||||
},
|
||||
"spring-boot.ls.problem.version-validation.UNSUPPORTED_COMMERCIAL_VERSION": {
|
||||
"type": "string",
|
||||
"default": "HINT",
|
||||
"default": "WARNING",
|
||||
"description": "Unsupported Commercial Version",
|
||||
"enum": [
|
||||
"IGNORE",
|
||||
@@ -1038,4 +1038,4 @@
|
||||
"extensionDependencies": [
|
||||
"redhat.java"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user