Skip to content

Commit 34a9e2e

Browse files
committed
implement in own code
1 parent f2bd492 commit 34a9e2e

File tree

11 files changed

+272
-780
lines changed

11 files changed

+272
-780
lines changed

adapter/build.gradle

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ startScripts {
1919
repositories {
2020
mavenCentral()
2121
maven { url 'https://jitpack.io' }
22-
maven { url 'https://repo.eclipse.org/content/groups/releases/' }
23-
2422
}
2523

2624
dependencies {
@@ -31,17 +29,9 @@ dependencies {
3129
implementation 'com.github.fwcd.kotlin-language-server:shared:229c762a4d75304d21eba6d8e1231ed949247629'
3230
// The Java Debug Interface classes (com.sun.jdi.*)
3331
implementation files("${System.properties['java.home']}/../lib/tools.jar")
34-
// The Implementation of jdi by eclipse
35-
// implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.debug', version: '3.15.100'
36-
// Failed to use the one above because jdi.jar and jdimodel.jar are sub jars included in org.eclipse.jdt.debug-3.15.100.jar,
37-
// and cannot be recognized correctly.
38-
// TODO: a fix for this
39-
implementation files('lib/org.eclipse.jdt.debug-3.15.100.jdi.jar')
40-
implementation files('lib/org.eclipse.jdt.debug-3.15.100.jdimodel.jar')
41-
// For org.eclipse.osgi.util.NLS used in eclipse.jdt.debug
42-
implementation group: 'org.eclipse.platform', name: 'org.eclipse.osgi', version: '3.15.200'
43-
// For com.ibm.icu.text.DateFormat used in eclipse.jdt.debug
44-
implementation group: 'at.bestsolution.eclipse', name: 'com.ibm.icu.base', version: '54.1.1'
32+
// For CommandLineUtils.translateCommandLine
33+
// https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-utils
34+
implementation 'org.codehaus.plexus:plexus-utils:3.3.0'
4535
testImplementation 'junit:junit:4.12'
4636
testImplementation 'org.hamcrest:hamcrest-all:1.3'
4737
}

adapter/src/main/kotlin/com/sun/tools/jdi/KDACommandLineLauncher.kt

Lines changed: 0 additions & 298 deletions
This file was deleted.

adapter/src/main/kotlin/org/javacs/ktda/adapter/KotlinDebugAdapter.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.javacs.ktda.adapter
22

3-
import com.sun.tools.jdi.KDACommandLineLauncher
43
import java.util.concurrent.CompletableFuture
54
import java.util.concurrent.CompletableFuture.completedFuture
65
import java.io.InputStream

adapter/src/main/kotlin/org/javacs/ktda/jdi/launch/JDILauncher.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import org.javacs.ktda.core.launch.AttachConfiguration
77
import org.javacs.ktda.core.DebugContext
88
import org.javacs.ktda.util.KotlinDAException
99
import org.javacs.ktda.jdi.JDIDebuggee
10+
import com.sun.jdi.Bootstrap
1011
import com.sun.jdi.VirtualMachineManager
1112
import com.sun.jdi.connect.Connector
1213
import com.sun.jdi.connect.LaunchingConnector
1314
import com.sun.jdi.connect.AttachingConnector
14-
import com.sun.tools.jdi.KDACommandLineLauncher
1515
import java.io.File
1616
import java.nio.file.Path
1717
import java.nio.file.Files
@@ -23,8 +23,7 @@ class JDILauncher(
2323
private val modulePaths: String? = null
2424
) : DebugLauncher {
2525
private val vmManager: VirtualMachineManager
26-
//using our own manager to use KDALaunchingConnector
27-
get() = KDAVirtualMachineManager.manager()
26+
get() = Bootstrap.virtualMachineManager()
2827

2928
override fun launch(config: LaunchConfiguration, context: DebugContext): JDIDebuggee {
3029
val connector = createLaunchConnector()
@@ -55,7 +54,7 @@ class JDILauncher(
5554
args["options"]!!.setValue(formatOptions(config))
5655
args["main"]!!.setValue(formatMainClass(config))
5756
args["cwd"]!!.setValue(config.cwd.toAbsolutePath().toString())
58-
args["envs"]!!.setValue(KDALaunchingConnector.urlEncode(config.envs) ?: "")
57+
args["envs"]!!.setValue(KDACommandLineLauncher.urlEncode(config.envs) ?: "")
5958
}
6059

6160
private fun createAttachArgs(config: AttachConfiguration, connector: Connector): Map<String, Connector.Argument> = connector.defaultArguments()
@@ -71,7 +70,7 @@ class JDILauncher(
7170

7271
private fun createLaunchConnector(): LaunchingConnector = vmManager.launchingConnectors()
7372
// Using our own connector to support cwd and envs
74-
.let { it.find { it.name().equals(KDALaunchingConnector::class.java.name) } ?: it.firstOrNull() }
73+
.let { it.find { it.name().equals(KDACommandLineLauncher::class.java.name) } ?: it.firstOrNull() }
7574
?: throw KotlinDAException("Could not find a launching connector (for a new debuggee VM)")
7675

7776
private fun sourcesRootsOf(projectRoot: Path): Set<Path> = projectRoot.resolve("src")

0 commit comments

Comments
 (0)