github.com/myafeier/fabric@v1.0.1-0.20170722181825-3a4b1f2bce86/core/chaincode/shim/java/javabuild.sh (about)

     1  #!/bin/bash
     2  
     3  #
     4  #Copyright DTCC 2016 All Rights Reserved.
     5  #
     6  #Licensed under the Apache License, Version 2.0 (the "License");
     7  #you may not use this file except in compliance with the License.
     8  #You may obtain a copy of the License at
     9  #
    10  #         http://www.apache.org/licenses/LICENSE-2.0
    11  #
    12  #Unless required by applicable law or agreed to in writing, software
    13  #distributed under the License is distributed on an "AS IS" BASIS,
    14  #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15  #See the License for the specific language governing permissions and
    16  #limitations under the License.
    17  #
    18  #
    19  set -e
    20  PARENTDIR=$(pwd)
    21  ARCH=`uname -m`
    22  
    23  pattern='(https?://)?((([^:\/]+)(:([^\/]*))?@)?([^:\/?]+)(:([0-9]+))?)'
    24  
    25  [ -n "$http_proxy" ] && HTTPPROXY=$http_proxy
    26  [ -n "$HTTP_PROXY" ] && HTTPPROXY=$HTTP_PROXY
    27  [ -n "$https_proxy" ] && HTTPSPROXY=$https_proxy
    28  [ -n "$HTTPS_PROXY" ] && HTTPSPROXY=$HTTPS_PROXY
    29  
    30  if [ -n "$HTTPPROXY" ]; then
    31  	if [[ "$HTTPPROXY" =~ $pattern ]]; then
    32  		[ -n "${BASH_REMATCH[4]}" ] && JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyUser=${BASH_REMATCH[4]}"
    33  		[ -n "${BASH_REMATCH[6]}" ] && JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyPass=${BASH_REMATCH[6]}"
    34  		[ -n "${BASH_REMATCH[7]}" ] && JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=${BASH_REMATCH[7]}"
    35  		[ -n "${BASH_REMATCH[9]}" ] && JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyPort=${BASH_REMATCH[9]}"
    36  	fi
    37  fi
    38  if [ -n "$HTTPSPROXY" ]; then
    39  	if [[ "$HTTPSPROXY" =~ $pattern ]]; then
    40  		[ -n "${BASH_REMATCH[4]}" ] && JAVA_OPTS="$JAVA_OPTS -Dhttps.proxyUser=${BASH_REMATCH[4]}"
    41  		[ -n "${BASH_REMATCH[6]}" ] && JAVA_OPTS="$JAVA_OPTS -Dhttps.proxyPass=${BASH_REMATCH[6]}"
    42  		[ -n "${BASH_REMATCH[7]}" ] && JAVA_OPTS="$JAVA_OPTS -Dhttps.proxyHost=${BASH_REMATCH[7]}"
    43  		[ -n "${BASH_REMATCH[9]}" ] && JAVA_OPTS="$JAVA_OPTS -Dhttps.proxyPort=${BASH_REMATCH[9]}"
    44  	fi
    45  fi
    46  
    47  export JAVA_OPTS
    48  
    49  if [ x$ARCH == xx86_64 ]
    50  then
    51      gradle -q -b ${PARENTDIR}/core/chaincode/shim/java/build.gradle clean
    52      gradle -q -b ${PARENTDIR}/core/chaincode/shim/java/build.gradle build
    53      cp -r ${PARENTDIR}/core/chaincode/shim/java/build/libs /root/
    54  else
    55      echo "FIXME: Java Shim code needs work on ppc64le and s390x."
    56      echo "Commenting it for now."
    57  fi