Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS-38628] [Impacted Test Engine] Kotlin Migration #618

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
- name: Build with Gradle
run: ./gradlew build
- name: Upload Release Assets
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
- name: Build with Gradle
run: ./gradlew build
- name: Upload coverage to Teamscale
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gradle/
.kotlin/
**/build/**
**/out/**
/*/bin/
Expand Down
2 changes: 1 addition & 1 deletion agent/src/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# --- build image ---

FROM openjdk:17 as build
FROM openjdk:21 as build

Check warning on line 3 in agent/src/docker/Dockerfile

View workflow job for this annotation

GitHub Actions / docker

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
# install xargs which is needed during the build
RUN microdnf install findutils
ADD . /src
Expand All @@ -19,4 +19,4 @@
# make the image do nothing when started
# except if /transfer is mounted, then copy the agent there and exit immediately
# this lets us use the image as an init container in Kubernetes
CMD exec /bin/sh -c "[ -e /transfer ] && cp -r /agent/teamscale-jacoco-agent.jar /transfer && exit 0 ; trap : TERM INT; sleep infinity & wait"

Check warning on line 22 in agent/src/docker/Dockerfile

View workflow job for this annotation

GitHub Actions / docker

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static IRuntime createRuntime(final Instrumentation inst)
final Class<InjectedClassRuntime> clazz = module
.loadClassInModule(InjectedClassRuntime.class);
return clazz.getConstructor(Class.class, String.class)
.newInstance(Object.class, "$JaCoCo");
.newInstance(Object.class, "$TeamscaleJaCoCo");
}

return ModifiedSystemClassRuntime.createFor(inst,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static List<Pair<String, Properties>> findGitPropertiesInArchive(
}

/**
* Returns the CommitInfo (revision & branch + timestmap) from a git properties file. The revision can be either in
* Returns the CommitInfo (revision and branch + timestmap) from a git properties file. The revision can be either in
* {@link #GIT_PROPERTIES_GIT_COMMIT_ID} or {@link #GIT_PROPERTIES_GIT_COMMIT_ID_FULL}. The branch and timestamp in
* {@link #GIT_PROPERTIES_GIT_BRANCH} + {@link #GIT_PROPERTIES_GIT_COMMIT_TIME} or in
* {@link #GIT_PROPERTIES_TEAMSCALE_COMMIT_BRANCH} + {@link #GIT_PROPERTIES_TEAMSCALE_COMMIT_TIME}. By default,
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
alias(libs.plugins.versions)
alias(libs.plugins.nexusPublish)
kotlin("jvm") apply false
}

group = "com.teamscale"
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ dependencies {

implementation("org.ow2.asm:asm:9.7.1")
implementation("org.ow2.asm:asm-commons:9.7.1")
implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:2.0.20")
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ repositories {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(21))
}
}

tasks.compileJava {
options.release = 8
options.compilerArgs.add("-Xlint:-options")
}

tasks.compileTestJava {
options.release = 21
}

tasks.test {
useJUnitPlatform {
excludeEngines("teamscale-test-impacted")
Expand All @@ -33,6 +42,7 @@ dependencies {
testImplementation(lib("assertj"))
testImplementation(lib("mockito-core"))
testImplementation(lib("mockito-junit"))
testImplementation(lib("mockito-kotlin"))

testRuntimeOnly(lib("junit-platform-launcher"))
testRuntimeOnly(lib("junit-jupiter-engine"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import org.gradle.kotlin.dsl.kotlin
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
kotlin("jvm")
id("com.teamscale.java-convention")
}

tasks.compileKotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static List<Path> getReportFileNames(String mavenProjectPath) throws IOEx
}
}

private interface AgentService {
public interface AgentService {
/** Dumps coverage */
@POST("/dump")
Call<Void> dump();
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ retrofit = "2.11.0"
junit = "5.11.3"
junitPlatform = "1.11.3"
okhttp = "4.12.0"
mockito = "4.11.0"
mockito = "5.12.0"
mockitoKotlin = "5.4.0"
picocli = "4.7.6"

[libraries]
Expand Down Expand Up @@ -75,6 +76,7 @@ jsonassert = { module = "org.skyscreamer:jsonassert", version = "1.5.3" }

mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
mockito-junit = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" }
mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockitoKotlin" }

springboot-loader = { module = "org.springframework.boot:spring-boot-loader", version = "3.4.0" }

Expand Down
5 changes: 3 additions & 2 deletions impacted-test-engine/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
`java-library`
com.teamscale.`java-convention`
com.teamscale.`kotlin-convention`
com.teamscale.coverage
com.teamscale.`shadow-convention`
com.teamscale.publish
Expand All @@ -18,6 +18,7 @@ dependencies {

compileOnly(libs.junit.platform.engine)
compileOnly(libs.junit.platform.commons)
testImplementation(libs.junit.platform.engine)
testImplementation(libs.junit.platform.engine)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.mockito.kotlin)
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading