[DO NOT MERGE] Import Jack and Jill Brest 1.1-rc2

Jack version: 169300 6818d55680a43e0b0b7b10ec50804c6c82d9c380
Jill version: 169300 18d76d9a6dc022d7d89b3033e15c6945f877b688

(cherry-picked from commit 9ebf1c82ff7cec98b657f2f4901ca8c42c6b2b23)

Change-Id: I39aa1f24780c216e978ef743098ca7ac65b2962e
diff --git a/tools/jack b/tools/jack
index 35591c2..be5383c 100755
--- a/tools/jack
+++ b/tools/jack
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-# v 1.1-a11-log-pl2
+# v 1.1-rc2
 #
 set -o nounset
 umask 077
@@ -59,7 +59,7 @@
 #
 if [ "$SERVER" != "true" ]; then
   exec $JACK_VM_COMMAND -cp $JACK_JAR com.android.jack.Main "$@"
-  echo "Cannot succeed to launch Jack" >&2
+  echo "ERROR: Cannot succeed to launch Jack without Jack server" >&2
   exit 255
 fi
 
@@ -135,7 +135,7 @@
     # Failed to connect
     if [ $(date +%s) -ge $DATE_CONNECT ]; then
       if [ $RETRY_LAUNCH -eq 0 ]; then
-        echo "Cannot launch background server" >&2
+        echo "ERROR: Cannot launch Jack server" >&2
         abort
       else
         let RETRY_LAUNCH=RETRY_LAUNCH-1
@@ -153,21 +153,21 @@
     # Http code not OK, let's decode and abort
     if [ $HTTP_CODE -eq 401 ]; then
       # 401: Unauthorized
-      echo "Security problem, see server log ($SERVER_LOG)" >&2
+      echo "ERROR: Security problem, see Jack server log ($SERVER_LOG)" >&2
       abort
     elif [ $HTTP_CODE -eq 400 ]; then
       # 400: Bad request
-      echo "Bad request, see server log ($SERVER_LOG)" >&2
+      echo "ERROR: Bad request, see Jack server log ($SERVER_LOG)" >&2
       abort
     else
       # Other
-      echo "Internal unknown error ($HTTP_CODE), try other ports in ~/.jack, or see server log ($SERVER_LOG)" >&2
+      echo "ERROR: Internal unknown error ($HTTP_CODE), try other ports in ~/.jack, or see Jack server log ($SERVER_LOG)" >&2
       abort
     fi
   else
     # In case of partial, timeout, empty respond, network error, let's retry
     if [ $RETRY_SESSION -eq 0 ]; then
-      echo "Communication error with server ($CURL_CODE)" >&2
+      echo "ERROR: Communication error with Jack server ($CURL_CODE)" >&2
       abort
     else
       let RETRY_SESSION=RETRY_SESSION-1
diff --git a/tools/jack-admin b/tools/jack-admin
index a1bc7af..13e6dff 100755
--- a/tools/jack-admin
+++ b/tools/jack-admin
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-# v 1.1-a11
+# v 1.1-rc2
 #
 set -o nounset
 umask 077
@@ -82,14 +82,19 @@
     exit 0 ;;
   kill-server)
     echo "Killing background server"
-    kill $(ps aux | grep JackSimpleServer | grep -v grep | awk '{print $2}')
-    exit $? ;;
+    kill $(ps aux | grep JackSimpleServer | grep -v grep | awk '{print $2}') 2>/dev/null
+    if [ $? -ne 0 ]; then
+      echo "ERROR: No Jack server to kill" >&2
+      exit 2
+    else
+      exit 0 
+    fi ;;
   list-server)
     ps aux | grep JackSimpleServer | grep -v grep
     exit $? ;;
   start-server)
     SERVER_PRG="$JACK_VM_COMMAND -cp $JACK_JAR com.android.jack.server.JackSimpleServer"
-    echo "Launching background server" $SERVER_PRG
+    echo "Launching Jack server" $SERVER_PRG
     $SERVER_PRG $SERVER_PORT_SERVICE $SERVER_PORT_ADMIN $SERVER_COUNT $SERVER_NB_COMPILE $SERVER_TIMEOUT >>$SERVER_LOG 2>&1 &
     exit 0 ;;
   *)
@@ -123,7 +128,7 @@
   elif [ $CURL_CODE -eq 7 ]; then
     # Failed to connect
     if [ $(date +%s) -ge $DATE_CONNECT ]; then
-        echo "No Jack server running"
+        echo "ERROR: No Jack server running"
         exit 255
     else
       sleep 0.2 2>/dev/null
@@ -134,21 +139,21 @@
     # Http code not OK, let's decode and abort
     if [ $HTTP_CODE -eq 401 ]; then
       # 401: Unauthorized
-      echo "Security problem, see server log" >&2
+      echo "ERROR: Security problem, see Jack server log" >&2
       exit 255
     elif [ $HTTP_CODE -eq 400 ]; then
       # 400: Bad request
-      echo "Bad request, see server log" >&2
+      echo "ERROR: Bad request, see Jack server log" >&2
       exit 255
     else
       # Other
-      echo "Internal unknown error ($HTTP_CODE), try other ports in ~/.jack, or see server log" >&2
+      echo "ERROR: Internal unknown error ($HTTP_CODE), try other ports in ~/.jack, or see Jack server log" >&2
       exit 255
     fi
   else
     # In case of partial, timeout, empty respond, network error, let's retry
     if [ $RETRY_SESSION -eq 0 ]; then
-      echo "Communication error with server ($CURL_CODE)" >&2
+      echo "ERROR: Communication error with Jack server ($CURL_CODE)" >&2
       exit 255
     else
       let RETRY_SESSION=RETRY_SESSION-1
diff --git a/tools/jack-launcher.jar b/tools/jack-launcher.jar
index fd0be2e..ec05d0a 100644
--- a/tools/jack-launcher.jar
+++ b/tools/jack-launcher.jar
Binary files differ
diff --git a/tools/jack.jar b/tools/jack.jar
index 337a64c..5d26429 100644
--- a/tools/jack.jar
+++ b/tools/jack.jar
Binary files differ
diff --git a/tools/jill.jar b/tools/jill.jar
index a16ac47..729b1c7 100644
--- a/tools/jill.jar
+++ b/tools/jill.jar
Binary files differ