Home | History | Annotate | Download | only in build
      1 #!/bin/bash
      2 #
      3 # libjingle
      4 # Copyright 2013 Google Inc.
      5 #
      6 # Redistribution and use in source and binary forms, with or without
      7 # modification, are permitted provided that the following conditions are met:
      8 #
      9 #  1. Redistributions of source code must retain the above copyright notice,
     10 #     this list of conditions and the following disclaimer.
     11 #  2. Redistributions in binary form must reproduce the above copyright notice,
     12 #     this list of conditions and the following disclaimer in the documentation
     13 #     and/or other materials provided with the distribution.
     14 #  3. The name of the author may not be used to endorse or promote products
     15 #     derived from this software without specific prior written permission.
     16 #
     17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     18 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     19 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
     20 # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     22 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     23 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     24 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     25 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     26 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 
     28 # javac & jar wrapper helping to simplify gyp action specification.
     29 
     30 set -e  # Exit on any error.
     31 
     32 # Allow build-error parsers (such as emacs' compilation-mode) to find failing
     33 # files easily.
     34 echo "$0: Entering directory \``pwd`'"
     35 
     36 JAVA_HOME="$1"; shift
     37 JAR_NAME="$1"; shift
     38 TMP_DIR="$1"; shift
     39 CLASSPATH="$1"; shift
     40 
     41 if [ -z "$1" ]; then
     42   echo "Usage: $0 jar-name temp-work-dir source-path-dir .so-to-bundle " \
     43     "classpath path/to/Source1.java path/to/Source2.java ..." >&2
     44   exit 1
     45 fi
     46 
     47 rm -rf "$TMP_DIR"
     48 mkdir -p "$TMP_DIR"
     49 
     50 $JAVA_HOME/bin/javac -Xlint:deprecation -Xlint:unchecked -d "$TMP_DIR" \
     51   -classpath "$CLASSPATH" "$@"
     52 $JAVA_HOME/bin/jar cf "$JAR_NAME" -C "$TMP_DIR" .
     53