This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# TODO License. | ||
|
||
# Configuration for the JAVA LSP server component | ||
--- | ||
version: 0.0.+ | ||
repository_root: "https://lsp-component-eslint.cfapps.eu10.hana.ondemand.com/" | ||
env: | ||
workdir: language_server_node_eslint/server/ | ||
exec: language_server_node_eslint/launcher.sh | ||
ipc: | ||
protocol: "stream" |
86 changes: 86 additions & 0 deletions
86
lib/java_buildpack/framework/language_server_node_eslint.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Encoding: utf-8 | ||
# TODO License. | ||
|
||
require 'java_buildpack/component/versioned_dependency_component' | ||
require 'java_buildpack/framework' | ||
require 'fileutils' | ||
require 'java_buildpack/util/qualify_path' | ||
require 'java_buildpack/logging/logger_factory' | ||
|
||
module JavaBuildpack | ||
module Framework | ||
|
||
# Installs ESLINT based LSP server component. | ||
class LanguageServerNodeESLINT < JavaBuildpack::Component::VersionedDependencyComponent | ||
|
||
# Creates an instance | ||
# | ||
# @param [Hash] context a collection of utilities used the component | ||
def initialize(context) | ||
super(context) | ||
@logger = JavaBuildpack::Logging::LoggerFactory.instance.get_logger LanguageServerNodeESLINT | ||
end | ||
|
||
|
||
# (see JavaBuildpack::Component::BaseComponent#compile) | ||
def compile | ||
@logger.debug { "Compile ESLINT" } | ||
# Install node js | ||
FileUtils.mkdir_p @droplet.root + "nodejs" | ||
nodedir = @droplet.sandbox + "nodejs" | ||
comp_version = @version | ||
comp_uri = @uri | ||
@version="8.0.0" | ||
@uri="https://buildpacks.cloudfoundry.org/dependencies/node/node-8.0.0-linux-x64-ade5a8e5.tgz" | ||
download_tar( target_directory=nodedir ) | ||
@version = comp_version | ||
@uri = comp_uri | ||
download_zip strip_top_level = false | ||
@droplet.copy_resources | ||
|
||
end | ||
|
||
# (see JavaBuildpack::Component::BaseComponent#release) | ||
def release | ||
|
||
@logger.debug { "Release ESLINT" } | ||
environment_variables = @droplet.environment_variables | ||
myWorkdir = @configuration["env"]["workdir"] | ||
environment_variables.add_environment_variable(ENV_PREFIX + "workdir", myWorkdir) | ||
myExec = @configuration["env"]["exec"] | ||
environment_variables.add_environment_variable(ENV_PREFIX + "exec", myExec) | ||
|
||
myIpc = @configuration["env"]["ipc"] | ||
@logger.debug { "ESLINT Env vars IPC:#{myIpc}" } | ||
myIpc.each do |key, value| | ||
environment_variables.add_environment_variable(ENV_PREFIX + key, value) | ||
end | ||
|
||
environment_variables.add_environment_variable 'PATH', "/home/vcap/app/.java-buildpack/#{@droplet.component_id}/nodejs/bin:$PATH" | ||
end | ||
|
||
protected | ||
|
||
# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?) | ||
def supports? | ||
@application.environment.key?(LSPSERVERS) && @application.environment[LSPSERVERS].split(',').include?("eslint") | ||
end | ||
|
||
private | ||
|
||
LSPSERVERS = 'lspservers'.freeze | ||
|
||
private_constant :LSPSERVERS | ||
|
||
BINEXEC = 'exec'.freeze | ||
|
||
private_constant :BINEXEC | ||
|
||
ENV_PREFIX = 'LSPESLINT_'.freeze | ||
|
||
private_constant :ENV_PREFIX | ||
|
||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
exec ../nodejs/bin/node ./out/server.js --stdio |