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

Refactor/#134 local common #135

Merged
merged 2 commits into from
Jun 19, 2024
Merged

Refactor/#134 local common #135

merged 2 commits into from
Jun 19, 2024

Conversation

jinukeu
Copy link
Member

@jinukeu jinukeu commented Jun 19, 2024

📮 관련 이슈

Summary by CodeRabbit

  • Chores

    • Updated Gradle distribution from version 8.0 to 8.7.
    • Increased maximum heap size for Gradle to 4096m.
    • Refactored package names from com.suwiki.core.database to com.suwiki.local.common.
    • Updated project dependencies from projects.core.database to projects.local.common.
  • Refactor

    • Reorganized package structures and updated import statements across various files to reflect new package names.

@jinukeu jinukeu self-assigned this Jun 19, 2024
Copy link

coderabbitai bot commented Jun 19, 2024

Walkthrough

This update enhances the project by increasing the Gradle build system's maximum heap size and upgrading the Gradle wrapper version. It restructures the project's package organization, primarily focusing on database-related classes, by shifting them from a core namespace to a local.common namespace. Several build scripts have also been updated to reflect these changes, ensuring proper dependency management and module configuration.

Changes

File/Path Change Summary
gradle.properties Increased maximum heap size from 2048m to 4096m
gradle/wrapper/gradle-wrapper.properties Upgraded Gradle version from 8.0 to 8.7
local/common/build.gradle.kts Updated namespace from com.suwiki.core.database to com.suwiki.local.common
...TimetableDatabaseMigrate1To2Test.kt Updated package imports and references
local/common/src/main/AndroidManifest.xml Added a newline at the end of the file
.../OpenMajorDatabase.kt, .../TimetableDatabase.kt Updated package imports for database-related entities
.../TimetableCellListConverter.kt Changed package declaration for TimetableCellListConverter
.../OpenMajorDao.kt, .../TimeTableDao.kt Updated package declaration and import statements for DAOs
.../DaoModule.kt, .../DatabaseModule.kt Updated package declaration and imports in DI modules
.../OpenMajorEntity.kt, .../TimetableEntity.kt Changed package structure for database entities
.../TimetableMigration.kt Updated package declaration for TimetableMigration.kt
.../DataStoreModule.kt, .../NormalDataStore.kt Changed package declarations and import statements related to DataStore classes
.../proto/user_preference.proto Updated Java package in proto file
local/openmajor/build.gradle.kts, local/timetable/build.gradle.kts, local/user/build.gradle.kts Changed dependency from projects.core.database to projects.local.common
.../OpenMajor.kt Updated import path for OpenMajorEntity
.../LocalOpenMajorDataSourceImpl.kt Updated imports for OpenMajorDatabase and NormalDataStore
.../LocalTimetableDatasourceImpl.kt Updated imports for TimetableDatabase and NormalDataStore
settings.gradle.kts Replaced module inclusion ":core:database" with ":local:common"

Poem

Under the sun, in fields so green,
A CodeRabbit's work can be seen.
With packages moved and memory anew,
Gradle shines bright, versions grew.
Database paths now clearer, less lean,
In this update, efficiency's keen!
Hopping on, to code that's neat,
For a project's refined heartbeat.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (1)
local/common/src/main/java/com/suwiki/local/common/database/migration/TimetableMigration.kt (1)

Line range hint 51-93: Conversion functions toTimetableCell and timeTableJsonDataToCellList are well-implemented. However, consider adding error handling for cases where data conversion might fail, especially with type conversions and JSON parsing.

+ try {
+   // conversion logic here
+ } catch (e: Exception) {
+   // handle error
+ }
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6825eb8 and 6247a17.

