From 0aab8a3734ac0c3fc76d843988a51595c888bfed Mon Sep 17 00:00:00 2001 From: aantunovic <aantunovic89@gmail.com> Date: Sat, 7 Nov 2020 11:25:18 +0100 Subject: [PATCH 1/3] AsyncSSLSocketWrapper fixed failing assertion --- .../src/com/koushikdutta/async/AsyncSSLSocketWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AndroidAsync/src/com/koushikdutta/async/AsyncSSLSocketWrapper.java b/AndroidAsync/src/com/koushikdutta/async/AsyncSSLSocketWrapper.java index 52c539d..52221e6 100644 --- a/AndroidAsync/src/com/koushikdutta/async/AsyncSSLSocketWrapper.java +++ b/AndroidAsync/src/com/koushikdutta/async/AsyncSSLSocketWrapper.java @@ -471,9 +471,9 @@ public class AsyncSSLSocketWrapper implements AsyncSocketWrapper, AsyncSSLSocket bb.addAll(arr); writeBuf.flip(); writeList.add(writeBuf); - assert !writeList.hasRemaining(); if (writeList.remaining() > 0) mSink.write(writeList); + assert !writeList.hasRemaining(); int previousCapacity = writeBuf.capacity(); writeBuf = null; if (res.getStatus() == Status.BUFFER_OVERFLOW) { -- GitLab From 74f5d177b4d39064b090e52dfbc731b399f78ea5 Mon Sep 17 00:00:00 2001 From: aantunovic <aantunovic89@gmail.com> Date: Sat, 7 Nov 2020 11:30:15 +0100 Subject: [PATCH 2/3] Sample, fixed CacheOverrideMiddleware, MainActivity cleanup --- .../async/sample/MainActivity.java | 37 ++++++------------- .../middleware/CacheOverrideMiddleware.java | 6 +-- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/AndroidAsyncSample/src/com/koushikdutta/async/sample/MainActivity.java b/AndroidAsyncSample/src/com/koushikdutta/async/sample/MainActivity.java index f474d2a..46fc913 100644 --- a/AndroidAsyncSample/src/com/koushikdutta/async/sample/MainActivity.java +++ b/AndroidAsyncSample/src/com/koushikdutta/async/sample/MainActivity.java @@ -10,8 +10,6 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.MenuItem.OnMenuItemClickListener; -import android.view.View; -import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; @@ -53,18 +51,13 @@ public class MainActivity extends Activity { } setContentView(R.layout.activity_main); - Button b = (Button)findViewById(R.id.go); - b.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - refresh(); - } - }); + Button b = findViewById(R.id.go); + b.setOnClickListener(v -> refresh()); - rommanager = (ImageView)findViewById(R.id.rommanager); - tether = (ImageView)findViewById(R.id.tether); - desksms = (ImageView)findViewById(R.id.desksms); - chart = (ImageView)findViewById(R.id.chart); + rommanager = findViewById(R.id.rommanager); + tether = findViewById(R.id.tether); + desksms = findViewById(R.id.desksms); + chart = findViewById(R.id.chart); showCacheToast(); } @@ -76,24 +69,16 @@ public class MainActivity extends Activity { @Override public boolean onCreateOptionsMenu(Menu menu) { - menu.add("Toggle Caching").setOnMenuItemClickListener(new OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - cacher.setCaching(!cacher.getCaching()); - showCacheToast(); - return true; - } + menu.add("Toggle Caching").setOnMenuItemClickListener(item -> { + cacher.setCaching(!cacher.getCaching()); + showCacheToast(); + return true; }); return true; } private void assignImageView(final ImageView iv, final BitmapDrawable bd) { - iv.getHandler().post(new Runnable() { - @Override - public void run() { - iv.setImageDrawable(bd); - } - }); + iv.getHandler().post(() -> iv.setImageDrawable(bd)); } private void getFile(final ImageView iv, String url, final String filename) { diff --git a/AndroidAsyncSample/src/com/koushikdutta/async/sample/middleware/CacheOverrideMiddleware.java b/AndroidAsyncSample/src/com/koushikdutta/async/sample/middleware/CacheOverrideMiddleware.java index 7f3e3a1..f0c9d32 100644 --- a/AndroidAsyncSample/src/com/koushikdutta/async/sample/middleware/CacheOverrideMiddleware.java +++ b/AndroidAsyncSample/src/com/koushikdutta/async/sample/middleware/CacheOverrideMiddleware.java @@ -1,10 +1,8 @@ package com.koushikdutta.async.sample.middleware; import android.text.TextUtils; -import android.util.Base64; import com.koushikdutta.async.http.AsyncHttpClient; -import com.koushikdutta.async.http.AsyncHttpClientMiddleware; import com.koushikdutta.async.http.SimpleMiddleware; import java.util.Hashtable; @@ -22,19 +20,21 @@ public class CacheOverrideMiddleware extends SimpleMiddleware { } @Override - public void onHeadersReceived(OnHeadersReceivedDataOnRequestSentData data) { + public void onHeadersReceived(OnHeadersReceivedData data) { super.onHeadersReceived(data); // do more checking here, since uri may not necessarily be http or have a host, etc. String cache = cacheHeaders.get(data.request.getUri().getHost()); if (!TextUtils.isEmpty(cache)) data.response.headers().set("Cache-Control", cache); + } Hashtable<String, String> cacheHeaders = new Hashtable<String, String>(); /** * Override cache-control directives + * * @param host * @param cacheControl a Cache-Control value, like "max-age=300" to cache for 5 minutes */ -- GitLab From 64a209a05fa8048c1fcc3468e811176bdc89dd9c Mon Sep 17 00:00:00 2001 From: aantunovic <aantunovic89@gmail.com> Date: Sat, 7 Nov 2020 11:33:39 +0100 Subject: [PATCH 3/3] Gradle plugin, sdk and dependecies updates - android gradle plugin bump to 4.1 - tests migrated to androidx - target & compile sdk bumped to 29 - AndroidManifest cleanup - added gradle.properties file --- AndroidAsync-Kotlin/build.gradle | 10 +- AndroidAsync/build.gradle | 10 +- .../{project.properties => gradle.properties} | 2 +- .../koushikdutta/async/test/BodyTests.java | 7 +- .../koushikdutta/async/test/CacheTests.java | 8 +- .../async/test/CallbackTests.java | 7 +- .../async/test/ConscryptTests.java | 5 +- .../koushikdutta/async/test/ConvertTests.java | 7 +- .../async/test/FileCacheTests.java | 6 +- .../koushikdutta/async/test/FileTests.java | 2 +- .../koushikdutta/async/test/FutureTests.java | 6 +- .../async/test/HttpClientTests.java | 8 +- .../async/test/MultipartTests.java | 4 +- .../com/koushikdutta/async/test/SSLTests.java | 4 +- AndroidAsyncSample/AndroidManifest.xml | 7 +- AndroidAsyncSample/build.gradle | 14 +- build.gradle | 8 +- gradle.properties | 20 ++ gradlew | 109 ++++++---- gradlew.bat | 190 +++++++++--------- 20 files changed, 243 insertions(+), 191 deletions(-) rename AndroidAsync/{project.properties => gradle.properties} (95%) create mode 100644 gradle.properties diff --git a/AndroidAsync-Kotlin/build.gradle b/AndroidAsync-Kotlin/build.gradle index ffd86e3..132345b 100644 --- a/AndroidAsync-Kotlin/build.gradle +++ b/AndroidAsync-Kotlin/build.gradle @@ -25,7 +25,9 @@ android { sourceCompatibility 1.8 targetCompatibility 1.8 } - + kotlinOptions { + jvmTarget = "1.8" + } defaultConfig { minSdkVersion 14 targetSdkVersion 29 @@ -50,9 +52,9 @@ dependencies { testImplementation 'junit:junit:4.12' - testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.3.61' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.3.72' + androidTestImplementation 'androidx.test:runner:1.3.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' } // upload to maven task diff --git a/AndroidAsync/build.gradle b/AndroidAsync/build.gradle index c165681..9f63b8b 100644 --- a/AndroidAsync/build.gradle +++ b/AndroidAsync/build.gradle @@ -22,7 +22,7 @@ android { } defaultConfig { - targetSdkVersion 28 + targetSdkVersion 29 minSdkVersion 14 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -33,8 +33,8 @@ android { targetCompatibility 1.8 } - compileSdkVersion project.hasProperty('global_compileSdkVersion') ? global_compileSdkVersion : 28 - buildToolsVersion project.hasProperty('global_buildToolsVersion') ? global_buildToolsVersion : '28.0.3' + compileSdkVersion project.hasProperty('global_compileSdkVersion') ? global_compileSdkVersion : 29 + buildToolsVersion project.hasProperty('global_buildToolsVersion') ? global_buildToolsVersion : '29.0.3' dependencies { // this is only necessary to get compilation working for self signed certificates. dependency isn't added. @@ -43,8 +43,8 @@ android { testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' // for when i wanna test this against gms conscrypt androidTestImplementation 'com.google.android.gms:play-services-base:17.0.0' } diff --git a/AndroidAsync/project.properties b/AndroidAsync/gradle.properties similarity index 95% rename from AndroidAsync/project.properties rename to AndroidAsync/gradle.properties index edc832b..1b35726 100644 --- a/AndroidAsync/project.properties +++ b/AndroidAsync/gradle.properties @@ -13,5 +13,5 @@ # Project target. target=android-19 android.library=true - +android.useAndroidX=true diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/BodyTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/BodyTests.java index 112a96f..d7d2e24 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/BodyTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/BodyTests.java @@ -1,13 +1,12 @@ package com.koushikdutta.async.test; -import androidx.test.runner.AndroidJUnit4; +import org.junit.Test; +import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; import com.koushikdutta.async.http.Multimap; import com.koushikdutta.async.http.body.UrlEncodedFormBody; -import org.junit.Test; -import org.junit.runner.RunWith; - /** * Created by koush on 3/19/14. */ diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/CacheTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/CacheTests.java index 7d4272c..3152d29 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/CacheTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/CacheTests.java @@ -1,8 +1,11 @@ package com.koushikdutta.async.test; +import org.junit.Test; +import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; + import android.content.res.AssetManager; import androidx.test.InstrumentationRegistry; -import androidx.test.runner.AndroidJUnit4; import com.koushikdutta.async.AsyncServer; import com.koushikdutta.async.AsyncServerSocket; @@ -20,9 +23,6 @@ import com.koushikdutta.async.http.server.AsyncHttpServerRequest; import com.koushikdutta.async.http.server.AsyncHttpServerResponse; import com.koushikdutta.async.http.server.HttpServerRequestCallback; -import org.junit.Test; -import org.junit.runner.RunWith; - import java.io.File; import java.nio.ByteBuffer; import java.util.Date; diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/CallbackTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/CallbackTests.java index f632ce7..67c0e14 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/CallbackTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/CallbackTests.java @@ -1,6 +1,8 @@ package com.koushikdutta.async.test; -import androidx.test.runner.AndroidJUnit4; +import org.junit.Test; +import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; import com.koushikdutta.async.AsyncServer; import com.koushikdutta.async.AsyncServerSocket; @@ -20,9 +22,6 @@ import com.koushikdutta.async.http.server.AsyncHttpServerRequest; import com.koushikdutta.async.http.server.AsyncHttpServerResponse; import com.koushikdutta.async.http.server.HttpServerRequestCallback; -import org.junit.Test; -import org.junit.runner.RunWith; - import static org.junit.Assert.fail; /** diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/ConscryptTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/ConscryptTests.java index 5487e16..40a0891 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/ConscryptTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/ConscryptTests.java @@ -16,11 +16,10 @@ package com.koushikdutta.async.test; +import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; import android.content.Context; -import androidx.test.runner.AndroidJUnit4; - -import org.junit.runner.RunWith; import java.io.InputStream; import java.io.OutputStream; diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/ConvertTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/ConvertTests.java index 57f343b..5a2f9bb 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/ConvertTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/ConvertTests.java @@ -1,13 +1,12 @@ package com.koushikdutta.async.test; -import androidx.test.runner.AndroidJUnit4; +import org.junit.Test; +import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; import com.koushikdutta.async.future.SimpleFuture; import org.json.JSONObject; -import org.junit.Test; -import org.junit.runner.RunWith; - import java.nio.ByteBuffer; import static com.koushikdutta.async.future.Converter.convert; diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/FileCacheTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/FileCacheTests.java index d4a1644..6229324 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/FileCacheTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/FileCacheTests.java @@ -1,12 +1,12 @@ package com.koushikdutta.async.test; -import androidx.test.runner.AndroidJUnit4; + +import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; import com.koushikdutta.async.util.FileCache; import com.koushikdutta.async.util.StreamUtility; -import org.junit.runner.RunWith; - import java.io.File; import java.io.FileInputStream; import java.io.IOException; diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/FileTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/FileTests.java index 6a05592..1b179e4 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/FileTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/FileTests.java @@ -1,7 +1,7 @@ package com.koushikdutta.async.test; -import androidx.test.runner.AndroidJUnit4; +import androidx.test.ext.junit.runners.AndroidJUnit4; import com.koushikdutta.async.AsyncServer; import com.koushikdutta.async.FileDataEmitter; diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/FutureTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/FutureTests.java index f73715b..28014e2 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/FutureTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/FutureTests.java @@ -2,7 +2,9 @@ package com.koushikdutta.async.test; import android.os.Handler; import android.os.Looper; -import androidx.test.runner.AndroidJUnit4; +import androidx.test.ext.junit.runners.AndroidJUnit4; +import org.junit.Test; +import org.junit.runner.RunWith; import com.koushikdutta.async.AsyncServer; import com.koushikdutta.async.callback.CompletedCallback; @@ -16,8 +18,6 @@ import com.koushikdutta.async.future.ThenCallback; import junit.framework.TestCase; -import org.junit.Test; -import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.concurrent.CancellationException; diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/HttpClientTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/HttpClientTests.java index 664e6a5..b54bf1f 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/HttpClientTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/HttpClientTests.java @@ -1,7 +1,11 @@ package com.koushikdutta.async.test; + +import org.junit.Test; +import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; + import android.net.Uri; -import androidx.test.runner.AndroidJUnit4; import android.text.TextUtils; import android.util.Log; @@ -29,8 +33,6 @@ import com.koushikdutta.async.http.server.AsyncProxyServer; import org.json.JSONObject; import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; import java.io.File; import java.util.concurrent.CancellationException; diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/MultipartTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/MultipartTests.java index e29a256..52fa173 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/MultipartTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/MultipartTests.java @@ -1,6 +1,7 @@ package com.koushikdutta.async.test; -import androidx.test.runner.AndroidJUnit4; +import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; import com.koushikdutta.async.AsyncServer; import com.koushikdutta.async.ByteBufferList; @@ -20,7 +21,6 @@ import com.koushikdutta.async.http.server.AsyncHttpServerRequest; import com.koushikdutta.async.http.server.AsyncHttpServerResponse; import com.koushikdutta.async.http.server.HttpServerRequestCallback; -import org.junit.runner.RunWith; import java.io.File; import java.io.FileOutputStream; diff --git a/AndroidAsync/test/src/com/koushikdutta/async/test/SSLTests.java b/AndroidAsync/test/src/com/koushikdutta/async/test/SSLTests.java index ec5fb93..6cb10ad 100644 --- a/AndroidAsync/test/src/com/koushikdutta/async/test/SSLTests.java +++ b/AndroidAsync/test/src/com/koushikdutta/async/test/SSLTests.java @@ -1,6 +1,7 @@ package com.koushikdutta.async.test; -import androidx.test.runner.AndroidJUnit4; +import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; import com.koushikdutta.async.AsyncServer; import com.koushikdutta.async.http.AsyncHttpClient; @@ -11,7 +12,6 @@ import com.koushikdutta.async.http.server.AsyncHttpServerResponse; import com.koushikdutta.async.http.server.HttpServerRequestCallback; import org.json.JSONObject; -import org.junit.runner.RunWith; import java.security.KeyStore; diff --git a/AndroidAsyncSample/AndroidManifest.xml b/AndroidAsyncSample/AndroidManifest.xml index 13285f9..941e186 100644 --- a/AndroidAsyncSample/AndroidManifest.xml +++ b/AndroidAsyncSample/AndroidManifest.xml @@ -1,11 +1,6 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.koushikdutta.async.sample" - android:versionCode="1" - android:versionName="1.0" > + package="com.koushikdutta.async.sample"> - <uses-sdk - android:minSdkVersion="8" - android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> diff --git a/AndroidAsyncSample/build.gradle b/AndroidAsyncSample/build.gradle index 7141854..2728a76 100644 --- a/AndroidAsyncSample/build.gradle +++ b/AndroidAsyncSample/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.application' dependencies { - compile project(':AndroidAsync') + implementation project(':AndroidAsync') } android { @@ -14,11 +14,15 @@ android { } defaultConfig { - targetSdkVersion 24 - minSdkVersion 9 + targetSdkVersion 29 + minSdkVersion 14 } - compileSdkVersion project.hasProperty('global_compileSdkVersion') ? global_compileSdkVersion : 25 - buildToolsVersion project.hasProperty('global_buildToolsVersion') ? global_buildToolsVersion : '25.0.2' + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + compileSdkVersion project.hasProperty('global_compileSdkVersion') ? global_compileSdkVersion : 29 + buildToolsVersion project.hasProperty('global_buildToolsVersion') ? global_buildToolsVersion : '29.0.3' } diff --git a/build.gradle b/build.gradle index b9752b7..eddbb2a 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath project.hasProperty('global_gradleAndroidPlugin') ? global_gradleAndroidPlugin : 'com.android.tools.build:gradle:3.2.0' + classpath project.hasProperty('global_gradleAndroidPlugin') ? global_gradleAndroidPlugin : 'com.android.tools.build:gradle:4.1.0' } } @@ -16,7 +16,7 @@ subprojects { google() } - ext.global_compileSdkVersion = project.hasProperty('global_compileSdkVersion') ? global_compileSdkVersion : 28 - ext.global_buildToolsVersion = project.hasProperty('global_buildToolsVersion') ? global_buildToolsVersion : '28.0.3' - ext.global_gradleAndroidPlugin = project.hasProperty('global_gradleAndroidPlugin') ? global_gradleAndroidPlugin : 'com.android.tools.build:gradle:3.2.0' + ext.global_compileSdkVersion = project.hasProperty('global_compileSdkVersion') ? global_compileSdkVersion : 29 + ext.global_buildToolsVersion = project.hasProperty('global_buildToolsVersion') ? global_buildToolsVersion : '29.0.3' + ext.global_gradleAndroidPlugin = project.hasProperty('global_gradleAndroidPlugin') ? global_gradleAndroidPlugin : 'com.android.tools.build:gradle:4.1.0' } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..7c6efd3 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,20 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# 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 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects + + +android.useAndroidX=true diff --git a/gradlew b/gradlew index 9d82f78..2fe81a7 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env 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. +# ############################################################################## ## @@ -6,20 +22,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='"-Xmx64m" "-Xms64m"' + # 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 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,26 +75,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# 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 - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -85,7 +105,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 @@ -105,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -134,27 +154,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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=("$@") +# 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" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index aec9973..9618d8d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,90 +1,100 @@ -@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 +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@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 + +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="-Xmx64m" "-Xms64m" + +@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 Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_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=%* + +: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 -- GitLab