Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert the main :app subproject to use Declarative Gradle #33

Merged
merged 7 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions app-nia-catalog/build.gradle.dcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ androidApplication {
versionCode = 1
versionName = "0.0.1" // X.Y.Z; X = Major, Y = minor, Z = Patch level

// The UI catalog does not depend on content from the app, however, it depends on modules
// which do, so we must specify a default value for the contentType dimension.
missingDimensionStrategy {
name = "contentType"
value = "demo"
}

// TODO: DG
// packaging {
// resources {
// excludes.add("/META-INF/{AL2.0,LGPL2.1}")
// }
// }

dependencies {
implementation("androidx.activity:activity-compose:1.8.0")

Expand Down
157 changes: 157 additions & 0 deletions app/build.gradle.dcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
androidApplication {
namespace = "com.google.samples.apps.nowinandroid"

applicationId = "com.google.samples.apps.nowinandroid"
versionCode = 8
versionName = "0.1.2" // X.Y.Z; X = Major, Y = minor, Z = Patch level
vectorDrawablesUseSupportLibrary = true

dependencies {
implementation(project(":feature:interests"))
implementation(project(":feature:foryou"))
implementation(project(":feature:bookmarks"))
implementation(project(":feature:topic"))
implementation(project(":feature:search"))
implementation(project(":feature:settings"))

implementation(project(":core:common"))
implementation(project(":core:ui"))
implementation(project(":core:designsystem"))
implementation(project(":core:data"))
implementation(project(":core:model"))
implementation(project(":core:analytics"))
implementation(project(":sync:work"))

implementation("androidx.activity:activity-compose:1.8.0")
implementation("androidx.compose.material3.adaptive:adaptive:1.0.0-alpha10")
implementation("androidx.compose.material3.adaptive:adaptive-layout:1.0.0-alpha10")
implementation("androidx.compose.material3.adaptive:adaptive-navigation:1.0.0-alpha10")
implementation("androidx.compose.material3:material3-window-size-class")
implementation("androidx.compose.runtime:runtime-tracing:1.0.0-beta01")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.core:core-splashscreen:1.0.1")
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0")
implementation("androidx.navigation:navigation-compose:2.7.4")
implementation("androidx.profileinstaller:profileinstaller:1.3.1")
implementation("androidx.window:window-core:1.3.0-alpha03")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.8.0")
implementation("io.coil-kt:coil:2.6.0")
}

compose {}
hilt {}
flavors {}
licenses {}

firebase {
version = "32.4.0"

// Disable the Crashlytics mapping file upload. This feature should only be
// enabled if a Firebase backend is available and configured in
// google-services.json.
mappingFileUploadEnabled = false
}

baselineProfile {
// Don't build on every iteration of a full assemble.
// Instead enable generation directly for the release build variant.
automaticGenerationDuringBuild = false

dependencies {
profile(project(":benchmarks"))
}
}

dependencyGuard {
configurationName = "prodReleaseRuntimeClasspath"
}

buildTypes {
debug {
applicationIdSuffix = ".debug"

dependencies {
implementation("androidx.compose.ui:ui-test-manifest")
implementation(project(":ui-test-hilt-manifest"))
}
}

release {
// TODO:DG doesn't support setting this to null
// Is there any need to explicitly set this to null?
// applicationIdSuffix = null

minify {
enabled = true
}

defaultProguardFile {
name = "proguard-android-optimize.txt"
}
proguardFile {
name = "proguard-rules.pro"
}

// TODO:DG - Skiping converting signing for now
// To publish on the Play store a private signing key is required, but to allow anyone
// who clones the code to sign and run the release variant, use the debug signing key.
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
// signingConfig = signingConfigs.named("debug")).get()

baselineProfile {
// Ensure Baseline Profile is fresh for release builds.
automaticGenerationDuringBuild = true
}

// TODO:DG - Why is this necessary? Without it :app:compileDemoReleaseUnitTestKotlin
// Can't find deps from the ui-test-hilt-manifest project. But nowhere in the original
// build were those deps added, except to debugImplementation. What is the configuration
// hierarchy in NiA, does the configuration used for this RELEASE compilation classpath
// somehow extend the DEBUG compilation classpath?
dependencies {
implementation("androidx.compose.ui:ui-test-manifest")
implementation(project(":ui-test-hilt-manifest"))
}
}
}

testing {
dependencies {
implementation(project(":core:data-test"))
implementation(project(":core:testing"))
implementation(project(":sync:sync-test"))
implementation("androidx.compose.ui:ui-test-junit4:1.7.0-alpha06")
implementation("com.google.dagger:hilt-android-testing:2.51")
implementation("androidx.work:work-testing:2.9.0")

// TODO:DG - These were originally only dependencies of testDemoImplementation, but we haven't modeled Product Flavors yet
implementation("org.robolectric:robolectric:4.11.1")
implementation("io.github.takahirom.roborazzi:roborazzi:1.7.0")
implementation(project(":core:screenshot-testing"))

androidImplementation(project(":core:testing"))
androidImplementation(project(":core:data-test"))
androidImplementation(project(":core:datastore-test"))
androidImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidImplementation("androidx.navigation:navigation-testing:2.7.4")
androidImplementation("androidx.compose.ui:ui-test-junit4:1.7.0-alpha06")
androidImplementation("com.google.dagger:hilt-android-testing:2.51")
}

testOptions {
// TODO:DG - This was only for unit tests, we need to model different types of tests
includeAndroidResources = true
}

jacoco {}
roborazzi {}
}

// TODO:DG - Packaging
// packaging {
// resources {
// excludes.add("/META-INF/{AL2.0,LGPL2.1}")
// }
// }
}
6 changes: 3 additions & 3 deletions app/build.gradle.kts → app/build.gradle.kts.OLD
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {

// Custom test runner to set up Hilt dependency graph
testInstrumentationRunner = "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner"
vectorDrawables {
vectorDrawables { // TODO:DG
useSupportLibrary = true
}
}
Expand All @@ -52,13 +52,13 @@ android {
// To publish on the Play store a private signing key is required, but to allow anyone
// who clones the code to sign and run the release variant, use the debug signing key.
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
signingConfig = signingConfigs.named("debug").get()
signingConfig = signingConfigs.named("debug").get() // TODO:DG
// Ensure Baseline Profile is fresh for release builds.
baselineProfile.automaticGenerationDuringBuild = true
}
}

packaging {
packaging { // TODO:DG
resources {
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
}
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,18 @@ work-testing = { group = "androidx.work", name = "work-testing", version = "2.9.
android-application = { id = "com.android.application" }
android-library = { id = "com.android.library" }
android-test = { id = "com.android.test" }
baselineprofile = { id = "androidx.baselineprofile", version.ref = "androidxMacroBenchmark"}
baselineprofile = { id = "androidx.baselineprofile" }
dependencyGuard = { id = "com.dropbox.dependency-guard" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlyticsPlugin" }
firebase-perf = { id = "com.google.firebase.firebase-perf", version.ref = "firebasePerfPlugin" }
gms = { id = "com.google.gms.google-services", version.ref = "gmsPlugin" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics" }
firebase-perf = { id = "com.google.firebase.firebase-perf" }
gms = { id = "com.google.gms.google-services" }
hilt = { id = "com.google.dagger.hilt.android" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization" }
ksp = { id = "com.google.devtools.ksp" }
module-graph = { id = "com.jraska.module.graph.assertion", version.ref = "moduleGraph" }
protobuf = { id = "com.google.protobuf" }
roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" }
roborazzi = { id = "io.github.takahirom.roborazzi" }
room = { id = "androidx.room" }
secrets = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secrets" }

Expand Down
Loading