Skip to content

Commit

Permalink
extract testing library to its own module
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Azpillaga Aldalur committed Feb 22, 2024
1 parent 1182fe7 commit 322336b
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 69 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
59 changes: 2 additions & 57 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Jar>("testingJar") {
from(tasks.getByName("compileTestKotlin"))
archiveBaseName = "library-testing"
}

tasks.register<Jar>("testingSourcesJar") {
from(tasks.getByName("compileTestKotlin").outputs)
archiveBaseName = "library-testing"
archiveClassifier = "sources"
}

tasks.register<Jar>("testingJavadocJar") {
archiveBaseName = "library-testing"
archiveClassifier = "javadoc"
}

java {
Expand All @@ -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
}
}
}
Expand Down Expand Up @@ -91,45 +71,10 @@ publishing {
developerConnection = "scm:git:ssh:github.com/Strumenta/kolasu-languageserver-library.git"
}
}
create<MavenPublication>("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 = "[email protected]"
}
}
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"))
}
2 changes: 1 addition & 1 deletion plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ class LanguageServerPlugin : Plugin<Project?> {

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()
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
80 changes: 80 additions & 0 deletions testing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<MavenPublication>("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 = "[email protected]"
}
}
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"))
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.strumenta.kolasu.languageserver.testing
package testing

import org.eclipse.lsp4j.MessageActionItem
import org.eclipse.lsp4j.MessageParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.strumenta.kolasu.languageserver.testing
package testing

import com.google.gson.JsonObject
import com.strumenta.kolasu.languageserver.CodeGenerator
Expand Down

0 comments on commit 322336b

Please sign in to comment.