diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index af39804..e1becaf 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,15 +18,9 @@ jobs: with: distribution: 'adopt' java-version: ${{ matrix.java }} - - name: Install Gradle - run: | - curl -s "https://get.sdkman.io" | bash - source "$HOME/.sdkman/bin/sdkman-init.sh" - sdk install gradle 8.3 - name: Build env: STRUMENTA_PACKAGES_USER: ${{ secrets.STRUMENTA_PACKAGES_USER }} STRUMENTA_PACKAGES_TOKEN: ${{ secrets.STRUMENTA_PACKAGES_TOKEN }} run: | - cd library && gradle build --console=plain --stacktrace - cd ../plugin && gradle build --console=plain --stacktrace + ./gradlew build --console=plain --stacktrace diff --git a/library/build.gradle.kts b/library/build.gradle.kts index bad1c7f..ed53a7d 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -13,29 +13,9 @@ repositories { dependencies { implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.21") - implementation("com.strumenta.kolasu:kolasu-core:1.5.31") implementation("org.eclipse.lsp4j:org.eclipse.lsp4j:0.21.1") implementation("org.apache.lucene:lucene-core:9.8.0") - - testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.1") - testImplementation("org.junit.jupiter:junit-jupiter-engine:5.6.0") -} - -tasks.register("testingJar") { - from(tasks.getByName("compileTestKotlin")) - archiveBaseName = "library-testing" -} - -tasks.register("testingSourcesJar") { - from(tasks.getByName("compileTestKotlin").outputs) - archiveBaseName = "library-testing" - archiveClassifier = "sources" -} - -tasks.register("testingJavadocJar") { - archiveBaseName = "library-testing" - archiveClassifier = "javadoc" } java { @@ -52,8 +32,8 @@ publishing { val snapshotRepo = URI("https://oss.sonatype.org/content/repositories/snapshots/") url = if (isReleaseVersion) releaseRepo else snapshotRepo credentials { - username = project.properties["ossrhUsername"] as String - password = project.properties["ossrhPassword"] as String + username = project.properties["ossrhUsername"] as? String + password = project.properties["ossrhPassword"] as? String } } } @@ -91,45 +71,10 @@ publishing { developerConnection = "scm:git:ssh:github.com/Strumenta/kolasu-languageserver-library.git" } } - create("language-server-testing") { - groupId = "com.strumenta.kolasu.languageserver" - artifactId = "testing" - version = project.version as String - - artifact(tasks.getByName("testingJar")) - artifact(tasks.getByName("testingSourcesJar")) - artifact(tasks.getByName("testingJavadocJar")) - - pom { - name = "Kolasu language server testing" - description = "Testing helpers for Kolasu language server library" - inceptionYear = "2023" - url = "https://github.com/Strumenta/kolasu-languageserver-library" - licenses { - license { - name = "Apache License, Version 2.0" - url = "https://opensource.org/license/apache-2-0/" - } - } - developers { - developer { - id = "martin-azpillaga" - name = "Martin Azpillaga Aldalur" - email = "martin.azpillaga@strumenta.com" - } - } - scm { - url = "https://github.com/Strumenta/kolasu-languageserver-library.git" - connection = "scm:git:git:github.com/Strumenta/kolasu-languageserver-library.git" - developerConnection = "scm:git:ssh:github.com/Strumenta/kolasu-languageserver-library.git" - } - } - } } } } signing { sign(publishing.publications.getByName("language-server-library")) - sign(publishing.publications.getByName("language-server-testing")) } diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index ccfd540..b132865 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -21,7 +21,7 @@ gradlePlugin { website = "https://strumenta.com" vcsUrl = "https://github.com/Strumenta/kolasu-languageserver-library" plugins { - create("com.strumenta.kolasu.language-server-plugin") { + create("com.strumenta.kolasu.languageserver.plugin") { id = "com.strumenta.kolasu.languageserver.plugin" version = project.version displayName = "Kolasu language server plugin" diff --git a/plugin/src/main/kotlin/com/strumenta/kolasu/languageserver/plugin/LanguageServerPlugin.kt b/plugin/src/main/kotlin/com/strumenta/kolasu/languageserver/plugin/LanguageServerPlugin.kt index c4b74b9..dca03f2 100644 --- a/plugin/src/main/kotlin/com/strumenta/kolasu/languageserver/plugin/LanguageServerPlugin.kt +++ b/plugin/src/main/kotlin/com/strumenta/kolasu/languageserver/plugin/LanguageServerPlugin.kt @@ -221,8 +221,8 @@ class LanguageServerPlugin : Plugin { Files.copy(configuration.serverJarPath, Paths.get(configuration.outputPath.toString(), "server.jar"), StandardCopyOption.REPLACE_EXISTING) - val npm = if(isWindows()) "npm.cmd" else "npm" - val npx = if(isWindows()) "npx.cmd" else "npx" + val npm = if (isWindows()) "npm.cmd" else "npm" + val npx = if (isWindows()) "npx.cmd" else "npx" ProcessBuilder(npm, "install", "--prefix", "build/vscode/", "vscode-languageclient").directory(project.projectDir).start().waitFor() ProcessBuilder(npx, "esbuild", "build/vscode/client.js", "--bundle", "--external:vscode", "--format=cjs", "--platform=node", "--outfile=build/vscode/client.js", "--allow-overwrite").directory(project.projectDir).start().waitFor() diff --git a/settings.gradle.kts b/settings.gradle.kts index 6426f2b..9b37f14 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,8 @@ include("library") +include("testing") include("plugin") rootProject.name="kolasu-languageserver" project(":library").name = "kolasu-languageserver-library" +project(":testing").name = "kolasu-languageserver-testing" project(":plugin").name = "kolasu-languageserver-plugin" diff --git a/testing/build.gradle.kts b/testing/build.gradle.kts new file mode 100644 index 0000000..0e9664f --- /dev/null +++ b/testing/build.gradle.kts @@ -0,0 +1,80 @@ +import java.net.URI + +plugins { + id("org.jetbrains.kotlin.jvm") version "1.8.22" + id("org.jlleitschuh.gradle.ktlint") version "11.6.0" + id("maven-publish") + id("signing") +} + +repositories { + mavenCentral() +} + +dependencies { + implementation(project(":kolasu-languageserver-library")) + implementation("com.strumenta.kolasu:kolasu-core:1.5.31") + implementation("org.eclipse.lsp4j:org.eclipse.lsp4j:0.21.1") + implementation("org.junit.jupiter:junit-jupiter-api:5.7.1") +} + +java { + withSourcesJar() + withJavadocJar() +} + +val isReleaseVersion = !(project.version as String).endsWith("SNAPSHOT") + +publishing { + repositories { + maven { + val releaseRepo = URI("https://oss.sonatype.org/service/local/staging/deploy/maven2/") + val snapshotRepo = URI("https://oss.sonatype.org/content/repositories/snapshots/") + url = if (isReleaseVersion) releaseRepo else snapshotRepo + credentials { + username = project.properties["ossrhUsername"] as? String + password = project.properties["ossrhPassword"] as? String + } + } + } + publications { + create("language-server-testing") { + groupId = "com.strumenta.kolasu.languageserver" + artifactId = "testing" + version = project.version as String + + artifact(tasks.getByName("jar")) + artifact(tasks.getByName("sourcesJar")) + artifact(tasks.getByName("javadocJar")) + + pom { + name = "Kolasu language server testing" + description = "Test Kolasu language servers" + inceptionYear = "2023" + url = "https://github.com/Strumenta/kolasu-languageserver-library" + licenses { + license { + name = "Apache License, Version 2.0" + url = "https://opensource.org/license/apache-2-0/" + } + } + developers { + developer { + id = "martin-azpillaga" + name = "Martin Azpillaga Aldalur" + email = "martin.azpillaga@strumenta.com" + } + } + scm { + url = "https://github.com/Strumenta/kolasu-languageserver-library.git" + connection = "scm:git:git:github.com/Strumenta/kolasu-languageserver-library.git" + developerConnection = "scm:git:ssh:github.com/Strumenta/kolasu-languageserver-library.git" + } + } + } + } +} + +signing { + sign(publishing.publications.getByName("language-server-testing")) +} diff --git a/library/src/test/kotlin/com/strumenta/kolasu/languageserver/testing/DiagnosticListenerClient.kt b/testing/src/main/kotlin/testing/DiagnosticListenerClient.kt similarity index 96% rename from library/src/test/kotlin/com/strumenta/kolasu/languageserver/testing/DiagnosticListenerClient.kt rename to testing/src/main/kotlin/testing/DiagnosticListenerClient.kt index 6242ee6..da60c70 100644 --- a/library/src/test/kotlin/com/strumenta/kolasu/languageserver/testing/DiagnosticListenerClient.kt +++ b/testing/src/main/kotlin/testing/DiagnosticListenerClient.kt @@ -1,4 +1,4 @@ -package com.strumenta.kolasu.languageserver.testing +package testing import org.eclipse.lsp4j.MessageActionItem import org.eclipse.lsp4j.MessageParams diff --git a/library/src/test/kotlin/com/strumenta/kolasu/languageserver/testing/TestKolasuServer.kt b/testing/src/main/kotlin/testing/TestKolasuServer.kt similarity index 98% rename from library/src/test/kotlin/com/strumenta/kolasu/languageserver/testing/TestKolasuServer.kt rename to testing/src/main/kotlin/testing/TestKolasuServer.kt index 49a7228..dad0591 100644 --- a/library/src/test/kotlin/com/strumenta/kolasu/languageserver/testing/TestKolasuServer.kt +++ b/testing/src/main/kotlin/testing/TestKolasuServer.kt @@ -1,4 +1,4 @@ -package com.strumenta.kolasu.languageserver.testing +package testing import com.google.gson.JsonObject import com.strumenta.kolasu.languageserver.CodeGenerator