Files selected for processing (29)
  • gradle.properties (1 hunks)
  • gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • local/common/build.gradle.kts (1 hunks)
  • local/common/src/androidTest/java/com/suwiki/local/common/TimetableDatabaseMigrate1To2Test.kt (3 hunks)
  • local/common/src/main/AndroidManifest.xml (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/OpenMajorDatabase.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/TimetableDatabase.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/converter/TimetableCellListConverter.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/dao/OpenMajorDao.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/dao/TimeTableDao.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/di/DaoModule.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/di/DatabaseModule.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/entity/OpenMajorEntity.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/entity/TimetableEntity.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/database/migration/TimetableMigration.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/datastore/di/DataStoreModule.kt (2 hunks)
  • local/common/src/main/java/com/suwiki/local/common/datastore/di/NormalDataStore.kt (1 hunks)
  • local/common/src/main/java/com/suwiki/local/common/datastore/proto/UserPreferenceSerializer.kt (1 hunks)
  • local/common/src/main/proto/user_preference.proto (1 hunks)
  • local/openmajor/build.gradle.kts (1 hunks)
  • local/openmajor/src/main/java/com/suwiki/local/openmajor/converter/OpenMajor.kt (1 hunks)
  • local/openmajor/src/main/java/com/suwiki/local/openmajor/datasource/LocalOpenMajorDataSourceImpl.kt (1 hunks)
  • local/timetable/build.gradle.kts (1 hunks)
  • local/timetable/src/main/java/com.suwiki.local.timetable/converter/Timetable.kt (1 hunks)
  • local/timetable/src/main/java/com.suwiki.local.timetable/converter/TimetableEntity.kt (1 hunks)
  • local/timetable/src/main/java/com.suwiki.local.timetable/datasource/LocalTimetableDatasourceImpl.kt (1 hunks)
  • local/user/build.gradle.kts (1 hunks)
  • local/user/src/main/java/com/suwiki/local/user/datasource/LocalUserDataSourceImpl.kt (2 hunks)
  • settings.gradle.kts (2 hunks)
Files not reviewed due to errors (1)
  • local/openmajor/build.gradle.kts (no review received)
Files skipped from review due to trivial changes (11)
  • gradle.properties
  • gradle/wrapper/gradle-wrapper.properties
  • local/common/build.gradle.kts
  • local/common/src/main/AndroidManifest.xml
  • local/common/src/main/java/com/suwiki/local/common/database/dao/TimeTableDao.kt
  • local/common/src/main/java/com/suwiki/local/common/database/entity/OpenMajorEntity.kt
  • local/common/src/main/java/com/suwiki/local/common/database/entity/TimetableEntity.kt
  • local/common/src/main/java/com/suwiki/local/common/datastore/di/NormalDataStore.kt
  • local/common/src/main/java/com/suwiki/local/common/datastore/proto/UserPreferenceSerializer.kt
  • local/common/src/main/proto/user_preference.proto
  • settings.gradle.kts
Additional comments not posted (31)
local/openmajor/src/main/java/com/suwiki/local/openmajor/converter/OpenMajor.kt (2)

4-4: Updated import statement correctly reflects the new package structure.


Line range hint 6-10: Conversion functions correctly utilize the updated OpenMajorEntity from the new package.

local/timetable/src/main/java/com.suwiki.local.timetable/converter/TimetableEntity.kt (2)

4-4: Updated import statement correctly reflects the new package structure.


Line range hint 6-11: Conversion function correctly utilizes the updated TimetableEntity from the new package.

local/timetable/src/main/java/com.suwiki.local.timetable/converter/Timetable.kt (2)

4-4: Updated import statement correctly reflects the new package structure.


Line range hint 6-11: Conversion function correctly utilizes the updated TimetableEntity from the new package.

local/common/src/main/java/com/suwiki/local/common/database/dao/OpenMajorDao.kt (2)

1-1: Updated package and import statements correctly reflect the new package structure.

Also applies to: 6-6


Line range hint 8-15: DAO interface methods correctly utilize the updated OpenMajorEntity from the new package.

local/common/src/main/java/com/suwiki/local/common/database/converter/TimetableCellListConverter.kt (1)

Line range hint 6-14: The JSON conversion methods are correctly implemented using Kotlin serialization.

local/common/src/main/java/com/suwiki/local/common/database/TimetableDatabase.kt (2)

1-1: The package and import statements are correctly updated to reflect the new structure.

Also applies to: 6-8


Line range hint 9-19: The TimetableDatabase class is correctly defined with appropriate entities and converters.

local/user/build.gradle.kts (1)

14-14: The dependency on projects.local.common is correctly added to align with the new project structure.

local/common/src/main/java/com/suwiki/local/common/database/di/DaoModule.kt (2)

1-1: The package and import statements are correctly updated to reflect the new structure.

Also applies to: 3-6


Line range hint 15-23: The DaoModule class correctly provides DAO instances using Dagger, ensuring proper dependency injection.

local/common/src/main/java/com/suwiki/local/common/database/OpenMajorDatabase.kt (2)

1-1: Package declaration updated to reflect the new namespace. Good job maintaining consistency.


8-9: Import statements correctly updated to reflect the new namespace. This ensures consistency across the module.

local/timetable/build.gradle.kts (1)

16-16: Dependency update aligns with the project restructuring. Please ensure all dependent modules are updated accordingly.

Verification successful

The verification confirms that all instances of the old dependency projects.core.database have been removed, and the new dependency projects.local.common has been correctly integrated into the necessary modules.

  • local/user/build.gradle.kts
  • local/openmajor/build.gradle.kts
  • local/timetable/build.gradle.kts
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all dependent modules are updated to use `projects.local.common`.

# Test: Search for the old dependency usage. Expect: No occurrences except in historical docs or comments.
rg --type kotlin $'projects.core.database'

Length of output: 41



Script:

#!/bin/bash
# Description: Verify all dependent modules are updated to use `projects.local.common`.

# Test 1: Search for the old dependency usage across all file types. Expect: No occurrences except in historical docs or comments.
rg 'projects.core.database'

# Test 2: Verify the presence of the new dependency usage across all file types.
rg 'projects.local.common'

Length of output: 268

local/common/src/main/java/com/suwiki/local/common/database/di/DatabaseModule.kt (2)

1-1: Package declaration updated to reflect the new namespace. Consistency is key in large refactorings.


5-7: Import statements correctly updated to reflect the new namespace. This ensures that the database providers are correctly linked to the new structure.

local/common/src/main/java/com/suwiki/local/common/datastore/di/DataStoreModule.kt (3)

12-13: Imports are correctly updated to reflect the new package structure.


1-1: Method providesUserPreferencesDataStore correctly uses updated imports and adheres to the new package structure.

Also applies to: 12-13, 24-32


Line range hint 34-47: Method provideDataStore is implemented correctly, ensuring data integrity with a corruption handler and proper file management.

local/user/src/main/java/com/suwiki/local/user/datasource/LocalUserDataSourceImpl.kt (2)

12-12: Import statement correctly updated to use UserPreference from the new package.


Line range hint 14-43: Class LocalUserDataSourceImpl correctly utilizes the updated UserPreference class and effectively manages user data with robust coroutine-based operations.

local/openmajor/src/main/java/com/suwiki/local/openmajor/datasource/LocalOpenMajorDataSourceImpl.kt (2)

11-12: Imports are correctly updated to reflect the new package and dependency structure.


Line range hint 14-53: Class LocalOpenMajorDataSourceImpl effectively manages Open Major data with correctly used dependency injections and asynchronous operations on the appropriate dispatcher.

local/common/src/androidTest/java/com/suwiki/local/common/TimetableDatabaseMigrate1To2Test.kt (2)

6-8: Imports are correctly updated to reflect the new package structure for database components.


Line range hint 26-48: The testTimetableDBMigrate1To2 method correctly tests the database migration using well-structured setup and validation procedures.

local/timetable/src/main/java/com.suwiki.local.timetable/datasource/LocalTimetableDatasourceImpl.kt (2)

12-13: Import statements updated to reflect the new package structure. Looks good!


Line range hint 1-53: The refactoring of package names and import statements has been integrated correctly throughout the class. Ensure all related components are updated to use the new package paths.

local/common/src/main/java/com/suwiki/local/common/database/migration/TimetableMigration.kt (1)

Line range hint 1-50: The migration logic appears robust, handling the creation of a new table and data transfer correctly. However, ensure proper testing, especially around data integrity during the migration process.

@jinukeu jinukeu merged commit 9b04af9 into develop Jun 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor] core:database -> local:common 변경
1 participant