diff options
Diffstat (limited to 'infrastructure/bin')
-rwxr-xr-x | infrastructure/bin/classpath.sh | 21 | ||||
-rwxr-xr-x | infrastructure/bin/comp.sh | 199 | ||||
-rwxr-xr-x | infrastructure/bin/compilecache.sh | 66 | ||||
-rwxr-xr-x | infrastructure/bin/jscomp.sh | 23 | ||||
-rwxr-xr-x | infrastructure/bin/makejar.sh | 74 | ||||
-rwxr-xr-x | infrastructure/bin/makesars.sh | 23 | ||||
-rwxr-xr-x | infrastructure/bin/run.sh | 20 |
7 files changed, 426 insertions, 0 deletions
diff --git a/infrastructure/bin/classpath.sh b/infrastructure/bin/classpath.sh new file mode 100755 index 0000000..b1d297c --- /dev/null +++ b/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/infrastructure/bin/comp.sh b/infrastructure/bin/comp.sh new file mode 100755 index 0000000..5f65c2f --- /dev/null +++ b/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/infrastructure/bin/compilecache.sh b/infrastructure/bin/compilecache.sh new file mode 100755 index 0000000..6e42a50 --- /dev/null +++ b/infrastructure/bin/compilecache.sh @@ -0,0 +1,66 @@ +#!/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" +elif [ `uname` == "SunOS" ]; then + CP_CMD="cp -R" #Solaris cp does not have '-u' +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/infrastructure/bin/jscomp.sh b/infrastructure/bin/jscomp.sh new file mode 100755 index 0000000..3f5bc51 --- /dev/null +++ b/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/infrastructure/bin/makejar.sh b/infrastructure/bin/makejar.sh new file mode 100755 index 0000000..46b4609 --- /dev/null +++ b/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_LIBRARY_JAR lib/*.jar lib/manifest` +function genjar { + echo "unzipping JARs..." + pushd $1 >> /dev/null + $JAR xf $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/infrastructure/bin/makesars.sh b/infrastructure/bin/makesars.sh new file mode 100755 index 0000000..541b04a --- /dev/null +++ b/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/infrastructure/bin/run.sh b/infrastructure/bin/run.sh new file mode 100755 index 0000000..cf918d4 --- /dev/null +++ b/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 $@ + |