Skip to content

Commit

Permalink
Merge pull request #241 from cqse/ts/34214_update
Browse files Browse the repository at this point in the history
TS-34214 Update dependencies
  • Loading branch information
AnonymFx committed May 3, 2023
2 parents aa23b1e + 0b40c27 commit ed1d746
Show file tree
Hide file tree
Showing 81 changed files with 891 additions and 855 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
report-generator/test-coverage-*.xml
gradle.properties
**/maven-wrapper.jar
**/logTest/**
**/jacoco.exec
17 changes: 0 additions & 17 deletions .project

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ Only use GitHub releases in production. This ensures that we always know which c

### Compiling for a different JaCoCo version

* change `ext.jacocoVersion` in the build script
* change `jacoco` in `gradle/libs.versions.toml`
* `./gradlew dist`
* **Do not commit unless you are upgrading to a newer version!**
105 changes: 0 additions & 105 deletions agent/build.gradle

This file was deleted.

107 changes: 107 additions & 0 deletions agent/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
plugins {
com.teamscale.`java-convention`
alias(libs.plugins.markdownToPdf)
application

// we don't want to cause conflicts between our dependencies and the target application
// since the agent will be loaded with the same class loader as the profiled application
// so we use the shadow plugin to relocate our dependencies
com.teamscale.`shadow-convention`
com.teamscale.coverage
com.teamscale.publish
}

publishAs {
artifactId.set("teamscale-jacoco-agent")
readableName.set("Teamscale JaCoCo Agent")
description.set("JVM profiler that simplifies various aspects around recording and uploading test coverage")
}

val appVersion = rootProject.extra("appVersion").toString()
val jacocoVersion = libs.versions.jacoco.get()
val outputVersion = "$appVersion-jacoco-$jacocoVersion"

dependencies {
implementation(libs.jetty.server)
implementation(libs.jetty.servlet)

implementation(libs.jersey.server)
implementation(libs.jersey.containerServletCore)
implementation(libs.jersey.containerJettyHttp)
implementation(libs.jersey.mediaJsonJackson)
implementation(libs.jersey.hk2)

implementation(project(":teamscale-client"))
implementation(project(":report-generator"))

implementation(libs.jacoco.core)
implementation(libs.jacoco.report)
implementation(libs.jacoco.agent) {
artifact {
classifier = "runtime"
}
}

implementation(libs.logback.core)
implementation(libs.logback.classic)

implementation(libs.jcommander)
implementation(libs.teamscaleLibCommons)

implementation(libs.retrofit.core)

implementation(libs.moshi)

testImplementation(project(":tia-client"))
testImplementation(libs.retrofit.converter.moshi)
testImplementation(libs.okhttp.mockwebserver)
}

application {
mainClass.set("com.teamscale.jacoco.agent.Main")
}

tasks.shadowJar {
// since this is used as an agent, we want it to always have the same name
// otherwise people have to adjust their -javaagent parameters after every
// update
archiveFileName.set("teamscale-jacoco-agent.jar")

manifest {
attributes["Premain-Class"] = "com.teamscale.jacoco.agent.PreMain"
}
}

tasks.startShadowScripts {
applicationName = "convert"
}

distributions {
named("shadow") {
distributionBaseName.set("teamscale-jacoco-agent")
contents {
from(tasks.readmeToPdf) {
into("documentation")
rename("README.pdf", "userguide.pdf")
}

filesMatching("**/VERSION.txt") {
filter {
it.replace("%APP_VERSION_TOKEN_REPLACED_DURING_BUILD%", outputVersion)
}
}
}
}
}

tasks.shadowDistZip {
archiveFileName.set("teamscale-jacoco-agent.zip")
}

tasks.processResources {
filesMatching("**/app.properties") {
filter {
it.replace("%APP_VERSION_TOKEN_REPLACED_DURING_BUILD%", appVersion)
}
}
}
57 changes: 0 additions & 57 deletions build.gradle

This file was deleted.

37 changes: 37 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
plugins {
alias(libs.plugins.versions)
alias(libs.plugins.nexusPublish)
}

group = "com.teamscale"

val appVersion by extra("29.1.3")

val snapshotVersion = appVersion + if (VersionUtils.isTaggedRelease()) "" else "-SNAPSHOT"

allprojects {
version = snapshotVersion
}

// Installs all Maven artifacts to your local Maven repository
val publishToMavenLocal by tasks.registering

subprojects {
// must be run after evaluation because the publishToMavenLocal tasks are generated by our plugin during
// project evaluation
afterEvaluate {
val publishTask = tasks.findByPath("publishToMavenLocal")
if (publishTask != null) {
publishToMavenLocal.configure {
dependsOn(publishTask)
}
}
}
}

nexusPublishing {
repositories {
sonatype()
}
}

7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
16 changes: 16 additions & 0 deletions buildSrc/src/main/kotlin/TestExtension.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.get
import java.io.File

/** Determines the file under which the shadowJar task will store the final Teamscale JaCoCo Agent jar. */
val Test.agentJar: File
get() {
return project.project(":agent").tasks["shadowJar"].outputs.files.singleFile
}

/** Adds a convenient way to attach the Teamscale JaCoCo agent to the test JVM with the given options in a readable map format. */
fun Test.teamscaleAgent(options: Map<String, String>) {
jvmArgs(
"-javaagent:$agentJar=${options.entries.joinToString(separator = ",") { "${it.key}=${it.value}" }}"
)
}

0 comments on commit ed1d746

Please sign in to comment.