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
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/gradle
36 changes: 17 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ buildscript {
classpath(libs.junitGradlePlugin)
classpath(libs.kotlinGradlePlugin)
classpath(libs.mavenPublishGradlePlugin)
classpath(libs.shadowGradlePlugin)
classpath(libs.wireGradlePlugin)
}
}
Expand Down Expand Up @@ -100,26 +101,23 @@ subprojects {
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
}

// We have to set the dokka configuration after evaluation since the com.vanniktech.maven.publish
// plugin overwrites our dokka configuration on projects where it's applied.
afterEvaluate {
tasks.withType<DokkaTask>().configureEach {
val dokkaTask = this
dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(11)

externalDocumentationLink {
url.set(URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/"))
packageListUrl.set(
URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/package-list")
)
}
tasks.withType<DokkaTask>().configureEach {
val dokkaTask = this

if (dokkaTask.name == "dokkaGfm") {
outputDirectory.set(project.file("$rootDir/docs/1.x"))
}
if (dokkaTask.name == "dokkaGfm") {
outputDirectory.set(project.file("$rootDir/docs/1.x/${project.name}"))
}

dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(11)

externalDocumentationLink {
url.set(URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/"))
packageListUrl.set(
URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/package-list")
)
}
}
}
Expand Down
33 changes: 29 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
[versions]
aws2 = "2.31.30"
jackson = "2.14.3"
jetty = "12.0.9"
ktlint = "0.40.0"
kotlin = "1.9.23"
sqlite4java = "1.0.392"

[libraries]
antlr4Runtime = { module = "org.antlr:antlr4-runtime", version = "4.13.2" }
assertj = { module = "org.assertj:assertj-core", version = "3.23.1" }
aws2Dynamodb = { module = "software.amazon.awssdk:dynamodb", version = "2.25.11" }
aws2DynamodbEnhanced = { module = "software.amazon.awssdk:dynamodb-enhanced", version = "2.25.11" }
awsDynamodb = { module = "com.amazonaws:aws-java-sdk-dynamodb", version = "1.11.960" }
aws2Dynamodb = { module = "software.amazon.awssdk:dynamodb", version.ref = "aws2" }
aws2DynamodbEnhanced = { module = "software.amazon.awssdk:dynamodb-enhanced", version.ref = "aws2" }
aws2Pinpoint = { module = "software.amazon.awssdk:pinpoint", version.ref = "aws2" } # for DynamoDBLocal
awsDynamodb = { module = "com.amazonaws:aws-java-sdk-dynamodb", version = "1.12.782" }
awsDynamodbLocal = { module = "com.amazonaws:DynamoDBLocal", version = "2.6.0" }
clikt = { module = "com.github.ajalt:clikt", version = "2.8.0" }
commonsCli = { module = "commons-cli:commons-cli", version = "1.9.0" } # for DynamoDBLocal
commonsLang3 = { module = "org.apache.commons:commons-lang3", version = "3.17.0" } # for DynamoDBLocal
dokkaGradlePlugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.9.20" }
dockerCore = { module = "com.github.docker-java:docker-java-core", version = "3.2.13" }
dockerTransport = { module = "com.github.docker-java:docker-java-transport-httpclient5", version = "3.2.13" }
findbugsJsr305 = { module = "com.google.code.findbugs:jsr305", version = "3.0.2" }
guava = { module = "com.google.guava:guava", version = "31.0.1-jre" }
jacksonDatabind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" } # for DynamoDBLocal
jacksonDatatypeJsr310 = { module = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310", version.ref = "jackson" } # for DynamoDBLocal
jettyAlpnClient = { module = "org.eclipse.jetty:jetty-alpn-client", version.ref = "jetty" } # for DynamoDBLocal
jettyClient = { module = "org.eclipse.jetty:jetty-client", version.ref = "jetty" } # for DynamoDBLocal
jettyServer = { module = "org.eclipse.jetty:jetty-server", version.ref = "jetty" } # for DynamoDBLocal
junit4Api = { module = "junit:junit", version = "4.13.2" }
junitApi = { module = "org.junit.jupiter:junit-jupiter-api", version = "5.8.2" }
junitEngine = { module = "org.junit.jupiter:junit-jupiter-engine", version = "5.11.4" }
Expand All @@ -26,10 +39,22 @@ kotlinxCoroutinesJdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk
kotlinxCoroutinesReactive = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactive", version = "1.6.4" }
log4jCore = { module = "org.apache.logging.log4j:log4j-core", version = "2.17.1" }
loggingApi = { module = "io.github.microutils:kotlin-logging", version = "2.0.10" }
mavenPublishGradlePlugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.25.2" }
mavenPublishGradlePlugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.28.0" }
moshiCore = { module = "com.squareup.moshi:moshi", version = "1.15.2" }
moshiKotlin = { module = "com.squareup.moshi:moshi-kotlin", version = "1.15.2" }
nettyBom = { module = "io.netty:netty-bom", version = "4.1.79.Final" }
okio = { module = "com.squareup.okio:okio", version = "3.4.0" }
okioFakefilesystem = { module = "com.squareup.okio:okio-fakefilesystem", version = "3.4.0" }
shadowGradlePlugin = { module = "com.gradleup.shadow:shadow-gradle-plugin", version = "8.3.6" }
slf4jApi = { module = "org.slf4j:slf4j-api", version = "2.0.17" } # for DynamoDBLocal
sqlite4javaLinuxI386 = { module = "com.almworks.sqlite4java:libsqlite4java-linux-i386", version.ref = "sqlite4java" } # for DynamoDBLocal
sqlite4javaLinuxAmd64 = { module = "com.almworks.sqlite4java:libsqlite4java-linux-amd64", version.ref = "sqlite4java" } # for DynamoDBLocal
sqlite4javaOsx = { module = "com.almworks.sqlite4java:libsqlite4java-osx", version.ref = "sqlite4java" } # for DynamoDBLocal
sqlite4javaWinX64 = { module = "com.almworks.sqlite4java:sqlite4java-win32-x64", version.ref = "sqlite4java" } # for DynamoDBLocal
sqlite4javaWinX86 = { module = "com.almworks.sqlite4java:sqlite4java-win32-x86", version.ref = "sqlite4java" } # for DynamoDBLocal
wireGradlePlugin = { module = "com.squareup.wire:wire-gradle-plugin", version = "4.8.1" }

[bundles]
jackson = ["jacksonDatabind", "jacksonDatatypeJsr310"]
jetty = ["jettyAlpnClient", "jettyClient", "jettyServer"]
sqlite4java = ["sqlite4javaLinuxI386", "sqlite4javaLinuxAmd64", "sqlite4javaOsx", "sqlite4javaWinX64", "sqlite4javaWinX86"]
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include("tempest-internal")
include("tempest")
include("tempest-bom")
include("tempest-docker")
include("tempest-dynamodb-local")
include("tempest-testing")
include("tempest-testing-internal")
include("tempest-testing-docker")
Expand Down
106 changes: 106 additions & 0 deletions tempest-dynamodb-local/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import com.vanniktech.maven.publish.JavadocJar.Dokka
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.MavenPublishBaseExtension

plugins {
kotlin("jvm")
`java-library`
id("com.gradleup.shadow")
id("com.vanniktech.maven.publish.base")
}

dependencies {
// Ignore transtive dependencies and instead manage explicitly.
implementation(libs.awsDynamodbLocal) {
isTransitive = false
}

// Implementation dependencies will be shaded in the JAR.
implementation(libs.bundles.jackson)
implementation(libs.bundles.jetty)
implementation(libs.kotlinStdLib)

// Shadow dependencies will not be shaded.
shadow(libs.antlr4Runtime)
shadow(libs.aws2Dynamodb)
shadow(libs.aws2DynamodbEnhanced)
shadow(libs.aws2Pinpoint)
shadow(libs.awsDynamodb)
shadow(libs.commonsCli)
shadow(libs.commonsLang3)
shadow(libs.guava)
shadow(libs.slf4jApi)
shadow(libs.bundles.sqlite4java)
}

tasks.named<Jar>("jar") {
archiveClassifier.set("unshaded")
}

tasks.shadowJar {
// Dependencies to be shaded must be explicitly included as dependencies.
dependencies {
include(dependency("com.amazonaws:DynamoDBLocal"))
include(dependency("com.fasterxml.jackson.core:.*"))
include(dependency("com.fasterxml.jackson.dataformat:.*"))
include(dependency("com.fasterxml.jackson.datatype:.*"))
include(dependency("com.fasterxml.jackson.module:.*"))
include(dependency("org.eclipse.jetty:.*"))
}

// Relocate packages to avoid conflicts.
listOf(
"com.amazon.dynamodb.grammar",
"com.amazon.ion",
"com.amazonaws.services.dynamodbv2.dataMembers",
"com.amazonaws.services.dynamodbv2.datamodel",
"com.amazonaws.services.dynamodbv2.dbenv",
"com.amazonaws.services.dynamodbv2.exceptions",
"com.amazonaws.services.dynamodbv2.local",
"com.fasterxml.jackson",
"ddb.partiql",
"kotlin",
"org.eclipse.jetty",
"org.partiql",
).forEach { relocate(it, "app.cash.tempest.testing.dynamodb.local.shaded.${it}") }

mergeServiceFiles()

// Publish shadow JAR as the main JAR.
archiveClassifier = ""
}

configure<MavenPublishBaseExtension> {
configure(
KotlinJvm(javadocJar = Dokka("dokkaGfm"))
)

pom {
withXml {
val root = asNode()

// First collect all dependencies nodes.
val dependenciesNodes = root.children()
.filterIsInstance<groovy.util.Node>()
.filter { it.name().toString().contains("dependencies") }
.toList()

// Then remove them safely.
dependenciesNodes.forEach { node ->
root.remove(node)
}

// Add a new dependencies node with shadow configuration.
val dependenciesNode = root.appendNode("dependencies")

// Add all shadow dependencies to the POM.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The net effect here is to remove the dependencies that were shaded, right? Kinda surprised this needs to be done explicitly but I don't have much experience with the intersection of shadow and publication

Copy link
Collaborator Author

@ThePumpingLemma ThePumpingLemma Apr 28, 2025

Choose a reason for hiding this comment

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

Yeah, this surprised me as well. What's happening is that the publication is using the runtime classpath, which is not the same as the shadow classpath of the shadow jar. If you publish via the shadow plugin, it can handle this for you, but I didn't want to change the publication mechanism.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ThePumpingLemma can you elaborate on

but I didn't want to change the publication mechanism

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't want to switch which plugin was used to publish to maven, but if we're okay with doing this via the shadow plugin and it's easier then let's do it.

project.configurations.named("shadow").get().allDependencies.forEach { dep ->
val dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", dep.group)
dependencyNode.appendNode("artifactId", dep.name)
dependencyNode.appendNode("version", dep.version)
dependencyNode.appendNode("scope", "compile")
}
}
}
}
18 changes: 9 additions & 9 deletions tempest-testing-jvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.MavenPublishBaseExtension

plugins {
kotlin("jvm")
`java-library`
kotlin("jvm")
`java-library`
id("com.vanniktech.maven.publish.base")
}

dependencies {
api(project(":tempest-testing"))
implementation(project(":tempest-testing-internal"))
implementation(libs.awsDynamodbLocal)
implementation(libs.kotlinStdLib)
api(project(":tempest-testing"))
implementation(project(":tempest-testing-internal"))
implementation(project(path = ":tempest-dynamodb-local", configuration = "shadow"))
implementation(libs.kotlinStdLib)

testImplementation(libs.assertj)
testImplementation(libs.junitApi)
testImplementation(libs.junitEngine)
testImplementation(libs.assertj)
testImplementation(libs.junitApi)
testImplementation(libs.junitEngine)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

package app.cash.tempest.testing

import com.amazonaws.services.dynamodbv2.local.main.ServerRunner
import com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer
import app.cash.tempest.testing.dynamodb.local.shaded.com.amazonaws.services.dynamodbv2.local.main.ServerRunner
import app.cash.tempest.testing.dynamodb.local.shaded.com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer
import com.google.common.util.concurrent.AbstractIdleService
import java.io.File

class JvmDynamoDbServer private constructor(
override val port: Int,
Expand Down
2 changes: 1 addition & 1 deletion tempest2-testing-jvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
dependencies {
api(project(":tempest2-testing"))
implementation(project(":tempest2-testing-internal"))
implementation(libs.awsDynamodbLocal)
implementation(project(path = ":tempest-dynamodb-local", configuration = "shadow"))
implementation(libs.kotlinStdLib)

testImplementation(libs.assertj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

package app.cash.tempest2.testing

import com.amazonaws.services.dynamodbv2.local.main.ServerRunner
import com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer
import app.cash.tempest.testing.dynamodb.local.shaded.com.amazonaws.services.dynamodbv2.local.main.ServerRunner
import app.cash.tempest.testing.dynamodb.local.shaded.com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer
import com.google.common.util.concurrent.AbstractIdleService
import java.io.File

class JvmDynamoDbServer private constructor(
override val port: Int,
Expand Down
Loading