diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 28e48125..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,263 +0,0 @@ -plugins { - id 'com.android.application' - id 'kotlin-android' - id 'kotlin-kapt' - id 'com.google.devtools.ksp' - id 'dagger.hilt.android.plugin' - id "io.sentry.android.gradle" version "4.7.0" - id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" -} - -def keystorePropertiesFile = rootProject.file("keystore.properties") -def localPropertiesFile = rootProject.file('local.properties') - -android { - namespace 'org.listenbrainz.android' - compileSdk 34 - - signingConfigs { - release { - if (keystorePropertiesFile.exists()) { - def keystoreProperties = new Properties() - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - } - } - } - - defaultConfig { - applicationId 'org.listenbrainz.android' - minSdk 21 - targetSdk 34 - versionCode 51 - versionName "2.6.1" - multiDexEnabled true - testInstrumentationRunner "org.listenbrainz.android.di.CustomTestRunner" // "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary true - } - } - - buildFeatures { - compose true - viewBinding true - } - - buildTypes { - debug { - if (localPropertiesFile.exists()) { - def localProperties = new Properties() - localProperties.load(new FileInputStream(localPropertiesFile)) - - if(localProperties.getProperty('youtubeApiKey') != null && !localProperties.getProperty('youtubeApiKey').isEmpty()){ - resValue("string", "youtubeApiKey", localProperties['youtubeApiKey']) - } - else{ - resValue("string", "youtubeApiKey", "test") - } - - if (localProperties.getProperty('spotifyClientId') != null && !localProperties.getProperty('spotifyClientId').isEmpty()){ - resValue("string", "spotifyClientId", localProperties['spotifyClientId']) - } - else{ - resValue("string", "spotifyClientId", "test") - } - } - else{ - resValue("string", "youtubeApiKey", "test") - resValue("string", "spotifyClientId", "test") - } - resValue("string", "sentryDsn", "") - - applicationIdSuffix ".debug" - versionNameSuffix ".debug" - } - release { - if (keystorePropertiesFile.exists()) { - def keystoreProperties = new Properties() - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) - resValue("string", "youtubeApiKey", keystoreProperties['youtubeApiKey']) - resValue("string", "spotifyClientId", keystoreProperties['spotifyClientId']) - resValue("string", "sentryDsn", keystoreProperties['sentryDsn']) - - signingConfig signingConfigs.release - } - else{ - resValue("string", "youtubeApiKey", "") - resValue("string", "spotifyClientId", "") - resValue("string", "sentryDsn", "") - } - minifyEnabled false - //shrinkResources true - //proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - composeOptions { - kotlinCompilerExtensionVersion '1.5.14' - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = '17' - } - lint { - abortOnError false - } - kapt { - correctErrorTypes true - } - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } - dependenciesInfo { - // Disables dependency metadata when building APKs. - // This is for the signed .apk that we post to GitHub, so the dependency metadata isn't relevant. - includeInApk = false - // Disables dependency metadata when building Android App Bundles. - // This is for the Google Play Store, so we'll want the metadata. - includeInBundle = true - } -} - -dependencies { - //AndroidX - implementation 'androidx.appcompat:appcompat:1.7.0' - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.2' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.2' - implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.8.2' - implementation 'androidx.lifecycle:lifecycle-runtime-compose:2.8.2' - implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.2' - implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - implementation 'androidx.browser:browser:1.8.0' - implementation 'androidx.preference:preference-ktx:1.2.1' - implementation 'androidx.core:core-splashscreen:1.0.1' - implementation 'androidx.datastore:datastore-preferences:1.1.1' - implementation "androidx.work:work-runtime-ktx:$work_version" - - //Web Service Setup - implementation 'com.google.code.gson:gson:2.11.0' - implementation 'com.squareup.retrofit2:retrofit:2.11.0' - implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.14' - implementation 'com.squareup.retrofit2:converter-gson:2.11.0' - implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.14' - implementation 'androidx.paging:paging-runtime-ktx:3.3.0' - implementation 'androidx.paging:paging-compose:3.3.0' - - - //Image downloading and Caching library - implementation 'com.github.bumptech.glide:glide:4.16.0' - implementation 'com.github.bumptech.glide:compose:1.0.0-beta01' - implementation 'io.coil-kt:coil-compose:2.6.0' - implementation 'com.caverock:androidsvg-aar:1.4' - ksp 'com.github.bumptech.glide:compiler:4.16.0' - - //Permissions - implementation "com.google.accompanist:accompanist-permissions:$accompanist_version" - - //Design Setup - implementation 'com.google.android.material:material:1.12.0' - implementation 'com.airbnb.android:lottie:6.4.1' - implementation 'com.github.akshaaatt:Onboarding:1.1.3' - implementation 'com.github.akshaaatt:Share-Android:1.0.0' - implementation 'androidx.hilt:hilt-navigation-compose:1.2.0' - implementation 'com.airbnb.android:lottie-compose:6.4.1' - - //Dagger-Hilt - implementation("com.google.dagger:hilt-android:$hilt_version") - kapt("com.google.dagger:hilt-android-compiler:$hilt_version") - kapt('androidx.hilt:hilt-compiler:1.2.0') - implementation 'androidx.hilt:hilt-work:1.2.0' - implementation "androidx.startup:startup-runtime:1.1.1" - androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version" - kaptAndroidTest "com.google.dagger:hilt-android-compiler:$hilt_version" - - //Jetpack Compose - implementation platform('androidx.compose:compose-bom:2024.06.00') - implementation 'androidx.compose.ui:ui-graphics' - implementation 'androidx.compose.ui:ui' - implementation 'androidx.compose.ui:ui-tooling' - implementation 'androidx.compose.ui:ui-util' - implementation 'androidx.compose.material:material' - implementation 'androidx.compose.material:material-icons-extended' - implementation 'androidx.compose.material3:material3' - implementation 'androidx.compose.material3:material3-window-size-class' - implementation 'androidx.compose.animation:animation' - implementation 'androidx.compose.ui:ui-tooling-preview' - implementation 'androidx.compose.foundation:foundation' - implementation 'androidx.activity:activity-compose' - - // Compose Navigation - implementation "androidx.navigation:navigation-compose:$navigationVersion" - - //Spotify - implementation files('./lib/spotify-app-remote-release-0.7.2.aar') - - // HTML Parser for retrieving token - implementation 'org.jsoup:jsoup:1.17.2' - - //Socket IO - implementation ('io.socket:socket.io-client:2.1.0') { - exclude group: 'org.json', module: 'json' - } - - //Test Setup - implementation 'androidx.test.ext:junit-ktx:1.2.0' - implementation 'app.cash.turbine:turbine:1.1.0' - testImplementation 'junit:junit:4.13.2' - testImplementation 'com.squareup.okhttp3:mockwebserver:5.0.0-alpha.14' - testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1' - testImplementation 'androidx.arch.core:core-testing:2.2.0' - - // Mockito framework - testImplementation 'org.mockito:mockito-core:5.12.0' - testImplementation 'org.mockito.kotlin:mockito-kotlin:5.3.1' - - debugImplementation 'androidx.test:monitor:1.7.0' - // Solves "class PlatformTestStorageRegistery not found" error for ui tests. - debugImplementation 'androidx.compose.ui:ui-test-manifest:1.6.8' - - androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" - androidTestImplementation "androidx.work:work-testing:$work_version" - androidTestImplementation 'androidx.test:runner:1.6.0' - androidTestImplementation 'androidx.test.ext:junit:1.2.0' - androidTestImplementation 'androidx.arch.core:core-testing:2.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.0' - androidTestImplementation 'androidx.test.espresso:espresso-intents:3.6.0' - //androidTestImplementation 'tools.fastlane:screengrab:2.1.1' // Fastlane ScreenGrab - - testImplementation project(path: ':sharedTest') - androidTestImplementation project(path: ':sharedTest') - - //Exoplayer - api "com.google.android.exoplayer:exoplayer-core:$exoplayer_version" - api "com.google.android.exoplayer:exoplayer-ui:$exoplayer_version" - api "com.google.android.exoplayer:extension-mediasession:$exoplayer_version" - - // Room db - implementation "androidx.room:room-runtime:$room_version" - ksp "androidx.room:room-compiler:$room_version" - implementation "androidx.room:room-ktx:$room_version" - testImplementation "androidx.room:room-testing:$room_version" - - // Paging - implementation "androidx.paging:paging-runtime-ktx:$paging_version" - implementation "androidx.paging:paging-compose:$paging_version" - testImplementation "androidx.paging:paging-common-ktx:$paging_version" - - //Jetpack Compose accompanists (https://github.com/google/accompanist) - implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version" - - // Third party libraries - implementation 'com.github.a914-gowtham:compose-ratingbar:1.3.4' - implementation 'com.github.akshaaatt:Logger-Android:1.0.0' - - //Charting Library (Vico) - implementation('com.patrykandpatrick.vico:compose:1.15.0') -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..e76e6c65 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,242 @@ +import java.util.Properties +import java.io.FileInputStream + +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.ksp) + alias(libs.plugins.hilt) + alias(libs.plugins.compose.compiler) + alias(libs.plugins.sentry) +} + +val keystorePropertiesFile = rootProject.file("keystore.properties") +val localPropertiesFile = rootProject.file("local.properties") + +android { + namespace = "org.listenbrainz.android" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + applicationId = "org.listenbrainz.android" + minSdk = libs.versions.minSdk.get().toInt() + targetSdk = libs.versions.targetSdk.get().toInt() + versionCode = 51 + versionName = "2.6.1" + multiDexEnabled = true + testInstrumentationRunner = "org.listenbrainz.android.di.CustomTestRunner" + vectorDrawables { + useSupportLibrary = true + } + } + + signingConfigs { + create("release") { + if (keystorePropertiesFile.exists()) { + val keystoreProperties = Properties() + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) + storeFile = file(keystoreProperties["storeFile"] as String) + storePassword = keystoreProperties["storePassword"] as String + keyAlias = keystoreProperties["keyAlias"] as String + keyPassword = keystoreProperties["keyPassword"] as String + } + } + } + + buildTypes { + debug { + if (localPropertiesFile.exists()) { + val localProperties = Properties() + localProperties.load(FileInputStream(localPropertiesFile)) + + if (localProperties.getProperty("youtubeApiKey") != null && localProperties.getProperty("youtubeApiKey").isNotEmpty()) { + resValue("string", "youtubeApiKey", localProperties.getProperty("youtubeApiKey")) + } else { + resValue("string", "youtubeApiKey", "test") + } + + if (localProperties.getProperty("spotifyClientId") != null && localProperties.getProperty("spotifyClientId").isNotEmpty()) { + resValue("string", "spotifyClientId", localProperties.getProperty("spotifyClientId")) + } else { + resValue("string", "spotifyClientId", "test") + } + } else { + resValue("string", "youtubeApiKey", "test") + resValue("string", "spotifyClientId", "test") + } + resValue("string", "sentryDsn", "") + + applicationIdSuffix = ".debug" + versionNameSuffix = ".debug" + } + + release { + if (keystorePropertiesFile.exists()) { + val keystoreProperties = Properties() + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) + resValue("string", "youtubeApiKey", keystoreProperties.getProperty("youtubeApiKey")) + resValue("string", "spotifyClientId", keystoreProperties.getProperty("spotifyClientId")) + resValue("string", "sentryDsn", keystoreProperties.getProperty("sentryDsn")) + + signingConfig = signingConfigs.getByName("release") + } else { + resValue("string", "youtubeApiKey", "") + resValue("string", "spotifyClientId", "") + resValue("string", "sentryDsn", "") + } + isMinifyEnabled = false + // isShrinkResources = true + // proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + buildFeatures { + compose = true + viewBinding = true + buildConfig = true + } + + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.compose.get() + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" + } + + lint { + abortOnError = false + } + + dependenciesInfo { + includeInApk = false + includeInBundle = true + } +} + +dependencies { + // AndroidX libraries + implementation(libs.androidx.appcompat) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.lifecycle.viewmodel.ktx) + implementation(libs.androidx.lifecycle.viewmodel.compose) + implementation(libs.androidx.lifecycle.runtime.compose) + implementation(libs.androidx.lifecycle.livedata.ktx) + implementation(libs.androidx.lifecycle.extensions) + implementation(libs.androidx.browser) + implementation(libs.androidx.preference.ktx) + implementation(libs.androidx.core.splashscreen) + implementation(libs.androidx.datastore.preferences) + implementation(libs.androidx.work.runtime.ktx) + implementation(libs.androidx.paging.runtime) + implementation(libs.androidx.paging.compose) + + //Room DB + implementation(libs.androidx.room.runtime) + ksp(libs.androidx.room.compiler) + implementation(libs.androidx.room.ktx) + + // Networking + implementation(libs.gson) + implementation(libs.retrofit) + implementation(libs.okhttp) + implementation(libs.retrofit.converter.gson) + implementation(libs.okhttp.logging.interceptor) + + // Image loading and processing + implementation(libs.glide) + implementation(libs.glide.compose) + implementation(libs.coil.compose) + implementation(libs.androidsvg) + ksp(libs.glide.compiler) + + // Compose + val composeBom = platform(libs.androidx.compose.bom) + implementation(composeBom) + implementation(libs.androidx.compose.ui.graphics) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.tooling) + implementation(libs.androidx.compose.ui.util) + implementation(libs.androidx.compose.material) + implementation(libs.androidx.compose.material.icons.extended) + implementation(libs.androidx.compose.material3) + implementation(libs.androidx.compose.material3.window.size) + implementation(libs.androidx.compose.animation) + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.compose.foundation) + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.navigation.compose) + + // Dependency Injection + implementation(libs.hilt.android) + ksp(libs.hilt.android.compiler) + implementation(libs.androidx.hilt.work) + implementation(libs.androidx.hilt.navigation.compose) + implementation(libs.androidx.startup.runtime) + + // UI Components + implementation(libs.material) + implementation(libs.lottie) + implementation(libs.lottie.compose) + implementation(libs.onboarding) + implementation(libs.share.android) + implementation(libs.compose.ratingbar) + + // Accompanist + implementation(libs.google.accompanist.permissions) + implementation(libs.google.accompanist.systemuicontroller) + + // Media playback + implementation(libs.google.exoplayer.core) + implementation(libs.google.exoplayer.ui) + implementation(libs.google.exoplayer.mediasession) + + // Spotify SDK + implementation(files("./lib/spotify-app-remote-release-0.7.2.aar")) + + // Networking and parsing + implementation(libs.jsoup) + implementation(libs.socket.io) { + exclude(group = "org.json", module = "json") + } + + // Logging + implementation(libs.logger.android) + + // Charts + implementation(libs.vico.compose) + + // Testing + testImplementation(libs.junit) + testImplementation(libs.mockwebserver) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.androidx.arch.core.testing) + testImplementation(libs.mockito.core) + testImplementation(libs.mockito.kotlin) + testImplementation(project(":sharedTest")) + + androidTestImplementation(libs.androidx.compose.ui.test.junit4) + androidTestImplementation(libs.androidx.work.testing) + androidTestImplementation(libs.androidx.test.runner) + androidTestImplementation(libs.androidx.test.ext.junit) + androidTestImplementation(libs.androidx.arch.core.testing) + androidTestImplementation(libs.androidx.test.espresso.core) + androidTestImplementation(libs.androidx.test.espresso.intents) + androidTestImplementation(libs.hilt.android) + androidTestImplementation(libs.hilt.android.testing) + androidTestImplementation(project(":sharedTest")) + + kspAndroidTest(libs.hilt.android.compiler) + + debugImplementation(libs.androidx.test.monitor) + debugImplementation(libs.androidx.compose.ui.test.manifest) + + implementation(libs.androidx.test.ext.junit.ktx) + implementation(libs.turbine) +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index f1b42451..8b137891 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,21 +1 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/app/src/main/java/org/listenbrainz/android/di/Yim23RepositoryModule.kt b/app/src/main/java/org/listenbrainz/android/di/Yim23RepositoryModule.kt index c86ad98a..7846a146 100644 --- a/app/src/main/java/org/listenbrainz/android/di/Yim23RepositoryModule.kt +++ b/app/src/main/java/org/listenbrainz/android/di/Yim23RepositoryModule.kt @@ -12,5 +12,5 @@ import org.listenbrainz.android.repository.yim23.Yim23RepositoryImpl @InstallIn(ActivityRetainedComponent::class) abstract class Yim23RepositoryModule { @Binds - abstract fun bindsYim23Repository(repository: Yim23RepositoryImpl?) : Yim23Repository + abstract fun bindsYim23Repository(repository: Yim23RepositoryImpl?) : Yim23Repository? } \ No newline at end of file diff --git a/app/src/main/java/org/listenbrainz/android/repository/yim23/Yim23RepositoryImpl.kt b/app/src/main/java/org/listenbrainz/android/repository/yim23/Yim23RepositoryImpl.kt index 1c015d19..681e3828 100644 --- a/app/src/main/java/org/listenbrainz/android/repository/yim23/Yim23RepositoryImpl.kt +++ b/app/src/main/java/org/listenbrainz/android/repository/yim23/Yim23RepositoryImpl.kt @@ -1,15 +1,10 @@ package org.listenbrainz.android.repository.yim23 -import androidx.annotation.WorkerThread import org.listenbrainz.android.model.ResponseError import org.listenbrainz.android.model.yimdata.Yim23Payload -import org.listenbrainz.android.model.yimdata.YimPayload import org.listenbrainz.android.service.Yim23Service -import org.listenbrainz.android.service.YimService -import org.listenbrainz.android.util.Log import org.listenbrainz.android.util.Resource import org.listenbrainz.android.util.Utils -import retrofit2.http.GET import javax.inject.Inject // TODO: TO BE REMOVED WHEN YIM GOES LIVE diff --git a/app/src/main/java/org/listenbrainz/android/ui/screens/yim23/YearInMusic23Activity.kt b/app/src/main/java/org/listenbrainz/android/ui/screens/yim23/YearInMusic23Activity.kt index f641f483..11dbfeb9 100644 --- a/app/src/main/java/org/listenbrainz/android/ui/screens/yim23/YearInMusic23Activity.kt +++ b/app/src/main/java/org/listenbrainz/android/ui/screens/yim23/YearInMusic23Activity.kt @@ -1,7 +1,6 @@ package org.listenbrainz.android.ui.screens.yim23 import android.os.Bundle -import android.util.Log import android.widget.Toast import androidx.activity.ComponentActivity import androidx.activity.compose.setContent @@ -15,9 +14,7 @@ import org.listenbrainz.android.util.Constants.Strings.STATUS_LOGGED_IN import org.listenbrainz.android.util.Constants.Strings.STATUS_LOGGED_OUT import org.listenbrainz.android.util.connectivityobserver.NetworkConnectivityViewModel import org.listenbrainz.android.util.connectivityobserver.NetworkConnectivityViewModelImpl -import org.listenbrainz.android.viewmodel.SocialViewModel import org.listenbrainz.android.viewmodel.Yim23ViewModel -import org.listenbrainz.android.viewmodel.YimViewModel @AndroidEntryPoint class YearInMusic23Activity : ComponentActivity() { diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 5f312a0e..00000000 --- a/build.gradle +++ /dev/null @@ -1,61 +0,0 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -buildscript { - ext { - kotlin_version = '2.0.0' - navigationVersion = '2.7.7' - hilt_version = '2.51.1' - compose_version = '1.6.8' - room_version = '2.6.1' - accompanist_version = '0.34.0' - work_version = '2.9.0' - exoplayer_version = '2.19.1' - paging_version = '3.3.0' - } - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:8.5.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version" - } -} - -plugins { - id 'com.google.devtools.ksp' version '2.0.0-1.0.21' apply false -} - -allprojects { - repositories { - google() - mavenCentral() - maven {url "https://jitpack.io"} - } -} - -tasks.register('clean', Delete) { - delete rootProject.buildDir -} - -subprojects { - tasks.withType(KotlinCompile).configureEach { - kotlinOptions { - if (project.findProperty("composeCompilerReports") == "true") { - freeCompilerArgs += [ - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + - project.buildDir.absolutePath + "/compose_compiler" - ] - } - if (project.findProperty("composeCompilerMetrics") == "true") { - freeCompilerArgs += [ - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + - project.buildDir.absolutePath + "/compose_compiler" - ] - } - } - } -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..7e1eccd5 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.serialization) apply false + alias(libs.plugins.ksp) apply false + alias(libs.plugins.hilt) apply false + alias(libs.plugins.compose.compiler) apply false +} + +tasks.register("clean") { + delete(layout.buildDirectory) +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index c3d3da7e..35d10e57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,6 @@ org.gradle.jvmargs=-Xmx4096m android.useAndroidX=true android.enableJetifier=false -android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false android.nonFinalResIds=false org.gradle.configuration-cache=true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..e275fdaf --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,152 @@ +[versions] +kotlin = "2.0.0" +navigation = "2.7.7" +hilt = "2.51.1" +compose = "1.6.8" +room = "2.6.1" +accompanist = "0.34.0" +work = "2.9.0" +exoplayer = "2.19.1" +paging = "3.3.0" +androidGradlePlugin = "8.5.0" +sentry = "4.7.0" +ksp = "2.0.0-1.0.22" +composeBom = "2024.06.00" +appcompat = "1.7.0" +lifecycle = "2.8.3" +browser = "1.8.0" +preference = "1.2.1" +coreSplashscreen = "1.0.1" +datastorePreferences = "1.1.1" +gson = "2.11.0" +retrofit = "2.11.0" +okhttp = "5.0.0-alpha.14" +glide = "4.16.0" +glideCompose = "1.0.0-beta01" +coil = "2.6.0" +androidsvg = "1.4" +material = "1.12.0" +lottie = "6.4.1" +onboarding = "1.1.3" +shareAndroid = "1.0.0" +hiltNavigationCompose = "1.2.0" +startup = "1.1.1" +jsoup = "1.17.2" +socketIo = "2.1.0" +junit = "4.13.2" +archCoreTesting = "2.2.0" +mockito = "5.12.0" +mockitoKotlin = "5.3.1" +testMonitor = "1.7.1" +testRunner = "1.6.1" +testExtJunit = "1.2.1" +espresso = "3.6.1" +turbine = "1.1.0" +vicoCompose = "1.15.0" +composeRatingbar = "1.3.4" +loggerAndroid = "1.0.0" +compileSdk = "34" +targetSdk = "34" +minSdk = "21" + +[libraries] +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } +androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" } +androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" } +androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycle" } +androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle" } +androidx-lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycle" } +androidx-lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version = "2.2.0" } +androidx-browser = { module = "androidx.browser:browser", version.ref = "browser" } +androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preference" } +androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" } +androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" } +androidx-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "work" } +androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigationCompose" } +androidx-hilt-work = { module = "androidx.hilt:hilt-work", version.ref = "hiltNavigationCompose" } +androidx-startup-runtime = { module = "androidx.startup:startup-runtime", version.ref = "startup" } + +androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } +androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" } +androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } +androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +androidx-compose-ui-util = { group = "androidx.compose.ui", name = "ui-util" } +androidx-compose-material = { group = "androidx.compose.material", name = "material" } +androidx-compose-material-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended" } +androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } +androidx-compose-material3-window-size = { group = "androidx.compose.material3", name = "material3-window-size-class" } +androidx-compose-animation = { group = "androidx.compose.animation", name = "animation" } +androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" } +androidx-activity-compose = { group = "androidx.activity", name = "activity-compose" } + +androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation" } + +androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } +androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" } +androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" } + +androidx-paging-runtime = { module = "androidx.paging:paging-runtime-ktx", version.ref = "paging" } +androidx-paging-compose = { module = "androidx.paging:paging-compose", version.ref = "paging" } + +google-accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanist" } +google-accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" } + +hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" } +hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" } +hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" } + +google-exoplayer-core = { module = "com.google.android.exoplayer:exoplayer-core", version.ref = "exoplayer" } +google-exoplayer-ui = { module = "com.google.android.exoplayer:exoplayer-ui", version.ref = "exoplayer" } +google-exoplayer-mediasession = { module = "com.google.android.exoplayer:extension-mediasession", version.ref = "exoplayer" } + +gson = { module = "com.google.code.gson:gson", version.ref = "gson" } +retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +retrofit-converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } +okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" } + +glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" } +glide-compose = { module = "com.github.bumptech.glide:compose", version.ref = "glideCompose" } +glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "glide" } +coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" } +androidsvg = { module = "com.caverock:androidsvg-aar", version.ref = "androidsvg" } + +material = { module = "com.google.android.material:material", version.ref = "material" } +lottie = { module = "com.airbnb.android:lottie", version.ref = "lottie" } +lottie-compose = { module = "com.airbnb.android:lottie-compose", version.ref = "lottie" } +onboarding = { module = "com.github.akshaaatt:Onboarding", version.ref = "onboarding" } +share-android = { module = "com.github.akshaaatt:Share-Android", version.ref = "shareAndroid" } + +jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } +socket-io = { module = "io.socket:socket.io-client", version.ref = "socketIo" } +junit = { module = "junit:junit", version.ref = "junit" } +androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "testExtJunit" } +androidx-test-ext-junit-ktx = { module = "androidx.test.ext:junit-ktx", version.ref = "testExtJunit" } +turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } +mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version = "1.8.1" } +androidx-arch-core-testing = { module = "androidx.arch.core:core-testing", version.ref = "archCoreTesting" } +mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } +mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockitoKotlin" } +androidx-test-monitor = { module = "androidx.test:monitor", version.ref = "testMonitor" } +androidx-compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose" } +androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" } +androidx-work-testing = { module = "androidx.work:work-testing", version.ref = "work" } +androidx-test-runner = { module = "androidx.test:runner", version.ref = "testRunner" } +androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" } +androidx-test-espresso-intents = { module = "androidx.test.espresso:espresso-intents", version.ref = "espresso" } + +vico-compose = { module = "com.patrykandpatrick.vico:compose", version.ref = "vicoCompose" } +compose-ratingbar = { module = "com.github.a914-gowtham:compose-ratingbar", version.ref = "composeRatingbar" } +logger-android = { module = "com.github.akshaaatt:Logger-Android", version.ref = "loggerAndroid" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } +sentry = { id = "io.sentry.android.gradle", version.ref = "sentry" } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 20251183..479c0fef 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,19 @@ -include ':app' -include ':sharedTest' +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url = uri("https://jitpack.io") } + } +} + +include(":app") +include(":sharedTest") diff --git a/sharedTest/build.gradle b/sharedTest/build.gradle deleted file mode 100644 index 979ee11e..00000000 --- a/sharedTest/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -plugins { - id 'com.android.library' - id 'kotlin-android' -} - -android { - namespace 'org.listenbrainz.sharedtest' - compileSdk 34 - - defaultConfig { - minSdk 21 - targetSdk 34 - } - - buildTypes { - release { - minifyEnabled false - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = '17' - } -} - -dependencies { - implementation 'androidx.appcompat:appcompat:1.7.0' - implementation 'com.google.android.material:material:1.12.0' - - //Web Service Setup - implementation 'com.google.code.gson:gson:2.11.0' - implementation 'com.squareup.retrofit2:retrofit:2.11.0' - implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.14' - implementation 'com.squareup.retrofit2:converter-gson:2.11.0' - - //Test Setup - implementation 'junit:junit:4.13.2' - implementation 'com.squareup.okhttp3:mockwebserver:5.0.0-alpha.14' - implementation 'androidx.arch.core:core-testing:2.2.0' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1' - implementation 'androidx.room:room-testing:2.6.1' - debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version" - - implementation 'androidx.test:runner:1.6.0' - implementation 'androidx.test.ext:junit:1.2.0' - implementation 'androidx.arch.core:core-testing:2.2.0' - implementation 'androidx.test.espresso:espresso-core:3.6.0' - implementation 'androidx.test.espresso:espresso-intents:3.6.0' - implementation "androidx.compose.ui:ui-test-junit4:$compose_version" - - implementation project(path: ':app') -} \ No newline at end of file diff --git a/sharedTest/build.gradle.kts b/sharedTest/build.gradle.kts new file mode 100644 index 00000000..988a96db --- /dev/null +++ b/sharedTest/build.gradle.kts @@ -0,0 +1,63 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} + +android { + namespace = "org.listenbrainz.sharedtest" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + minSdk = libs.versions.minSdk.get().toInt() + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" + } + + lint { + targetSdk = libs.versions.compileSdk.get().toInt() + } +} + +dependencies { + // AndroidX and UI + implementation(libs.androidx.appcompat) + implementation(libs.material) + + // Networking + implementation(libs.gson) + implementation(libs.retrofit) + implementation(libs.okhttp) + implementation(libs.retrofit.converter.gson) + + // Testing + implementation(libs.junit) + implementation(libs.mockwebserver) + implementation(libs.androidx.arch.core.testing) + implementation(libs.kotlinx.coroutines.test) + implementation(libs.androidx.test.runner) + implementation(libs.androidx.test.ext.junit) + implementation(libs.androidx.test.espresso.core) + implementation(libs.androidx.test.espresso.intents) + + // App module dependency + implementation(project(":app")) +} \ No newline at end of file