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

Merged
merged 31 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
20d0982
TS-38628 Impacted Test Engine Tests migration
Avanatiker Dec 1, 2024
b8c1d3b
TS-38628 Migrate commons
Avanatiker Dec 1, 2024
d5b37d1
TS-38628 Resolver migration
Avanatiker Dec 3, 2024
b171c3d
TS-38628 Cleanup tests
Avanatiker Dec 3, 2024
2b76f2a
TS-38628 Refactor test descriptors
Avanatiker Dec 3, 2024
c8ec448
TS-38628 Option migration
Avanatiker Dec 3, 2024
0f6cbf0
TS-38628 AvailableTests migration
Avanatiker Dec 3, 2024
9abca7e
TS-38628 Dynamic logger creation
Avanatiker Dec 4, 2024
5579895
TS-38628 Sorter listener migration
Avanatiker Dec 4, 2024
1f80e95
TS-38628 Broken mockito
Avanatiker Dec 4, 2024
779dab1
TS-38628 Remove mockito kotlin
Avanatiker Dec 4, 2024
69c3273
TS-38628 Update Mockito 4.11.0 -> 5.4.0 and Mockito Kotlin
Avanatiker Dec 4, 2024
22a9e1a
TS-38628 Run tests using Java 21 to allow newer Mockito versions
DreierF Dec 5, 2024
01183b2
TS-38628 Fix some test failures
Avanatiker Dec 9, 2024
be430f4
TS-38628 Fix marker collisions
Avanatiker Dec 12, 2024
03e1dc8
TS-38628 Migrate ImpactedTestEngine mocks to kotlin mocks
Avanatiker Dec 13, 2024
68181f5
TS-38628 Migrate ImpactedTestEngine class
Avanatiker Dec 13, 2024
12d4308
TS-38628 Registry and reworked builder pattern
Avanatiker Dec 13, 2024
2c58ab9
TS-38628 Fix null partition
DreierF Dec 13, 2024
b8e441f
TS-38628 Remove native Mockito mock call
Avanatiker Dec 14, 2024
c7cf5ac
TS-38628 Enhance test verification for execution listener callbacks
Avanatiker Dec 14, 2024
09ea65f
TS-38628 Static logging
Avanatiker Dec 20, 2024
1670c2e
TS-38628 Reduce builder overhead and improve typesafety
Avanatiker Dec 20, 2024
3b37ede
TS-38628 Explicit API visibility
Avanatiker Jan 6, 2025
4be0d76
TS-38628 Update some docs
Avanatiker Jan 6, 2025
5b6f553
Merge remote-tracking branch 'origin/master' into ts/38628
Avanatiker Jan 6, 2025
dcb8bf2
TS-38628 Even more docs
Avanatiker Jan 6, 2025
e987641
TS-38628 Fixed configuration condition for TIA execution
DreierF Jan 16, 2025
5a60708
TS-38628 Resolve Dockerfile findings use infix for property writing
Avanatiker Jan 19, 2025
e2f36a6
TS-38628 Missing Interface Comment
Avanatiker Jan 19, 2025
08c18ea
TS-38628 Remove Docker code duplication
Avanatiker Jan 19, 2025
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
16 changes: 13 additions & 3 deletions agent/src/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# --- build image ---

FROM openjdk:17 as build
FROM openjdk:21 AS build
# install xargs which is needed during the build
RUN microdnf install findutils
ADD . /src
WORKDIR /src
RUN ./gradlew :agent:shadowJar

# --- production image ---

FROM alpine:latest

RUN mkdir -p /agent
Expand All @@ -19,4 +18,15 @@ VOLUME /agent
# 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"
COPY <<EOT /entrypoint.sh
#!/bin/sh
if [ -e /transfer ]; then
cp -r /agent/teamscale-jacoco-agent.jar /transfer
exit 0
fi
trap : TERM INT
sleep infinity & wait
EOT
RUN chmod +x /entrypoint.sh

CMD ["/entrypoint.sh"]
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 @@ -12,4 +12,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,10 @@ public static List<Path> getReportFileNames(String mavenProjectPath) throws IOEx
}
}

private interface AgentService {
/**
* Interface for interacting with an agent service that enables coverage dumping and partition management.
*/
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.4"
junitPlatform = "1.11.4"
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.1" }

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