Enhance: Bind extension to product flavor for robust type safety #1848
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Description
This pull request includes two commits aimed at improving the codebase:
1. Enhance: Bind extension to product flavor for robust type safety
What Changed:
Refactored flavor configuration in NiaFlavor.kt by eliminating runtime type checks for
ApplicationExtension
andApplicationProductFlavor
. The new implementation leverages generics to explicitly bind the extension (E) to the product flavor (F), ensuring that configuration is unambiguous and type-safe at compile time.Why:
This change removes unnecessary runtime checks and enhances compile-time safety.
2. Enhance: Enforce consistent formatting with Spotless plugin
What Changed:
Ran the Spotless plugin across the codebase to ensure that all code adheres to the established style guidelines. This commit is purely a formatting cleanup and does not affect functionality.
Why:
Consistent formatting improves code readability and maintainability, reinforcing the commitment to a clean and uniform codebase through the
build-logic
Gradle module.Testing and Verification (CD into
build-logic
Directory)Local Tests:
Verified changes by running tests on the
DemoDebug
variant using the command:../gradlew build
.Formatting:
Applied code formatting using the command:
../gradlew --init-script ../gradle/init.gradle.kts spotlessApply
.Additional Context
This pull request is designed to strengthen type safety and clarity in the flavor configuration while also ensuring consistent code formatting throughout the
build-logic
Gradle module. Together, these changes contribute to a more robust and maintainable codebase.