Skip to content

Commit

Permalink
✨ Kai analyzer (#54)
Browse files Browse the repository at this point in the history
Signed-off-by: David Zager <dzager@redhat.com>
  • Loading branch information
djzager authored Oct 14, 2024
1 parent d9a59cf commit 72c95f4
Show file tree
Hide file tree
Showing 451 changed files with 136,809 additions and 368 deletions.
5 changes: 0 additions & 5 deletions analyzer/README.md

This file was deleted.

Binary file added vscode/assets/bin/fernflower.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions vscode/assets/bin/jdtls/bin/jdtls
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
###############################################################################
# Copyright (c) 2022 Marc Schreiber and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Marc Schreiber - initial API and implementation
###############################################################################
import jdtls
import sys

jdtls.main(sys.argv[1:])

3 changes: 3 additions & 0 deletions vscode/assets/bin/jdtls/bin/jdtls.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
python %~dp0/jdtls %*
pause
114 changes: 114 additions & 0 deletions vscode/assets/bin/jdtls/bin/jdtls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
###############################################################################
# Copyright (c) 2022 Marc Schreiber and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Marc Schreiber - initial API and implementation
###############################################################################
import argparse
from hashlib import sha1
import os
import platform
import re
import subprocess
from pathlib import Path
import tempfile

def get_java_executable(known_args):
if known_args.java_executable is not None:
java_executable = known_args.java_executable
else:
java_executable = 'java'

if 'JAVA_HOME' in os.environ:
ext = '.exe' if platform.system() == 'Windows' else ''
java_exec_to_test = Path(os.environ['JAVA_HOME']) / 'bin' / f'java{ext}'
if java_exec_to_test.is_file():
java_executable = java_exec_to_test.resolve()

if not known_args.validate_java_version:
return java_executable

out = subprocess.check_output([java_executable, '-version'], stderr = subprocess.STDOUT, universal_newlines=True)

matches = re.finditer(r"(?<=version\s\")(?P<major>\d+)(\.\d+\.\d+(_\d+)?)?", out)
for match in matches:
java_major_version = int(match.group("major"))

if java_major_version < 17:
raise Exception("jdtls requires at least Java 17")

return java_executable

raise Exception("Could not determine Java version")

def find_equinox_launcher(jdtls_base_directory):
plugins_dir = jdtls_base_directory / "plugins"
launchers = plugins_dir.glob('org.eclipse.equinox.launcher_*.jar')
for launcher in launchers:
return plugins_dir / launcher

raise Exception("Cannot find equinox launcher")

def get_shared_config_path(jdtls_base_path):
system = platform.system()

if system in ['Linux', 'FreeBSD']:
config_dir = 'config_linux'
elif system == 'Darwin':
config_dir = 'config_mac'
elif system == 'Windows':
config_dir = 'config_win'
else:
raise Exception("Unknown platform {} detected".format(system))

return jdtls_base_path / config_dir

def main(args):
cwd_name = os.path.basename(os.getcwd())
jdtls_data_path = os.path.join(tempfile.gettempdir(), "jdtls-" + sha1(cwd_name.encode()).hexdigest())

parser = argparse.ArgumentParser()
parser.add_argument('--validate-java-version', action='store_true', default=True)
parser.add_argument('--no-validate-java-version', dest='validate_java_version', action='store_false')
parser.add_argument("--java-executable", help="Path to java executable used to start runtime.")
parser.add_argument("--jvm-arg",
default=[],
action="append",
help="An additional JVM option (can be used multiple times. Note, use with equal sign. For example: --jvm-arg=-Dlog.level=ALL")
parser.add_argument("-data", default=jdtls_data_path)

known_args, args = parser.parse_known_args(args)
java_executable = get_java_executable(known_args)

jdtls_base_path = Path(__file__).parent.parent
shared_config_path = get_shared_config_path(jdtls_base_path)
jar_path = find_equinox_launcher(jdtls_base_path)

system = platform.system()
exec_args = ["-Declipse.application=org.eclipse.jdt.ls.core.id1",
"-Dosgi.bundles.defaultStartLevel=4",
"-Declipse.product=org.eclipse.jdt.ls.core.product",
"-Dosgi.checkConfiguration=true",
"-Dosgi.sharedConfiguration.area=" + str(shared_config_path),
"-Dosgi.sharedConfiguration.area.readOnly=true",
"-Dosgi.configuration.cascaded=true",
"-Xms1g",
'-XX:MaxRAMPercentage=70.0',
"--add-modules=ALL-SYSTEM",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/java.lang=ALL-UNNAMED"] \
+ known_args.jvm_arg \
+ ["-jar", jar_path,
"-data", known_args.data] \
+ args

if os.name == 'posix':
os.execvp(java_executable, exec_args)
else:
subprocess.run([java_executable] + exec_args)
10 changes: 10 additions & 0 deletions vscode/assets/bin/jdtls/config_linux/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser
#Thu Aug 01 13:42:09 UTC 2024
eclipse.product=org.eclipse.jdt.ls.core.product
osgi.bundles=reference\:file\:ch.qos.logback.classic_1.5.0.jar@2\:start,reference\:file\:ch.qos.logback.core_1.5.0.jar@4,reference\:file\:com.google.gson_2.10.1.v20230109-0753.jar@4,reference\:file\:com.google.guava_33.0.0.jre.jar@4,reference\:file\:com.google.guava.failureaccess_1.0.2.jar@4,reference\:file\:com.sun.jna_5.14.0.v20231211-1200/@4,reference\:file\:com.sun.jna.platform_5.14.0.jar@4,reference\:file\:jakarta.annotation-api_1.3.5.jar@4,reference\:file\:jakarta.inject.jakarta.inject-api_1.0.5.jar@4,reference\:file\:jakarta.servlet-api_5.0.0.jar@4,reference\:file\:org.apache.ant_1.10.14.v20230922-1200/@4,reference\:file\:org.apache.aries.spifly.dynamic.bundle_1.3.7.jar@2\:start,reference\:file\:org.apache.commons.cli_1.6.0.jar@4,reference\:file\:org.apache.commons.commons-codec_1.17.0.jar@4,reference\:file\:org.apache.commons.lang3_3.14.0.jar@4,reference\:file\:org.apache.felix.scr_2.2.12.jar@2\:start,reference\:file\:org.eclipse.ant.core_3.7.400.v20240413-1529.jar@4,reference\:file\:org.eclipse.buildship.compat_3.1.10.v20240724-1403-s.jar@4,reference\:file\:org.eclipse.buildship.core_3.1.10.v20240724-1403-s.jar@4,reference\:file\:org.eclipse.compare.core_3.8.500.v20240524-2010.jar@4,reference\:file\:org.eclipse.core.commands_3.12.200.v20240627-1019.jar@4,reference\:file\:org.eclipse.core.contenttype_3.9.500.v20240708-0707.jar@4,reference\:file\:org.eclipse.core.expressions_3.9.400.v20240413-1529.jar@4,reference\:file\:org.eclipse.core.filebuffers_3.8.300.v20240207-1054.jar@4,reference\:file\:org.eclipse.core.filesystem_1.11.0.v20240724-1730.jar@4,reference\:file\:org.eclipse.core.jobs_3.15.400.v20240619-0602.jar@4,reference\:file\:org.eclipse.core.net_1.5.500.v20240625-1706.jar@4,reference\:file\:org.eclipse.core.resources_3.21.0.v20240723-2151.jar@4,reference\:file\:org.eclipse.core.runtime_3.31.100.v20240524-2010.jar@4\:start,reference\:file\:org.eclipse.core.variables_3.6.500.v20240702-1152.jar@4,reference\:file\:org.eclipse.debug.core_3.21.500.v20240606-1317.jar@4,reference\:file\:org.eclipse.equinox.app_1.7.200.v20240722-2103.jar@4,reference\:file\:org.eclipse.equinox.common_3.19.100.v20240524-2011.jar@2\:start,reference\:file\:org.eclipse.equinox.frameworkadmin_2.3.200.v20240321-1450.jar@4,reference\:file\:org.eclipse.equinox.frameworkadmin.equinox_1.3.200.v20240321-1450.jar@4,reference\:file\:org.eclipse.equinox.http.service.api_1.2.2.v20231218-2126.jar@4,reference\:file\:org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar@4,reference\:file\:org.eclipse.equinox.launcher.gtk.linux.x86_64_1.2.1100.v20240722-2106/@4,reference\:file\:org.eclipse.equinox.preferences_3.11.100.v20240327-0645.jar@4,reference\:file\:org.eclipse.equinox.registry_3.12.100.v20240524-2011.jar@4,reference\:file\:org.eclipse.equinox.security_1.4.400.v20240702-1702.jar@4,reference\:file\:org.eclipse.equinox.security.linux_1.1.300.v20240419-2334.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.5.300.v20240424-1301.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator.manipulator_2.3.300.v20240702-1335.jar@4,reference\:file\:org.eclipse.jdt.apt.core_3.8.500.v20240702-1051.jar@4,reference\:file\:org.eclipse.jdt.apt.pluggable.core_1.4.500.v20240620-1418.jar@4,reference\:file\:org.eclipse.jdt.core_3.39.0.v20240724-1734.jar@4,reference\:file\:org.eclipse.jdt.core.compiler.batch_3.39.0.v20240725-1906.jar@4,reference\:file\:org.eclipse.jdt.core.manipulation_1.21.200.v20240725-2012.jar@4,reference\:file\:org.eclipse.jdt.debug_3.21.500.v20240725-1239/@4,reference\:file\:org.eclipse.jdt.junit.core_3.13.300.v20240621-0244.jar@4,reference\:file\:org.eclipse.jdt.junit.runtime_3.7.500.v20240702-1918.jar@4,reference\:file\:org.eclipse.jdt.launching_3.23.0.v20240718-0707.jar@4,reference\:file\:org.eclipse.jdt.ls.core_1.38.0.202408011337.jar@4\:start,reference\:file\:org.eclipse.jdt.ls.filesystem_1.38.0.202408011337.jar@4,reference\:file\:org.eclipse.jdt.ls.logback.appender_1.38.0.202408011337.jar@4,reference\:file\:org.eclipse.jetty.servlet-api_4.0.6.jar@4,reference\:file\:org.eclipse.lsp4j_0.22.0.v20240213-2011.jar@4,reference\:file\:org.eclipse.lsp4j.jsonrpc_0.22.0.v20240213-2011.jar@4,reference\:file\:org.eclipse.ltk.core.refactoring_3.14.500.v20240702-1521.jar@4,reference\:file\:org.eclipse.m2e.apt.core_2.2.201.20240125-1714.jar@4,reference\:file\:org.eclipse.m2e.core_2.6.0.20240220-1109.jar@4,reference\:file\:org.eclipse.m2e.jdt_2.3.400.20240219-2341.jar@4,reference\:file\:org.eclipse.m2e.maven.runtime_3.9.600.20231203-1234/@4,reference\:file\:org.eclipse.m2e.workspace.cli_0.3.1.jar@4,reference\:file\:org.eclipse.osgi.services_3.12.100.v20240327-0645.jar@4,reference\:file\:org.eclipse.search.core_3.16.300.v20240708-0708.jar@4,reference\:file\:org.eclipse.text_3.14.100.v20240524-2010.jar@4,reference\:file\:org.eclipse.xtext.xbase.lib_2.34.0.v20240227-0940.jar@4,reference\:file\:org.gradle.toolingapi_8.9.0.v20240724-1403-s.jar@4,reference\:file\:org.hamcrest_2.2.0.jar@4,reference\:file\:org.hamcrest.core_2.2.0.v20230809-1000.jar@4,reference\:file\:org.junit_4.13.2.v20230809-1000.jar@4,reference\:file\:org.objectweb.asm_9.7.0.jar@4,reference\:file\:org.objectweb.asm.commons_9.7.0.jar@4,reference\:file\:org.objectweb.asm.tree_9.7.0.jar@4,reference\:file\:org.objectweb.asm.tree.analysis_9.7.0.jar@4,reference\:file\:org.objectweb.asm.util_9.7.0.jar@4,reference\:file\:org.osgi.service.cm_1.6.1.202109301733.jar@4,reference\:file\:org.osgi.service.component_1.5.1.202212101352.jar@4,reference\:file\:org.osgi.service.device_1.1.1.202109301733.jar@4,reference\:file\:org.osgi.service.event_1.4.1.202109301733.jar@4,reference\:file\:org.osgi.service.http.whiteboard_1.1.1.202109301733.jar@4,reference\:file\:org.osgi.service.metatype_1.4.1.202109301733.jar@4,reference\:file\:org.osgi.service.prefs_1.1.2.202109301733.jar@4,reference\:file\:org.osgi.service.provisioning_1.2.0.201505202024.jar@4,reference\:file\:org.osgi.service.upnp_1.2.1.202109301733.jar@4,reference\:file\:org.osgi.service.useradmin_1.1.1.202109301733.jar@4,reference\:file\:org.osgi.service.wireadmin_1.0.2.202109301733.jar@4,reference\:file\:org.osgi.util.function_1.2.0.202109301733.jar@4,reference\:file\:org.osgi.util.promise_1.3.0.202212101352.jar@4,reference\:file\:slf4j.api_2.0.13.jar@4
eclipse.p2.data.area=@config.dir/../p2
eclipse.p2.profile=DefaultProfile
osgi.bundles.defaultStartLevel=4
eclipse.application=org.eclipse.jdt.ls.core.id1
osgi.framework=file\:plugins/org.eclipse.osgi_3.21.0.v20240717-2103.jar
osgi.framework.extensions=reference\:file\:org.eclipse.osgi.compatibility.state_1.2.1000.v20240213-1057.jar
10 changes: 10 additions & 0 deletions vscode/assets/bin/jdtls/config_linux_arm/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser
#Thu Aug 01 13:42:11 UTC 2024
eclipse.product=org.eclipse.jdt.ls.core.product
osgi.bundles=reference\:file\:ch.qos.logback.classic_1.5.0.jar@2\:start,reference\:file\:ch.qos.logback.core_1.5.0.jar@4,reference\:file\:com.google.gson_2.10.1.v20230109-0753.jar@4,reference\:file\:com.google.guava_33.0.0.jre.jar@4,reference\:file\:com.google.guava.failureaccess_1.0.2.jar@4,reference\:file\:com.sun.jna_5.14.0.v20231211-1200/@4,reference\:file\:com.sun.jna.platform_5.14.0.jar@4,reference\:file\:jakarta.annotation-api_1.3.5.jar@4,reference\:file\:jakarta.inject.jakarta.inject-api_1.0.5.jar@4,reference\:file\:jakarta.servlet-api_5.0.0.jar@4,reference\:file\:org.apache.ant_1.10.14.v20230922-1200/@4,reference\:file\:org.apache.aries.spifly.dynamic.bundle_1.3.7.jar@2\:start,reference\:file\:org.apache.commons.cli_1.6.0.jar@4,reference\:file\:org.apache.commons.commons-codec_1.17.0.jar@4,reference\:file\:org.apache.commons.lang3_3.14.0.jar@4,reference\:file\:org.apache.felix.scr_2.2.12.jar@2\:start,reference\:file\:org.eclipse.ant.core_3.7.400.v20240413-1529.jar@4,reference\:file\:org.eclipse.buildship.compat_3.1.10.v20240724-1403-s.jar@4,reference\:file\:org.eclipse.buildship.core_3.1.10.v20240724-1403-s.jar@4,reference\:file\:org.eclipse.compare.core_3.8.500.v20240524-2010.jar@4,reference\:file\:org.eclipse.core.commands_3.12.200.v20240627-1019.jar@4,reference\:file\:org.eclipse.core.contenttype_3.9.500.v20240708-0707.jar@4,reference\:file\:org.eclipse.core.expressions_3.9.400.v20240413-1529.jar@4,reference\:file\:org.eclipse.core.filebuffers_3.8.300.v20240207-1054.jar@4,reference\:file\:org.eclipse.core.filesystem_1.11.0.v20240724-1730.jar@4,reference\:file\:org.eclipse.core.jobs_3.15.400.v20240619-0602.jar@4,reference\:file\:org.eclipse.core.net_1.5.500.v20240625-1706.jar@4,reference\:file\:org.eclipse.core.resources_3.21.0.v20240723-2151.jar@4,reference\:file\:org.eclipse.core.runtime_3.31.100.v20240524-2010.jar@4\:start,reference\:file\:org.eclipse.core.variables_3.6.500.v20240702-1152.jar@4,reference\:file\:org.eclipse.debug.core_3.21.500.v20240606-1317.jar@4,reference\:file\:org.eclipse.equinox.app_1.7.200.v20240722-2103.jar@4,reference\:file\:org.eclipse.equinox.common_3.19.100.v20240524-2011.jar@2\:start,reference\:file\:org.eclipse.equinox.frameworkadmin_2.3.200.v20240321-1450.jar@4,reference\:file\:org.eclipse.equinox.frameworkadmin.equinox_1.3.200.v20240321-1450.jar@4,reference\:file\:org.eclipse.equinox.http.service.api_1.2.2.v20231218-2126.jar@4,reference\:file\:org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar@4,reference\:file\:org.eclipse.equinox.launcher.gtk.linux.aarch64_1.2.1100.v20240722-2106/@4,reference\:file\:org.eclipse.equinox.preferences_3.11.100.v20240327-0645.jar@4,reference\:file\:org.eclipse.equinox.registry_3.12.100.v20240524-2011.jar@4,reference\:file\:org.eclipse.equinox.security_1.4.400.v20240702-1702.jar@4,reference\:file\:org.eclipse.equinox.security.linux_1.1.300.v20240419-2334.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.5.300.v20240424-1301.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator.manipulator_2.3.300.v20240702-1335.jar@4,reference\:file\:org.eclipse.jdt.apt.core_3.8.500.v20240702-1051.jar@4,reference\:file\:org.eclipse.jdt.apt.pluggable.core_1.4.500.v20240620-1418.jar@4,reference\:file\:org.eclipse.jdt.core_3.39.0.v20240724-1734.jar@4,reference\:file\:org.eclipse.jdt.core.compiler.batch_3.39.0.v20240725-1906.jar@4,reference\:file\:org.eclipse.jdt.core.manipulation_1.21.200.v20240725-2012.jar@4,reference\:file\:org.eclipse.jdt.debug_3.21.500.v20240725-1239/@4,reference\:file\:org.eclipse.jdt.junit.core_3.13.300.v20240621-0244.jar@4,reference\:file\:org.eclipse.jdt.junit.runtime_3.7.500.v20240702-1918.jar@4,reference\:file\:org.eclipse.jdt.launching_3.23.0.v20240718-0707.jar@4,reference\:file\:org.eclipse.jdt.ls.core_1.38.0.202408011337.jar@4\:start,reference\:file\:org.eclipse.jdt.ls.filesystem_1.38.0.202408011337.jar@4,reference\:file\:org.eclipse.jdt.ls.logback.appender_1.38.0.202408011337.jar@4,reference\:file\:org.eclipse.jetty.servlet-api_4.0.6.jar@4,reference\:file\:org.eclipse.lsp4j_0.22.0.v20240213-2011.jar@4,reference\:file\:org.eclipse.lsp4j.jsonrpc_0.22.0.v20240213-2011.jar@4,reference\:file\:org.eclipse.ltk.core.refactoring_3.14.500.v20240702-1521.jar@4,reference\:file\:org.eclipse.m2e.apt.core_2.2.201.20240125-1714.jar@4,reference\:file\:org.eclipse.m2e.core_2.6.0.20240220-1109.jar@4,reference\:file\:org.eclipse.m2e.jdt_2.3.400.20240219-2341.jar@4,reference\:file\:org.eclipse.m2e.maven.runtime_3.9.600.20231203-1234/@4,reference\:file\:org.eclipse.m2e.workspace.cli_0.3.1.jar@4,reference\:file\:org.eclipse.osgi.services_3.12.100.v20240327-0645.jar@4,reference\:file\:org.eclipse.search.core_3.16.300.v20240708-0708.jar@4,reference\:file\:org.eclipse.text_3.14.100.v20240524-2010.jar@4,reference\:file\:org.eclipse.xtext.xbase.lib_2.34.0.v20240227-0940.jar@4,reference\:file\:org.gradle.toolingapi_8.9.0.v20240724-1403-s.jar@4,reference\:file\:org.hamcrest_2.2.0.jar@4,reference\:file\:org.hamcrest.core_2.2.0.v20230809-1000.jar@4,reference\:file\:org.junit_4.13.2.v20230809-1000.jar@4,reference\:file\:org.objectweb.asm_9.7.0.jar@4,reference\:file\:org.objectweb.asm.commons_9.7.0.jar@4,reference\:file\:org.objectweb.asm.tree_9.7.0.jar@4,reference\:file\:org.objectweb.asm.tree.analysis_9.7.0.jar@4,reference\:file\:org.objectweb.asm.util_9.7.0.jar@4,reference\:file\:org.osgi.service.cm_1.6.1.202109301733.jar@4,reference\:file\:org.osgi.service.component_1.5.1.202212101352.jar@4,reference\:file\:org.osgi.service.device_1.1.1.202109301733.jar@4,reference\:file\:org.osgi.service.event_1.4.1.202109301733.jar@4,reference\:file\:org.osgi.service.http.whiteboard_1.1.1.202109301733.jar@4,reference\:file\:org.osgi.service.metatype_1.4.1.202109301733.jar@4,reference\:file\:org.osgi.service.prefs_1.1.2.202109301733.jar@4,reference\:file\:org.osgi.service.provisioning_1.2.0.201505202024.jar@4,reference\:file\:org.osgi.service.upnp_1.2.1.202109301733.jar@4,reference\:file\:org.osgi.service.useradmin_1.1.1.202109301733.jar@4,reference\:file\:org.osgi.service.wireadmin_1.0.2.202109301733.jar@4,reference\:file\:org.osgi.util.function_1.2.0.202109301733.jar@4,reference\:file\:org.osgi.util.promise_1.3.0.202212101352.jar@4,reference\:file\:slf4j.api_2.0.13.jar@4
eclipse.p2.data.area=@config.dir/../p2
eclipse.p2.profile=DefaultProfile
osgi.bundles.defaultStartLevel=4
eclipse.application=org.eclipse.jdt.ls.core.id1
osgi.framework=file\:plugins/org.eclipse.osgi_3.21.0.v20240717-2103.jar
osgi.framework.extensions=reference\:file\:org.eclipse.osgi.compatibility.state_1.2.1000.v20240213-1057.jar
Loading

0 comments on commit 72c95f4

Please sign in to comment.