Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(jdbc): add GaussDB types and migrate plugin to Gradle

Andrew1dd005db0f86
diff --git a/.github/scripts/bump-jdbc-plugin-version.mjs b/.github/scripts/bump-jdbc-plugin-version.mjs
index c072bd9e78..1e06d1fe51 100644
--- a/.github/scripts/bump-jdbc-plugin-version.mjs
+++ b/.github/scripts/bump-jdbc-plugin-version.mjs
@@ -2,11 +2,11 @@
import { execFileSync } from "node:child_process";
import { readFileSync, writeFileSync } from "node:fs";
-const POM_PATH = "plugins/jdbc/pom.xml";
+const BUILD_GRADLE_PATH = "plugins/jdbc/build.gradle";
const MANIFEST_PATH = "plugins/jdbc/manifest.json";
-function firstProjectVersion(pomXml) {
- const match = pomXml.match(/<project[\s\S]*?<version>([^<]+)<\/version>/);
+function gradleVersion(buildGradle) {
+ const match = buildGradle.match(/^version\s*=\s*['"]([^'"]+)['"]/m);
return match?.[1]?.trim() ?? "";
}
@@ -27,16 +27,16 @@ function isReleaseBumpRelevantJdbcPluginChange(file) {
if (!file.startsWith("plugins/jdbc/")) return false;
if (file.startsWith("plugins/jdbc/dist/") || file.startsWith("plugins/jdbc/target/")) return false;
if (file === "plugins/jdbc/README.md" || file === "plugins/jdbc/package.sh") return false;
- if (file === POM_PATH || file === MANIFEST_PATH) return false;
+ if (file === BUILD_GRADLE_PATH || file === MANIFEST_PATH) return false;
return true;
}
function hasJdbcPluginVersionChange(file) {
- return file === POM_PATH || file === MANIFEST_PATH;
+ return file === MANIFEST_PATH;
}
-function updatePomVersion(pomXml, version) {
- return pomXml.replace(/(<project[\s\S]*?<version>)([^<]+)(<\/version>)/, `$1${version}$3`);
+function updateGradleVersion(buildGradle, version) {
+ return buildGradle.replace(/^(version\s*=\s*)(['"])[^'"]+\2/m, (_, prefix, quote) => `${prefix}${quote}${version}${quote}`);
}
function updateManifestVersion(manifestJson, version) {
@@ -45,20 +45,20 @@ function updateManifestVersion(manifestJson, version) {
return `${JSON.stringify(manifest, null, 2)}\n`;
}
-export function evaluateJdbcPluginReleaseBump({ changedFiles, pomXml, manifestJson }) {
- const pomVersion = firstProjectVersion(pomXml);
+export function evaluateJdbcPluginReleaseBump({ changedFiles, buildGradle, manifestJson }) {
+ const currentGradleVersion = gradleVersion(buildGradle);
const currentManifestVersion = manifestVersion(manifestJson);
- if (pomVersion !== currentManifestVersion) {
- throw new Error(`JDBC plugin version mismatch: pom.xml is ${pomVersion} but manifest.json is ${currentManifestVersion}.`);
+ if (currentGradleVersion !== currentManifestVersion) {
+ throw new Error(`JDBC plugin version mismatch: build.gradle is ${currentGradleVersion} but manifest.json is ${currentManifestVersion}.`);
}
const shouldBump = changedFiles.some(isReleaseBumpRelevantJdbcPluginChange) && !changedFiles.some(hasJdbcPluginVersionChange);
- const newVersion = shouldBump ? bumpPatchVersion(pomVersion) : pomVersion;
+ const newVersion = shouldBump ? bumpPatchVersion(currentGradleVersion) : currentGradleVersion;
return {
changed: shouldBump,
- oldVersion: pomVersion,
+ oldVersion: currentGradleVersion,
newVersion,
- pomXml: shouldBump ? updatePomVersion(pomXml, newVersion) : pomXml,
+ buildGradle: shouldBump ? updateGradleVersion(buildGradle, newVersion) : buildGradle,
manifestJson: shouldBump ? updateManifestVersion(manifestJson, newVersion) : manifestJson,
};
}
@@ -73,12 +73,12 @@ function main() {
const changedFiles = git(["diff", "--name-only", baseRef, headRef]).split("\n").filter(Boolean);
const result = evaluateJdbcPluginReleaseBump({
changedFiles,
- pomXml: readFileSync(POM_PATH, "utf8"),
+ buildGradle: readFileSync(BUILD_GRADLE_PATH, "utf8"),
manifestJson: readFileSync(MANIFEST_PATH, "utf8"),
});
if (write && result.changed) {
- writeFileSync(POM_PATH, result.pomXml);
+ writeFileSync(BUILD_GRADLE_PATH, result.buildGradle);
writeFileSync(MANIFEST_PATH, result.manifestJson);
}
diff --git a/.github/scripts/check-jdbc-plugin-version.mjs b/.github/scripts/check-jdbc-plugin-version.mjs
index 538b2015b7..4c04de4e07 100644
--- a/.github/scripts/check-jdbc-plugin-version.mjs
+++ b/.github/scripts/check-jdbc-plugin-version.mjs
@@ -1,11 +1,11 @@
#!/usr/bin/env node
import { execFileSync } from "node:child_process";
-const POM_PATH = "plugins/jdbc/pom.xml";
+const BUILD_GRADLE_PATH = "plugins/jdbc/build.gradle";
const MANIFEST_PATH = "plugins/jdbc/manifest.json";
-function firstProjectVersion(pomXml) {
- const match = pomXml.match(/<project[\s\S]*?<version>([^<]+)<\/version>/);
+export function jdbcGradleVersion(buildGradle) {
+ const match = buildGradle.match(/^version\s*=\s*['"]([^'"]+)['"]/m);
return match?.[1]?.trim() ?? "";
}
@@ -13,10 +13,10 @@ function manifestVersion(manifestJson) {
return JSON.parse(manifestJson).version ?? "";
}
-export function evaluateJdbcPluginVersionChange({ headPomVersion, headManifestVersion }) {
+export function evaluateJdbcPluginVersionChange({ headGradleVersion, headManifestVersion }) {
const errors = [];
- if (headPomVersion !== headManifestVersion) {
- errors.push(`JDBC plugin version mismatch: pom.xml is ${headPomVersion} but manifest.json is ${headManifestVersion}.`);
+ if (headGradleVersion !== headManifestVersion) {
+ errors.push(`JDBC plugin version mismatch: build.gradle is ${headGradleVersion} but manifest.json is ${headManifestVersion}.`);
return errors;
}
return errors;
@@ -32,10 +32,10 @@ function readFileAt(ref, path) {
function main() {
const [, headRef = "HEAD"] = process.argv.slice(2);
- const headPomVersion = firstProjectVersion(readFileAt(headRef, POM_PATH));
+ const headGradleVersion = jdbcGradleVersion(readFileAt(headRef, BUILD_GRADLE_PATH));
const headManifestVersion = manifestVersion(readFileAt(headRef, MANIFEST_PATH));
const errors = evaluateJdbcPluginVersionChange({
- headPomVersion,
+ headGradleVersion,
headManifestVersion,
});
@@ -45,7 +45,7 @@ function main() {
}
process.exit(1);
}
- console.log(`JDBC plugin version check passed (${headPomVersion}).`);
+ console.log(`JDBC plugin version check passed (${headGradleVersion}).`);
}
if (import.meta.url === `file://${process.argv[1]}`) {
diff --git a/.github/scripts/jdbc-plugin-version.test.mjs b/.github/scripts/jdbc-plugin-version.test.mjs
new file mode 100644
index 0000000000..7005cd3ba4
--- /dev/null
+++ b/.github/scripts/jdbc-plugin-version.test.mjs
@@ -0,0 +1,53 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { evaluateJdbcPluginReleaseBump } from "./bump-jdbc-plugin-version.mjs";
+import { evaluateJdbcPluginVersionChange, jdbcGradleVersion } from "./check-jdbc-plugin-version.mjs";
+
+const buildGradle = `plugins {
+ id 'java'
+}
+
+version = '0.1.26'
+`;
+const manifestJson = `${JSON.stringify({ version: "0.1.26" }, null, 2)}\n`;
+
+test("reads the JDBC plugin version from Gradle", () => {
+ assert.equal(jdbcGradleVersion(buildGradle), "0.1.26");
+});
+
+test("checks Gradle and manifest versions together", () => {
+ assert.deepEqual(
+ evaluateJdbcPluginVersionChange({ headGradleVersion: "0.1.26", headManifestVersion: "0.1.26" }),
+ [],
+ );
+ assert.match(
+ evaluateJdbcPluginVersionChange({ headGradleVersion: "0.1.27", headManifestVersion: "0.1.26" })[0],
+ /build\.gradle is 0\.1\.27/,
+ );
+});
+
+test("bumps Gradle and manifest versions for JDBC source changes", () => {
+ const result = evaluateJdbcPluginReleaseBump({
+ changedFiles: ["plugins/jdbc/build.gradle", "plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java"],
+ buildGradle,
+ manifestJson,
+ });
+
+ assert.equal(result.changed, true);
+ assert.equal(result.oldVersion, "0.1.26");
+ assert.equal(result.newVersion, "0.1.27");
+ assert.match(result.buildGradle, /version = '0\.1\.27'/);
+ assert.equal(JSON.parse(result.manifestJson).version, "0.1.27");
+});
+
+test("keeps an explicit Gradle version change", () => {
+ const result = evaluateJdbcPluginReleaseBump({
+ changedFiles: ["plugins/jdbc/build.gradle", "plugins/jdbc/manifest.json"],
+ buildGradle,
+ manifestJson,
+ });
+
+ assert.equal(result.changed, false);
+ assert.equal(result.newVersion, "0.1.26");
+});
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1dcc5224dd..22b760e9cd 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -332,8 +332,8 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: temurin
- java-version: "17"
- cache: maven
+ java-version: "21"
+ cache: gradle
- name: JDBC plugin version guard
env:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ef2cd93b1f..6cb047cca9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -87,16 +87,16 @@ jobs:
shell: bash
run: |
TMP_DIR="$(mktemp -d)"
- cp plugins/jdbc/pom.xml "$TMP_DIR/pom.xml"
+ cp plugins/jdbc/build.gradle "$TMP_DIR/build.gradle"
cp plugins/jdbc/manifest.json "$TMP_DIR/manifest.json"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch origin main
git switch -C jdbc-plugin-version-bump origin/main
- cp "$TMP_DIR/pom.xml" plugins/jdbc/pom.xml
+ cp "$TMP_DIR/build.gradle" plugins/jdbc/build.gradle
cp "$TMP_DIR/manifest.json" plugins/jdbc/manifest.json
- git add plugins/jdbc/pom.xml plugins/jdbc/manifest.json
+ git add plugins/jdbc/build.gradle plugins/jdbc/manifest.json
if git diff --cached --quiet; then
echo "JDBC plugin version ${{ steps.bump.outputs.new_version }} is already on main."
exit 0
@@ -599,8 +599,8 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: temurin
- java-version: "17"
- cache: maven
+ java-version: "21"
+ cache: gradle
- name: Apply automatic JDBC plugin version bump
shell: bash
@@ -610,7 +610,7 @@ jobs:
id: jdbc-plugin
shell: bash
run: |
- VERSION="$(grep -m1 '<version>' plugins/jdbc/pom.xml | sed -E 's/.*<version>([^<]+)<.*/\1/')"
+ VERSION="$(sed -nE "s/^version[[:space:]]*=[[:space:]]*'([^']+)'.*/\1/p" plugins/jdbc/build.gradle | head -n 1)"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Package JDBC plugin
diff --git a/.gitignore b/.gitignore
index 3c635fac6a..b5c82134dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,8 @@ coverage/
plugins/jdbc/target/
plugins/jdbc/dependency-reduced-pom.xml
plugins/jdbc/lib/*.jar
+plugins/jdbc/.gradle/
+plugins/jdbc/build/
plugins/jdbc/dist/
docs/.next/
docs/out/
diff --git a/packages/app-tests/jdbcPluginRelease.test.ts b/packages/app-tests/jdbcPluginRelease.test.ts
index 3e90b5a97a..478fe3a040 100644
--- a/packages/app-tests/jdbcPluginRelease.test.ts
+++ b/packages/app-tests/jdbcPluginRelease.test.ts
@@ -15,23 +15,17 @@ function importScript(path: string): Promise<Record<string, unknown>> {
test("allows JDBC plugin runtime changes without a manual version bump before release", () => {
assert.deepEqual(
evaluateJdbcPluginVersionChange({
- changedFiles: ["plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java"],
- basePomVersion: "0.1.1",
- baseManifestVersion: "0.1.1",
- headPomVersion: "0.1.1",
+ headGradleVersion: "0.1.1",
headManifestVersion: "0.1.1",
}),
[],
);
});
-test("allows JDBC plugin runtime changes when pom and manifest versions are bumped together", () => {
+test("allows JDBC plugin runtime changes when Gradle and manifest versions are bumped together", () => {
assert.deepEqual(
evaluateJdbcPluginVersionChange({
- changedFiles: ["plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java"],
- basePomVersion: "0.1.1",
- baseManifestVersion: "0.1.1",
- headPomVersion: "0.1.2",
+ headGradleVersion: "0.1.2",
headManifestVersion: "0.1.2",
}),
[],
@@ -41,47 +35,41 @@ test("allows JDBC plugin runtime changes when pom and manifest versions are bump
test("does not require a JDBC plugin version bump for docs or release packaging changes", () => {
assert.deepEqual(
evaluateJdbcPluginVersionChange({
- changedFiles: ["plugins/jdbc/README.md", "plugins/jdbc/package.sh"],
- basePomVersion: "0.1.1",
- baseManifestVersion: "0.1.1",
- headPomVersion: "0.1.1",
+ headGradleVersion: "0.1.1",
headManifestVersion: "0.1.1",
}),
[],
);
});
-test("requires JDBC plugin pom and manifest versions to match", () => {
+test("requires JDBC plugin Gradle and manifest versions to match", () => {
assert.deepEqual(
evaluateJdbcPluginVersionChange({
- changedFiles: ["plugins/jdbc/manifest.json"],
- basePomVersion: "0.1.1",
- baseManifestVersion: "0.1.1",
- headPomVersion: "0.1.2",
+ headGradleVersion: "0.1.2",
headManifestVersion: "0.1.1",
}),
- ["JDBC plugin version mismatch: pom.xml is 0.1.2 but manifest.json is 0.1.1."],
+ ["JDBC plugin version mismatch: build.gradle is 0.1.2 but manifest.json is 0.1.1."],
);
});
test("auto bumps JDBC plugin patch version when runtime files changed for release", () => {
const result = evaluateJdbcPluginReleaseBump({
changedFiles: ["plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java"],
- pomXml: "<project><version>0.1.9</version></project>",
+ buildGradle: "version = '0.1.9'\n",
manifestJson: '{ "version": "0.1.9" }',
});
assert.equal(result.changed, true);
assert.equal(result.oldVersion, "0.1.9");
assert.equal(result.newVersion, "0.1.10");
- assert.match(result.pomXml, /<version>0\.1\.10<\/version>/);
+ assert.match(result.buildGradle, /version = '0\.1\.10'/);
assert.match(result.manifestJson, /"version": "0\.1\.10"/);
});
test("does not auto bump JDBC plugin again when release range already includes a version bump", () => {
const result = evaluateJdbcPluginReleaseBump({
- changedFiles: ["plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java", "plugins/jdbc/pom.xml", "plugins/jdbc/manifest.json"],
- pomXml: "<project><version>0.1.10</version></project>",
+ changedFiles: ["plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java", "plugins/jdbc/build.gradle", "plugins/jdbc/manifest.json"],
+ buildGradle: "version = '0.1.10'\n",
manifestJson: '{ "version": "0.1.10" }',
});
@@ -93,7 +81,7 @@ test("does not auto bump JDBC plugin again when release range already includes a
test("does not auto bump JDBC plugin version for release packaging-only changes", () => {
const result = evaluateJdbcPluginReleaseBump({
changedFiles: ["plugins/jdbc/README.md", "plugins/jdbc/package.sh"],
- pomXml: "<project><version>0.1.9</version></project>",
+ buildGradle: "version = '0.1.9'\n",
manifestJson: '{ "version": "0.1.9" }',
});
@@ -107,7 +95,7 @@ test("auto bump refuses mismatched JDBC plugin source versions", () => {
() =>
evaluateJdbcPluginReleaseBump({
changedFiles: ["plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java"],
- pomXml: "<project><version>0.1.9</version></project>",
+ buildGradle: "version = '0.1.9'\n",
manifestJson: '{ "version": "0.1.8" }',
}),
/JDBC plugin version mismatch/,
diff --git a/plugins/dialects/gaussdb.yaml b/plugins/dialects/gaussdb.yaml
index 573ee8d5db..267fe27a8a 100644
--- a/plugins/dialects/gaussdb.yaml
+++ b/plugins/dialects/gaussdb.yaml
@@ -8,6 +8,7 @@ dialect:
status: "COMPATIBLE"
types:
+ # --- PostgreSQL native types (A-mode) ---
- name: "SMALLINT"
category: "INTEGER"
aliases: ["INT2"]
@@ -35,6 +36,10 @@ types:
category: "DECIMAL"
has_precision: true
aliases: ["DECIMAL"]
+ - name: "DECIMAL"
+ category: "DECIMAL"
+ has_precision: true
+ aliases: ["NUMERIC"]
- name: "VARCHAR"
category: "STRING"
has_length: true
@@ -76,6 +81,33 @@ types:
- name: "POINT"
category: "SPATIAL"
+ # --- MySQL-compatible types (M-mode) ---
+ - name: "MEDIUMINT"
+ category: "INTEGER"
+ - name: "FLOAT"
+ category: "FLOAT"
+ - name: "DOUBLE"
+ category: "FLOAT"
+ aliases: ["DOUBLE PRECISION", "REAL"]
+ - name: "TINYTEXT"
+ category: "STRING"
+ - name: "MEDIUMTEXT"
+ category: "STRING"
+ - name: "LONGTEXT"
+ category: "STRING"
+ - name: "TINYBLOB"
+ category: "BINARY"
+ - name: "MEDIUMBLOB"
+ category: "BINARY"
+ - name: "LONGBLOB"
+ category: "BINARY"
+ - name: "DATETIME"
+ category: "DATETIME"
+ - name: "YEAR"
+ category: "INTEGER"
+ - name: "GEOMETRY"
+ category: "SPATIAL"
+
ddl_capabilities:
add_column: true
drop_column: true
diff --git a/plugins/jdbc/README.md b/plugins/jdbc/README.md
index 6e2436166c..e70d732e07 100644
--- a/plugins/jdbc/README.md
+++ b/plugins/jdbc/README.md
@@ -5,9 +5,8 @@ This is an optional sidecar plugin for DBX. It is not bundled with the main DBX
## Build
```sh
-mvn -q -DskipTests package
-mkdir -p lib
-cp target/dbx-jdbc-plugin-*-all.jar lib/dbx-jdbc-plugin.jar
+./gradlew shadowJar
+cp build/libs/dbx-jdbc-plugin-all.jar lib/dbx-jdbc-plugin.jar
```
## Package for release
@@ -16,7 +15,7 @@ cp target/dbx-jdbc-plugin-*-all.jar lib/dbx-jdbc-plugin.jar
./package.sh
```
-The package version follows the JDBC plugin version in `pom.xml` and `manifest.json`.
+The package version follows the JDBC plugin version in `build.gradle` and `manifest.json`.
The package script writes both `dbx-jdbc-plugin-<version>.zip` and `dbx-jdbc-plugin-latest.zip`.
## Install for local DBX
diff --git a/plugins/jdbc/build.gradle b/plugins/jdbc/build.gradle
new file mode 100644
index 0000000000..40e92266a7
--- /dev/null
+++ b/plugins/jdbc/build.gradle
@@ -0,0 +1,65 @@
+plugins {
+ id 'java'
+ id 'com.gradleup.shadow' version '9.0.0-beta12'
+}
+
+group = 'app.dbx'
+version = '0.1.26'
+
+java {
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(21)
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+
+def mavenResolverVersion = '2.0.18'
+def mavenCoreVersion = '4.0.0-rc-5'
+
+dependencies {
+ implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.2'
+ implementation('org.slf4j:slf4j-api') {
+ version {
+ strictly '1.7.36'
+ }
+ }
+ implementation 'org.apache.commons:commons-lang3:3.18.0'
+
+ implementation "org.apache.maven.resolver:maven-resolver-api:${mavenResolverVersion}"
+ implementation "org.apache.maven.resolver:maven-resolver-spi:${mavenResolverVersion}"
+ implementation "org.apache.maven.resolver:maven-resolver-util:${mavenResolverVersion}"
+ implementation "org.apache.maven.resolver:maven-resolver-impl:${mavenResolverVersion}"
+ implementation "org.apache.maven.resolver:maven-resolver-connector-basic:${mavenResolverVersion}"
+ implementation "org.apache.maven.resolver:maven-resolver-transport-file:${mavenResolverVersion}"
+ implementation "org.apache.maven.resolver:maven-resolver-transport-jdk:${mavenResolverVersion}"
+ implementation "org.apache.maven.resolver:maven-resolver-supplier-mvn4:${mavenResolverVersion}"
+ implementation "org.apache.maven:maven-resolver-provider:${mavenCoreVersion}"
+ implementation "org.apache.maven:maven-model-builder:${mavenCoreVersion}"
+
+ runtimeOnly 'org.slf4j:slf4j-nop:1.7.36'
+
+ testImplementation 'com.h2database:h2:2.2.224'
+ testImplementation 'org.junit.jupiter:junit-jupiter:5.10.3'
+ testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
+}
+
+tasks.named('test') {
+ useJUnitPlatform()
+}
+
+tasks.named('shadowJar') {
+ archiveBaseName = 'dbx-jdbc-plugin'
+ archiveVersion = ''
+ archiveClassifier = 'all'
+ mergeServiceFiles()
+ manifest {
+ attributes 'Main-Class': 'app.dbx.jdbc.DbxJdbcPlugin'
+ }
+}
+
+tasks.named('build') {
+ dependsOn tasks.named('shadowJar')
+}
diff --git a/plugins/jdbc/gradle/wrapper/gradle-wrapper.jar b/plugins/jdbc/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000..b1b8ef56b4
Binary files /dev/null and b/plugins/jdbc/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/plugins/jdbc/gradle/wrapper/gradle-wrapper.properties b/plugins/jdbc/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..b52fb7e713
--- /dev/null
+++ b/plugins/jdbc/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,9 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
+networkTimeout=10000
+retries=0
+retryBackOffMs=500
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/plugins/jdbc/gradlew b/plugins/jdbc/gradlew
new file mode 100755
index 0000000000..b9bb139f79
--- /dev/null
+++ b/plugins/jdbc/gradlew
@@ -0,0 +1,248 @@
+#!/bin/sh
+
+#
+# Copyright © 2015 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/plugins/jdbc/gradlew.bat b/plugins/jdbc/gradlew.bat
new file mode 100644
index 0000000000..24c62d56f2
--- /dev/null
+++ b/plugins/jdbc/gradlew.bat
@@ -0,0 +1,82 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables, and ensure extensions are enabled
+setlocal EnableExtensions
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+"%COMSPEC%" /c exit 1
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+"%COMSPEC%" /c exit 1
+
+:execute
+@rem Setup the command line
+
+
+
+@rem Execute Gradle
+@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
+@rem which allows us to clear the local environment before executing the java command
+endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
+
+:exitWithErrorLevel
+@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
+"%COMSPEC%" /c exit %ERRORLEVEL%
diff --git a/plugins/jdbc/package.sh b/plugins/jdbc/package.sh
index 236ba3627d..303369adc6 100755
--- a/plugins/jdbc/package.sh
+++ b/plugins/jdbc/package.sh
@@ -2,13 +2,13 @@
set -eu
ROOT="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
-VERSION="$(grep -m1 '<version>' "$ROOT/pom.xml" | sed -E 's/.*<version>([^<]+)<.*/\1/')"
+VERSION="$(sed -nE "s/^version[[:space:]]*=[[:space:]]*'([^']+)'.*/\1/p" "$ROOT/build.gradle" | head -n 1)"
PACKAGE_DIR="$ROOT/dist/dbx-jdbc-plugin-$VERSION"
ZIP_PATH="$ROOT/dist/dbx-jdbc-plugin-$VERSION.zip"
LATEST_ZIP_PATH="$ROOT/dist/dbx-jdbc-plugin-latest.zip"
cd "$ROOT"
-mvn -q -DskipTests package
+./gradlew -q shadowJar -x test
rm -rf "$PACKAGE_DIR" "$ZIP_PATH" "$LATEST_ZIP_PATH"
mkdir -p "$PACKAGE_DIR/bin" "$PACKAGE_DIR/lib"
@@ -17,7 +17,7 @@ cp "$ROOT/bin/dbx-jdbc-plugin" "$PACKAGE_DIR/bin/dbx-jdbc-plugin"
cp "$ROOT/bin/dbx-jdbc-plugin.bat" "$PACKAGE_DIR/bin/dbx-jdbc-plugin.bat"
cp "$ROOT/bin/dbx-maven-resolver" "$PACKAGE_DIR/bin/dbx-maven-resolver"
cp "$ROOT/bin/dbx-maven-resolver.bat" "$PACKAGE_DIR/bin/dbx-maven-resolver.bat"
-cp "$ROOT/target/dbx-jdbc-plugin-$VERSION-all.jar" "$PACKAGE_DIR/lib/dbx-jdbc-plugin.jar"
+cp "$ROOT/build/libs/dbx-jdbc-plugin-all.jar" "$PACKAGE_DIR/lib/dbx-jdbc-plugin.jar"
chmod +x "$PACKAGE_DIR/bin/dbx-jdbc-plugin"
chmod +x "$PACKAGE_DIR/bin/dbx-maven-resolver"
diff --git a/plugins/jdbc/pom.xml b/plugins/jdbc/pom.xml
deleted file mode 100644
index addcc98930..0000000000
--- a/plugins/jdbc/pom.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>app.dbx</groupId>
- <artifactId>dbx-jdbc-plugin</artifactId>
- <version>0.1.26</version>
-
- <properties>
- <maven.compiler.source>17</maven.compiler.source>
- <maven.compiler.target>17</maven.compiler.target>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.resolver.version>2.0.18</maven.resolver.version>
- <maven.core.version>4.0.0-rc-5</maven.core.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.17.2</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.36</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-nop</artifactId>
- <version>1.7.36</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.18.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-api</artifactId>
- <version>${maven.resolver.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-spi</artifactId>
- <version>${maven.resolver.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-util</artifactId>
- <version>${maven.resolver.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-impl</artifactId>
- <version>${maven.resolver.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-connector-basic</artifactId>
- <version>${maven.resolver.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-transport-file</artifactId>
- <version>${maven.resolver.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-transport-jdk</artifactId>
- <version>${maven.resolver.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-supplier-mvn4</artifactId>
- <version>${maven.resolver.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-resolver-provider</artifactId>
- <version>${maven.core.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model-builder</artifactId>
- <version>${maven.core.version}</version>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>2.2.224</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>5.10.3</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>3.2.5</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>3.5.3</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <createDependencyReducedPom>false</createDependencyReducedPom>
- <shadedArtifactAttached>true</shadedArtifactAttached>
- <shadedClassifierName>all</shadedClassifierName>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <mainClass>app.dbx.jdbc.DbxJdbcPlugin</mainClass>
- </transformer>
- </transformers>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/plugins/jdbc/settings.gradle b/plugins/jdbc/settings.gradle
new file mode 100644
index 0000000000..524e6ba832
--- /dev/null
+++ b/plugins/jdbc/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'dbx-jdbc-plugin'