Skip to content

Using kts files instead of .gradle - #807

Open
pfmaggi wants to merge 20 commits into
mainfrom
pfm/kts
Open

Using kts files instead of .gradle#807
pfmaggi wants to merge 20 commits into
mainfrom
pfm/kts

Conversation

@pfmaggi

@pfmaggi pfmaggi commented Dec 9, 2019

Copy link
Copy Markdown
Collaborator

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Moving to Kotlin DSL for the gradle build scripts.

💡 Motivation and Context

Having a single language both for the app and for its build script.

💚 How did you test it?

./gradlew check

📝 Checklist

  • I ran ./gradlew spotlessApply before submitting the PR
  • I reviewed submitted code
  • I added tests to verify changes
  • All tests passing

🔮 Next steps

Improve KTS design and build speed.

📸 Screenshots / GIFs

@keyboardsurfer keyboardsurfer mentioned this pull request Dec 18, 2019
8 tasks
@florina-muntenescu

Copy link
Copy Markdown
Collaborator

would you mind re-basing when you get the chance, please

@pfmaggi

pfmaggi commented Dec 30, 2019

Copy link
Copy Markdown
Collaborator Author

Rebase on master plus, a commit to add the main Glide artifact to kapt classpath. This is required having disabled compile avoidance for kapt in master:

kapt.include.compile.classpath=false

@florina-muntenescu florina-muntenescu changed the title Pfm/kts Using kts files instead of .gradle Jan 2, 2020
Comment thread core/proguard-rules.pro Outdated

@florina-muntenescu florina-muntenescu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall, for someone with no experience with kts, this looks good.
Maybe someone else, could take a look as well.

Comment thread gradle.properties Outdated

# Use kapt in parallel
kapt.use.worker.api=true
## Use kapt incremental

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this not needed anymore?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Incremental annotation processing is enabled by default starting from version 1.3.50.

- Split the config object into three separate files based on content
- Cleanup main build.gradle.kts
- Incremental annotation processing is now enabled by default
- Too many kts in "build.gradle.kts.kts.kts".

@keyboardsurfer keyboardsurfer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AFAICT depconstraints only hosts a build file. Does it need to be its own project for that?

Comment thread app/build.gradle.kts
Comment thread buildSrc/src/main/java/Versions.kt Outdated
Comment thread depconstraints/build.gradle.kts Outdated
Comment thread depconstraints/build.gradle.kts Outdated
Comment thread app/build.gradle.kts Outdated
Comment thread buildSrc/src/main/java/Libs.kt Outdated
Comment thread buildSrc/src/main/java/Libs.kt
id("maven-publish")
}

val appcompat = "1.1.0"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why arent' these constant?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I would prefer to not put them in an object: "const val are only allowed on top level or in objects

Comment thread buildSrc/src/main/java/Libs.kt Outdated
@Suppress("MayBeConstant") // Improve perf when changing values

object Libs {
val AX_ANNOTATION = "androidx.annotation:annotation:"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Either const & SCREAMING_SNAKE_CASE or non const & pascalCase

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

const & screaming

Comment thread gradle.properties Outdated

@pfmaggi pfmaggi left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a special components that needs to be consumed by the other modules:
https://docs.gradle.org/current/userguide/java_platform_plugin.html#sec:java_platform_consumption

e.g. it needs to be a project that can be imported:

dependencies {
    // get recommended versions from the platform project
    api(platform(project(":platform")))
    // no version required
    api("commons-httpclient:commons-httpclient")
}

@codingjeremy
codingjeremy changed the base branch from master to main September 29, 2020 19:11
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.

4 participants