Skip to content
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
java-version: '21'
distribution: 'temurin'

# lintAll gates :proguard-tests, which applies the google-services plugin and
# will not configure without this file. Mirrors what scripts/build.sh copies.
# lintAll gates :app and :proguard-tests, both of which apply the google-services
# plugin and will not configure without this file. Mirrors what build.sh copies.
- name: Copy google-services.json
run: |
cp library/google-services.json app/google-services.json
Expand Down
32 changes: 32 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,38 @@ android {
}
}
}

lint {
// Common lint options across all modules
disable += mutableSetOf(
"IconExpectedSize",
"InvalidPackage", // Firestore uses GRPC which makes lint mad
"NewerVersionAvailable", "GradleDependency", // For reproducible builds
"SelectableText", "SyntheticAccessor" // We almost never care about this
)
Comment on lines +43 to +50

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The common lint options are duplicated across multiple modules (e.g., :app and :e2eTest). This violates the DRY (Don't Repeat Yourself) principle and increases maintenance overhead when adding or removing global lint rules. Consider centralizing these common lint options in the root build.gradle.kts file using subprojects or by creating a custom Gradle convention plugin.


// Module specific
disable += mutableSetOf(
// Reads the root wrapper, but only the application module analyses it, so it
// cannot sit in the common set above. For reproducible builds.
"AndroidGradlePluginVersion",
// The demos log their auth callbacks unconditionally on purpose — watching
// logcat is how you see one fire. Same call as :auth.
"LogConditional",
// Glide's KSP processor does not generate GlideApp, which the storage demo and
// storage/README.md are both written around. Migration tracked separately.
"KaptUsageInsteadOfKsp",
// A themed icon needs a flat silhouette drawn for the purpose. The only
// candidate here is ic_launcher_foreground, whose opaque region is a solid
// plate, so it tints to a featureless block — worse than no monochrome layer.
"MonochromeLauncherIcon"
)

checkAllWarnings = true
warningsAsErrors = true
abortOnError = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@
android:usesCleartextTraffic="true">
<activity
android:name="com.firebaseui.android.demo.MainActivity"
android:label="@string/app_name"
android:exported="true"
android:theme="@style/Theme.FirebaseUIAndroid">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<intent-filter android:autoVerify="true">
<!--
The host is a placeholder the demo's own Firebase project fills in, so lint
can neither read it as a domain nor resolve it over the network.
-->
<intent-filter
android:autoVerify="true"
tools:ignore="AppLinkUrlError,AppLinksAutoVerify">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.firebase.ui.database.paging.DatabasePagingOptions
import com.firebase.ui.database.paging.FirebaseRecyclerPagingAdapter
import com.firebaseui.android.demo.R
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.DatabaseReference
import com.google.firebase.database.FirebaseDatabase
Expand Down Expand Up @@ -122,7 +123,8 @@ class ScoreAdapter(options: DatabasePagingOptions<ScoreItem>) :
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ScoreViewHolder(parent)

override fun onBindViewHolder(holder: ScoreViewHolder, position: Int, model: ScoreItem) {
(holder.itemView as TextView).text = "${model.name} — score: ${model.score}"
val row = holder.itemView as TextView
row.text = row.context.getString(R.string.demo_score_row, model.name, model.score)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.firebase.ui.firestore.paging.FirestorePagingAdapter
import com.firebase.ui.firestore.paging.FirestorePagingOptions
import com.firebaseui.android.demo.R
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.CollectionReference
import com.google.firebase.firestore.FirebaseFirestore
Expand Down Expand Up @@ -129,7 +130,8 @@ class ScoreAdapter(options: FirestorePagingOptions<ScoreItem>) :
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ScoreViewHolder(parent)

override fun onBindViewHolder(holder: ScoreViewHolder, position: Int, model: ScoreItem) {
(holder.itemView as TextView).text = "${model.name} — score: ${model.score}"
val row = holder.itemView as TextView
row.text = row.context.getString(R.string.demo_score_row, model.name, model.score)
}
}

Expand Down
Binary file removed app/src/main/res/drawable-hdpi/firebase_auth.png
Binary file not shown.
Binary file added app/src/main/res/drawable-hdpi/firebase_auth.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-mdpi/firebase_auth.png
Binary file not shown.
Binary file added app/src/main/res/drawable-mdpi/firebase_auth.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 0 additions & 30 deletions app/src/main/res/drawable-v24/ic_launcher_foreground.xml

This file was deleted.

Binary file removed app/src/main/res/drawable-xhdpi/firebase_auth.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-xxhdpi/firebase_auth.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-xxxhdpi/firebase_auth.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
170 changes: 0 additions & 170 deletions app/src/main/res/drawable/ic_launcher_background.xml

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/res/values/colors.xml

This file was deleted.

21 changes: 15 additions & 6 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name">FirebaseUI Demo</string>

<string name="firebase_web_host" translatable="false">CHANGE-HERE</string>

<!-- Facebook SDK Configuration -->
<string name="facebook_application_id" translatable="false">APP-ID</string>
<string name="facebook_login_protocol_scheme" translatable="false">fbAPP-ID</string>
<string name="facebook_client_token" translatable="false">CHANGE-HERE</string>
</resources>
<!-- One row of the paging demos: %1$s is the player name, %2$d their score. -->
<string name="demo_score_row">%1$s — score: %2$d</string>

<!--
The Facebook SDK reads these through the auth module's manifest and provider
validation, so lint cannot see them being used from this module.
-->
<string name="facebook_application_id" translatable="false"
tools:ignore="UnusedResources">APP-ID</string>
<string name="facebook_login_protocol_scheme" translatable="false"
tools:ignore="UnusedResources">fbAPP-ID</string>
<string name="facebook_client_token" translatable="false"
tools:ignore="UnusedResources">CHANGE-HERE</string>
</resources>
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ tasks.register("lintAll") {
description = "Runs Android Lint for every module that configures a lint { } block."

dependsOn(
":app:lintDebug",
":auth:lintDebug",
":common:lintDebug",
":database:lintDebug",
":e2eTest:lintDebug",
":firestore:lintDebug",
":library:lintDebug",
":storage:lintDebug",
Expand Down
14 changes: 14 additions & 0 deletions e2eTest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ android {
minSdk = Config.SdkVersions.min
}

lint {
// Common lint options across all modules
disable += mutableSetOf(
"IconExpectedSize",
"InvalidPackage", // Firestore uses GRPC which makes lint mad
"NewerVersionAvailable", "GradleDependency", // For reproducible builds
"SelectableText", "SyntheticAccessor" // We almost never care about this
)
Comment on lines +17 to +24

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The common lint options are duplicated across multiple modules (e.g., :app and :e2eTest). This violates the DRY (Don't Repeat Yourself) principle and increases maintenance overhead when adding or removing global lint rules. Consider centralizing these common lint options in the root build.gradle.kts file using subprojects or by creating a custom Gradle convention plugin.


checkAllWarnings = true
warningsAsErrors = true
abortOnError = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
2 changes: 1 addition & 1 deletion okf-bundle/ci-workflows/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Step 4 is **Java-only** (`include("**/*.java")`), so it inspects zero files in t

Separate workflow, `pull_request` only, running `./gradlew --max-workers=2 lintAll`.

`lintAll` is registered in the root `build.gradle.kts` and gates the 8 modules that configure a `lint { }` block; `:app` and `:e2eTest` are not yet among them (CPRN-433).
`lintAll` is registered in the root `build.gradle.kts` and gates all 10 modules that configure a `lint { }` block.

It is a separate workflow rather than a step in `build.sh` for two reasons. Lint measured **~4-5 minutes** on this repo — the `build` job went from 3-6 min to 8-11 min when it was inline — so running it in parallel roughly halves PR feedback time at about the same total runner cost, since the extra compile the lint job pays is the one `build.sh` stops paying (`lintAnalyze` depends on `compileDebugKotlin`, and there is no remote build cache: Develocity here is configured for build scans only). And under `set -e` an inline lint failure aborted the run **before** `testDebugUnitTest`, so one new finding cost you every test result for that run.

Expand Down
Loading