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
7 changed files
with
202 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 JSON LSP server component | ||
--- | ||
version: 0.0.+ | ||
repository_root: "https://lsp-component-json.cfapps.eu10.hana.ondemand.com/" | ||
env: | ||
workdir: language_server_node_json/server | ||
exec: language_server_node_json/launcher.sh | ||
ipc: | ||
protocol: "stream" |
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-xml.cfapps.sap.hana.ondemand.com/" | ||
env: | ||
workdir: language_server_node_xml/server/ | ||
exec: language_server_node_xml/launcher.sh | ||
ipc: | ||
protocol: "stream" |
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 JSON based LSP server component. | ||
class LanguageServerNodeJSON < 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 LanguageServerNodeJSON | ||
end | ||
|
||
|
||
# (see JavaBuildpack::Component::BaseComponent#compile) | ||
def compile | ||
@logger.debug { "Compile JSON" } | ||
# 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 JSON" } | ||
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 { "JSON 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?("json") | ||
end | ||
|
||
private | ||
|
||
LSPSERVERS = 'lspservers'.freeze | ||
|
||
private_constant :LSPSERVERS | ||
|
||
BINEXEC = 'exec'.freeze | ||
|
||
private_constant :BINEXEC | ||
|
||
ENV_PREFIX = 'LSPJSON_'.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,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 XML based LSP server component. | ||
class LanguageServerNodeXML < 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 LanguageServerNodeXML | ||
end | ||
|
||
|
||
# (see JavaBuildpack::Component::BaseComponent#compile) | ||
def compile | ||
@logger.debug { "Compile XML" } | ||
# 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 XML" } | ||
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 { "XML 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?("xml") | ||
end | ||
|
||
private | ||
|
||
LSPSERVERS = 'lspservers'.freeze | ||
|
||
private_constant :LSPSERVERS | ||
|
||
BINEXEC = 'exec'.freeze | ||
|
||
private_constant :BINEXEC | ||
|
||
ENV_PREFIX = 'LSPXML_'.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/jsonServerMain.js --stdio |
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/xmlServerMain.js --stdio |