diff --git a/BaseGameUtils/build.gradle b/BaseGameUtils/build.gradle index 9bdda3d..9643458 100644 --- a/BaseGameUtils/build.gradle +++ b/BaseGameUtils/build.gradle @@ -1,4 +1,4 @@ -apply plugin: 'android-library' +apply plugin: 'com.android.library' repositories { mavenCentral() @@ -11,17 +11,15 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.1' + classpath 'com.android.tools.build:gradle:7.4.2' } } dependencies { - compile 'com.android.support:appcompat-v7:20.0.+' - compile 'com.android.support:support-v4:20.0.+' + api 'androidx.appcompat:appcompat:1.6.1' } android { compileSdkVersion 20 - buildToolsVersion '27.0.3' } diff --git a/app/build.gradle b/app/build.gradle index 1915059..0920a8b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,11 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 21 - buildToolsVersion '25.0.0' + compileSdkVersion 33 defaultConfig { applicationId 'de.tudarmstadt.informatik.secuso.phishedu2' - minSdkVersion 10 - targetSdkVersion 19 + minSdkVersion 19 + targetSdkVersion 33 versionCode 31 versionName "1.4.0" } @@ -21,9 +20,18 @@ android { } dependencies { - compile 'com.android.support:support-v4:21.0.2' - compile project(':BaseGameUtils') - compile 'com.google.code.gson:gson:2.3' - compile files('libs/android-json-rpc-0.2.jar') - compile 'com.android.support:appcompat-v7:21.0.2' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation project(':BaseGameUtils') + implementation 'com.google.code.gson:gson:2.3' + implementation files('libs/android-json-rpc-0.2.jar') + implementation 'androidx.appcompat:appcompat:1.0.0' + + constraints { + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version") { + because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib") + } + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version") { + because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib") + } + } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ed1ff0e..00a9f0a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ android:theme="@style/AppTheme" > diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/AwarenessActivity.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/AwarenessActivity.java index cbabb7a..3765959 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/AwarenessActivity.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/AwarenessActivity.java @@ -120,7 +120,7 @@ public void sendEmail(View view) { } else { // Input is OK send email // invoke Backendcontroller - BackendControllerImpl.getInstance().sendMail(from, to, userMessage); + //BackendControllerImpl.getInstance().sendMail(from, to, userMessage); // Pop up with go to E-Mail on your Smartphone showAlertDialog(); diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelIntroActivity.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelIntroActivity.java index 06bad51..142dea1 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelIntroActivity.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelIntroActivity.java @@ -133,10 +133,12 @@ protected void onStartClick() { Class next_activity = URLTaskActivity.class; if (this.getLevel() == 0) { BackendControllerImpl.getInstance().skipLevel0(); - next_activity = AwarenessActivity.class; + BackendControllerImpl.getInstance().startLevel(1); + next_activity = LevelIntroActivity.class; } else if (this.getLevel() == 1) { - next_activity = FindAddressBarActivity.class; BackendControllerImpl.getInstance().skipLevel1(); + BackendControllerImpl.getInstance().startLevel(2); + next_activity = LevelIntroActivity.class; } else if (this.getLevel() == BackendControllerImpl.getInstance() .getLevelCount() - 1) { next_activity = AppEndActivity.class; diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelSelectorActivity.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelSelectorActivity.java index d5f7dd0..64c4a9d 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelSelectorActivity.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelSelectorActivity.java @@ -21,12 +21,13 @@ package de.tudarmstadt.informatik.secuso.phishedu2; import android.os.Bundle; -import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.viewpager.widget.ViewPager; + import de.tudarmstadt.informatik.secuso.phishedu2.backend.BackendControllerImpl; import de.tudarmstadt.informatik.secuso.phishedu2.backend.NoPhishLevelInfo; diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/MainActivity.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/MainActivity.java index 5efd52d..7f9db6a 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/MainActivity.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/MainActivity.java @@ -29,8 +29,9 @@ import android.net.Uri; import android.os.Bundle; import android.os.Vibrator; -import android.support.v4.app.Fragment; -import android.support.v7.app.ActionBarActivity; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -53,7 +54,7 @@ //import com.google.android.gms.common.api.GoogleApiClient; //import com.google.android.gms.games.Games; -public class MainActivity extends ActionBarActivity implements FrontendController, OnLevelChangeListener, BackendInitListener, OnLevelstateChangeListener { +public class MainActivity extends AppCompatActivity implements FrontendController, OnLevelChangeListener, BackendInitListener, OnLevelstateChangeListener { Map fragCache = new HashMap(); String current_frag; diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/PhishBaseActivity.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/PhishBaseActivity.java index 7b9119c..512188d 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/PhishBaseActivity.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/PhishBaseActivity.java @@ -24,8 +24,10 @@ import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v7.app.ActionBarActivity; + +import androidx.appcompat.app.ActionBar; +import androidx.fragment.app.Fragment; +import androidx.appcompat.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -149,7 +151,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa } private void setTitles(){ - android.support.v7.app.ActionBar ab = ((ActionBarActivity)getActivity()).getSupportActionBar(); + ActionBar ab = ((AppCompatActivity)getActivity()).getSupportActionBar(); //ab.setDisplayUseLogoEnabled(true); ab.setDisplayHomeAsUpEnabled(enableHomeButton()); ab.setDisplayShowHomeEnabled(true); @@ -312,21 +314,21 @@ int getLevel(){ return BackendControllerImpl.getInstance().getLevel(); } - @Override - public void onDetach() { - super.onDetach(); - - try { - Field childFragmentManager = Fragment.class.getDeclaredField("mChildFragmentManager"); - childFragmentManager.setAccessible(true); - childFragmentManager.set(this, null); - - } catch (NoSuchFieldException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } +// @Override +// public void onDetach() { +// super.onDetach(); +// +// try { +// Field childFragmentManager = Fragment.class.getDeclaredField("mChildFragmentManager"); +// childFragmentManager.setAccessible(true); +// childFragmentManager.set(this, null); +// +// } catch (NoSuchFieldException e) { +// throw new RuntimeException(e); +// } catch (IllegalAccessException e) { +// throw new RuntimeException(e); +// } +// } protected void switchToFragment(Class target){ ((MainActivity)getActivity()).switchToFragment(target); diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/SwipeActivity.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/SwipeActivity.java index b549f83..c893ce2 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/SwipeActivity.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/SwipeActivity.java @@ -22,9 +22,10 @@ import android.app.Activity; import android.os.Bundle; -import android.support.v4.app.FragmentManager; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; +import androidx.fragment.app.FragmentManager; +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; + import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -104,6 +105,9 @@ void updateUI(Activity v){ super.updateUI(v); final ViewPager mPager= (ViewPager) v.findViewById(R.id.pager); + if(mPager == null) { + return; + } mPager.setAdapter(new SwipePageAdapter(getFragmentManager(),this)); mPager.setOnPageChangeListener(this); diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/backend/networkTasks/GetUrlsTask.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/backend/networkTasks/GetUrlsTask.java index 97ca6cd..6e800c0 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/backend/networkTasks/GetUrlsTask.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/backend/networkTasks/GetUrlsTask.java @@ -22,18 +22,6 @@ import android.os.AsyncTask; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.StatusLine; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.DefaultHttpClient; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Arrays; - -import de.tudarmstadt.informatik.secuso.phishedu2.backend.BackendControllerImpl; -import de.tudarmstadt.informatik.secuso.phishedu2.backend.BasePhishURL; import de.tudarmstadt.informatik.secuso.phishedu2.backend.PhishAttackType; import de.tudarmstadt.informatik.secuso.phishedu2.backend.PhishURL; @@ -56,38 +44,38 @@ public GetUrlsTask(UrlsLoadedListener controller){ protected PhishURL[] doInBackground(Integer... params) { - if(false){ - int count = params[0]; - this.type = PhishAttackType.NoPhish; - for(PhishAttackType type : PhishAttackType.values()){ - if(type.getValue() == params[1]){ - this.type=type; - break; - } - } - try { - String url = "https://api.no-phish.de/urls/"+this.type.toString()+".json"; - HttpResponse response = new DefaultHttpClient().execute(new HttpGet(url)); - StatusLine statusLine = response.getStatusLine(); - if(statusLine.getStatusCode() == HttpStatus.SC_OK){ - ByteArrayOutputStream out = new ByteArrayOutputStream(); - response.getEntity().writeTo(out); - out.close(); - BasePhishURL[] result = BackendControllerImpl.deserializeURLs(out.toString()); - if(result.length > count){ - result = Arrays.copyOf(result, count); - } - return result; - } else{ - //Closes the connection. - response.getEntity().getContent().close(); - throw new IOException(statusLine.getReasonPhrase()); - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } +// if(false){ +// int count = params[0]; +// this.type = PhishAttackType.NoPhish; +// for(PhishAttackType type : PhishAttackType.values()){ +// if(type.getValue() == params[1]){ +// this.type=type; +// break; +// } +// } +// try { +// String url = "https://api.no-phish.de/urls/"+this.type.toString()+".json"; +// HttpResponse response = new DefaultHttpClient().execute(new HttpGet(url)); +// StatusLine statusLine = response.getStatusLine(); +// if(statusLine.getStatusCode() == HttpStatus.SC_OK){ +// ByteArrayOutputStream out = new ByteArrayOutputStream(); +// response.getEntity().writeTo(out); +// out.close(); +// BasePhishURL[] result = BackendControllerImpl.deserializeURLs(out.toString()); +// if(result.length > count){ +// result = Arrays.copyOf(result, count); +// } +// return result; +// } else{ +// //Closes the connection. +// response.getEntity().getContent().close(); +// throw new IOException(statusLine.getReasonPhrase()); +// } +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } return new PhishURL[0]; } diff --git a/app/src/main/res/layout/fragment_pager.xml b/app/src/main/res/layout/fragment_pager.xml index f878dea..a8a83c9 100644 --- a/app/src/main/res/layout/fragment_pager.xml +++ b/app/src/main/res/layout/fragment_pager.xml @@ -6,7 +6,7 @@ android:layout_height="match_parent" android:orientation="vertical" > - Skip - Now it's your turn\n\n1. Click on the button \"Click here\", to open a practice website.\n\n2. Wait until the website is fully loaded.\n\n3. Solve the task on the website. When you have completed the task, you will be automatically redirected to the app. + Now it\'s your turn\n\n1. Click on the button \"Click here\", to open a practice website.\n\n2. Wait until the website is fully loaded.\n\n3. Solve the task on the website. When you have completed the task, you will be automatically redirected to the app. Click here @@ -166,7 +166,7 @@ Sender E-Mail: Optional free text: Not arrived at Google?\n\nYou probably thought you were getting to Google\'s website. Unfortunately, you can but the links in an e-mail or. In general, trust links as well as the given email sender and the rest of the email content. - General information:\n\n1.) It is easy to fake the sender of an e-mail. Anyone can do this, even without much prior knowledge. Accordingly, you should be careful when evaluating the trustworthiness of news (Emails, Skype, Social Networks etc.). This is especially true if they contain a link. Not only for links that seem to be familiar to you, but also for those who, for example. �Click Here� mean, you should be careful.\n\n2.) Furthermore, clicking on links does not necessarily lead to the web address specified in the link. Most e-mail applications do not provide a way to see the real goal of links at first glance. \n\nThe real goal of a link is experienced by letting your finger on the link. Depending on the mail program, the destination is then displayed either in a small window directly next to the mouse pointer, or in the status bar at the bottom of the opened mail.\n\nPhishing-Emails and phishing websites you can just based on the web address (of the link) recognize. Therefore, in this app, we'll explain how to verify the authenticity of web addresses before clicking. + General information:\n\n1.) It is easy to fake the sender of an e-mail. Anyone can do this, even without much prior knowledge. Accordingly, you should be careful when evaluating the trustworthiness of news (Emails, Skype, Social Networks etc.). This is especially true if they contain a link. Not only for links that seem to be familiar to you, but also for those who, for example. �Click Here� mean, you should be careful.\n\n2.) Furthermore, clicking on links does not necessarily lead to the web address specified in the link. Most e-mail applications do not provide a way to see the real goal of links at first glance. \n\nThe real goal of a link is experienced by letting your finger on the link. Depending on the mail program, the destination is then displayed either in a small window directly next to the mouse pointer, or in the status bar at the bottom of the opened mail.\n\nPhishing-Emails and phishing websites you can just based on the web address (of the link) recognize. Therefore, in this app, we\'ll explain how to verify the authenticity of web addresses before clicking. By the way, that does not just apply to e-mails!\n\nDangers do not just lurk behind links in emails, but generally whenever you click on a link (e.g., on another website, in an SMS or in messages on Facebook or Twitter). Anyone can create web addresses and website copies!\n\nAnyone can create web addresses and website copies. Displaying an identical copy of a web page there is almost effortless and involves almost no cost. That, if you land on a website, the displayed website may look correct at first glance, but is actually the copy of a familiar website, which was created to harm you. Original\n\nIn the following we show you a part of the original Website of Facebook. At the web address https://m.facebook.com/ (outlined in green) you can tell that this website is the original. @@ -219,7 +219,7 @@ Done!\n\nCongratulations! You have completed the level successfully. On to the next Level! - Attack by IP address as the who area\n\nPhishers use various deceptions, to make web addresses trustworthy, although they are not.\n\nYou will gradually learn with which tricks they try, to fool you.\n\nIn this level, we'll cover one of the simplest tricks of using IP addresses instead of terms in the who's area of the web address. + Attack by IP address as the who area\n\nPhishers use various deceptions, to make web addresses trustworthy, although they are not.\n\nYou will gradually learn with which tricks they try, to fool you.\n\nIn this level, we\'ll cover one of the simplest tricks of using IP addresses instead of terms in the who\'s area of the web address. IP-Addresses\n\nJust as our homes are addressed by street names, computers are identified on the Internet with so-called IP-Address. An IP address is a sequence of 4 blocks of numbers separated by dots. Example: 192.168.10.15 diff --git a/build.gradle b/build.gradle index 2a7b3ba..2452c3e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,9 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { + ext.kotlin_version = "1.8.10" repositories { jcenter() + mavenCentral() maven { url 'https://maven.google.com/' name 'Google' @@ -9,13 +11,14 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.1' + classpath 'com.android.tools.build:gradle:7.4.2' } } allprojects { repositories { jcenter() + mavenCentral() maven { url 'https://maven.google.com/' name 'Google' diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..5465fec --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 8c0fb64..1948b90 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4917a6b..ef0fa13 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jul 02 16:05:46 CEST 2018 +#Mon Jul 17 15:37:25 CEST 2023 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 91a7e26..cccdd3d 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -114,6 +113,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index aec9973..e95643d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line