From f671d9cd6681b0eb2739d2f8f6467f1ad17de68f Mon Sep 17 00:00:00 2001 From: Peter Amiri Date: Sat, 25 Apr 2026 16:28:12 -0700 Subject: [PATCH] fix: bundle sqlite-jdbc to fix `wheels new` on lucee 7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lucee 7's BundleProvider crashes when resolving sqlite-jdbc via the bundleName hint (malformed entry in upstream S3 bundle listing), so wheels-dev/wheels#2304 dropped the hint from the datasource emitted by `wheels new`. Without the hint Lucee falls back to classpath resolution, which requires the JAR to be on the Lucee lib path. This formula now: - Adds a `sqlite_jdbc` resource (3.49.1.0 from Maven Central, sha256 pinned) and stages it into share/wheels/lib/. - Drops the JAR into ~/.wheels/express//lib/ext/ on every run via the wrapper, idempotent — copies only if missing. The express directory only exists after the first LuCLI extraction, so the copy is a no-op on the first invocation and self-heals from the second invocation onward (which is fine — `wheels new` doesn't touch the database; `wheels migrate latest` does). - Adds a brew-test assertion that the JAR is staged into the Cellar. Co-Authored-By: Claude Opus 4.7 (1M context) --- Formula/wheels.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Formula/wheels.rb b/Formula/wheels.rb index efb3f54..352504b 100644 --- a/Formula/wheels.rb +++ b/Formula/wheels.rb @@ -5,6 +5,7 @@ class Wheels < Formula LUCLI_VERSION = "0.3.7" MODULE_VERSION = "4.0.0-SNAPSHOT+1596" + SQLITE_JDBC_VERSION = "3.49.1.0" if OS.mac? url "https://github.com/cybersonic/LuCLI/releases/download/v#{LUCLI_VERSION}/lucli-#{LUCLI_VERSION}-macos" @@ -24,6 +25,16 @@ class Wheels < Formula sha256 "b4e773dfaebe8716a3c16e9ecc4d3f13ac5f72eecc249dbf374c00e5f7f55e4b" end + # SQLite JDBC driver for the zero-config datasource emitted by `wheels new`. + # Lucee 7's BundleProvider crashes when resolving sqlite-jdbc via the + # bundleName hint, so wheels >=4.0 generates app.cfm without the hint and + # relies on the JAR being on the classpath. The wrapper drops this JAR into + # ~/.wheels/express//lib/ext/ on first run after LuCLI extracts. + resource "sqlite_jdbc" do + url "https://repo1.maven.org/maven2/org/xerial/sqlite-jdbc/#{SQLITE_JDBC_VERSION}/sqlite-jdbc-#{SQLITE_JDBC_VERSION}.jar" + sha256 "5c8609d2ca341deb8c6f71778974b5ba4995c7d32d7c7c89d9392a3e72c39291" + end + depends_on "openjdk@21" def install @@ -44,6 +55,10 @@ def install (share/"wheels/framework/wheels").install Dir["*"] end + resource("sqlite_jdbc").stage do + (share/"wheels/lib").install Dir["*.jar"] + end + (share/"wheels").mkpath (share/"wheels/.module-version").write MODULE_VERSION @@ -62,6 +77,7 @@ def install WHEELS_FRAMEWORK_DST="$HOME/.wheels/modules/wheels/vendor/wheels" WHEELS_VERSION_SRC="$BREW_PREFIX/share/wheels/.module-version" WHEELS_VERSION_DST="$HOME/.wheels/modules/wheels/.module-version" + SQLITE_JDBC_SRC="$BREW_PREFIX/share/wheels/lib/sqlite-jdbc-#{SQLITE_JDBC_VERSION}.jar" if [ -f "$WHEELS_VERSION_SRC" ]; then src_ver=$(cat "$WHEELS_VERSION_SRC") @@ -78,6 +94,17 @@ def install fi fi + # Drop sqlite-jdbc into LuCLI's extracted Lucee lib/ext/ if missing. The + # express dir only exists after first LuCLI run, so this is a no-op on + # the very first invocation and self-heals on every run after. + if [ -f "$SQLITE_JDBC_SRC" ]; then + for ext_dir in "$HOME/.wheels/express"/*/lib/ext; do + [ -d "$ext_dir" ] || continue + [ -f "$ext_dir/sqlite-jdbc-#{SQLITE_JDBC_VERSION}.jar" ] && continue + cp "$SQLITE_JDBC_SRC" "$ext_dir/" 2>/dev/null || true + done + fi + export JAVA_HOME="#{java_home}" export LUCLI_HOME="$HOME/.wheels" exec "$BREW_PREFIX/libexec/wheels" "$@" @@ -105,6 +132,7 @@ def caveats assert_predicate libexec/"wheels", :executable? assert_predicate share/"wheels/module/Module.cfc", :exist? assert_predicate share/"wheels/framework/wheels", :exist? + assert_predicate share/"wheels/lib/sqlite-jdbc-#{SQLITE_JDBC_VERSION}.jar", :exist? assert_match(/\d+\.\d+\.\d+/, shell_output("#{bin}/wheels --version")) end end