Skip to content

Commit

Permalink
Add correct transformers to gradle build configurations (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper authored Dec 15, 2023
1 parent 3503ed3 commit 55e1316
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions java/hello-world-lambda/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
import com.google.protobuf.gradle.id

plugins {
Expand Down Expand Up @@ -58,6 +61,12 @@ protobuf {
}
}

// Configure shadowJar plugin to properly merge SPI files and Log4j plugin configurations
tasks.withType<ShadowJar> {
transform(Log4j2PluginsCacheFileTransformer::class.java)
transform(ServiceFileTransformer::class.java)
}

// Configure test platform
tasks.withType<Test> {
useJUnitPlatform()
Expand Down
4 changes: 3 additions & 1 deletion kotlin/hello-world-lambda-cdk/lambda/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
import com.google.protobuf.gradle.id

val restateVersion = "0.6.0"
Expand Down Expand Up @@ -80,9 +81,10 @@ protobuf {
}
}

// Configure shadowJar plugin to properly transform Log4j plugin configurations - needed for AWS Lambda logger
// Configure shadowJar plugin to properly merge SPI files and Log4j plugin configurations
tasks.withType<ShadowJar> {
transform(Log4j2PluginsCacheFileTransformer::class.java)
transform(ServiceFileTransformer::class.java)
}

// Configure test platform
Expand Down
10 changes: 9 additions & 1 deletion kotlin/hello-world-lambda/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
import com.google.protobuf.gradle.id
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.10"
Expand Down Expand Up @@ -76,6 +78,12 @@ protobuf {
}
}

// Configure shadowJar plugin to properly merge SPI files and Log4j plugin configurations
tasks.withType<ShadowJar> {
transform(Log4j2PluginsCacheFileTransformer::class.java)
transform(ServiceFileTransformer::class.java)
}

// Configure test platform
tasks.withType<Test> {
useJUnitPlatform()
Expand Down

0 comments on commit 55e1316

Please sign in to comment.