Skip to content

Commit 392cd67

Browse files
authored
Package lombok into extension (#2550)
- Add the feature of using extension's lombok version by default - If the lombok support is enable, the extension always adds the latest version lombok jar to start JDT LS. This can avoid the errors caused by old version lombok. - The user can select the lombok version of the extension, or project - If the user wants to use project's lombok which is lower then 1.18.2, we send a warning message and continue to use extension's lombok Signed-off-by: Yuhao Xiao <[email protected]>
1 parent b5729c1 commit 392cd67

File tree

8 files changed

+221
-240
lines changed

8 files changed

+221
-240
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ undefined
88
target
99
dist
1010
jre
11+
lombok
1112
bin/
1213
.settings
1314
.classpath

Jenkinsfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ def buildVscodeExtension(){
1212
sh "npm run vscode:prepublish"
1313
}
1414

15+
def downloadLombokJar(){
16+
stage "Download lombok.jar"
17+
sh "npx gulp download_lombok"
18+
}
19+
1520
def packageSpecificExtensions() {
1621
stage "Package platform specific vscode-java"
1722
def platforms = ["win32-x64", "linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64"]
@@ -159,6 +164,8 @@ node('rhel8'){
159164
sh "npm test --silent"
160165
}
161166

167+
downloadLombokJar()
168+
162169
packageExtensions()
163170

164171
publishExtensions()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Supported VS Code settings
112112
The following settings are supported:
113113

114114
* `java.home` : **Deprecated, please use 'java.jdt.ls.java.home' instead.** Absolute path to JDK home folder used to launch the Java Language Server. Requires VS Code restart.
115-
* `java.jdt.ls.lombokSupport.enabled`: Whether to load lombok processors from project classpath. Defaults to `true`.
115+
* `java.jdt.ls.lombokSupport.enabled`: Whether to enable lombok support. Defaults to `true`.
116116
* `java.jdt.ls.vmargs` : Extra VM arguments used to launch the Java Language Server. Requires VS Code restart.
117117
* `java.errors.incompleteClasspath.severity` : Specifies the severity of the message when the classpath is incomplete for a Java file. Supported values are `ignore`, `info`, `warning`, `error`.
118118
* `java.trace.server` : Traces the communication between VS Code and the Java language server.

gulpfile.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ gulp.task('download_jre', async function(done) {
116116
done();
117117
});
118118

119+
gulp.task('download_lombok', function(done) {
120+
if (fse.existsSync('./lombok')) {
121+
fse.removeSync('./lombok');
122+
}
123+
const lombokVersion = '1.18.24';
124+
// The latest lombok version can be found on the website https://projectlombok.org/downloads
125+
const lombokUrl = `https://projectlombok.org/downloads/lombok-${lombokVersion}.jar`;
126+
download(lombokUrl)
127+
.pipe(gulp.dest('./lombok/'))
128+
done();
129+
});
130+
119131
gulp.task('download_server', function(done) {
120132
fse.removeSync('./server');
121133
download("http://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz")

src/extension.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { runtimeStatusBarProvider } from './runtimeStatusBarProvider';
2727
import { serverStatusBarProvider } from './serverStatusBarProvider';
2828
import { markdownPreviewProvider } from "./markdownPreviewProvider";
2929
import * as chokidar from 'chokidar';
30+
import { cleanupLombokCache } from "./lombokSupport";
3031

3132
const syntaxClient: SyntaxLanguageClient = new SyntaxLanguageClient();
3233
const standardClient: StandardLanguageClient = new StandardLanguageClient();
@@ -359,6 +360,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
359360
const cleanWorkspaceExists = fs.existsSync(path.join(workspacePath, cleanWorkspaceFileName));
360361
if (cleanWorkspaceExists) {
361362
try {
363+
cleanupLombokCache(context);
362364
deleteDirectory(workspacePath);
363365
deleteDirectory(syntaxServerWorkspacePath);
364366
} catch (error) {

0 commit comments

Comments
 (0)