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

Source file package structure changes #1780

Merged
merged 7 commits into from
Apr 13, 2022

Conversation

patrickgold
Copy link
Member

This PR is the working draft for cleaning app and re-organizing the source code files in this project. The main motivation behind this is to make it easier both for me and for new/existing contributors to find around in this rather big code base. Below are the main changes in the structure and naming.

Java source directory name

Previously, all source files where stored in app/src/main/java/. Now the source files are stored in app/src/main/kotlin/. This is rather a symbolic move but indicates once more that this project is written in Kotlin and not Java.

Top-level packages within dev.patrickgold.florisboard

Previously, FlorisBoard's top-level structure looked like this:
image

The main pain points of that were, that it is extremely unorganized, and components were used criss-cross all over the place. Now there are exactly 3 top-level packages:

  • app: Contains all the UI code and preference models for the Settings, Splash screen, and extension editors, but NO keyboard UI code and also not generic shared widgets like Buttons and Modifiers.
  • ime: Contains all the logic and UI code relevant for everything you see and touch on the keyboard surface. This includes the layout logic, clipboard, emoji, etc.
  • lib: This package contains all generic shared codes, logic, IO, extension core, Snygg theme engine core, shared UI widgets, ... Pretty much everything which is used by both app and ime and which is somewhat self-contained.

Above three points is what it should be, note though that there may be some exceptions and also some old relics, which have not been cleaned up yet. This is what the future version's dev cycle 0.4.0 will continue to fix, especially within the ime package.

The three files for the services and the application will remain where they were, because it makes most sense as those are the main entry point to the app's logic.

But what about the git history for source code?

I have made sure to move around the files in the least destructive way so the git diff would indicate the file has actually been moved and not deleted/re-created in another place. This means git blame will, excluding the import section of each file, show the correct commit before this structure change associated with each line of source.

Impact for this project

Like said above, re-organizing this project is important for having a cleaner code base in the future. Also doing the work now is much effort, but it would be even more if I had to do it with an even bigger and messier code base if I waited longer. For the "normal" end user nothing will change, except a hyperlink to a source file may be broken. Within this project's scope I will ensure that all links will be fixed, external links may still break though.

@patrickgold patrickgold marked this pull request as ready for review April 12, 2022 18:30
@patrickgold patrickgold merged commit f8db5d3 into master Apr 13, 2022
@patrickgold patrickgold deleted the kotlin-package-structure-changes branch April 13, 2022 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant