diff --git a/.github/workflows/scheduled_snyk.yaml b/.github/workflows/scheduled_snyk.yaml new file mode 100644 index 00000000..676aafe7 --- /dev/null +++ b/.github/workflows/scheduled_snyk.yaml @@ -0,0 +1,47 @@ +name: Snyk scheduled test +on: + schedule: + - cron: '0 2 * * 1' + push: + branches: + - master + +jobs: + security: + runs-on: ubuntu-latest + env: + REPORT_FILE: test.json + + steps: + - uses: actions/checkout@v3 + - uses: snyk/actions/setup@master + with: + snyk-version: v1.1032.0 + + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Run Snyk + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + run: > + snyk test + --all-sub-projects + --configuration-matching='^releaseRuntimeClasspath$' + --fail-on=upgradable + --json-file-output=${{ env.REPORT_FILE }} + --org=radar-base + --policy-path=$PWD/.snyk + + - name: Report new vulnerabilities + uses: thehyve/report-vulnerability@master + if: success() || failure() + with: + report-file: ${{ env.REPORT_FILE }} + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/snyk.yaml b/.github/workflows/snyk.yaml new file mode 100644 index 00000000..6fff0f03 --- /dev/null +++ b/.github/workflows/snyk.yaml @@ -0,0 +1,35 @@ +name: Snyk test +on: + pull_request: + branches: + - master + - dev + +jobs: + security: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: snyk/actions/setup@master + with: + snyk-version: v1.1032.0 + + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Run Snyk to check for vulnerabilities + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + run: > + snyk test + --all-sub-projects + --configuration-matching="^runtimeClasspath$" + --fail-on=upgradable + --org=radar-base + --policy-path=.snyk + --severity-threshold=high diff --git a/.gitignore b/.gitignore index 4fd3dc57..6cf01799 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +app/src/debug/google-services.json +app/google-services.json + # Local configuration file local.properties diff --git a/app/build.gradle b/app/build.gradle index 9732c504..5294dac5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,19 +1,19 @@ -apply plugin: 'com.android.application' -apply plugin: 'com.google.android.gms.oss-licenses-plugin' -apply plugin: 'kotlin-android' +apply plugin: "com.android.application" +apply plugin: "com.google.android.gms.oss-licenses-plugin" +apply plugin: "kotlin-android" android { - compileSdkVersion 33 - buildToolsVersion '32.0.0' + compileSdkVersion 34 + buildToolsVersion "34.0.0" namespace "org.radarcns.detail" defaultConfig { - applicationId 'org.radarcns.detail' - minSdkVersion 24 - targetSdkVersion 33 - versionCode 62 - versionName '1.2.0' - manifestPlaceholders = ['appAuthRedirectScheme': 'org.radarbase.passive.app'] + applicationId "org.radarcns.detail" + minSdkVersion 26 + targetSdkVersion 34 + versionCode 69 + versionName "1.2.7" + manifestPlaceholders = ["appAuthRedirectScheme": "org.radarbase.passive.app"] multiDexEnabled true ndkVersion "25.2.9519653" } @@ -21,25 +21,25 @@ android { release { shrinkResources true minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ndk { - debugSymbolLevel = 'full' + debugSymbolLevel = "full" } } debug { shrinkResources false minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } packagingOptions { resources { - excludes += ['META-INF/ASL2.0', 'META-INF/LICENSE'] + excludes += ["META-INF/ASL2.0", "META-INF/LICENSE"] } } compileOptions { - targetCompatibility JavaVersion.VERSION_11 - sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_17 } buildFeatures { viewBinding true @@ -61,66 +61,70 @@ android { } configurations.all { - resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds' - resolutionStrategy.cacheChangingModulesFor 0, 'seconds' + resolutionStrategy.cacheDynamicVersionsFor 0, "seconds" + resolutionStrategy.cacheChangingModulesFor 0, "seconds" } repositories { - flatDir { dirs 'libs' } + flatDir { dirs "libs" } google() mavenLocal() mavenCentral() maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } maven { url 'https://repo.thehyve.nl/content/repositories/releases' } + maven { url 'https://jitpack.io' } } -ext.radarCommonsVersion = '1.2.4' - dependencies { api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - api "org.radarbase:radar-commons-android:$radarCommonsVersion" + api "org.radarbase:radar-commons-android:$radar_commons_android_version" - implementation "org.radarbase:radar-android-login-qr:$radarCommonsVersion" + implementation "org.radarbase:radar-android-login-qr:$radar_commons_android_version" - implementation platform('com.google.firebase:firebase-bom:31.2.2') - implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0' + implementation platform("com.google.firebase:firebase-bom:$firebase_bom_version") + implementation "com.google.android.gms:play-services-oss-licenses:$play_services_oss_licenses_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - implementation 'org.slf4j:slf4j-api:2.0.6' - - implementation 'com.google.firebase:firebase-config' - implementation 'com.google.firebase:firebase-crashlytics' - implementation 'com.google.firebase:firebase-analytics' - - implementation 'com.gitlab.mvysny.slf4j:slf4j-handroid:2.0.4' - - implementation "org.radarbase:radar-android-phone:$radarCommonsVersion" - implementation "org.radarbase:radar-android-phone-usage:$radarCommonsVersion" - selfReleaseImplementation "org.radarbase:radar-android-phone-telephony:$radarCommonsVersion" - implementation "org.radarbase:radar-android-empatica:$radarCommonsVersion" - implementation "org.radarbase:radar-android-application-status:$radarCommonsVersion" - implementation "org.radarbase:radar-android-weather:$radarCommonsVersion" - implementation "org.radarbase:radar-android-audio:$radarCommonsVersion" - implementation "org.radarbase:radar-android-faros:$radarCommonsVersion" - - implementation 'androidx.lifecycle:lifecycle-process:2.5.1' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'com.google.android.material:material:1.8.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.fragment:fragment-ktx:1.5.7' - - testImplementation 'junit:junit:4.13.2' - testRuntimeOnly 'org.slf4j:slf4j-simple:2.0.6' + implementation "org.slf4j:slf4j-api:$slf4j_api_version" + + implementation "com.google.firebase:firebase-config" + implementation "com.google.firebase:firebase-crashlytics" + implementation "com.google.firebase:firebase-analytics" + + implementation "com.gitlab.mvysny.slf4j:slf4j-handroid:$slf4j_handroid_version" + + implementation "org.radarbase:radar-android-phone:$radar_commons_android_version" + implementation "org.radarbase:radar-android-phone-usage:$radar_commons_android_version" + selfReleaseImplementation "org.radarbase:radar-android-phone-telephony:$radar_commons_android_version" + implementation "org.radarbase:radar-android-empatica:$radar_commons_android_version" + implementation "org.radarbase:radar-android-application-status:$radar_commons_android_version" + implementation "org.radarbase:radar-android-weather:$radar_commons_android_version" + implementation "org.radarbase:radar-android-audio:$radar_commons_android_version" + implementation "org.radarbase:radar-android-faros:$radar_commons_android_version" +// implementation "org.radarbase:radar-android-polar:$radar_commons_android_version" + implementation "org.radarbase:radar-android-google-sleep:$radar_commons_android_version" + implementation "org.radarbase:radar-android-google-activity:$radar_commons_android_version" + implementation "org.radarbase:radar-android-google-places:$radar_commons_android_version" + implementation "org.radarbase:radar-android-phone-audio-input:$radar_commons_android_version" + + implementation "androidx.lifecycle:lifecycle-process:$lifecycle_process_version" + implementation "androidx.legacy:legacy-support-v4:$legacy_support_version" + implementation "com.google.android.material:material:$material_version" + implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" + implementation "androidx.fragment:fragment-ktx:$fragment_version" + + testImplementation "junit:junit:$junit_version" + testRuntimeOnly "org.slf4j:slf4j-simple:$slf4j_simple_version" } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { - jvmTarget = '11' - apiVersion = '1.7' - languageVersion = '1.7' + jvmTarget = "17" + apiVersion = "1.7" + languageVersion = "1.7" } } // Needed for Firebase. Put at the bottom so it can detect the Firebase version. -apply plugin: 'com.google.gms.google-services' -apply plugin: 'com.google.firebase.crashlytics' +apply plugin: "com.google.gms.google-services" +apply plugin: "com.google.firebase.crashlytics" diff --git a/app/src/debug/google-services.json b/app/src/debug/google-services.json deleted file mode 100644 index 519ecf91..00000000 --- a/app/src/debug/google-services.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "project_info": { - "project_number": "250256119064", - "firebase_url": "https://radar-cns-78f28.firebaseio.com", - "project_id": "radar-cns-78f28", - "storage_bucket": "radar-cns-78f28.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:250256119064:android:f40d0ec34fa2d4ca", - "android_client_info": { - "package_name": "org.radarbase.passive.app" - } - }, - "oauth_client": [ - { - "client_id": "250256119064-g6o71at9m28ttboflhs8dbdfetjadkvh.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyDzSGuSjeEIv-R0ElbSIpoY0r7cG-4SWpk" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "appinvite_service": { - "status": 1, - "other_platform_oauth_client": [] - }, - "ads_service": { - "status": 2 - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:250256119064:android:b6edbb49b79ef2b6", - "android_client_info": { - "package_name": "org.radarcns.detail" - } - }, - "oauth_client": [ - { - "client_id": "250256119064-g6o71at9m28ttboflhs8dbdfetjadkvh.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyDzSGuSjeEIv-R0ElbSIpoY0r7cG-4SWpk" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "appinvite_service": { - "status": 1, - "other_platform_oauth_client": [] - }, - "ads_service": { - "status": 2 - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 24ba07f7..a313fa1c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,6 +18,13 @@ + + + + + + + @@ -117,7 +124,13 @@ android:name=".SettingsActivity" android:screenOrientation="userPortrait" android:parentActivityName=".MainActivityImpl" /> - + + + + @@ -76,6 +77,7 @@ Settings are incomplete. Please update the Firebase Remote Configuration No network connection available. Please connect your phone to the internet and try again. Login failed. Please try again later. + Login failed. Please try again later. No internet connection available. Please make sure wifi and/or cellphone data is turned on. About This App RADAR pRMT @@ -149,4 +151,6 @@ 100% Reject Consent + , + RadarService operates with plugins and modules that may need permissions beyond standard foreground service types. Defining a special use subtype ensures compliance with Android’s requirements for permissions that may vary dynamically based on active plugins diff --git a/app/src/main/res/xml/remote_config_defaults.xml b/app/src/main/res/xml/remote_config_defaults.xml index e80c066f..746f7cf2 100644 --- a/app/src/main/res/xml/remote_config_defaults.xml +++ b/app/src/main/res/xml/remote_config_defaults.xml @@ -47,7 +47,7 @@ device_services_to_connect - .phone.PhoneSensorProvider .application.ApplicationServiceProvider .weather.WeatherApiProvider .phone.PhoneLocationProvider .phone.PhoneBluetoothProvider .phone.PhoneContactListProvider .phone.PhoneUsageProvider .passive.bittium.FarosProvider + .phone.PhoneSensorProvider .application.ApplicationServiceProvider .weather.WeatherApiProvider .phone.PhoneLocationProvider .phone.PhoneBluetoothProvider .phone.PhoneContactListProvider .phone.PhoneUsageProvider .phone.PhoneAudioInputProvider .passive.bittium.FarosProvider .google.GoogleActivityProvider .google.GoogleSleepProvider .google.GooglePlacesProvider diff --git a/app/src/playStore/java/org/radarcns/detail/RadarServiceImpl.kt b/app/src/playStore/java/org/radarcns/detail/RadarServiceImpl.kt index fa595eda..b15d28c9 100644 --- a/app/src/playStore/java/org/radarcns/detail/RadarServiceImpl.kt +++ b/app/src/playStore/java/org/radarcns/detail/RadarServiceImpl.kt @@ -19,8 +19,6 @@ package org.radarcns.detail import android.Manifest.permission.RECEIVE_BOOT_COMPLETED import android.Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS import android.Manifest.permission.SYSTEM_ALERT_WINDOW -import android.os.Build -import org.radarbase.android.RadarConfiguration import org.radarbase.android.RadarConfiguration.Companion.START_AT_BOOT import org.radarbase.android.RadarService import org.radarbase.android.config.SingleRadarConfiguration @@ -29,10 +27,15 @@ import org.radarbase.monitor.application.ApplicationStatusProvider import org.radarbase.passive.audio.OpenSmileAudioProvider import org.radarbase.passive.bittium.FarosProvider import org.radarbase.passive.empatica.E4Provider +import org.radarbase.passive.google.activity.GoogleActivityProvider +import org.radarbase.passive.google.places.GooglePlacesProvider +import org.radarbase.passive.google.sleep.GoogleSleepProvider import org.radarbase.passive.phone.PhoneBluetoothProvider import org.radarbase.passive.phone.PhoneContactListProvider import org.radarbase.passive.phone.PhoneLocationProvider import org.radarbase.passive.phone.PhoneSensorProvider +import org.radarbase.passive.phone.audio.input.PhoneAudioInputProvider +//import org.radarbase.passive.polar.PolarProvider import org.radarbase.passive.phone.usage.PhoneUsageProvider import org.radarbase.passive.weather.WeatherApiProvider @@ -42,12 +45,17 @@ class RadarServiceImpl : RadarService() { OpenSmileAudioProvider(this), E4Provider(this), FarosProvider(this), +// PolarProvider(this), PhoneBluetoothProvider(this), PhoneContactListProvider(this), PhoneLocationProvider(this), PhoneSensorProvider(this), PhoneUsageProvider(this), WeatherApiProvider(this), + GoogleActivityProvider(this), + GoogleSleepProvider(this), + GooglePlacesProvider(this), + PhoneAudioInputProvider(this) ) override val servicePermissions: List diff --git a/app/src/selfRelease/AndroidManifest.xml b/app/src/selfRelease/AndroidManifest.xml index b96434bf..3342dd41 100644 --- a/app/src/selfRelease/AndroidManifest.xml +++ b/app/src/selfRelease/AndroidManifest.xml @@ -22,6 +22,13 @@ + + + + + + + @@ -121,7 +128,12 @@ android:screenOrientation="userPortrait" android:parentActivityName=".MainActivityImpl" /> - + + + diff --git a/app/src/selfRelease/java/org/radarcns/detail/RadarServiceImpl.kt b/app/src/selfRelease/java/org/radarcns/detail/RadarServiceImpl.kt index 6cf63a07..4b8a256e 100644 --- a/app/src/selfRelease/java/org/radarcns/detail/RadarServiceImpl.kt +++ b/app/src/selfRelease/java/org/radarcns/detail/RadarServiceImpl.kt @@ -36,12 +36,17 @@ import org.radarbase.monitor.application.ApplicationStatusProvider import org.radarbase.passive.audio.OpenSmileAudioProvider import org.radarbase.passive.bittium.FarosProvider import org.radarbase.passive.empatica.E4Provider +import org.radarbase.passive.google.activity.GoogleActivityProvider +import org.radarbase.passive.google.places.GooglePlacesProvider +import org.radarbase.passive.google.sleep.GoogleSleepProvider import org.radarbase.passive.phone.PhoneBluetoothProvider import org.radarbase.passive.phone.PhoneContactListProvider import org.radarbase.passive.phone.PhoneLocationProvider import org.radarbase.passive.phone.PhoneSensorProvider import org.radarbase.passive.phone.telephony.PhoneLogProvider import org.radarbase.passive.phone.usage.PhoneUsageProvider +import org.radarbase.passive.phone.audio.input.PhoneAudioInputProvider +import org.radarbase.passive.polar.PolarProvider import org.radarbase.passive.weather.WeatherApiProvider import org.radarcns.detail.UpdatesActivity.Companion.DAY import org.radarcns.detail.UpdatesActivity.Companion.LAST_AUTO_UPDATE_CHECK_TIME_KEY @@ -64,6 +69,7 @@ class RadarServiceImpl : RadarService() { OpenSmileAudioProvider(this), E4Provider(this), FarosProvider(this), + PolarProvider(this), PhoneBluetoothProvider(this), PhoneContactListProvider(this), PhoneLocationProvider(this), @@ -71,6 +77,10 @@ class RadarServiceImpl : RadarService() { PhoneLogProvider(this), PhoneUsageProvider(this), WeatherApiProvider(this), + GoogleActivityProvider(this), + GoogleSleepProvider(this), + GooglePlacesProvider(this), + PhoneAudioInputProvider(this) ) override val servicePermissions: List @@ -146,13 +156,13 @@ class RadarServiceImpl : RadarService() { AlarmManager.RTC_WAKEUP, calendar.timeInMillis, updateCheckInterval, - updateCheckAlarmIntent + updateCheckAlarmIntent!! ) } private fun cancelUpdateCheckAlarmManager(){ if(updateCheckAlarmManager != null && updateCheckAlarmIntent != null) { - updateCheckAlarmManager!!.cancel(updateCheckAlarmIntent) + updateCheckAlarmManager!!.cancel(updateCheckAlarmIntent!!) } } diff --git a/build.gradle b/build.gradle index f00580d4..e86d021a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,25 +1,24 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.8.10' repositories { mavenLocal() google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.1' + classpath "com.android.tools.build:gradle:$gradle_android_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files - classpath 'com.google.gms:google-services:4.3.15' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4' - classpath 'com.google.android.gms:oss-licenses-plugin:0.10.6' + classpath "com.google.gms:google-services:$google_services_version" + classpath "com.google.firebase:firebase-crashlytics-gradle:$firebase_crashlytics_gradle_version" + classpath "com.google.android.gms:oss-licenses-plugin:$oss_licenses_plugin" } } plugins { - id("com.github.ben-manes.versions") version "0.45.0" + id("com.github.ben-manes.versions") version "$versions_plugin_version" } def isNonStable = { String version -> @@ -35,5 +34,5 @@ tasks.named("dependencyUpdates").configure { } wrapper { - gradleVersion '8.0' + gradleVersion "$gradle_version" } diff --git a/gradle.properties b/gradle.properties index fbf262af..dc2448bd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,6 +11,8 @@ # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +android.jetifier.ignorelist=jackson-core-2.15.2.jar, jackson-core-2.16.1.jar +android.defaults.buildfeatures.buildconfig=true # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit @@ -18,3 +20,32 @@ org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF # org.gradle.parallel=true android.useAndroidX=true android.enableJetifier=true + +radar_commons_android_version=1.4.1 + +kotlin_version=1.9.24 +gradle_version=8.6 + +gradle_android_version=8.4.0 +versions_plugin_version=0.51.0 + +google_services_version=4.4.1 +firebase_crashlytics_gradle_version=2.9.9 + +slf4j_api_version=2.0.13 +slf4j_simple_version=2.0.13 +slf4j_handroid_version=2.0.4 +legacy_support_version=1.0.0 +firebase_bom_version=33.0.0 +material_version=1.12.0 +constraintlayout_version=2.1.4 +fragment_version=1.5.7 + +# test dependencies +# junit 4! +junit_version=4.13.2 + +lifecycle_process_version=2.7.0 +oss_licenses_plugin=0.10.6 +firebase_crashlytics_gradle=2.9.9 +play_services_oss_licenses_version=17.0.1 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ccebba77..d64cd491 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 42defcc9..a80b22ce 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 79a61d42..1aa94a42 100755 --- a/gradlew +++ b/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ 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. + if ! command -v java >/dev/null 2>&1 + then + 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 fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85b..7101f8e4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -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. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -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. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/settings.gradle b/settings.gradle index e7b4def4..af1a9988 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app' +include ":app"