prepare/release#7
Conversation
This commit enables Proguard for release builds in both the `app` and `triggerx` modules and updates the toast message in `HomeScreen.kt`.
Key changes:
- **app/build.gradle.kts**:
- Set `isMinifyEnabled` to `true` for release builds.
- Added `signingConfig = signingConfigs.getByName("debug")` to release build type for now.
- **triggerx/build.gradle.kts**:
- Set `isMinifyEnabled` to `true` for release builds.
- **app/src/main/java/com/meticha/triggerxexample/home/HomeScreen.kt**:
- Changed the toast message from "Scheduled for 10 seconds" to "Scheduled for 1 minute. Now you can close the App and chill".
- **triggerx/consumer-rules.pro**:
- Added comprehensive Proguard rules to keep necessary classes, methods, and members of the `triggerx` library, including Activities, Receivers, Services, DSL classes, Permission classes, and data providers.
- Ensured Kotlin metadata and enum methods are preserved.
- **triggerx/proguard-rules.pro**:
- Added the same comprehensive Proguard rules as in `consumer-rules.pro` to ensure library components are not stripped during minification.
- **app/proguard-rules.pro**:
- Added a comment indicating temporary rules for diagnosing library issues.
These changes ensure that the application and library are properly minified for release, and the user receives a more informative message when scheduling an alarm.
This commit updates several dependencies to their latest versions and introduces a new inspection profile for the project.
Key changes:
- **Dependency Updates (`gradle/libs.versions.toml`):**
- `lifecycleRuntimeKtx`: Updated from `2.9.0` to `2.9.1`
- `composeBom`: Updated from `2024.09.00` to `2025.06.00`
- `appcompat`: Updated from `1.6.1` to `1.7.1`
- **Inspection Profile (`.idea/inspectionProfiles/Project_Default.xml`):**
- Added a new project-level inspection profile (`Project_Default.xml`). This file configures various Android lint and Jetpack Compose specific inspections, setting their severity levels (e.g., ERROR, WARNING).
- Inspections for Compose Previews and Glance Previews are enabled, including checks for top-level functions, `@Composable` annotations, and parameter validity.
- Several Markdown related inspections are explicitly disabled.
- **Build Script Cleanup (`app/build.gradle.kts`):**
- Removed an unused import: `org.jetbrains.kotlin.gradle.internal.builtins.StandardNames.FqNames.target`.
These changes help maintain the project's health by using up-to-date libraries and enforcing code quality standards through inspections.
This commit updates the `getSystemService` calls to use the type-safe version and removes unused imports in several files.
Key changes:
- **triggerx/src/main/java/com/meticha/triggerx/services/TriggerXForegroundService.kt**:
- Updated `getSystemService(Context.POWER_SERVICE) as PowerManager` to `getSystemService(PowerManager::class.java)` for improved type safety.
- **triggerx/src/main/java/com/meticha/triggerx/permission/TriggerXPermissionComposable.kt**:
- Removed unused imports: `DisposableEffect`, `Lifecycle`, `LifecycleEventObserver`, `LocalLifecycleOwner`, and `LoggerConfig`.
- **triggerx/src/main/java/com/meticha/triggerx/permission/TriggerXPermissionManager.kt**:
- Removed an unused `context` variable declaration within the `allRequiredGranted()` method.
- **app/src/main/java/com/meticha/triggerxexample/ui/theme/Theme.kt**:
- Removed unused import: `android.app.Activity`.
These changes improve code cleanliness and maintainability.
WalkthroughThis update introduces new ProGuard rules for both the app and library modules, enabling code shrinking and obfuscation for release builds. It also updates several dependency versions, adjusts toast messaging, and removes unused imports. Additionally, a new IntelliJ inspection profile is added, and minor internal logic and API usage improvements are made in the permission and service components. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant HomeScreen
participant AlarmScheduler
User->>HomeScreen: Clicks "Schedule Alarm"
HomeScreen->>AlarmScheduler: scheduleOneMinuteAlarm()
AlarmScheduler-->>HomeScreen: Alarm scheduled
HomeScreen->>User: Show toast "Scheduled for 1 minute. Now you can close the App and chill"
sequenceDiagram
participant BuildSystem
participant ProGuard
participant App
participant TriggerXLibrary
BuildSystem->>ProGuard: Run with new rules (app/proguard-rules.pro, triggerx/proguard-rules.pro, consumer-rules.pro)
ProGuard->>App: Shrink and obfuscate code, keep specified classes/methods
ProGuard->>TriggerXLibrary: Preserve public APIs, Android components, and metadata
App->>User: Release APK with optimized and preserved functionality
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
triggerx/src/main/java/com/meticha/triggerx/services/TriggerXForegroundService.kt (1)
108-113:⚠️ Potential issueHandle nullable result from getSystemService
getSystemService(PowerManager::class.java)may return null, leading to NPE onnewWakeLock(). Add a null-check or fallback, e.g.:val powerManager = ContextCompat.getSystemService(this, PowerManager::class.java) ?: throw IllegalStateException("PowerManager not available")
🧹 Nitpick comments (1)
app/proguard-rules.pro (1)
21-25: Remove or finalize temporary ProGuard comments
The “Temporary rules for app/proguard-rules.pro to diagnose library issue” comment is placeholder-only and there are no active rules. Remove or replace it with actual ProGuard directives before releasing.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
.idea/inspectionProfiles/Project_Default.xml(1 hunks)app/build.gradle.kts(1 hunks)app/proguard-rules.pro(1 hunks)app/src/main/java/com/meticha/triggerxexample/home/HomeScreen.kt(1 hunks)app/src/main/java/com/meticha/triggerxexample/ui/theme/Theme.kt(0 hunks)gradle/libs.versions.toml(1 hunks)triggerx/build.gradle.kts(1 hunks)triggerx/consumer-rules.pro(1 hunks)triggerx/proguard-rules.pro(1 hunks)triggerx/src/main/java/com/meticha/triggerx/permission/TriggerXPermissionComposable.kt(0 hunks)triggerx/src/main/java/com/meticha/triggerx/permission/TriggerXPermissionManager.kt(0 hunks)triggerx/src/main/java/com/meticha/triggerx/services/TriggerXForegroundService.kt(1 hunks)
💤 Files with no reviewable changes (3)
- app/src/main/java/com/meticha/triggerxexample/ui/theme/Theme.kt
- triggerx/src/main/java/com/meticha/triggerx/permission/TriggerXPermissionComposable.kt
- triggerx/src/main/java/com/meticha/triggerx/permission/TriggerXPermissionManager.kt
🔇 Additional comments (6)
gradle/libs.versions.toml (1)
9-12: Dependency version bumps
lifecycle-runtime-ktx upgraded to 2.9.1, Compose BOM to 2025.06.00, and AppCompat to 1.7.1. These align with the release objective and should be safe to update.triggerx/build.gradle.kts (1)
37-37: Verify ProGuard keep rules when minification is enabled
isMinifyEnabled = truecan strip needed public API and lifecycle methods. Ensureproguard-rules.proandconsumer-rules.procover all TriggerX public interfaces and Android components.app/build.gradle.kts (1)
42-42: Good practice: Enabling minification for release builds.Enabling
isMinifyEnabled = truefor release builds is excellent for reducing APK size and code obfuscation. This aligns well with the comprehensive ProGuard rules added in the TriggerX library..idea/inspectionProfiles/Project_Default.xml (1)
1-69: Excellent addition: Comprehensive Compose inspection profile.This inspection profile provides valuable code quality checks for Jetpack Compose development, including:
- Preview dimension validation and constraints
- Proper composable annotations enforcement
- Unit test file restrictions for previews
- Parameter provider validations
The severity levels are well-configured (ERROR for critical issues, WARNING/WEAK WARNING for others). Disabling Markdown inspections is reasonable to reduce noise.
triggerx/proguard-rules.pro (1)
1-65: Well-structured ProGuard rules for library protection.These rules provide comprehensive protection for the TriggerX library's public API and Android components:
✅ Strengths:
- Preserves all main public API classes and interfaces
- Protects Android lifecycle components with critical methods
- Maintains Kotlin metadata for reflection and coroutines
- Includes enum reflection methods (
values(),valueOf())- Specific member preservation for key classes like
TriggerXPreferencesThe rules strike a good balance between enabling code optimization while preventing obfuscation of essential library functionality.
triggerx/consumer-rules.pro (1)
1-65: Appropriate consumer rules for library distribution.These consumer rules ensure that when other projects include the TriggerX library, the same comprehensive API protection is automatically applied. This prevents common integration issues where consuming projects might inadvertently strip or obfuscate library classes during their own build process.
The identical content to
proguard-rules.prois correct - both the library build and consumer builds need the same protections.
Summary by CodeRabbit
New Features
Bug Fixes
Chores
Style