diff --git a/app/build.gradle.kts b/app/build.gradle.kts index db8794c4..5d7cf6ab 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,11 +1,11 @@ import com.android.build.gradle.internal.api.BaseVariantOutputImpl plugins { - id("com.android.application") - id("kotlin-android") - id("kotlin-parcelize") - id("org.jetbrains.kotlin.kapt") - id("dagger.hilt.android.plugin") + id(libs.plugins.android.application.get().pluginId) + id(libs.plugins.kotlin.android.get().pluginId) + id(libs.plugins.kotlin.parcelize.get().pluginId) + id(libs.plugins.ksp.get().pluginId) + id(libs.plugins.hilt.plugin.get().pluginId) } android { @@ -15,8 +15,8 @@ android { applicationId = "me.rosuh.easywatermark" minSdk = (Apps.minSdk) targetSdk = (Apps.targetSdk) - versionCode = 20809 - versionName = "2.8.9" + versionCode = 20900 + versionName = "2.9.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" setProperty("archivesBaseName", "$applicationId-v$versionName($versionCode)") } @@ -62,8 +62,19 @@ android { namespace = "me.rosuh.easywatermark" - lint { - baseline = file("lint-baseline.xml") +// lint { +// baseline = file("lint-baseline.xml") +// quiet = true +// abortOnError = false +// checkReleaseBuilds = false +// } + + buildFeatures { + compose = true + } + + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get() } kotlin { @@ -71,9 +82,6 @@ android { } } -kapt { - correctErrorTypes = true -} dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) @@ -81,17 +89,21 @@ dependencies { implementation(libs.room.runtime) implementation(libs.room.ktx) - kapt(libs.room.compiler) + implementation(libs.core.ktx) + ksp(libs.room.compiler) implementation(libs.datastore.preference) - implementation(libs.dagger.hilt.android) - kapt(libs.dagger.hilt.compiler) + // di + implementation(libs.hilt.android) + ksp(libs.hilt.compiler) + androidTestImplementation(libs.hilt.testing) + kspAndroidTest(libs.hilt.compiler) - implementation(libs.asyncLayoutInflater) + implementation(libs.asynclayout.inflater) - implementation(libs.glide.glide) - kapt(libs.glide.compiler) + implementation(libs.glide) + ksp(libs.glide.compiler) implementation(libs.compressor) @@ -105,13 +117,13 @@ dependencies { implementation(libs.activity.ktx) implementation(libs.lifecycle.runtime.ktx) implementation(libs.lifecycle.livedata.ktx) - implementation(libs.lifecycle.viewModel.ktx) + implementation(libs.lifecycle.viewmodel.ktx) implementation(libs.viewpager2) implementation(libs.recyclerview) - implementation(libs.constraintLayout) - implementation(libs.exifInterface) + implementation(libs.constraintlayout) + implementation(libs.exifinterface) implementation(libs.palette.ktx) - implementation(libs.profieinstaller) + implementation(libs.profileinstaller) implementation(libs.colorpicker) @@ -126,4 +138,58 @@ dependencies { androidTestImplementation(libs.test.espresso.core) androidTestImplementation(libs.test.uiautomator) androidTestImplementation(libs.test.ext.junit) + + // or only import the main APIs for the underlying toolkit systems, + // such as input and measurement/layout +// val composeBom = platform("androidx.compose:compose-bom:2023.10.00") +// implementation(composeBom) +// androidTestImplementation(composeBom) + implementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(platform(libs.androidx.compose.bom)) + // implementation("androidx.compose.material3:material3:1.2.0-alpha09") +// implementation("androidx.compose.material3:material3-window-size-class:1.1.2") +// implementation(libs.material) + implementation(libs.androidx.compose.material3) + implementation(libs.androidx.compose.material3.windowSizeClass) +// implementation("androidx.compose.ui:ui") + implementation(libs.androidx.compose.ui.ui) + +// implementation("androidx.compose.ui:ui-tooling-preview") +// debugImplementation("androidx.compose.ui:ui-tooling") + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.compose.ui.tooling) + + // Optional - Integration with activities +// implementation("androidx.activity:activity-compose:1.8.0") + implementation(libs.androidx.activity.compose) + // Optional - Integration with ViewModels +// implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2") + implementation(libs.androidx.compose.lifecycle.viewmodel) + + // When using a MDC theme +// implementation("com.google.android.material:compose-theme-adapter:1.2.1") + +// implementation("com.google.accompanist:accompanist-permissions:0.33.2-alpha") + implementation(libs.accompanist.permissions) +// implementation("io.coil-kt:coil-compose:2.3.0") + implementation(libs.coil.kt) + implementation(libs.coil.kt.compose) + implementation(libs.coil.kt.svg) + +// implementation("androidx.compose.runtime:runtime-livedata:1.5.3") + implementation(libs.androidx.compose.runtime.livedata) + +// implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.2") + implementation(libs.androidx.lifecycle.runtime.compose) + +// implementation("androidx.navigation:navigation-compose:2.7.4") + implementation(libs.androidx.navigation.compose) + +// implementation("com.google.accompanist:accompanist-navigation-animation:0.31.1-alpha") + implementation(libs.accompanist.navigation.animation) + +// implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1") + implementation(libs.androidx.constraintlayout.compose) + implementation(libs.androidx.motionlayoout.compose) + } diff --git a/app/src/main/java/me/rosuh/easywatermark/ui/widget/CircleImageView.kt b/app/src/main/java/me/rosuh/easywatermark/ui/widget/CircleImageView.kt index b73fa513..dd5f59e2 100644 --- a/app/src/main/java/me/rosuh/easywatermark/ui/widget/CircleImageView.kt +++ b/app/src/main/java/me/rosuh/easywatermark/ui/widget/CircleImageView.kt @@ -60,7 +60,7 @@ class CircleImageView : AppCompatImageView { } @SuppressLint("DrawAllocation") - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { if (sourceImageBitmap == null || (sizeHasChanged && width > 0 && height > 0)) { super.onDraw(canvas) sourceImageBitmap = drawable.toBitmap(width, height) diff --git a/app/src/main/java/me/rosuh/easywatermark/ui/widget/ColoredImageVIew.kt b/app/src/main/java/me/rosuh/easywatermark/ui/widget/ColoredImageVIew.kt index 264fbdb6..da511db9 100644 --- a/app/src/main/java/me/rosuh/easywatermark/ui/widget/ColoredImageVIew.kt +++ b/app/src/main/java/me/rosuh/easywatermark/ui/widget/ColoredImageVIew.kt @@ -83,7 +83,7 @@ class ColoredImageVIew : AppCompatImageView { } @SuppressLint("DrawAllocation") - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { if (innerBitmap == null || (sizeHasChanged && width > 0 && height > 0)) { super.onDraw(canvas) } diff --git a/app/src/main/java/me/rosuh/easywatermark/ui/widget/ProgressImageView.kt b/app/src/main/java/me/rosuh/easywatermark/ui/widget/ProgressImageView.kt index 7c905910..4d5bc30f 100644 --- a/app/src/main/java/me/rosuh/easywatermark/ui/widget/ProgressImageView.kt +++ b/app/src/main/java/me/rosuh/easywatermark/ui/widget/ProgressImageView.kt @@ -61,11 +61,10 @@ class ProgressImageView : AppCompatImageView { private val saveLayerBounds = RectF() @SuppressLint("DrawAllocation") - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { super.onDraw(canvas) - if (measuredWidth < 0 || measuredHeight <= 0 || drawable == null - || drawable.intrinsicWidth <= 0 || drawable.intrinsicHeight <= 0 || canvas == null - || curX <= 0f || !enableProgress.get() + if ((measuredWidth < 0 || measuredHeight <= 0 || drawable == null + || drawable.intrinsicWidth <= 0 || drawable.intrinsicHeight <= 0) || curX <= 0f || !enableProgress.get() ) { return } diff --git a/app/src/main/java/me/rosuh/easywatermark/ui/widget/RadioButton.kt b/app/src/main/java/me/rosuh/easywatermark/ui/widget/RadioButton.kt index 7f4deaaa..88644f96 100644 --- a/app/src/main/java/me/rosuh/easywatermark/ui/widget/RadioButton.kt +++ b/app/src/main/java/me/rosuh/easywatermark/ui/widget/RadioButton.kt @@ -72,7 +72,7 @@ class RadioButton : View { return ContextCompat.getDrawable(context, iconRes) ?: ColorDrawable(context.colorOnSurface) } - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { // draw background paint.style = Paint.Style.FILL paint.color = if (isChecked) bgColorSelected else bgColorNormal diff --git a/app/src/main/java/me/rosuh/easywatermark/ui/widget/SelectableImageView.kt b/app/src/main/java/me/rosuh/easywatermark/ui/widget/SelectableImageView.kt index 948452ca..0dbcdf64 100644 --- a/app/src/main/java/me/rosuh/easywatermark/ui/widget/SelectableImageView.kt +++ b/app/src/main/java/me/rosuh/easywatermark/ui/widget/SelectableImageView.kt @@ -111,7 +111,7 @@ class SelectableImageView : View { invalidate() } - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { super.onDraw(canvas) if (isSelected) { canvas?.drawCircle( diff --git a/app/src/main/java/me/rosuh/easywatermark/ui/widget/TouchSensitiveRv.kt b/app/src/main/java/me/rosuh/easywatermark/ui/widget/TouchSensitiveRv.kt index af6a9d91..435ce23b 100644 --- a/app/src/main/java/me/rosuh/easywatermark/ui/widget/TouchSensitiveRv.kt +++ b/app/src/main/java/me/rosuh/easywatermark/ui/widget/TouchSensitiveRv.kt @@ -196,16 +196,16 @@ class TouchSensitiveRv : RecyclerView { borderAnimator.cancel() } - override fun onDraw(c: Canvas?) { + override fun onDraw(c: Canvas) { super.onDraw(c) - c?.withSave { + c.withSave { drawRect( glowRectF, glowPaint ) } if (enableBorder && scrollState == SCROLL_STATE_IDLE) { - c?.drawRoundRect(borderRectF, 2F.dp, 2F.dp, borderPaint) + c.drawRoundRect(borderRectF, 2F.dp, 2F.dp, borderPaint) } } diff --git a/app/src/main/java/me/rosuh/easywatermark/ui/widget/WaterMarkImageView.kt b/app/src/main/java/me/rosuh/easywatermark/ui/widget/WaterMarkImageView.kt index 386ee84a..b9122da1 100644 --- a/app/src/main/java/me/rosuh/easywatermark/ui/widget/WaterMarkImageView.kt +++ b/app/src/main/java/me/rosuh/easywatermark/ui/widget/WaterMarkImageView.kt @@ -280,7 +280,7 @@ class WaterMarkImageView : androidx.appcompat.widget.AppCompatImageView, Corouti Log.i("onSizeChanged", "$w, $h, $oldh, $oldh") } - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { super.onDraw(canvas) if (config?.text.isNullOrEmpty() || decodedUri.toString().isEmpty() diff --git a/app/src/main/res/drawable-xxhdpi/bg_avatar_dev.webp b/app/src/main/res/drawable-xxhdpi/bg_avatar_dev.webp index 758f961e..2405d651 100644 Binary files a/app/src/main/res/drawable-xxhdpi/bg_avatar_dev.webp and b/app/src/main/res/drawable-xxhdpi/bg_avatar_dev.webp differ diff --git a/baseBenchmarks/build.gradle.kts b/baseBenchmarks/build.gradle.kts index 019fbf62..5e25e18e 100644 --- a/baseBenchmarks/build.gradle.kts +++ b/baseBenchmarks/build.gradle.kts @@ -1,11 +1,12 @@ plugins { - id("com.android.library") - id("kotlin-android") + id(libs.plugins.android.library.get().pluginId) + id(libs.plugins.kotlin.android.get().pluginId) + id(libs.plugins.ksp.get().pluginId) } android { namespace = "me.rosuh.benchmark.macro.base" - compileSdk = 33 + compileSdk = 34 defaultConfig { minSdk = Apps.minSdk @@ -29,4 +30,6 @@ android { } } -dependencies {} \ No newline at end of file +dependencies { + implementation(libs.core.ktx) +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 5f3ce2ae..5c80e4d5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,45 +1,39 @@ buildscript { - repositories { - google() mavenCentral() - maven("https://jitpack.io") - maven("https://plugins.gradle.org/m2/") + google() + gradlePluginPortal() } + dependencies { - classpath("com.android.tools.build:gradle:8.1.0") - classpath(libs.kotlin.plugin) - classpath(libs.ktlint.gradle) - classpath(libs.dagger.hilt.plugin) - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + classpath(libs.agp) + classpath(libs.kotlin.gradlePlugin) + classpath(libs.hilt.plugin) } } -allprojects { - repositories { - google() - mavenCentral() - maven("https://jitpack.io") - } -} tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } -apply(plugin = "org.jlleitschuh.gradle.ktlint") - -subprojects { - apply(plugin = "org.jlleitschuh.gradle.ktlint") // Version should be inherited from parent +//apply(plugin = "org.jlleitschuh.gradle.ktlint") +// +//subprojects { +// apply(plugin = "org.jlleitschuh.gradle.ktlint") // Version should be inherited from parent +// +// repositories { +// // Required to download KtLint +// mavenCentral() +// } +// +// // Optionally configure plugin +// configure { +// debug.set(true) +// } +//} - repositories { - // Required to download KtLint - mavenCentral() - } - - // Optionally configure plugin - configure { - debug.set(true) - } +plugins { + alias(libs.plugins.hilt) apply false + alias(libs.plugins.ksp) apply false } diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 22f6d249..089ef419 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,5 +1,5 @@ object Apps { - const val compileSdk = 33 + const val compileSdk = 34 const val buildTools = "33.0.0" const val minSdk = 23 const val targetSdk = 33 diff --git a/cmonet/build.gradle.kts b/cmonet/build.gradle.kts index 1510a4b6..d4e66627 100644 --- a/cmonet/build.gradle.kts +++ b/cmonet/build.gradle.kts @@ -1,6 +1,7 @@ plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") + id(libs.plugins.android.library.get().pluginId) + id(libs.plugins.kotlin.android.get().pluginId) + id(libs.plugins.ksp.get().pluginId) } android { @@ -22,6 +23,7 @@ dependencies { implementation(libs.core.ktx) implementation(libs.appcompat) implementation(libs.material) + implementation(libs.core.ktx) testImplementation(libs.test.junit) androidTestImplementation(libs.test.ext.junit) androidTestImplementation(libs.test.espresso.core) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..27c455c9 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,146 @@ +[versions] +agp = "8.1.2" +kotlin = "1.9.10" +ksp = "1.9.10-1.0.13" +hilt = "2.48.1" +toolsGradle = "7.4.2" +ktlintGradle = "11.3.1" +androidxActivity = "1.8.0" +androidxConstraintLayoutCompose = "1.1.0-alpha13" +androidxNavigation = "2.7.4" +coroutines = "1.6.4" +fragmentKtx = "1.6.1" +activityKtx = "1.7.2" +lifecycle = "2.6.1" +lifecycleLiveData = "2.5.1" +lifecycleViewModel = "2.5.1" +coreKtx = "1.10.1" +appcompat = "1.6.0" +material = "1.8.0-rc01" +room = "2.5.2" +datastorePreference = "1.0.0" +asyncLayoutInflater = "1.0.0" +viewpager2 = "1.0.0" +recyclerview = "1.2.1" +constraintLayout = "2.1.4" +exifInterface = "1.3.5" +paletteKtx = "1.0.0" +glide = "4.14.2" +compressor = "3.0.1" +colorpicker = "2.2.3" +benchmark = "1.1.1" +profileinstaller = "1.3.1" +test = "1.4.0" +junit = "4.13.2" +espressoCore = "3.4.0" +uiautomator = "2.2.0" +extJunit = "1.1.4" +mockito = "4.0.0" +robolectric = "4.4" +hamcrest = "2.2" +androidxComposeBom = "2023.10.01" +androidxComposeCompiler = "1.5.3" +androidxComposeRuntimeTracing = "1.0.0-alpha04" +accompanist = "0.33.2-alpha" +coil = "2.4.0" +material3 = "1.2.0-alpha09" + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } +android-test = { id = "com.android.test", version.ref = "agp" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } +hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } +hilt-plugin = { id = "dagger.hilt.android.plugin", version.ref = "hilt" } + + + +[libraries] +agp = { module = "com.android.tools.build:gradle", version.ref = "agp" } +kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } +ksp = { module = "com.google.devtools.ksp:symbol-processing", version.ref = "ksp" } + + +androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } +androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" } +androidx-compose-foundation-layout = { group = "androidx.compose.foundation", name = "foundation-layout" } +androidx-compose-material-iconsExtended = { group = "androidx.compose.material", name = "material-icons-extended" } +androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" } +androidx-compose-material3-windowSizeClass = { group = "androidx.compose.material3", name = "material3-window-size-class" } +androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" } +androidx-compose-runtime-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata" } +androidx-compose-runtime-tracing = { group = "androidx.compose.runtime", name = "runtime-tracing", version.ref = "androidxComposeRuntimeTracing" } +androidx-compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4" } +androidx-compose-ui-ui = { group = "androidx.compose.ui", name = "ui" } +androidx-compose-ui-testManifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } +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-lifecycle-viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycle" } + +accompanist-permissions = { group = "com.google.accompanist", name = "accompanist-permissions", version.ref = "accompanist" } +accompanist-navigation-animation = { group = "com.google.accompanist", name = "accompanist-navigation-animation", version.ref = "accompanist" } +androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" } +androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" } +androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" } +androidx-constraintlayout-compose = { group = "androidx.constraintlayout", name = "constraintlayout-compose", version.ref = "androidxConstraintLayoutCompose" } +androidx-motionlayoout-compose = { group = "androidx.constraintlayout", name = "constraintlayout-compose", version.ref = "androidxConstraintLayoutCompose" } + + + + +coil-kt = { group = "io.coil-kt", name = "coil", version.ref = "coil" } +coil-kt-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" } +coil-kt-svg = { group = "io.coil-kt", name = "coil-svg", version.ref = "coil" } + +dagger-hilt-plugin = { group = "com.google.dagger", name = "hilt-android-gradle-plugin", version.ref = "hilt" } +tools-gradle = { group = "com.android.tools.build", name = "gradle", version.ref = "toolsGradle" } +kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } +ktlint-gradle = { group = "org.jlleitschuh.gradle", name = "ktlint-gradle", version.ref = "ktlintGradle" } +kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } +kotlin-coroutine-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" } +kotlin-coroutine-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" } +fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragmentKtx" } +activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activityKtx" } +lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" } +lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycleLiveData" } +lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycleViewModel" } +core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } +appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } +room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" } +room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" } +room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" } +datastore-preference = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "datastorePreference" } +asynclayout-inflater = { group = "androidx.asynclayoutinflater", name = "asynclayoutinflater", version.ref = "asyncLayoutInflater" } +viewpager2 = { group = "androidx.viewpager2", name = "viewpager2", version.ref = "viewpager2" } +recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" } +constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintLayout" } +exifinterface = { group = "androidx.exifinterface", name = "exifinterface", version.ref = "exifInterface" } +palette-ktx = { group = "androidx.palette", name = "palette-ktx", version.ref = "paletteKtx" } + +hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" } +hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" } +hilt-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" } +hilt-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" } + +glide = { group = "com.github.bumptech.glide", name = "glide", version.ref = "glide" } +glide-compiler = { group = "com.github.bumptech.glide", name = "compiler", version.ref = "glide" } +compressor = { group = "id.zelory", name = "compressor", version.ref = "compressor" } +colorpicker = { group = "com.github.skydoves", name = "colorpickerview", version.ref = "colorpicker" } +benchmark = { group = "androidx.benchmark", name = "benchmark-macro-junit4", version.ref = "benchmark" } +profileinstaller = { group = "androidx.profileinstaller", name = "profileinstaller", version.ref = "profileinstaller" } +test-core = { group = "androidx.test", name = "core", version.ref = "test" } +test-rules = { group = "androidx.test", name = "rules", version.ref = "test" } +test-runner = { group = "androidx.test", name = "runner", version.ref = "test" } +test-junit = { group = "junit", name = "junit", version.ref = "junit" } +test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } +test-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "uiautomator" } +test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "extJunit" } +mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" } +mockito-android = { group = "org.mockito", name = "mockito-android", version.ref = "mockito" } +robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" } +hamcrest-library = { group = "org.hamcrest", name = "hamcrest-library", version.ref = "hamcrest" } diff --git a/macrobenchmark/build.gradle.kts b/macrobenchmark/build.gradle.kts index da3cc0e1..25540770 100644 --- a/macrobenchmark/build.gradle.kts +++ b/macrobenchmark/build.gradle.kts @@ -1,14 +1,14 @@ import com.android.build.api.dsl.ManagedVirtualDevice plugins { - id("com.android.test") - id("kotlin-android") + id(libs.plugins.android.test.get().pluginId) + id(libs.plugins.kotlin.android.get().pluginId) } // [START macrobenchmark_setup_android] android { // [START_EXCLUDE] - compileSdk = 33 + compileSdk = 34 namespace = "me.rosuh.macrobenchmark" defaultConfig { @@ -45,6 +45,9 @@ android { // [END_EXCLUDE] } } + kotlin { + jvmToolchain(17) + } } // [END macrobenchmark_setup_android] @@ -64,4 +67,5 @@ dependencies { implementation(libs.test.espresso.core) implementation(libs.test.uiautomator) implementation(libs.kotlin.stdlib) + implementation(libs.core.ktx) } diff --git a/settings.gradle.kts b/settings.gradle.kts index fdb3770a..e7127dea 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,75 +1,93 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + maven(url = "https://oss.sonatype.org/content/repositories/snapshots/") + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + gradlePluginPortal() + maven(url = "https://oss.sonatype.org/content/repositories/snapshots/") + } +} + include(":app") include(":cmonet") include(":baseBenchmarks") include(":macrobenchmark") -dependencyResolutionManagement { - versionCatalogs { - create("libs") { - // plugins - val kotlinVersion = "1.8.22" - library("dagger-hilt-plugin", "com.google.dagger:hilt-android-gradle-plugin:2.44.2") - library("tools-gradle", "com.android.tools.build:gradle:7.4.2") - library("kotlin-plugin", "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") - library("ktlint-gradle", "org.jlleitschuh.gradle:ktlint-gradle:11.3.1") - - // kotlin libs - library("kotlin-stdlib", "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}") - library("kotlin-coroutine-android", "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") - library("kotlin-coroutine-core", "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") - - // android platforms libs - library("fragment-ktx", "androidx.fragment:fragment-ktx:1.6.1") - library("activity-ktx", "androidx.activity:activity-ktx:1.7.2") - library("lifecycle-runtime-ktx", "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1") - library("lifecycle-livedata-ktx", "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1") - library("lifecycle-viewModel-ktx", "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1") - library("core-ktx", "androidx.core:core-ktx:1.10.1") - library("appcompat", "androidx.appcompat:appcompat:1.6.0") - library("material", "com.google.android.material:material:1.8.0-rc01") - val roomVersion = "2.5.2" - library("room-runtime", "androidx.room:room-runtime:${roomVersion}") - library("room-ktx", "androidx.room:room-ktx:${roomVersion}") - library("room-compiler", "androidx.room:room-compiler:$roomVersion") - library("datastore-preference", "androidx.datastore:datastore-preferences:1.0.0") - library("asyncLayoutInflater", "androidx.asynclayoutinflater:asynclayoutinflater:1.0.0") - library("viewpager2", "androidx.viewpager2:viewpager2:1.0.0") - library("recyclerview", "androidx.recyclerview:recyclerview:1.2.1") - library("constraintLayout", "androidx.constraintlayout:constraintlayout:2.1.4") - library("exifInterface", "androidx.exifinterface:exifinterface:1.3.5") - library("palette-ktx", "androidx.palette:palette-ktx:1.0.0") - - // third party libs - val daggerVersion = "2.44.2" - library("dagger-hilt-android", "com.google.dagger:hilt-android:${daggerVersion}") - library("dagger-hilt-compiler", "com.google.dagger:hilt-compiler:${daggerVersion}") - - val glideVersion = "4.14.2" - library("glide-glide", "com.github.bumptech.glide:glide:${glideVersion}") - library("glide-compiler", "com.github.bumptech.glide:compiler:${glideVersion}") - - library("compressor", "id.zelory:compressor:3.0.1") - library("colorpicker", "com.github.skydoves:colorpickerview:2.2.3") - - - // benchmark && test libs - library("benchmark", "androidx.benchmark:benchmark-macro-junit4:1.1.1") - library("profieinstaller", "androidx.profileinstaller:profileinstaller:1.3.1") - - val testVersion = "1.4.0" - library("test-core", "androidx.test:core:${testVersion}") - library("test-rules", "androidx.test:rules:${testVersion}") - library("test-runner", "androidx.test:runner:${testVersion}") - - library("test-junit", "junit:junit:4.13.2") - library("test-espresso-core", "androidx.test.espresso:espresso-core:3.4.0") - library("test-uiautomator", "androidx.test.uiautomator:uiautomator:2.2.0") - library("test-ext-junit", "androidx.test.ext:junit:1.1.4") - library("mockito-core", "org.mockito:mockito-core:4.0.0") - library("mockito-android", "org.mockito:mockito-android:4.0.0") - library("robolectric", "org.robolectric:robolectric:4.4") - library("hamcrest-library", "org.hamcrest:hamcrest-library:2.2") - } - } -} +//dependencyResolutionManagement { +// versionCatalogs { +// create("libs") { +// // plugins +// val kotlinVersion = "1.9.20" +// library("dagger-hilt-plugin", "com.google.dagger:hilt-android-gradle-plugin:2.44.2") +// library("tools-gradle", "com.android.tools.build:gradle:7.4.2") +// library("kotlin-plugin", "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") +// library("ktlint-gradle", "org.jlleitschuh.gradle:ktlint-gradle:11.3.1") +// +// // kotlin libs +// library("kotlin-stdlib", "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}") +// library("kotlin-coroutine-android", "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") +// library("kotlin-coroutine-core", "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") +// +// // android platforms libs +// library("fragment-ktx", "androidx.fragment:fragment-ktx:1.6.1") +// library("activity-ktx", "androidx.activity:activity-ktx:1.7.2") +// library("lifecycle-runtime-ktx", "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1") +// library("lifecycle-livedata-ktx", "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1") +// library("lifecycle-viewModel-ktx", "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1") +// library("core-ktx", "androidx.core:core-ktx:1.10.1") +// library("appcompat", "androidx.appcompat:appcompat:1.6.0") +// library("material", "com.google.android.material:material:1.8.0-rc01") +// val roomVersion = "2.5.2" +// library("room-runtime", "androidx.room:room-runtime:${roomVersion}") +// library("room-ktx", "androidx.room:room-ktx:${roomVersion}") +// library("room-compiler", "androidx.room:room-compiler:$roomVersion") +// library("datastore-preference", "androidx.datastore:datastore-preferences:1.0.0") +// library("asyncLayoutInflater", "androidx.asynclayoutinflater:asynclayoutinflater:1.0.0") +// library("viewpager2", "androidx.viewpager2:viewpager2:1.0.0") +// library("recyclerview", "androidx.recyclerview:recyclerview:1.2.1") +// library("constraintLayout", "androidx.constraintlayout:constraintlayout:2.1.4") +// library("exifInterface", "androidx.exifinterface:exifinterface:1.3.5") +// library("palette-ktx", "androidx.palette:palette-ktx:1.0.0") +// +// // third party libs +// val daggerVersion = "2.44.2" +// library("dagger-hilt-android", "com.google.dagger:hilt-android:${daggerVersion}") +// library("dagger-hilt-compiler", "com.google.dagger:hilt-compiler:${daggerVersion}") +// +// val glideVersion = "4.14.2" +// library("glide-glide", "com.github.bumptech.glide:glide:${glideVersion}") +// library("glide-compiler", "com.github.bumptech.glide:compiler:${glideVersion}") +// +// library("compressor", "id.zelory:compressor:3.0.1") +// library("colorpicker", "com.github.skydoves:colorpickerview:2.2.3") +// +// +// // benchmark && test libs +// library("benchmark", "androidx.benchmark:benchmark-macro-junit4:1.1.1") +// library("profieinstaller", "androidx.profileinstaller:profileinstaller:1.3.1") +// +// val testVersion = "1.4.0" +// library("test-core", "androidx.test:core:${testVersion}") +// library("test-rules", "androidx.test:rules:${testVersion}") +// library("test-runner", "androidx.test:runner:${testVersion}") +// +// library("test-junit", "junit:junit:4.13.2") +// library("test-espresso-core", "androidx.test.espresso:espresso-core:3.4.0") +// library("test-uiautomator", "androidx.test.uiautomator:uiautomator:2.2.0") +// library("test-ext-junit", "androidx.test.ext:junit:1.1.4") +// library("mockito-core", "org.mockito:mockito-core:4.0.0") +// library("mockito-android", "org.mockito:mockito-android:4.0.0") +// library("robolectric", "org.robolectric:robolectric:4.4") +// library("hamcrest-library", "org.hamcrest:hamcrest-library:2.2") +// } +// } +//}