Skip to content

Commit d0f2853

Browse files
authored
Include microprofile.ls and quarkus.ls.ext jar (#253)
Signed-off-by: Ryan Zegray <[email protected]>
1 parent 3a60942 commit d0f2853

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

gulpfile.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,34 @@ const gulp = require('gulp');
1515
const rename = require('gulp-rename');
1616
const cp = require('child_process');
1717

18-
const serverName = 'com.redhat.microprofile.ls-uber.jar';
18+
const microprofileServerName = 'com.redhat.microprofile.ls-uber.jar';
1919
const extensions = ['com.redhat.microprofile.jdt.core', 'com.redhat.microprofile.jdt.quarkus'];
20-
const serverDir = '../quarkus-ls/microprofile.ls/com.redhat.microprofile.ls';
20+
const microprofileServerDir = '../quarkus-ls/microprofile.ls/com.redhat.microprofile.ls';
2121
const extensionDir = '../quarkus-ls/microprofile.jdt';
2222

23-
gulp.task('buildServer', (done) => {
24-
cp.execSync(mvnw() + ' clean verify -DskipTests', { cwd: serverDir , stdio: 'inherit' });
25-
gulp.src(serverDir + '/target/' + serverName)
23+
const quarkusServerExtGlob = 'com.redhat.quarkus.ls!(*-sources).jar';
24+
const quarkusServerExtDir = '../quarkus-ls/quarkus.ls.ext/com.redhat.quarkus.ls'
25+
26+
gulp.task('buildMicroProfileServer', (done) => {
27+
cp.execSync(mvnw() + ' clean install -DskipTests', { cwd: microprofileServerDir , stdio: 'inherit' });
28+
gulp.src(microprofileServerDir + '/target/' + microprofileServerName)
2629
.pipe(gulp.dest('./server'));
2730
done();
2831
});
2932

33+
gulp.task('buildQuarkusServerExt', (done) => {
34+
cp.execSync(mvnw() + ' clean verify -DskipTests', { cwd: quarkusServerExtDir , stdio: 'inherit' });
35+
gulp.src(quarkusServerExtDir + '/target/' + quarkusServerExtGlob)
36+
.pipe(gulp.dest('./server'));
37+
// copy over any dependencies not provided by mp-ls
38+
// dependencies are copied into /target/lib by the maven-dependency-plugin
39+
gulp.src(quarkusServerExtDir + '/target/lib/*.jar')
40+
.pipe(gulp.dest('./server'));
41+
done();
42+
});
43+
44+
gulp.task('buildServer', gulp.series(['buildMicroProfileServer', 'buildQuarkusServerExt']))
45+
3046
gulp.task('buildExtension', (done) => {
3147
cp.execSync(mvnw() + ' -pl "' + extensions.join(',') + '" clean verify -DskipTests' , { cwd: extensionDir, stdio: 'inherit' });
3248
extensions.forEach(extension => {

src/languageServer/javaServerStarter.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ const glob = require('glob');
77

88
const DEBUG = startedInDebugMode();
99
const DEBUG_PORT = 1064;
10-
const SERVER_NAME = 'com.redhat.microprofile.ls-uber.jar';
10+
const MICROPROFILE_SERVER_NAME = 'com.redhat.microprofile.ls-uber.jar';
11+
const QUARKUS_SERVER_EXTENSION_GLOB = 'com.redhat.quarkus.ls*.jar';
12+
const MICROPROFILE_SERVER_MAIN_CLASS = 'com.redhat.microprofile.ls.MicroProfileServerLauncher';
1113

1214
export function prepareExecutable(requirements: RequirementsData): Executable {
1315
const executable: Executable = Object.create(null);
@@ -37,9 +39,14 @@ function prepareParams(): string[] {
3739
}
3840
parseVMargs(params, vmargs);
3941
const serverHome: string = path.resolve(__dirname, '../server');
40-
const launchersFound: Array<string> = glob.sync(`**/${SERVER_NAME}`, { cwd: serverHome });
41-
if (launchersFound.length) {
42-
params.push('-jar'); params.push(path.resolve(serverHome, launchersFound[0]));
42+
const microprofileServerFound: Array<string> = glob.sync(`**/${MICROPROFILE_SERVER_NAME}`, { cwd: serverHome });
43+
const quarkusServerExtFound: Array<string> = glob.sync(`**/${QUARKUS_SERVER_EXTENSION_GLOB}`, { cwd: serverHome });
44+
if (microprofileServerFound.length && quarkusServerExtFound.length) {
45+
params.push('-cp');
46+
params.push(`${serverHome}/*`);
47+
params.push(MICROPROFILE_SERVER_MAIN_CLASS);
48+
} else {
49+
throw new Error('Unable to find required Language Server JARs');
4350
}
4451
return params;
4552
}

0 commit comments

Comments
 (0)