Skip to content

Migrate to Gradle Kotlin DSL #41

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

Merged

Conversation

dbaelz
Copy link
Contributor

@dbaelz dbaelz commented Jun 20, 2019

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Documentation Update

Description

Minor Documentation Change

Update the link to the "licensing" page in the README.

Migration to Gradle Kotlin DSL

The Kotlin DSL has some advantages as described in the documentation (e.g. enhanced editing experience in supported IDEs, with superior content assist, refactoring [...]). Everything should work as before, but features like auto-completion in the build scripts are now supported. Furthermore, I added the buildSrc directory, which is the Gradle way to share/abstract imperativ logic, config and so on for build scripts.

The migration is finished, but the build scripts can be improved even more. For example, all version declaration of dependencies could be moved to buildSrc. I didn't changed that because it's optional and I didn't want to make this decision for the project. With #40 another PR changes the build scripts. I will integrate these changes when this PR is merged before mine.

Feel free to ask questions or challenge my changes. I hope the migration to the Kotlin DSL is accepted for the project and this PR will be integrated.

[optional] What gif best describes this PR or how it makes you feel?

Kotlin everywhere

@CLAassistant
Copy link

CLAassistant commented Jun 20, 2019

CLA assistant check
All committers have signed the CLA.

@dbaelz dbaelz changed the title Feature/migrate to gradle kotlin dsl Migrate to Gradle Kotlin DSL Jun 20, 2019
@sierisimo
Copy link
Contributor

This is so awesome! I haven't tried the kotlin DSL in an Android Project but in a kotlin project it's really good. Great PR

@maestromac
Copy link
Contributor

Thanks for this @dbaelz !

I took a peak at Kotlin DSL and I'm totally for it. Regarding the buildSrc, what's the benefit of moving all version declaration of dependencies to buildSrc?

I'll merge this as soon as merge conflict is resolved.

@sierisimo
Copy link
Contributor

sierisimo commented Jun 20, 2019

I took a peak at Kotlin DSL and I'm totally for it. Regarding the buildSrc, what's the benefit of moving all version declaration of dependencies to buildSrc?

There's not mucho of the changes of adding buildSrc in this PR but the advantage is that you will have all the versions and string constants in one place, also if the building process require some complex step like copying or editing classes in compilation time, it can be achieved in Kotlin code in classes in buildSrc instead of doing patches and hacks on the build.gradle.kts

Also the buildSrc is compiled BEFORE everything so you can add anything that's needed for the building process in it.

But right now… there's no need.

@sierisimo
Copy link
Contributor

sierisimo commented Jun 20, 2019

Heres is an example of it:
image

There's also de posibility of writing custom tasks for the building process, like pushing changes to somewhere, run custom rules for validation of code, etc. All the steps implied in the building process and quality checks of your code can be achieved programatically in the buildSrc

This will be helpful if we are on the need of adding more modules that hold common dependencies

@dbaelz
Copy link
Contributor Author

dbaelz commented Jun 20, 2019

Thanks @sierisimo you summed it up faster quit well.

The idea (general and in this project) is to avoid redundant information in multiple modules like app, baseui and data. This lowers the risk of bugs due different versions in different modules. It isn't a huge advantage for these simple build scripts, but it's really great if the scripts are more extensive.

We could go even further and for example move parts of the app configuration like "base dependencies" (all dependencies that are redundant defined in all modules) into buildSrc. But for such compact scripts this might be overkill.

I'll updated the PR and integrated the changes of #40. Due the renaming of the scripts files I had to readd the changes to the Kotlin build scripts.

Copy link
Contributor

@maestromac maestromac left a comment

Choose a reason for hiding this comment

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

👍

@maestromac maestromac merged commit 9d3440f into forem:master Jul 7, 2019
@dbaelz dbaelz deleted the feature/migrate-to-gradle-kotlin-dsl branch October 19, 2019 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants