Merge pull request #923 from SimonMarquis/jvm-alt

Prep work for JVM alternatives to modules/plugins
jdk/fake_window_metrics
Don Turner 5 months ago committed by GitHub
commit 08305c4a52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -20,8 +20,8 @@ plugins {
alias(libs.plugins.nowinandroid.android.application.compose) alias(libs.plugins.nowinandroid.android.application.compose)
alias(libs.plugins.nowinandroid.android.application.flavors) alias(libs.plugins.nowinandroid.android.application.flavors)
alias(libs.plugins.nowinandroid.android.application.jacoco) alias(libs.plugins.nowinandroid.android.application.jacoco)
alias(libs.plugins.nowinandroid.android.hilt)
alias(libs.plugins.nowinandroid.android.application.firebase) alias(libs.plugins.nowinandroid.android.application.firebase)
alias(libs.plugins.nowinandroid.hilt)
id("com.google.android.gms.oss-licenses-plugin") id("com.google.android.gms.oss-licenses-plugin")
alias(libs.plugins.baselineprofile) alias(libs.plugins.baselineprofile)
alias(libs.plugins.roborazzi) alias(libs.plugins.roborazzi)

@ -89,9 +89,9 @@ gradlePlugin {
id = "nowinandroid.android.test" id = "nowinandroid.android.test"
implementationClass = "AndroidTestConventionPlugin" implementationClass = "AndroidTestConventionPlugin"
} }
register("androidHilt") { register("hilt") {
id = "nowinandroid.android.hilt" id = "nowinandroid.hilt"
implementationClass = "AndroidHiltConventionPlugin" implementationClass = "HiltConventionPlugin"
} }
register("androidRoom") { register("androidRoom") {
id = "nowinandroid.android.room" id = "nowinandroid.android.room"

@ -27,7 +27,7 @@ class AndroidFeatureConventionPlugin : Plugin<Project> {
with(target) { with(target) {
pluginManager.apply { pluginManager.apply {
apply("nowinandroid.android.library") apply("nowinandroid.android.library")
apply("nowinandroid.android.hilt") apply("nowinandroid.hilt")
} }
extensions.configure<LibraryExtension> { extensions.configure<LibraryExtension> {
testOptions.animationsDisabled = true testOptions.animationsDisabled = true

@ -1,5 +1,5 @@
/* /*
* Copyright 2022 The Android Open Source Project * Copyright 2023 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,25 +14,28 @@
* limitations under the License. * limitations under the License.
*/ */
import com.android.build.gradle.api.AndroidBasePlugin
import com.google.samples.apps.nowinandroid.libs import com.google.samples.apps.nowinandroid.libs
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.dependencies
class AndroidHiltConventionPlugin : Plugin<Project> { class HiltConventionPlugin : Plugin<Project> {
override fun apply(target: Project) { override fun apply(target: Project) {
with(target) { with(target) {
with(pluginManager) { pluginManager.apply("com.google.devtools.ksp")
apply("com.google.devtools.ksp")
apply("dagger.hilt.android.plugin")
}
dependencies { dependencies {
"implementation"(libs.findLibrary("hilt.android").get()) add("ksp", libs.findLibrary("hilt.compiler").get())
"ksp"(libs.findLibrary("hilt.compiler").get()) add("implementation", libs.findLibrary("hilt.core").get())
} }
/** Add support for Android modules, based on [AndroidBasePlugin] */
pluginManager.withPlugin("com.android.base") {
pluginManager.apply("dagger.hilt.android.plugin")
dependencies {
add("implementation", libs.findLibrary("hilt.android").get())
}
}
} }
} }
} }

@ -16,7 +16,7 @@
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.library.compose) alias(libs.plugins.nowinandroid.android.library.compose)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {

@ -14,16 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.jvm.library)
alias(libs.plugins.nowinandroid.android.library.jacoco) alias(libs.plugins.nowinandroid.hilt)
alias(libs.plugins.nowinandroid.android.hilt)
}
android {
namespace = "com.google.samples.apps.nowinandroid.core.common"
} }
dependencies { dependencies {
implementation(libs.kotlinx.coroutines.core)
testImplementation(libs.kotlinx.coroutines.test) testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.turbine) testImplementation(libs.turbine)
} }

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2022 The Android Open Source Project
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
http://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.
-->
<manifest />

@ -15,7 +15,7 @@
*/ */
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {

@ -16,7 +16,7 @@
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.library.jacoco) alias(libs.plugins.nowinandroid.android.library.jacoco)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
id("kotlinx-serialization") id("kotlinx-serialization")
} }

@ -17,8 +17,8 @@
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.library.jacoco) alias(libs.plugins.nowinandroid.android.library.jacoco)
alias(libs.plugins.nowinandroid.android.hilt)
alias(libs.plugins.nowinandroid.android.room) alias(libs.plugins.nowinandroid.android.room)
alias(libs.plugins.nowinandroid.hilt)
} }
android { android {

@ -15,7 +15,7 @@
*/ */
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {

@ -17,7 +17,7 @@
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.library.jacoco) alias(libs.plugins.nowinandroid.android.library.jacoco)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {
@ -33,7 +33,7 @@ android {
} }
dependencies { dependencies {
api(libs.androidx.dataStore.core) api(libs.androidx.dataStore)
api(projects.core.datastoreProto) api(projects.core.datastoreProto)
api(projects.core.model) api(projects.core.model)

@ -17,7 +17,7 @@
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.library.jacoco) alias(libs.plugins.nowinandroid.android.library.jacoco)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
id("kotlinx-serialization") id("kotlinx-serialization")
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
} }

@ -15,7 +15,7 @@
*/ */
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {
@ -28,5 +28,4 @@ dependencies {
implementation(projects.core.common) implementation(projects.core.common)
compileOnly(platform(libs.androidx.compose.bom)) compileOnly(platform(libs.androidx.compose.bom))
compileOnly(libs.androidx.compose.runtime)
} }

@ -65,9 +65,7 @@ internal class SystemTrayNotifier @Inject constructor(
val newsNotifications = truncatedNewsResources.map { newsResource -> val newsNotifications = truncatedNewsResources.map { newsResource ->
createNewsNotification { createNewsNotification {
setSmallIcon( setSmallIcon(R.drawable.core_notifications_ic_nia_notification)
com.google.samples.apps.nowinandroid.core.common.R.drawable.core_common_ic_nia_notification,
)
.setContentTitle(newsResource.title) .setContentTitle(newsResource.title)
.setContentText(newsResource.content) .setContentText(newsResource.content)
.setContentIntent(newsPendingIntent(newsResource)) .setContentIntent(newsPendingIntent(newsResource))
@ -82,9 +80,7 @@ internal class SystemTrayNotifier @Inject constructor(
) )
setContentTitle(title) setContentTitle(title)
.setContentText(title) .setContentText(title)
.setSmallIcon( .setSmallIcon(R.drawable.core_notifications_ic_nia_notification)
com.google.samples.apps.nowinandroid.core.common.R.drawable.core_common_ic_nia_notification,
)
// Build summary info into InboxStyle template. // Build summary info into InboxStyle template.
.setStyle(newsNotificationStyle(truncatedNewsResources, title)) .setStyle(newsNotificationStyle(truncatedNewsResources, title))
.setGroup(NEWS_NOTIFICATION_GROUP) .setGroup(NEWS_NOTIFICATION_GROUP)

@ -16,7 +16,7 @@
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.library.compose) alias(libs.plugins.nowinandroid.android.library.compose)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {

@ -15,7 +15,7 @@
*/ */
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {

@ -89,7 +89,8 @@ androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "u
androidx-compose-ui-util = { group = "androidx.compose.ui", name = "ui-util" } androidx-compose-ui-util = { group = "androidx.compose.ui", name = "ui-util" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" }
androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidxCoreSplashscreen" } androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidxCoreSplashscreen" }
androidx-dataStore-core = { group = "androidx.datastore", name = "datastore", version.ref = "androidxDataStore" } androidx-dataStore = { group = "androidx.datastore", name = "datastore", version.ref = "androidxDataStore" }
androidx-dataStore-core = { group = "androidx.datastore", name = "datastore-core", version.ref = "androidxDataStore" }
androidx-hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "androidxHiltNavigationCompose" } androidx-hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "androidxHiltNavigationCompose" }
androidx-lifecycle-runtimeCompose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidxLifecycle" } androidx-lifecycle-runtimeCompose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidxLifecycle" }
androidx-lifecycle-runtimeTesting = { group = "androidx.lifecycle", name = "lifecycle-runtime-testing", version.ref = "androidxLifecycle" } androidx-lifecycle-runtimeTesting = { group = "androidx.lifecycle", name = "lifecycle-runtime-testing", version.ref = "androidxLifecycle" }
@ -121,11 +122,14 @@ google-oss-licenses = { group = "com.google.android.gms", name = "play-services-
google-oss-licenses-plugin = { group = "com.google.android.gms", name = "oss-licenses-plugin", version.ref = "googleOssPlugin" } google-oss-licenses-plugin = { group = "com.google.android.gms", name = "oss-licenses-plugin", version.ref = "googleOssPlugin" }
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" }
hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" }
hilt-core = { group = "com.google.dagger", name = "hilt-core", version.ref = "hilt" }
hilt-ext-compiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hiltExt" } hilt-ext-compiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hiltExt" }
hilt-ext-work = { group = "androidx.hilt", name = "hilt-work", version.ref = "hiltExt" } hilt-ext-work = { group = "androidx.hilt", name = "hilt-work", version.ref = "hiltExt" }
javax-inject = { module = "javax.inject:javax.inject", version = "1" } javax-inject = { module = "javax.inject:javax.inject", version = "1" }
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" } kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" }
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" }
kotlinx-coroutines-guava = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-guava", version.ref = "kotlinxCoroutines" } kotlinx-coroutines-guava = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-guava", version.ref = "kotlinxCoroutines" }
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" } kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime" } kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime" }
@ -183,11 +187,11 @@ nowinandroid-android-application-firebase = { id = "nowinandroid.android.applica
nowinandroid-android-application-flavors = { id = "nowinandroid.android.application.flavors", version = "unspecified" } nowinandroid-android-application-flavors = { id = "nowinandroid.android.application.flavors", version = "unspecified" }
nowinandroid-android-application-jacoco = { id = "nowinandroid.android.application.jacoco", version = "unspecified" } nowinandroid-android-application-jacoco = { id = "nowinandroid.android.application.jacoco", version = "unspecified" }
nowinandroid-android-feature = { id = "nowinandroid.android.feature", version = "unspecified" } nowinandroid-android-feature = { id = "nowinandroid.android.feature", version = "unspecified" }
nowinandroid-android-hilt = { id = "nowinandroid.android.hilt", version = "unspecified" }
nowinandroid-android-library = { id = "nowinandroid.android.library", version = "unspecified" } nowinandroid-android-library = { id = "nowinandroid.android.library", version = "unspecified" }
nowinandroid-android-library-compose = { id = "nowinandroid.android.library.compose", version = "unspecified" } nowinandroid-android-library-compose = { id = "nowinandroid.android.library.compose", version = "unspecified" }
nowinandroid-android-library-jacoco = { id = "nowinandroid.android.library.jacoco", version = "unspecified" } nowinandroid-android-library-jacoco = { id = "nowinandroid.android.library.jacoco", version = "unspecified" }
nowinandroid-android-lint = { id = "nowinandroid.android.lint", version = "unspecified" } nowinandroid-android-lint = { id = "nowinandroid.android.lint", version = "unspecified" }
nowinandroid-android-room = { id = "nowinandroid.android.room", version = "unspecified" } nowinandroid-android-room = { id = "nowinandroid.android.room", version = "unspecified" }
nowinandroid-android-test = { id = "nowinandroid.android.test", version = "unspecified" } nowinandroid-android-test = { id = "nowinandroid.android.test", version = "unspecified" }
nowinandroid-hilt = { id = "nowinandroid.hilt", version = "unspecified" }
nowinandroid-jvm-library = { id = "nowinandroid.jvm.library", version = "unspecified" } nowinandroid-jvm-library = { id = "nowinandroid.jvm.library", version = "unspecified" }

@ -15,7 +15,7 @@
*/ */
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {

@ -16,7 +16,7 @@
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.library.jacoco) alias(libs.plugins.nowinandroid.android.library.jacoco)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {
@ -34,6 +34,7 @@ dependencies {
implementation(libs.hilt.ext.work) implementation(libs.hilt.ext.work)
implementation(projects.core.analytics) implementation(projects.core.analytics)
implementation(projects.core.data) implementation(projects.core.data)
implementation(projects.core.notifications)
prodImplementation(libs.firebase.cloud.messaging) prodImplementation(libs.firebase.cloud.messaging)
prodImplementation(platform(libs.firebase.bom)) prodImplementation(platform(libs.firebase.bom))

@ -71,7 +71,7 @@ private fun Context.syncWorkNotification(): Notification {
SYNC_NOTIFICATION_CHANNEL_ID, SYNC_NOTIFICATION_CHANNEL_ID,
) )
.setSmallIcon( .setSmallIcon(
com.google.samples.apps.nowinandroid.core.common.R.drawable.core_common_ic_nia_notification, com.google.samples.apps.nowinandroid.core.notifications.R.drawable.core_notifications_ic_nia_notification,
) )
.setContentTitle(getString(R.string.sync_work_notification_title)) .setContentTitle(getString(R.string.sync_work_notification_title))
.setPriority(NotificationCompat.PRIORITY_DEFAULT) .setPriority(NotificationCompat.PRIORITY_DEFAULT)

@ -15,7 +15,7 @@
*/ */
plugins { plugins {
alias(libs.plugins.nowinandroid.android.library) alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.hilt) alias(libs.plugins.nowinandroid.hilt)
} }
android { android {

Loading…
Cancel
Save