[CALCITE-2229] Allow sqlsh to be run from path, not just current directory
Project: http://git-wip-us.apache.org/repos/asf/calcite/repo Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/d0a119d5 Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/d0a119d5 Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/d0a119d5 Branch: refs/heads/master Commit: d0a119d50e5bd9b366f2e41eff70b2d646935626 Parents: c4e9070 Author: Julian Hyde <[email protected]> Authored: Tue Mar 27 14:31:28 2018 -0700 Committer: Julian Hyde <[email protected]> Committed: Wed Mar 28 15:48:20 2018 -0700 ---------------------------------------------------------------------- sqlsh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/calcite/blob/d0a119d5/sqlsh ---------------------------------------------------------------------- diff --git a/sqlsh b/sqlsh index 11ee912..c606f53 100755 --- a/sqlsh +++ b/sqlsh @@ -21,20 +21,25 @@ # Build classpath on first call. # (To force rebuild, remove target/fullclasspath.txt.) -cd $(dirname $0) -if [ ! -f target/fullclasspath.txt ]; then + +root=$(cd $(dirname $(readlink $0)); pwd) + +if [ ! -f ${root}/target/fullclasspath.txt ]; then + ( + cd ${root} mvn dependency:build-classpath -Dmdep.outputFile=target/classpath.txt awk -v RS=: -v ORS=: '{if (!m[$0]) {m[$0]=1; print}}' \ target/classpath.txt \ */target/classpath.txt > target/fullclasspath.txt + ) fi CP= for module in core file plus; do - CP=${CP}${module}/target/classes: - CP=${CP}${module}/target/test-classes: + CP=${CP}${root}/${module}/target/classes: + CP=${CP}${root}/${module}/target/test-classes: done -CP="${CP}$(cat target/fullclasspath.txt)" +CP="${CP}$(cat ${root}/target/fullclasspath.txt)" VM_OPTS= export JAVA_OPTS=-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
