#!/bin/sh
#
# Copyright 2015 the original author or authors.
#
# 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
#
#      https://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.
#

##############################################################################
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
#     noncompliant, but you have some other compliant shell available, you may
#     specify it by setting the SHELL variable when running this script.
# For example: SHELL=/bin/bash ./gradlew <some-task>
#
# (2) Springboot 3 requires Java 17+
#
##############################################################################

set -e

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
APP_HOME=$( cd "$SCRIPT_DIR" && cd "$(dirname "$0")" && pwd -P || echo "$SCRIPT_DIR" )
APP_NAME="mtg-search"
APP_JAR_NAME="mtg-search-0.1.0.jar"

case "$(uname)" in
  *CYGWIN*) APP_HOME=`(cd "$APP_HOME" && pwd -W)` ;;
esac

DEFAULT_JVM_OPTS='"-Xmx2g" "-Xms256m"'
CLASSPATH=$APP_HOME/backend/build/libs/$APP_JAR_NAME

java $DEFAULT_JVM_OPTS -jar "$CLASSPATH" "$@"
