Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions build-logic/conventions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
`kotlin-dsl`
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlin {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package datadog.buildlogic.mass

import javax.inject.Inject
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.ProviderFactory

open class MassExtension
@Inject
constructor(objects: ObjectFactory, providers: ProviderFactory) {
val readUrl: Property<String> =
objects.property(String::class.java).convention(providers.environmentVariable("MASS_READ_URL"))

fun artifactUrl(upstreamArtifactUrl: String): String {
val massReadUrl = readUrl.orNull ?: return "https://$upstreamArtifactUrl"
val baseUrl = if (massReadUrl.endsWith("/")) massReadUrl else "$massReadUrl/"
return "${baseUrl}internal/artifact/$upstreamArtifactUrl"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import datadog.buildlogic.mass.MassExtension
import org.gradle.kotlin.dsl.create

extensions.create<MassExtension>("mass")
1 change: 1 addition & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ dependencyResolutionManagement {

rootProject.name = "build-logic"

include(":conventions")
Copy link
Copy Markdown
Contributor Author

@bric3 bric3 Jun 4, 2026

Choose a reason for hiding this comment

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

note: Future home of the existing convention plugins, but only when we got rid of script plugins 🥺.

include(":smoke-test")
15 changes: 5 additions & 10 deletions dd-java-agent/instrumentation/cics-9.1/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
id 'dd-trace-java.mass'
}

apply from: "$rootDir/gradle/java.gradle"

// Configuration for downloading CICS SDK from IBM
Expand All @@ -6,18 +10,9 @@ ext {
cicsSdkName = 'CICS_TG_SDK_91_Unix'
}

def massArtifactUrl = { String upstreamArtifactUrl ->
def massReadUrl = providers.environmentVariable('MASS_READ_URL').orNull
if (massReadUrl == null) {
return "https://${upstreamArtifactUrl}"
}
def baseUrl = massReadUrl.endsWith('/') ? massReadUrl : "${massReadUrl}/"
return "${baseUrl}internal/artifact/${upstreamArtifactUrl}"
}

repositories {
ivy {
url = massArtifactUrl('public.dhe.ibm.com/software/htp/cics/support/supportpacs/individual/')
url = mass.artifactUrl('public.dhe.ibm.com/software/htp/cics/support/supportpacs/individual/')
patternLayout {
artifact '[module].[ext]'
}
Expand Down
12 changes: 2 additions & 10 deletions dd-smoke-tests/rum/wildfly-15/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import datadog.buildlogic.smoketest.NestedGradleBuild

plugins {
id 'dd-trace-java.smoke-test-app'
id 'dd-trace-java.mass'
}

ext {
Expand All @@ -12,18 +13,9 @@ ext {
serverExtension = 'zip'
}

def massArtifactUrl = { String upstreamArtifactUrl ->
def massReadUrl = providers.environmentVariable('MASS_READ_URL').orNull
if (massReadUrl == null) {
return "https://${upstreamArtifactUrl}"
}
def baseUrl = massReadUrl.endsWith('/') ? massReadUrl : "${massReadUrl}/"
return "${baseUrl}internal/artifact/${upstreamArtifactUrl}"
}

repositories {
ivy {
url = massArtifactUrl('github.com/wildfly/wildfly/releases/download/')
url = mass.artifactUrl('github.com/wildfly/wildfly/releases/download/')
// Restrict this repository to WildFly distribution artifacts only.
// Without this filter, Gradle may probe this host for unrelated dependencies
// (for example JUnit/Mockito), which makes the build flaky when the host is unreachable.
Expand Down
75 changes: 2 additions & 73 deletions dd-smoke-tests/springboot-tomcat/application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,78 +21,7 @@ java {
sourceCompatibility = JavaVersion.VERSION_1_8
}

ext {
serverName = 'tomcat'
serverModule = 'tomcat-9'
serverVersion = '9.0.117'
serverExtension = 'zip'
}

def massArtifactUrl = { String upstreamArtifactUrl ->
def massReadUrl = providers.environmentVariable('MASS_READ_URL').orNull
if (massReadUrl == null) {
return "https://${upstreamArtifactUrl}"
}
def baseUrl = massReadUrl.endsWith('/') ? massReadUrl : "${massReadUrl}/"
return "${baseUrl}internal/artifact/${upstreamArtifactUrl}"
}

repositories {
ivy {
url = massArtifactUrl('dlcdn.apache.org')
patternLayout {
artifact '/[organisation]/[module]/v[revision]/bin/apache-[organisation]-[revision].[ext]'
}
metadataSources {
it.artifact()
}
}
}

configurations {
serverFile {
extendsFrom implementation
canBeResolved = true
}
}

dependencies {
// uses the ivy repository url to download the tomcat server
// organisation = serverName, revision = serverVersion, module = serverModule, ext = serverExtension
serverFile "${serverName}:${serverModule}:${serverVersion}@${serverExtension}"

implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.5.12'
providedRuntime group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: '2.5.12'
}

tasks.register("unzip", Copy) {
def zipFileNamePrefix = "tomcat"
def serverZipTree = providers.provider {
// eager access
def zipPath = project.configurations.serverFile.find {
it.name.startsWith(zipFileNamePrefix)
}
if (zipPath == null) {
throw new GradleException("Can't find server zip file that starts with: " + zipFileNamePrefix)
}
zipTree(zipPath)
}

from serverZipTree
into layout.buildDirectory

// When tests are disabled this would still be run, so disable this manually
onlyIf { !project.rootProject.hasProperty("skipTests") }
}

tasks.named('bootWar') {
dependsOn 'unzip'
}

tasks.named('bootWarMainClassName') {
dependsOn 'unzip'
}

tasks.named('war') {
dependsOn 'unzip'
implementation 'org.springframework.boot:spring-boot-starter-web:2.5.12'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat:2.5.12'
}
70 changes: 69 additions & 1 deletion dd-smoke-tests/springboot-tomcat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,96 @@
plugins {
id 'dd-trace-java.smoke-test-app'
id 'dd-trace-java.mass'
}

apply from: "$rootDir/gradle/java.gradle"

description = 'SpringBoot Tomcat Smoke Tests.'

def serverName = 'tomcat'
def serverModule = 'tomcat-9'
def serverVersion = '9.0.117'
def serverExtension = 'zip'

repositories {
ivy {
url = mass.artifactUrl('dlcdn.apache.org')
content {
includeGroup serverName
}
patternLayout {
artifact '/[organisation]/[module]/v[revision]/bin/apache-[organisation]-[revision].[ext]'
}
metadataSources {
it.artifact()
}
}
}

configurations {
register('serverFile') {
canBeConsumed = false
canBeResolved = true
}
}

smokeTestApp {
application {
taskName = 'bootWar'
artifactPath = 'libs/springboot-tomcat-smoketest.war'
sysProperty = 'datadog.smoketest.springboot.war.path'
additionalSystemProperties.put('datadog.smoketest.tomcatDir', "apache-${serverName}-${serverVersion}")
}
}

dependencies {
// Uses the ivy repository url to download the Tomcat server zip.
// organisation = serverName, module = serverModule, revision = serverVersion,
// ext = serverExtension
serverFile "${serverName}:${serverModule}:${serverVersion}@${serverExtension}"

testImplementation project(':dd-smoke-tests')
testImplementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
}

def serverDirectory = layout.buildDirectory.dir("server")

tasks.register("unzip", Copy) {
def zipFileNamePrefix = "tomcat"
def serverZipTree = providers.provider {
// eager access
def zipPath = project.configurations.serverFile.find {
it.name.startsWith(zipFileNamePrefix)
}
if (zipPath == null) {
throw new GradleException("Can't find server zip file that starts with: " + zipFileNamePrefix)
}
zipTree(zipPath)
}

from serverZipTree
into serverDirectory

// When tests are disabled this would still be run, so disable this manually
onlyIf { !project.rootProject.hasProperty("skipTests") }
}

def tomcatDir = serverDirectory.map {
it.dir("apache-${serverName}-${serverVersion}")
}

tasks.withType(Test).configureEach {
dependsOn 'unzip'

jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
return tomcatDir.map {
["-Ddatadog.smoketest.tomcatDir=${it.asFile.absolutePath}"]
}.get()
}
})
}

spotless {
java {
target "**/*.java"
Expand Down
1 change: 1 addition & 0 deletions dd-smoke-tests/springboot-tomcat/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,5 @@ org.spockframework:spock-core:2.4-groovy-3.0=testCompileClasspath,testRuntimeCla
org.tabletest:tabletest-junit:1.2.1=testCompileClasspath,testRuntimeClasspath
org.tabletest:tabletest-parser:1.2.0=testCompileClasspath,testRuntimeClasspath
org.xmlresolver:xmlresolver:5.3.3=spotbugs
tomcat:tomcat-9:9.0.117=serverFile
empty=annotationProcessor,runtimeClasspath,spotbugsPlugins,testAnnotationProcessor
12 changes: 2 additions & 10 deletions dd-smoke-tests/wildfly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import datadog.buildlogic.smoketest.NestedGradleBuild

plugins {
id 'dd-trace-java.smoke-test-app'
id 'dd-trace-java.mass'
}

ext {
Expand All @@ -12,18 +13,9 @@ ext {
serverExtension = 'zip'
}

def massArtifactUrl = { String upstreamArtifactUrl ->
def massReadUrl = providers.environmentVariable('MASS_READ_URL').orNull
if (massReadUrl == null) {
return "https://${upstreamArtifactUrl}"
}
def baseUrl = massReadUrl.endsWith('/') ? massReadUrl : "${massReadUrl}/"
return "${baseUrl}internal/artifact/${upstreamArtifactUrl}"
}

repositories {
ivy {
url = massArtifactUrl('github.com/wildfly/wildfly/releases/download/')
url = mass.artifactUrl('github.com/wildfly/wildfly/releases/download/')
// Restrict this repository to WildFly distribution artifacts only.
// Without this filter, Gradle may probe this host for unrelated dependencies
// (for example JUnit/Mockito), which makes the build flaky when the host is unreachable.
Expand Down