Skip to content

[TS-38628] [Agent] Kotlin Migration#855

Open
Avanatiker wants to merge 37 commits intomasterfrom
ts/38628_kotlin_agent_migration
Open

[TS-38628] [Agent] Kotlin Migration#855
Avanatiker wants to merge 37 commits intomasterfrom
ts/38628_kotlin_agent_migration

Conversation

@Avanatiker
Copy link
Copy Markdown
Member

Migrating the agent to kotlin

@Avanatiker Avanatiker marked this pull request as ready for review April 16, 2026 10:45
Comment thread agent/src/main/kotlin/com/teamscale/jacoco/agent/Main.kt
Comment thread agent/src/main/kotlin/com/teamscale/jacoco/agent/PreMain.kt
inputStream: JarInputStream,
archiveName: String?,
recursiveSearch: Boolean,
isRootArchive: Boolean = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity: Why was this needed? The Java version didn't have that parameter.

// vfs:/content/helloworld.war/WEB-INF/classes
// Next, we try to extract the artefact URL from it, e.g., vfs:/content/helloworld.war
val artefactUrl = extractArtefactUrl(jarOrClassFolderUrl)
val virtualFile = URI.create(artefactUrl).toURL().openConnection().getContent()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URI.create is stricter about percent-encoding compared to new URL and JBoss VFS-style URLs with literal spaces may now throw.

*/
abstract class AgentBase(
/** The agent options. */
@JvmField var options: AgentOptions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need @JvmField? Same for controller?

/**
* Static setter to inject the [TestwiseCoverageAgent] to the resource.
*/
@JvmStatic
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

if (options.teamscaleServer.configId == null) return
if (!options.teamscaleServer.isConfiguredForServerConnection) {
throw AgentOptionParseException(
"Config-id '${options.teamscaleServer.configId}' specified without teamscale url/user/accessKey! These options must be provided locally via config-file or command line argument."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message was much more specific on master compared to this version here.

"Config-id '" + options.teamscaleServer.configId + "' specified but the following required option(s) are missing: " + String.join(", ", missingOptions) + ". These options must be provided locally via config-file or command line argument.");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants