forked from apache/calcite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On cygwin, fix sqlline to work around jline/jline2#62. sqlline now uses build-classpath on both linux and cygwin, in contrast to sqlline.bat, which uses copy-dependencies.
- Loading branch information
1 parent
10aeb5d
commit 5a4126f
Showing
3 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,58 @@ | ||
#!/bin/bash | ||
# sqlline - Script to launch SQL shell | ||
# | ||
# Licensed to Julian Hyde under one or more contributor license | ||
# agreements. See the NOTICE file distributed with this work for | ||
# additional information regarding copyright ownership. | ||
# | ||
# Julian Hyde licenses this file to you 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: | ||
# | ||
# http://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. | ||
# | ||
# Example: | ||
# $ ./sqlline | ||
# sqlline> !connect jdbc:optiq: admin admin | ||
|
||
# Deduce whether we are running cygwin | ||
case $(uname -s) in | ||
(CYGWIN*) cygwin=true;; | ||
(*) cygwin=;; | ||
esac | ||
|
||
# Build classpath on first call. (To force rebuild, remove .classpath.txt.) | ||
cd $(dirname $0) | ||
if [ ! -f .fullclasspath.txt ]; then | ||
mvn dependency:build-classpath -Dmdep.outputFile=.classpath.txt | ||
awk -v RS=: -v ORS=: '{if(!m[$0]) {m[$0]=1; print}}' .classpath.txt */.classpath.txt > .fullclasspath.txt | ||
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 mongodb spark splunk; do | ||
for module in core avatica mongodb spark splunk; do | ||
CP=${CP}${module}/target/classes: | ||
CP=${CP}${module}/target/test-classes: | ||
done | ||
CP="${CP}$(cat target/fullclasspath.txt)" | ||
|
||
VM_OPTS= | ||
if [ "$cygwin" ]; then | ||
CP=$(cygpath -wp "$CP") | ||
|
||
# Work around https://github.com/jline/jline2/issues/62 | ||
VM_OPTS=-Djline.terminal=jline.UnixTerminal | ||
fi | ||
|
||
export JAVA_OPTS=-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl | ||
|
||
exec java -cp "${CP}$(cat .fullclasspath.txt)" $JAVA_OPTS sqlline.SqlLine "$@" | ||
exec java $VM_OPTS -cp "${CP}" $JAVA_OPTS sqlline.SqlLine "$@" | ||
|
||
# End sqlline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@echo off | ||
:: sqlline.bat - Windows script to launch SQL shell | ||
:: | ||
:: Licensed to Julian Hyde under one or more contributor license | ||
:: agreements. See the NOTICE file distributed with this work for | ||
:: additional information regarding copyright ownership. | ||
:: | ||
:: Julian Hyde licenses this file to you 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: | ||
:: | ||
:: http://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. | ||
:: | ||
:: Example: | ||
:: > sqlline.bat | ||
:: sqlline> !connect jdbc:optiq: admin admin | ||
|
||
:: Copy dependency jars on first call. (To force jar refresh, remove target\dependencies) | ||
if not exist target\dependencies (call mvn -B dependency:copy-dependencies -DoverWriteReleases=false -DoverWriteSnapshots=false -DoverWriteIfNewer=true -DoutputDirectory=target\dependencies) | ||
|
||
java -Xmx1G -cp ".\target\dependencies\*;core\target\dependencies\*;avatica\target\dependencies\*;mongodb\target\dependencies\*;spark\target\dependencies\*;splunk\target\dependencies\*" sqlline.SqlLine --verbose=true %* | ||
|
||
:: End sqlline.bat |