summaryrefslogtreecommitdiffstats
path: root/trunk/infrastructure/bin
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/infrastructure/bin')
-rwxr-xr-xtrunk/infrastructure/bin/classpath.sh21
-rwxr-xr-xtrunk/infrastructure/bin/comp.sh199
-rw-r--r--trunk/infrastructure/bin/compilecache.sh64
-rwxr-xr-xtrunk/infrastructure/bin/jscomp.sh23
-rwxr-xr-xtrunk/infrastructure/bin/makejar.sh74
-rwxr-xr-xtrunk/infrastructure/bin/makesars.sh23
-rwxr-xr-xtrunk/infrastructure/bin/run.sh20
7 files changed, 424 insertions, 0 deletions
diff --git a/trunk/infrastructure/bin/classpath.sh b/trunk/infrastructure/bin/classpath.sh
new file mode 100755
index 0000000..b1d297c
--- /dev/null
+++ b/trunk/infrastructure/bin/classpath.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Copyright 2009 Google Inc.
+#
+# 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
+#
+# 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.
+
+CP="./"
+for f in `ls lib/*.jar`; do
+ CP="${CP}:${f}"
+done
+echo $CP
diff --git a/trunk/infrastructure/bin/comp.sh b/trunk/infrastructure/bin/comp.sh
new file mode 100755
index 0000000..5f65c2f
--- /dev/null
+++ b/trunk/infrastructure/bin/comp.sh
@@ -0,0 +1,199 @@
+#!/bin/bash -e
+
+# Copyright 2009 Google Inc.
+#
+# 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
+#
+# 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.
+
+source bin/compilecache.sh
+
+rm -rf build
+mkdir build
+
+if [ "$1" == "clearcache" ]; then
+ echo "CLEARING BUILD CACHE"
+ rm -rf buildcache
+ mkdir -p buildcache
+ shift;
+fi
+
+if [ -z "$CC" ]; then
+ CC=fsc
+fi
+echo compiling with \'$CC\'...
+
+CP=`bin/classpath.sh`
+CP="build/:${CP}"
+
+if [ -z "$OBFUSC" ]; then
+ OBFUSC=0
+else
+ echo obfuscation on...
+fi
+
+#THRIFTFILES=`echo net.appjet.fancypants/{storage/KeyValueStore,DebugLog,LtpLog}.thrift`
+#THRIFTFILES=`find gen-java/net/appjet/fancypants -name '*.java'`
+#function genthrift {
+# echo "generating thrift..."
+# rm -rf gen-java
+# for a in $THRIFTFILES; do
+# thrift -java $a
+# done
+
+# echo "compiling thrift..."
+# CP="${CP}:gen-java/"
+# javac \
+# -classpath $CP \
+# -target 1.5 \
+# -d $1 \
+# $THRIFTFILES
+#}
+#cacheonfiles thrift "$THRIFTFILES" genthrift
+
+ARGS=$@
+
+COMMONFILES=`find net.appjet.common -name '*.java'`
+COMMONSCALAFILES=`find net.appjet.common -name '*.scala'`
+function gencommon {
+ echo "compiling common..."
+ javac \
+ -cp $CP \
+ -d $1 \
+ -target 1.5 \
+ $COMMONFILES
+ $CC \
+ -classpath $CP \
+ -d $1 \
+ -target:jvm-1.5 \
+ $ARGS \
+ $COMMONSCALAFILES
+}
+cacheonfiles common "$COMMONFILES $COMMONSCALAFILES" gencommon
+
+SARSFILES=`find net.appjet.common.sars -name '*.scala'`
+function gensars {
+ echo "compiling sars..."
+ $CC \
+ -classpath $CP \
+ -d $1 \
+ -target:jvm-1.5 \
+ $ARGS \
+ $SARSFILES
+}
+cacheonfiles sars "$SARSFILES" gensars
+
+CLIFILES=`find net.appjet.common.cli -name '*.scala'`
+function gencli {
+ echo "compiling cli..."
+ $CC \
+ -classpath $CP \
+ -d $1 \
+ -target:jvm-1.5 \
+ $ARGS \
+ $CLIFILES
+ echo "done with cli"
+}
+cacheonfiles cli "$CLIFILES" gencli
+
+BODYLOCKFILES=`find net.appjet.bodylock -name '*.scala'`
+function genbodylock {
+ echo "compiling rhino abstraction..."
+ $CC \
+ -classpath build:$CP \
+ -d $1 \
+ -target:jvm-1.5 \
+ $ARGS \
+ $BODYLOCKFILES
+}
+cacheonfiles bodylock "$BODYLOCKFILES" genbodylock
+
+APPSERVERFILES=`find net.appjet.oui -name '*.scala'`
+APPSERVERJAVAFILES=`find net.appjet.oui -name '*.java'`
+function genappserver {
+ echo "compiling appserver source..."
+ javac \
+ -cp $CP \
+ -d $1 \
+ -target 1.5 \
+ $APPSERVERJAVAFILES
+ $CC \
+ -classpath $CP \
+ -d $1 \
+ -target:jvm-1.5 \
+ $ARGS \
+ $APPSERVERFILES
+}
+cacheonfiles appserver "$APPSERVERFILES $APPSERVERJAVAFILES" genappserver
+
+AJSTDLIBFILES=`find net.appjet.ajstdlib -name '*.scala'`
+AJSTDLIBJAVAFILES=`find net.appjet.ajstdlib -name '*.java'`
+function genajstdlib {
+ echo "compiling ajstdlib..."
+ mkdir -p $1
+ if [ ! -z "$AJSTDLIBJAVAFILES" ]; then
+ javac \
+ -cp $CP \
+ -d $1 \
+ -target 1.5 \
+ $AJSTDLIBJAVAFILES
+ fi
+ $CC \
+ -classpath $CP \
+ -d $1 \
+ -target:jvm-1.5 \
+ $ARGS \
+ $AJSTDLIBFILES
+}
+cacheonfiles ajstdlib "$AJSTDLIBFILES $AJSTDLIBJAVAFILES" genajstdlib
+
+EPFILES=`find com.etherpad -name '*.scala'`
+function genetherpad {
+ echo "compilng etherpad..."
+ $CC \
+ -classpath $CP \
+ -d $1 \
+ -target:jvm-1.5 \
+ $ARGS \
+ $EPFILES
+}
+cacheonfiles etherpad "$EPFILES" genetherpad
+
+OOSERVICEFILES=`find com.etherpad.openofficeservice -name '*.scala'`
+function genooservice {
+ echo "compiling ooservice..."
+ $CC \
+ -classpath $CP \
+ -d $1 \
+ -target:jvm-1.5 \
+ $ARGS \
+ $OOSERVICEFILES
+}
+cacheonfiles ooservice "$OOSERVICEFILES" genooservice
+
+echo "copying files..."
+cp net.appjet.ajstdlib/streaming-client.js build/net/appjet/ajstdlib/
+if [ $OBFUSC ] ; then
+ echo obfuscating...
+ scala -classpath $CP:. net.appjet.bodylock.compressor \
+ build/net/appjet/ajstdlib/streaming-client.js
+fi
+
+cp net.appjet.ajstdlib/streaming-iframe.html build/net/appjet/ajstdlib/
+mkdir -p build/net/appjet/ajstdlib/modules
+
+echo "building javascript classfiles..."
+scala -classpath $CP net.appjet.bodylock.Compiler \
+ -destination=build/net/appjet/ajstdlib/ \
+ -cutPrefix=framework-src \
+ `find framework-src -name '*.js'`
+
+echo "done."
diff --git a/trunk/infrastructure/bin/compilecache.sh b/trunk/infrastructure/bin/compilecache.sh
new file mode 100644
index 0000000..a2b6220
--- /dev/null
+++ b/trunk/infrastructure/bin/compilecache.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# Copyright 2009 Google Inc.
+#
+# 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
+#
+# 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.
+
+CP_CMD="cp -R -u"
+if [ `uname` == "Darwin" ]; then
+ CP_CMD="/bin/cp -R -n"
+fi
+
+function cacheonfiles {
+ NAME=$1; FILES=$2; FUNC=$3; NOCOPY=1;
+ if [ -z "$4" ]; then
+ NOCOPY=0
+ fi
+ REBUILD=0
+ BPATH=buildcache/$NAME
+ FILETEST=$BPATH/t
+ if [ ! -f $FILETEST ]; then
+ REBUILD=1
+ else
+ for a in $FILES; do
+ if [ $FILETEST -ot $a ]; then
+ echo $a has changed, rebuilding $NAME
+ REBUILD=1
+ fi
+ done
+ fi
+ if [ $REBUILD -eq 1 ]; then
+ if [ -d $BPATH ]; then
+ rm -rf $BPATH
+ fi
+ mkdir -p $BPATH
+ $FUNC $BPATH
+ pushd $BPATH >> /dev/null
+ touch t
+ popd >> /dev/null
+ else
+ echo using cached $NAME...
+ fi
+ if [ $NOCOPY -ne 1 ]; then
+ for a in $BPATH/*; do
+ if [ -d $a ]; then
+ $CP_CMD $a build/
+ elif [ -f $a ]; then
+ cp $a build/
+ else
+ echo unknown file type $a
+ exit 1
+ fi
+ done
+ fi
+}
diff --git a/trunk/infrastructure/bin/jscomp.sh b/trunk/infrastructure/bin/jscomp.sh
new file mode 100755
index 0000000..3f5bc51
--- /dev/null
+++ b/trunk/infrastructure/bin/jscomp.sh
@@ -0,0 +1,23 @@
+#!/bin/bash -e
+
+# Copyright 2009 Google Inc.
+#
+# 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
+#
+# 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.
+
+rm -rf buildjs
+mkdir buildjs
+
+bin/comp.sh
+CLASSPATH=`bin/classpath.sh`
+
+scala -cp $CLASSPATH:build net.appjet.bodylock.Compiler -destination buildjs $@
diff --git a/trunk/infrastructure/bin/makejar.sh b/trunk/infrastructure/bin/makejar.sh
new file mode 100755
index 0000000..c774fa6
--- /dev/null
+++ b/trunk/infrastructure/bin/makejar.sh
@@ -0,0 +1,74 @@
+#!/bin/bash -e
+
+# Copyright 2009 Google Inc.
+#
+# 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
+#
+# 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.
+
+if [ -z "$JAR" ]; then
+ JAR=jar
+else
+ echo "using JAR $JAR..."
+fi
+
+cp ${MYSQL_CONNECTOR_JAR} lib/
+
+source bin/compilecache.sh
+
+if [ "$1" == "clearcache" ]; then
+ echo "CLEARING BUILD CACHE"
+ rm -rf buildcache
+ shift;
+fi
+
+TMPSTORE=/tmp/ajbuild-tmpstore-`date +%s`
+
+JARFILES=`echo $SCALA_HOME/lib/scala-library.jar lib/*.jar lib/manifest`
+function genjar {
+ echo "unzipping JARs..."
+ pushd $1 >> /dev/null
+ $JAR xf $SCALA_HOME/lib/scala-library.jar
+ rm -rf META-INF
+ for a in ../../lib/*.jar; do
+ $JAR xf $a
+ rm -rf META-INF/{MANIFEST.MF,NOTICE{,.txt},LICENSE{,.txt},INDEX.LIST,SUN_MICR.{RSA,SF},maven}
+ done
+
+ echo "making cached JAR...."
+ $JAR -cfm appjet.jar ../../lib/manifest .
+ mv appjet.jar /tmp/appjet.jar
+ rm -rf *
+ mv /tmp/appjet.jar ./
+
+ popd >> /dev/null
+}
+cacheonfiles JAR "$JARFILES" genjar 1
+
+echo "compiling..."
+bin/comp.sh $@
+
+pushd build >> /dev/null
+
+echo "copying cached JAR..."
+cp ../buildcache/JAR/appjet.jar ./
+
+echo "making JAR..."
+mv appjet.jar /tmp/appjet.jar
+$JAR -uf /tmp/appjet.jar . #META-INF com javax org net uk v scala dojox
+mv /tmp/appjet.jar ./
+
+echo "cleaning up..."
+rm -rf $TMPSTORE
+
+popd >> /dev/null
+
+echo "done."
diff --git a/trunk/infrastructure/bin/makesars.sh b/trunk/infrastructure/bin/makesars.sh
new file mode 100755
index 0000000..541b04a
--- /dev/null
+++ b/trunk/infrastructure/bin/makesars.sh
@@ -0,0 +1,23 @@
+#!/bin/bash -e
+
+# Copyright 2009 Google Inc.
+#
+# 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
+#
+# 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.
+
+echo "compiling..."
+bin/comp.sh $@
+
+echo "building build/appjet-sars.jar..."
+jar cMf build/appjet-sars.jar -C build `echo build/net/appjet/common/sars/*.class | cut -d/ -f 2-`
+
+echo "done."
diff --git a/trunk/infrastructure/bin/run.sh b/trunk/infrastructure/bin/run.sh
new file mode 100755
index 0000000..cf918d4
--- /dev/null
+++ b/trunk/infrastructure/bin/run.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Copyright 2009 Google Inc.
+#
+# 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
+#
+# 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.
+
+CP=`bin/classpath.sh`
+
+JAVA_OPTS="-d64 -server -Xmx12288m -Xloggc:/appjet/log/appserver/jvm-gc.log -XX:MaxPermSize=256m" scala -cp build:$CP net.appjet.oui.main -devMode -ajstdlibHome framework-src/modules -listenSars 8081 $@
+