Author: andy
Date: Fri Jun 27 08:01:44 2014
New Revision: 1605983
URL: http://svn.apache.org/r1605983
Log:
classpath building in development environment
Added:
jena/trunk/jena-tdb/bin/make_classpath (with props)
jena/trunk/jena-tdb/bin/make_classpath_mvn (with props)
Modified:
jena/trunk/jena-tdb/ (props changed)
jena/trunk/jena-tdb/bin/tdb_path
Propchange: jena/trunk/jena-tdb/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Jun 27 08:01:44 2014
@@ -2,6 +2,7 @@ target
classes
tmp
DB*
+tdb.classpath
.classpath
.project
.settings
Added: jena/trunk/jena-tdb/bin/make_classpath
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-tdb/bin/make_classpath?rev=1605983&view=auto
==============================================================================
--- jena/trunk/jena-tdb/bin/make_classpath (added)
+++ jena/trunk/jena-tdb/bin/make_classpath Fri Jun 27 08:01:44 2014
@@ -0,0 +1,98 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF 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.
+
+# Usage: make_classpath DIR
+# Finds jars in lib/, and class files in classes/ and build/classes
+# If CP is already set, include that as well.
+
+DIRROOT="$1"
+
+if [ "$DIRROOT" = "" ]
+then
+ echo "No directory given" 1>&2
+ exit 1
+ fi
+
+# remove any trailing /
+DIRROOT=${DIRROOT%/}
+
+LIBDIR="$DIRROOT/lib"
+# List
+CPDIR1="$DIRROOT/classes"
+CPDIR2="$DIRROOT/target/classes"
+CPDIR3="$DIRROOT/target/classes-eclipse"
+ETCDIR="$DIRROOT/etc"
+
+# Cygwin - on Windows, the Java separator is ;
+# Alternative: Form in UNIX style, turn into windows form at the end.
+
+CYGWIN=0
+SEP=':'
+if [ "$OSTYPE" = "cygwin" ]
+then
+ CYGWIN=1
+ SEP=';'
+ fi
+
+# CP is the variable collecting the path/
+# It may already have a value.
+
+CP="${CP:-}"
+
+# Append any jars in the lib/ directory
+
+for jar in "$LIBDIR"/*.jar
+ do
+ # Check for no expansion
+ [ -e "$jar" ] || break
+ # Check not sources and no javadoc.
+ [ "${jar/sources}" = "${jar}" ] || continue
+ [ "${jar/javadoc}" = "${jar}" ] || continue
+ #echo "Path: $jar"
+ [ "$CP" != "" ] && CP="${CP}${SEP}"
+ CP="${CP}$jar"
+
+## # Suggested:
+## if [ "$CYGWIN" = 1 ]
+## then
+## CP="${CP}$(cygpath -wp "$jar")"
+## else
+## CP="${CP}$jar"
+## fi
+##
+done
+
+# Prepend any classes/ directory
+# As it's "prepend", we need to do it in reverse.
+for dir in "$CPDIR3" "$CPDIR2" "$CPDIR1"
+do
+ if [ -e "$dir" ]
+ then
+ [ "$CP" != "" ] && CP="${SEP}${CP}"
+ CP="${dir}$CP"
+ fi
+done
+
+# Add DIRROOT
+#CP="${CP}${SEP}${DIRROOT}"
+
+## if [ "$CYGWIN" = 1 ]
+## then
+## CP="$(cygpath -w "$CP")"
+## fi
+
+echo "$CP"
Propchange: jena/trunk/jena-tdb/bin/make_classpath
------------------------------------------------------------------------------
svn:executable = *
Added: jena/trunk/jena-tdb/bin/make_classpath_mvn
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-tdb/bin/make_classpath_mvn?rev=1605983&view=auto
==============================================================================
--- jena/trunk/jena-tdb/bin/make_classpath_mvn (added)
+++ jena/trunk/jena-tdb/bin/make_classpath_mvn Fri Jun 27 08:01:44 2014
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF 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.
+
+DIRROOT="$1"
+
+if [ "$DIRROOT" = "" ]; then
+ echo "No directory given" 1>&2
+ exit 1
+fi
+
+SEP=':'
+CP=${CP:-}
+
+which mvn > /dev/null
+HAS_MAVEN=$?
+if [ -e "$DIRROOT/pom.xml" ] && [ $HAS_MAVEN -eq 0 ]; then
+ # Take advantage of maven dependency plugin
+
+ # We want to filter out maven's INFO, WARNING and dependency download
messages
+ # We leave ERROR messages alone even though they'll break the classpath we
don't want
+ # to suppress them
+ MVN_OUTPUT_PATTERN="(^\[?(INFO|WARNING)|Download)"
+
+ # Switch up to the root directory and run maven
+ CURR_DIR=$PWD
+ cd $DIRROOT
+ MVN_CP=`mvn dependency:build-classpath -U | egrep -v ${MVN_OUTPUT_PATTERN}`
+ cd $CURR_DIR
+
+ # Append the result to any user defined classpath
+ [ "$CP" != "" ] && CP="${CP}${SEP}"
+ CP="${CP}${MVN_CP}"
+else
+ # Use the crude method
+ M2_REPO="${M2_REPO:-$HOME/.m2/repository/}" ;
+ X=$(perl -ne 'next unless /\spath="$M2_REPO([^"]*)"/s ; print "$1","\n"'
$DIRROOT/.classpath)
+
+ for x in $X
+ do
+ [ "$CP" != "" ] && CP="${CP}${SEP}"
+ CP="$CP$M2_REPO$x"
+ done
+fi
+
+if [ -e "$DIRROOT/classes" ]; then
+ CP="$DIRROOT/../jena-core/classes${SEP}$CP"
+ CP="$DIRROOT/classes${SEP}$CP"
+elif [ -e "$DIRROOT/target/classes" ]; then
+ CP="$DIRROOT/target/classes{SEP}$CP"
+fi
+
+echo "$CP"
Propchange: jena/trunk/jena-tdb/bin/make_classpath_mvn
------------------------------------------------------------------------------
svn:executable = *
Modified: jena/trunk/jena-tdb/bin/tdb_path
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-tdb/bin/tdb_path?rev=1605983&r1=1605982&r2=1605983&view=diff
==============================================================================
--- jena/trunk/jena-tdb/bin/tdb_path (original)
+++ jena/trunk/jena-tdb/bin/tdb_path Fri Jun 27 08:01:44 2014
@@ -15,37 +15,16 @@
## See the License for the specific language governing permissions and
## limitations under the License.
-# This is the distribution
-if [ -e "$TDBROOT/lib" ]
-then
- CP="$TDBROOT/lib/"'*'
- echo "$CP"
- exit
+if [ "$TDBROOT" = "" ]; then
+ echo "TDBROOT not set" 1>&2
+ exit 1
fi
-M2_REPO="${M2_REPO:-$HOME/.m2/repository}" ;
-# Looking in the POM would be better but it is very slow.
-X=$(perl -ne 'next unless /\spath="M2_REPO([^"]*)"/s ; print "$1","\n"'
$TDBROOT/.classpath)
-
-SEP=':'
-CP="${CP:-}"
-
-if [ -e "$TDBROOT/classes" ]
-then
- [ -z "$CP" ] || CP="${CP}${SEP}"
- CP="${CP}$TDBROOT/classes"
- CP="${CP}${SEP}$TDBROOT/../jena-arq/classes"
- CP="${CP}${SEP}$TDBROOT/../jena-core/classes"
-elif [ -e "$TDBROOT/target/classes" ]
-then
- [ -z "$CP" ] || CP="${CP}${SEP}"
- CP="${CP}$TDBROOT/target/classes"
+if [ -e "$TDBROOT/tdb.classpath" ]; then
+ cat "$TDBROOT/tdb.classpath"
+elif [ -e "$TDBROOT/.classpath" ]; then
+ # Development area
+ exec "$TDBROOT/bin/make_classpath_mvn" "$TDBROOT" | tee
"$TDBROOT/tdb.classpath"
+else
+ exec "$TDBROOT/bin/make_classpath" "$TDBROOT" | tee "$TDBROOT/tdb.classpth"
fi
-
-for x in $X
-do
- [ -z "$CP" ] || CP="${CP}${SEP}"
- CP="$CP$M2_REPO$x"
-done
-
-echo "$CP"