Skip to content
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

Add version to jar manifest and read at runtime for SDK version header #22

Merged
merged 3 commits into from
Feb 24, 2024
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
12 changes: 12 additions & 0 deletions inngest-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
description = "Inngest SDK"
version = "0.0.1-SNAPSHOT"

plugins { id("org.jetbrains.kotlin.jvm") version "1.9.10" }

Expand All @@ -17,6 +18,17 @@ dependencies {
testImplementation(kotlin("test"))
}

tasks.jar {
manifest {
attributes(
mapOf(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
),
)
}
}

tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
Expand Down
6 changes: 3 additions & 3 deletions inngest-core/src/main/kotlin/com/inngest/Comm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CommHandler(val functions: HashMap<String, InngestFunction>) {
return mapOf(
"Content-Type" to "application/json",
// TODO - Get this from the build
"x-inngest-sdk" to "inngest-kt:v0.0.1",
"x-inngest-sdk" to "inngest-kt:${Version.getVersion()}",
// TODO - Pull this from options
"x-inngest-framework" to "ktor",
)
Expand Down Expand Up @@ -123,7 +123,7 @@ class CommHandler(val functions: HashMap<String, InngestFunction>) {
framework = "ktor",
sdk = "kotlin",
url = "http://localhost:8080/api/inngest",
v = "0.0.1",
v = Version.getVersion(),
functions = getFunctionConfigs(),
)
val jsonRequestBody = Klaxon().toJsonString(requestPayload)
Expand Down Expand Up @@ -163,7 +163,7 @@ class CommHandler(val functions: HashMap<String, InngestFunction>) {
framework = "ktor",
sdk = "kotlin",
url = "http://localhost:8080/api/inngest",
v = "0.0.1",
v = Version.getVersion(),
functions = getFunctionConfigs(),
)
return Klaxon().toJsonString(requestPayload)
Expand Down
9 changes: 9 additions & 0 deletions inngest-core/src/main/kotlin/com/inngest/Version.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.inngest

class Version() {
companion object {
private val version: String = Version::class.java.getPackage().implementationVersion

fun getVersion(): String = version
}
}
1 change: 0 additions & 1 deletion inngest-spring-boot-demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ dependencyManagement {
tasks.withType<Test> {
useJUnitPlatform()
}

Loading