-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Kotlin DSL for gradle scripts (#81)
* Use Kotlin DSL for gradle scripts * Made the shared module import work with latest kotlin-language-server main * Add java version specifier to build pipeline * Experiment with disabling daemon for test invoking gradle * Remove copy-paste from kotlin language server
- Loading branch information
Showing
7 changed files
with
111 additions
and
66 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 was deleted.
Oops, something went wrong.
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 @@ | ||
plugins { | ||
kotlin("jvm") | ||
id("maven-publish") | ||
id("application") | ||
id("com.jaredsburrows.license") | ||
} | ||
|
||
val debugPort = 8000 | ||
val debugArgs = "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n,quiet=y" | ||
|
||
val adapterMainClassName = "org.javacs.ktda.KDAMainKt" | ||
|
||
application { | ||
mainClass.set(adapterMainClassName) | ||
description = "Debug Adapter for Kotlin" | ||
applicationDistribution.into("bin") { | ||
fileMode = 755 | ||
} | ||
} | ||
|
||
dependencies { | ||
// The JSON-RPC and Debug Adapter Protocol implementations | ||
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j.debug:0.15.0") | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib") | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
implementation("kotlin-language-server:shared") | ||
|
||
// modules temporarily needed because of shared module import above | ||
implementation("org.jetbrains.exposed:exposed-core:0.37.3") | ||
implementation("org.jetbrains.exposed:exposed-dao:0.37.3") | ||
|
||
|
||
testImplementation("junit:junit:4.12") | ||
testImplementation("org.hamcrest:hamcrest-all:1.3") | ||
} | ||
|
||
tasks.startScripts { | ||
applicationName = "kotlin-debug-adapter" | ||
} | ||
|
||
tasks.register<Exec>("fixFilePermissions") { | ||
// When running on macOS or Linux the start script | ||
// needs executable permissions to run. | ||
|
||
onlyIf { !System.getProperty("os.name").lowercase().contains("windows") } | ||
commandLine("chmod", "+x", "${tasks.installDist.get().destinationDir}/bin/kotlin-debug-adapter") | ||
} | ||
|
||
tasks.register<JavaExec>("debugRun") { | ||
mainClass.set(adapterMainClassName) | ||
classpath(sourceSets.main.get().runtimeClasspath) | ||
standardInput = System.`in` | ||
|
||
jvmArgs(debugArgs) | ||
doLast { | ||
println("Using debug port $debugPort") | ||
} | ||
} | ||
|
||
tasks.register<CreateStartScripts>("debugStartScripts") { | ||
applicationName = "kotlin-debug-adapter" | ||
mainClass.set(adapterMainClassName) | ||
outputDir = tasks.installDist.get().destinationDir.toPath().resolve("bin").toFile() | ||
classpath = tasks.startScripts.get().classpath | ||
defaultJvmOpts = listOf(debugArgs) | ||
} | ||
|
||
tasks.register<Sync>("installDebugDist") { | ||
dependsOn("installDist") | ||
finalizedBy("debugStartScripts") | ||
} | ||
|
||
tasks.withType<Test>() { | ||
testLogging { | ||
events("failed") | ||
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.SHORT | ||
} | ||
} | ||
|
||
tasks.installDist { | ||
finalizedBy("fixFilePermissions") | ||
} | ||
|
||
tasks.build { | ||
finalizedBy("installDist") | ||
} |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
plugins { | ||
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion" | ||
kotlin("jvm") | ||
`maven-publish` | ||
} | ||
|
||
allprojects { | ||
|
This file was deleted.
Oops, something went wrong.
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,21 @@ | ||
rootProject.name = "kotlin-debug-adapter" | ||
|
||
include("adapter") | ||
|
||
pluginManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
} | ||
|
||
plugins { | ||
val kotlinVersion: String by settings | ||
kotlin("jvm") version "$kotlinVersion" apply false | ||
id("com.jaredsburrows.license") version "0.8.42" apply false | ||
} | ||
} | ||
|
||
sourceControl { | ||
gitRepository(java.net.URI.create("https://github.com/fwcd/kotlin-language-server.git")) { | ||
producesModule("kotlin-language-server:shared") | ||
} | ||
} |