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
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ public enum ClientLanguage {
private final SnapshotsReducer snapshotsReducer;

public @Nullable String defaultArtifact() {
if (this == JAVA) {
return "files(\"" + CLI_DIR.toAbsolutePath() + "/astra-db-java-2.2.1-patched.jar\")"; // TODO remove this once Java is patched + update JavaDriver.extractClientVersion
}
return defaultArtifact;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,20 @@ public RunResult executeScript(BaseScriptRunnerCtx ctx, ExecutionEnvironment exe

@Override
public Optional<String> extractClientVersion(BaseScriptRunnerCtx ctx, ExecutionEnvironment execEnv) {
return Optional.of("v2.2.1"); // TODO remove once Java is patched and remove ClientLanguage.defaultArtifact

// val result = ExternalPrograms.custom().run(execEnv.envDir(), "./gradlew", "dependencies", "--configuration", "runtimeClasspath");
//
// if (result.notOk()) {
// throw new RunException("Failed to extract Java client version: " + result.output());
// }
//
// val output = result.stdout();
// val pattern = Pattern.compile("com\\.datastax\\.astra:astra-db-java:([\\d.]+(?:-[\\w.]+)?)");
// val matcher = pattern.matcher(output);
//
// if (matcher.find()) {
// return Optional.of("v" + matcher.group(1));
// }
//
// return Optional.of("unknown");
val result = ExternalPrograms.custom().run(execEnv.envDir(), "./gradlew", "dependencies", "--configuration", "runtimeClasspath");

if (result.notOk()) {
throw new RunException("Failed to extract Java client version: " + result.output());
}

val output = result.stdout();
val pattern = Pattern.compile("com\\.datastax\\.astra:astra-db-java:([\\d.]+(?:-[\\w.]+)?)");
val matcher = pattern.matcher(output);

if (matcher.find()) {
return Optional.of("v" + matcher.group(1));
}

return Optional.of("unknown");
}
}
Loading