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 class #155

Open
wants to merge 5 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
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"version": {
"pom.xml": "<artifactId>databricks-sdk-parent</artifactId>\n <version>$VERSION</version>",
"databricks-sdk-java/pom.xml": "<artifactId>databricks-sdk-parent</artifactId>\n <version>$VERSION</version>",
"databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java": "private static final String version = \"$VERSION\";"
"databricks-sdk-java/src/main/java/com/databricks/sdk/core/Version.java": "private static final String version = \"$VERSION\";"
},
"toolchain": {
"require": ["mvn", "java"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ public class UserAgent {

private static final Map<String, String> otherInfo = new HashMap<>();

// TODO: check if reading from
// /META-INF/maven/com.databricks/databrics-sdk-java/pom.properties
// or getClass().getPackage().getImplementationVersion() is enough.
private static final String version = "0.8.1";

public static void withProduct(String product, String productVersion) {
UserAgent.product = product;
UserAgent.productVersion = productVersion;
Expand Down Expand Up @@ -49,6 +44,6 @@ public static String asString() {
.collect(Collectors.joining());
return String.format(
"%s/%s databricks-sdk-java/%s jvm/%s os/%s%s",
product, productVersion, version, jvmVersion(), osName(), otherInfo);
product, productVersion, Version.sdkVersion(), jvmVersion(), osName(), otherInfo);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.databricks.sdk.core;

public final class Version {

// TODO: check if reading from
// /META-INF/maven/com.databricks/databrics-sdk-java/pom.properties
// or getClass().getPackage().getImplementationVersion() is enough.
private static final String version = "0.8.1";

public static String sdkVersion() {
return version;
}

private Version() {}
}