Merge pull request #304 from cyb3rko/update-build

Update build components
This commit is contained in:
Jannis Mattheis
2023-07-19 20:28:46 +02:00
committed by GitHub
18 changed files with 50 additions and 38 deletions

2
.editorconfig Normal file
View File

@@ -0,0 +1,2 @@
[*.{kt,kts}]
ktlint_code_style = android

View File

@@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: ./gradlew build --stacktrace
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}

View File

@@ -54,7 +54,7 @@ The foreground notification showing the connection status can be manually minimi
## Building
Use Java 11 and execute the following command to build the apk.
Use Java 17 and execute the following command to build the apk.
```bash
$ ./gradlew build

View File

@@ -1,7 +1,7 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'org.jmailen.kotlinter' version '3.13.0'
id 'org.jmailen.kotlinter' version '3.15.0'
}
android {
@@ -33,18 +33,20 @@ android {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '11'
}
lintOptions {
disable 'GoogleAppIndexingWarning'
lintConfig file('../lint.xml')
jvmTarget = '17'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
resources {
excludes += ['META-INF/DEPENDENCIES']
}
}
lint {
disable 'GoogleAppIndexingWarning'
lintConfig file('../lint.xml')
}
}
@@ -64,13 +66,13 @@ if (project.hasProperty('sign')) {
dependencies {
implementation project(':client')
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'com.github.cyb3rko:QuickPermissions-Kotlin:1.0.2'
implementation 'com.hypertrack:hyperlog:0.0.10'

View File

@@ -17,12 +17,6 @@ import com.google.android.material.snackbar.Snackbar
import com.google.gson.Gson
import com.squareup.picasso.Picasso.LoadedFrom
import com.squareup.picasso.Target
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import okio.Buffer
import org.threeten.bp.OffsetDateTime
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
@@ -31,6 +25,12 @@ import java.net.MalformedURLException
import java.net.URI
import java.net.URISyntaxException
import java.net.URL
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import okio.Buffer
import org.threeten.bp.OffsetDateTime
internal object Utils {
val JSON: Gson = JSON().gson

View File

@@ -1,7 +1,7 @@
package com.github.gotify.api
import retrofit2.Call
import java.io.IOException
import retrofit2.Call
internal object Api {
@Throws(ApiException::class)

View File

@@ -1,7 +1,7 @@
package com.github.gotify.api
import retrofit2.Response
import java.io.IOException
import retrofit2.Response
internal class ApiException : Exception {
var body: String = ""

View File

@@ -51,7 +51,10 @@ internal class Callback<T> private constructor(
)
}
fun <T> call(onSuccess: SuccessCallback<T> = SuccessCallback {}, onError: ErrorCallback = ErrorCallback {}): retrofit2.Callback<T> {
fun <T> call(
onSuccess: SuccessCallback<T> = SuccessCallback {},
onError: ErrorCallback = ErrorCallback {}
): retrofit2.Callback<T> {
return RetrofitCallback(merge(of(onSuccess, onError), errorCallback()))
}

View File

@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import com.github.gotify.SSLSettings
import com.github.gotify.Utils
import com.github.gotify.log.Log
import okhttp3.OkHttpClient
import java.io.IOException
import java.security.GeneralSecurityException
import java.security.KeyStore
@@ -16,6 +15,7 @@ import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.X509TrustManager
import okhttp3.OkHttpClient
internal object CertUtils {
@SuppressLint("CustomX509TrustManager")

View File

@@ -31,8 +31,8 @@ import com.github.gotify.log.LogsActivity
import com.github.gotify.log.UncaughtExceptionHandler
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.textfield.TextInputEditText
import okhttp3.HttpUrl
import java.security.cert.X509Certificate
import okhttp3.HttpUrl
internal class LoginActivity : AppCompatActivity() {
companion object {

View File

@@ -26,9 +26,9 @@ import com.github.gotify.databinding.MessageItemCompactBinding
import com.github.gotify.messages.provider.MessageWithImage
import com.squareup.picasso.Picasso
import io.noties.markwon.Markwon
import org.threeten.bp.OffsetDateTime
import java.text.DateFormat
import java.util.Date
import org.threeten.bp.OffsetDateTime
internal class ListMessageAdapter(
private val context: Context,

View File

@@ -56,9 +56,9 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.navigation.NavigationView
import com.google.android.material.snackbar.BaseTransientBottomBar.BaseCallback
import com.google.android.material.snackbar.Snackbar
import java.io.IOException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.io.IOException
internal class MessagesActivity :
AppCompatActivity(),

View File

@@ -11,10 +11,10 @@ import com.github.gotify.client.model.Application
import com.github.gotify.log.Log
import com.squareup.picasso.OkHttp3Downloader
import com.squareup.picasso.Picasso
import okhttp3.Cache
import okhttp3.OkHttpClient
import java.io.File
import java.io.IOException
import okhttp3.Cache
import okhttp3.OkHttpClient
internal class PicassoHandler(private val context: Context, private val settings: Settings) {
companion object {

View File

@@ -10,15 +10,15 @@ import com.github.gotify.Utils
import com.github.gotify.api.CertUtils
import com.github.gotify.client.model.Message
import com.github.gotify.log.Log
import java.util.Calendar
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicLong
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import okhttp3.WebSocket
import okhttp3.WebSocketListener
import java.util.Calendar
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicLong
internal class WebSocketConnection(
private val baseUrl: String,

View File

@@ -141,7 +141,7 @@ internal class WebSocketService : Service() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationSupport.createChannels(
this,
(this.getSystemService(NOTIFICATION_SERVICE) as NotificationManager),
(getSystemService(NOTIFICATION_SERVICE) as NotificationManager),
apps
)
}

View File

@@ -6,8 +6,8 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20'
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@@ -6,9 +6,13 @@
# 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.
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=true
android.nonFinalResIds=true
android.nonTransitiveRClass=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.unsafe.configuration-cache=true
# 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

View File

@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distrubutionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists