diff --git a/.gitignore b/.gitignore index 1922c65fe..a000de9dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,10 @@ .idea .gradle build -gradlew -gradlew.bat import-summary.txt local.properties /SWADroid/SWADroid-SWADroid.iml /SWADroid.iml app/lint.xml /SWADroid/google-services.json +keystore.properties diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..a6616243e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: android +jdk: +- oraclejdk8 +android: + components: + - tools + - tools + - platform-tools + - build-tools-25.0.2 + - android-25 + - extra-android-m2repository + - extra-android-support + - extra-google-m2repository + - extra-google-google_play_services +script: +- "./gradlew build connectedCheck" +before_install: +- chmod +x gradlew diff --git a/README.md b/README.md index c7fb288b6..d93e1b578 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,15 @@ Android client for e-learning platform [![SWADroid](https://openswad.org/logo/sw - Code: `git clone https://github.com/Amab/SWADroid.git` - Issue tracker: https://github.com/Amab/SWADroid/issues -[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/c/c8/Farm-Fresh_twitter_1.png)](http://twitter.com/SWADroid)[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/4/4d/Farm-Fresh_facebook.png)](https://www.facebook.com/SWADroid)[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/b/ba/Google_plus_32.png)](https://plus.google.com/115615684349730524355/posts)[![SWADroid](https://s.w.org/about/images/logos/wordpress-logo-32-blue.png)](http://swadroid.wordpress.com) +[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/c/c8/Farm-Fresh_twitter_1.png)](http://twitter.com/SWADroid)[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/4/4d/Farm-Fresh_facebook.png)](https://www.facebook.com/SWADroid)[![SWADroid](http://upload.wikimedia.org/wikipedia/commons/b/ba/Google_plus_32.png)](https://plus.google.com/115615684349730524355/posts)[![SWADroid](https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Telegram_Messenger.png/35px-Telegram_Messenger.png?uselang=es)](https://telegram.me/swadroid)[![SWADroid](https://s.w.org/about/images/logos/wordpress-logo-32-blue.png)](http://swadroid.wordpress.com) + +CI Status +--------- + +|Branch|CI status| +|------|---------| +|develop|[![Build Status](https://travis-ci.org/Amab/SWADroid.svg?branch=develop)](https://travis-ci.org/Amab/SWADroid)| +|master|[![Build Status](https://travis-ci.org/Amab/SWADroid.svg?branch=master)](https://travis-ci.org/Amab/SWADroid)| Copyright and License --------------------- @@ -17,7 +25,7 @@ Copyright (C) 2010, Juan Miguel Boyero Corral [![Copyright and License](https://img.shields.io/badge/license-GPLv3-green.svg?style=flat)](http://www.gnu.org/licenses/gpl.html) SWADroid client is free software; you can redistribute it and/or modify it under the same terms as [GPLv3](http://www.gnu.org/licenses/gpl.html) license. -[![Copyright and License](https://img.shields.io/badge/license-LGPLv3-green.svg?style=flat)](http://www.gnu.org/licenses/lgpl.html) SWADroid uses [Android DataFrameWork](http://code.google.com/p/androiddataframework/) library developed by [Javier Pérez Pacheco](http://www.javielinux.com/quiensoy.php) and licensed under [LGPLv3](http://www.gnu.org/licenses/lgpl.html). +[![Copyright and License](https://img.shields.io/badge/license-LGPLv3-green.svg?style=flat)](http://www.gnu.org/licenses/lgpl.html) SWADroid uses [Android DataFrameWork](http://code.google.com/p/androiddataframework/) library developed by Javier Pérez Pacheco and licensed under [LGPLv3](http://www.gnu.org/licenses/lgpl.html). [![Copyright and License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](http://www.opensource.org/licenses/mit-license.php) SWADroid uses [ksoap2-android](https://github.com/simpligility/ksoap2-android) library developed by [Manfred Moser](https://github.com/mosabua) and licensed under [MIT](http://www.opensource.org/licenses/mit-license.php). @@ -49,4 +57,4 @@ Contributing SWADroid is an open source project. I encourage contributions. -The Github team has also been kind enough to write up some great [documentation](http://help.github.com/pull-requests/) on working with pull requests. Contributions should be performed on [topic branches](http://progit.org/book/ch3-4.html) in your personal forks - just issue your pull requests from there. +The Github team has also been kind enough to write up some great [documentation](https://help.github.com/articles/about-pull-requests/) on working with pull requests. Contributions should be performed on [topic branches](http://progit.org/book/ch3-4.html) in your personal forks - just issue your pull requests from there. diff --git a/SWADroid/build.gradle b/SWADroid/build.gradle index f8cf6c554..9e09ce293 100644 --- a/SWADroid/build.gradle +++ b/SWADroid/build.gradle @@ -4,24 +4,30 @@ ext { git = org.ajoberstar.grgit.Grgit.open() gitVersionCode = git.tag.list().size() gitVersionName = "${git.describe()}" + + travisBuild = System.getenv("TRAVIS") == "true" } android { - compileSdkVersion 24 - buildToolsVersion "24.0.2" + compileSdkVersion 25 + buildToolsVersion "25.0.2" dexOptions { maxProcessCount=2 javaMaxHeapSize "2g" } + lintOptions { + abortOnError false + } + defaultConfig { applicationId "es.ugr.swad.swadroid" versionCode gitVersionCode versionName gitVersionName minSdkVersion 9 - targetSdkVersion 24 + targetSdkVersion 25 android.applicationVariants.all { variant -> def appName @@ -52,14 +58,34 @@ android { debug { versionNameSuffix '-DEBUG' } + + buildTypes.each { + it.buildConfigField "String", "SWAD_APP_KEY", getBuildConfigField("SWAD_APP_KEY") + it.buildConfigField "String", "ANALYTICS_API_KEY", getBuildConfigField("ANALYTICS_API_KEY") + } } } +//return a BuildConfigField from a properties file. +def getBuildConfigField(String property){ + def value + + if(travisBuild) { + value = "\"" + System.getenv(property) + "\"" + } else { + Properties properties = new Properties() + properties.load(new FileInputStream("keystore.properties")) + value = "\"" + properties.getProperty(property) + "\"" + } + + return value +} + dependencies { - compile 'com.android.support:support-v4:24.2.0' - compile 'com.android.support:appcompat-v7:24.2.0' - compile 'com.google.android.gms:play-services-analytics:9.4.0' - compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.1' + compile 'com.android.support:support-v4:25.1.0' + compile 'com.android.support:appcompat-v7:25.1.0' + compile 'com.google.android.gms:play-services-analytics:10.0.1' + compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.2' compile 'commons-io:commons-io:2.5' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar' diff --git a/SWADroid/src/main/java/es/ugr/swad/swadroid/.gitignore b/SWADroid/src/main/java/es/ugr/swad/swadroid/.gitignore deleted file mode 100644 index 00e2c3f41..000000000 --- a/SWADroid/src/main/java/es/ugr/swad/swadroid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/Config.java diff --git a/SWADroid/src/main/java/es/ugr/swad/swadroid/Config.java b/SWADroid/src/main/java/es/ugr/swad/swadroid/Config.java new file mode 100644 index 000000000..5752c00f4 --- /dev/null +++ b/SWADroid/src/main/java/es/ugr/swad/swadroid/Config.java @@ -0,0 +1,35 @@ +/* + * This file is part of SWADroid. + * + * Copyright (C) 2010 Juan Miguel Boyero Corral + * + * SWADroid is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SWADroid is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with SWADroid. If not, see . + */ +package es.ugr.swad.swadroid; + +/** + * Application settings. + * + * @author Juan Miguel Boyero Corral + */ +public class Config { + /** + * SWAD application key + */ + public static final String SWAD_APP_KEY = BuildConfig.SWAD_APP_KEY; + /** + * Google Analytics application key + */ + public static final String ANALYTICS_API_KEY = BuildConfig.ANALYTICS_API_KEY; +} diff --git a/SWADroid/src/main/java/es/ugr/swad/swadroid/SWADMain.java b/SWADroid/src/main/java/es/ugr/swad/swadroid/SWADMain.java index 579f9b929..c398f72f9 100644 --- a/SWADroid/src/main/java/es/ugr/swad/swadroid/SWADMain.java +++ b/SWADroid/src/main/java/es/ugr/swad/swadroid/SWADMain.java @@ -235,7 +235,7 @@ protected void onResume() { } //If today is the user birthday, show birthday message - if((Login.getLoggedUser() != null) + if((Login.getLoggedUser() != null) && (Login.getLoggedUser().getUserBirthday() != null) && DateTimeUtils.isBirthday(Login.getLoggedUser().getUserBirthday())) { showBirthdayMessage(); @@ -292,7 +292,9 @@ private void upgradeApp(int lastVersion, int currentVersion) throws NoSuchAlgori Preferences.upgradeCredentials(); Preferences.setSyncTime(String.valueOf(Constants.DEFAULT_SYNC_TIME)); - } else if(lastVersion < 57) { + } + + if(lastVersion < 57) { //Reconfigure automatic synchronization SyncUtils.removePeriodicSync(Constants.AUTHORITY, Bundle.EMPTY, this); if(!Preferences.getSyncTime().equals("0") && Preferences.isSyncEnabled()) { diff --git a/SWADroid/src/main/java/es/ugr/swad/swadroid/model/User.java b/SWADroid/src/main/java/es/ugr/swad/swadroid/model/User.java index 552b6dc8e..74df822be 100644 --- a/SWADroid/src/main/java/es/ugr/swad/swadroid/model/User.java +++ b/SWADroid/src/main/java/es/ugr/swad/swadroid/model/User.java @@ -28,6 +28,8 @@ import java.util.Hashtable; import java.util.Locale; +import es.ugr.swad.swadroid.Constants; + /** * User data. * @@ -256,7 +258,7 @@ public Calendar getUserBirthday() { * @param userBirthday User birthday. */ private void setUserBirthday(String userBirthday) throws ParseException { - if((userBirthday != null) && !userBirthday.equals("00000000")) { + if((userBirthday != null) && !userBirthday.equals(Constants.NULL_VALUE) && !userBirthday.equals("00000000")) { this.userBirthday = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.getDefault()); diff --git a/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/notifications/Notifications.java b/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/notifications/Notifications.java index 8d7f7e5e6..8b54646ae 100644 --- a/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/notifications/Notifications.java +++ b/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/notifications/Notifications.java @@ -196,7 +196,7 @@ private void refreshScreen() { hideSwipeProgress(); //If today is the user birthday, show birthday message - if((Login.getLoggedUser() != null) + if((Login.getLoggedUser() != null) && (Login.getLoggedUser().getUserBirthday() != null) && DateTimeUtils.isBirthday(Login.getLoggedUser().getUserBirthday())) { mBirthdayTextView.setText(getString(R.string.birthdayMsg).replace( Constants.USERNAME_TEMPLATE, Login.getLoggedUser().getUserFirstname())); @@ -475,7 +475,7 @@ protected void requestService() throws Exception { */ @Override protected void connect() { - Toast.makeText(this, R.string.notificationsProgressDescription, Toast.LENGTH_SHORT).show(); + //Toast.makeText(this, R.string.notificationsProgressDescription, Toast.LENGTH_SHORT).show(); startConnection(); } diff --git a/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/rollcall/ContinuousCaptureActivity.java b/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/rollcall/ContinuousCaptureActivity.java index 54898a346..fa80af081 100644 --- a/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/rollcall/ContinuousCaptureActivity.java +++ b/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/rollcall/ContinuousCaptureActivity.java @@ -97,6 +97,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.continuous_scan); + getSupportActionBar().hide(); + try { //Initialize database dbHelper = new DataBaseHelper(this); diff --git a/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/rollcall/UsersCursorAdapter.java b/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/rollcall/UsersCursorAdapter.java index 43d591ef7..927e91cca 100644 --- a/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/rollcall/UsersCursorAdapter.java +++ b/SWADroid/src/main/java/es/ugr/swad/swadroid/modules/rollcall/UsersCursorAdapter.java @@ -32,6 +32,7 @@ import com.nostra13.universalimageloader.core.ImageLoader; +import es.ugr.swad.swadroid.Constants; import es.ugr.swad.swadroid.R; import es.ugr.swad.swadroid.database.DataBaseHelper; import es.ugr.swad.swadroid.gui.ImageFactory; @@ -110,6 +111,19 @@ public void bindView(View view, Context context, Cursor cursor) { String userPhoto = cursor.getString(cursor.getColumnIndex("photoPath")); boolean present = Utils.parseIntBool(cursor.getInt(cursor.getColumnIndex("present"))); + // Replace NULL value for strings returned by the webservice with the empty string + if (userSurname1.equals(Constants.NULL_VALUE)) + userSurname1 = ""; + + if (userSurname2.equals(Constants.NULL_VALUE)) + userSurname2 = ""; + + if (userFirstname.equals(Constants.NULL_VALUE)) + userFirstname = ""; + + if (userID.equals(Constants.NULL_VALUE)) + userID = ""; + final ViewHolder holder = (ViewHolder) view.getTag(); view.setTag(holder); diff --git a/SWADroid/src/main/java/es/ugr/swad/swadroid/preferences/Preferences.java b/SWADroid/src/main/java/es/ugr/swad/swadroid/preferences/Preferences.java index 461b2ef14..fe8807d03 100644 --- a/SWADroid/src/main/java/es/ugr/swad/swadroid/preferences/Preferences.java +++ b/SWADroid/src/main/java/es/ugr/swad/swadroid/preferences/Preferences.java @@ -98,6 +98,10 @@ public class Preferences { * Google Plus preference name */ public static final String GOOGLEPLUSPREF = "googlePlusPref"; + /** + * Telegram preference name + */ + public static final String TELEGRAMPREF = "telegramPref"; /** * Blog preference name */ diff --git a/SWADroid/src/main/java/es/ugr/swad/swadroid/preferences/PreferencesActivity.java b/SWADroid/src/main/java/es/ugr/swad/swadroid/preferences/PreferencesActivity.java index d229e7266..425075024 100644 --- a/SWADroid/src/main/java/es/ugr/swad/swadroid/preferences/PreferencesActivity.java +++ b/SWADroid/src/main/java/es/ugr/swad/swadroid/preferences/PreferencesActivity.java @@ -90,6 +90,10 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere * Google Plus preference */ private static Preference googlePlusPref; + /** + * Telegram preference + */ + private static Preference telegramPref; /** * Blog preference */ @@ -188,6 +192,7 @@ protected void onCreate(Bundle savedInstanceState) { twitterPref = findPreference(Preferences.TWITTERPREF); facebookPref = findPreference(Preferences.FACEBOOKPREF); googlePlusPref = findPreference(Preferences.GOOGLEPLUSPREF); + telegramPref = findPreference(Preferences.TELEGRAMPREF); blogPref = findPreference(Preferences.BLOGPREF); sharePref = findPreference(Preferences.SHAREPREF); syncTimePref = findPreference(Preferences.SYNCTIMEPREF); @@ -200,6 +205,7 @@ protected void onCreate(Bundle savedInstanceState) { twitterPref.setOnPreferenceChangeListener(this); facebookPref.setOnPreferenceChangeListener(this); googlePlusPref.setOnPreferenceChangeListener(this); + telegramPref.setOnPreferenceChangeListener(this); blogPref.setOnPreferenceChangeListener(this); sharePref.setOnPreferenceChangeListener(this); syncEnablePref.setOnPreferenceChangeListener(this); @@ -272,6 +278,18 @@ public boolean onPreferenceClick(Preference preference) { return true; } }); + telegramPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { + /** + * Called when a preference is selected. + * @param preference Preference selected. + */ + public boolean onPreferenceClick(Preference preference) { + Intent urlIntent = new Intent(Intent.ACTION_VIEW); + urlIntent.setData(Uri.parse(getString(R.string.telegramURL))); + startActivity(urlIntent); + return true; + } + }); blogPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { /** * Called when a preference is selected. diff --git a/SWADroid/src/main/res/raw-es/changes.html b/SWADroid/src/main/res/raw-es/changes.html index 815034c10..f5328d4de 100644 --- a/SWADroid/src/main/res/raw-es/changes.html +++ b/SWADroid/src/main/res/raw-es/changes.html @@ -15,6 +15,11 @@ +

1.5.1 (2017-01-21)

+
    + [CORRECCIONES] +
  • Corregido error unparseable date: "anyType{}"(at offset 0)
  • +

1.5.0 (2016-09-01)

    [NOVEDADES] diff --git a/SWADroid/src/main/res/raw/changes.html b/SWADroid/src/main/res/raw/changes.html index 588378b4a..37fe6b3c6 100644 --- a/SWADroid/src/main/res/raw/changes.html +++ b/SWADroid/src/main/res/raw/changes.html @@ -15,6 +15,11 @@ +

    1.5.1 (2017-01-21)

    +
      + [FIXES] +
    • Fixed unparseable date: "anyType{}"(at offset 0) error
    • +

    1.5.0 (2016-09-01)

      [NEW] diff --git a/SWADroid/src/main/res/values-es/strings.xml b/SWADroid/src/main/res/values-es/strings.xml index 3896247b3..4423207f2 100644 --- a/SWADroid/src/main/res/values-es/strings.xml +++ b/SWADroid/src/main/res/values-es/strings.xml @@ -122,11 +122,7 @@ Estoy usando #SWADroid en mi Android para acceder a la plataforma de teleformación SWAD.\nObtenlo gratis aquí: https://play.google.com/store/apps/details?id=es.ugr.swad.swadroid - Twitter - Facebook - Google+ Blog - Google Play Sincronización Frecuencia de sincronización Frecuencia de sincronización de las notificaciones diff --git a/SWADroid/src/main/res/values/strings.xml b/SWADroid/src/main/res/values/strings.xml index 458dcae92..d4873e509 100644 --- a/SWADroid/src/main/res/values/strings.xml +++ b/SWADroid/src/main/res/values/strings.xml @@ -125,13 +125,15 @@ https://twitter.com/#!/SWADroid https://www.facebook.com/SWADroid http://goo.gl/kuezQ + https://telegram.me/swadroid http://swadroid.wordpress.com \@SWADroid - Twitter - Facebook - Google+ + Twitter + Facebook + Google+ + Telegram + Google Play Blog - Google Play Synchronization Synchronization frecuency Synchronization frecuency of notifications diff --git a/SWADroid/src/main/res/xml/preferences.xml b/SWADroid/src/main/res/xml/preferences.xml index 52a499541..a722fb87d 100644 --- a/SWADroid/src/main/res/xml/preferences.xml +++ b/SWADroid/src/main/res/xml/preferences.xml @@ -86,6 +86,11 @@ android:key="googlePlusPref" android:summary="@string/googlePlusURL" android:title="@string/googlePlusTitle" /> + \ No newline at end of file diff --git a/build.gradle b/build.gradle index e7ff91194..f4aea3ac8 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.3' + classpath 'com.android.tools.build:gradle:2.2.3' classpath 'org.ajoberstar:grgit:1.7.0' } } diff --git a/gradle.properties b/gradle.properties index 7f722e5f4..684634415 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -org.gradle.jvmargs=-Xmx2048m +org.gradle.jvmargs=-Xmx2560M # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/gradlew b/gradlew new file mode 100644 index 000000000..91a7e269e --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=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. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 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=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 000000000..8a0b282aa --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@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 Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz 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. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +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 + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega