Skip to content

Feature/hashicorp gradle kotlin enhancements #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*/Kafka*/build/*
!*/Kafka*/build/generated*/
*/Kafka*/.gradle
*/Kafka*/.java-version
api-key*.txt
client.properties
16 changes: 16 additions & 0 deletions client.properties-template
Copy link
Owner

Choose a reason for hiding this comment

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

The template should be in the HashiCorp folder, not in the root one

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username='<Username or API-KEY>' password='<Password or API-SECRET>';
bootstrap.servers=<hostname>:<port>
group.id=<Name of your consumer group>
# Schema Registry
schema.registry.url=<URL OF SCHEMA REGISTRY>
basic.auth.credentials.source=USER_INFO
basic.auth.user.info=<user>:<password>
use.latest.version=true
auto.register.schemas=false
# Encryption
rule.executors._default_.param.token.id=<root-token>
# Topic configuration
topic.name=csfle-test

30 changes: 16 additions & 14 deletions hashicorp/KafkaConsumer/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.5.31"
kotlin("jvm") version "1.7.20"
id("com.github.davidmc24.gradle.plugin.avro") version "1.2.0"
application
}
Expand Down Expand Up @@ -31,21 +31,23 @@ dependencies {
implementation("io.confluent:kafka-schema-registry-client-encryption-hcvault:7.4.2")
}

val fatJar = task("fatJar", type = Jar::class) {

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
baseName = "fatApp"
manifest {
attributes["Main-Class"] = application.mainClass
tasks {
val fatJar = register<Jar>("fatJar") {
dependsOn.addAll(listOf("compileJava", "compileKotlin", "processResources")) // We need this for Gradle optimization to work
archiveClassifier.set("standalone") // Naming the jar
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { attributes(mapOf("Main-Class" to application.mainClass)) } // Provided we set it up in the application plugin configuration
val sourcesMain = sourceSets.main.get()
val contents = configurations.runtimeClasspath.get()
.map { if (it.isDirectory) it else zipTree(it) } +
sourcesMain.output
from(contents)
}
build {
dependsOn(fatJar) // Trigger fat jar creation during build
}
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
with(tasks.jar.get() as CopySpec)
}

tasks.withType<Test> {
useJUnitPlatform()
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
kotlinOptions.jvmTarget = "17"
}
Binary file modified hashicorp/KafkaConsumer/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading