- extract dir structure creation to a separate task, i.e. not
apply
useapply from
insettings.gradle
instead of polluting it- apply common plugins to all subprojects:
subprojects {
apply plugin: "org.jlleitschuh.gradle.ktlint"
apply plugin: 'kotlin-kapt'
createapi:common
subprojectmake name configurable- fail if already exists a subproject with the default name
- make it work for both
groovy
andkts
createapi:live
subprojectcreateapi:mock
subprojectapply project-wide pluginsconfigureplugins.withId('com.android.application') { }
configureplugins.withId('com.android.library') { }
configureplugins.withId('java-library') { }
link unit tests ingradle.projectsEvaluated { }
- link UI tests
- figure out what to do with
id 'org.jetbrains.kotlin.jvm'
plugin requiring an explicit version during tests - also find a way to apply
"org.jetbrains.kotlin.android"
and have project evaluation test pass - explain in tips how to have a database module that uses Room (an
android-library
) and still have a plainjava-library
Repository layer (Hilt'sSingletonComponent
to the rescue) - organize all task names as an iterable to automatically run certain tests on all of them
provide a way to declare feature definitions with automatic layers' creationmakeapi
a regular layer for features- check how feature names with forward slashes behave
- allow to customize layers (could be not worth it). At least maybe give users ability to disable some predefined layers
- define
includeIfNeeded()
fororderly.gradle
to choosemock
orlive
dependencies - skip task registering if a matching subproject already exists
- provide a way to run only feature subprojects' creation (should be a common case when a new screen is added). Possibly can also create these during configuration, or also provide a task to delete certain ones.
- make
mock
andlive
names configurable - fix table below
- add
screen-compose
layer. Or, better, allow to easily add compose dependencies to a layer. make subproject creation tasks incremental, i.e. declare outputs and provide a way for Gradle to skip creation of already existing subprojects (seeplugin links all subprojects together
test)- figure out a way to describe
include project
lines inorderly.gradle
as a task output. - make all
build.gradle
templates swappable by user - allow users to declare their own repos
- figure out how to allow users to use
DependencyHandler
fordependenciesApiCommonLive
. Currentlyapi
dependency declaration is not present in the rootbuild.gradle.kts
since it is not ajava-library
. Also, it looks likeorg.gradle.kotlin.dsl.DependencyHandlerExtensions
is not on the classpath for the buildscript, which is a bit strange (and it does not force a project to be ajava-library
it seems). - extract string literals from everywhere
- solve the mystery of
java-library
not being applied to projects (worked around by addingit.plugins.apply("org.jetbrains.kotlin.jvm")
everywhere dependencies are declared). Probably they are being overridden by application ofplugins
extension property to all subprojects. UPD: possibly,it.plugins.apply()
is the one re-writing default plugins. - apply
dagger.hilt.android.plugin
by default - migrate to
settings.gradle.kts
andorderly.gradle.kts
settings.gradle
gets overrun byorderly.gradle
lines
orderly can be used to bootstrap a modularized Android App, that follows MVVM + Clean Architecture, i.e. in the end you get an opinionated project structure. The benefit is that you as a user will be able to skip the setup of relations between the app layers (represented by Gradle subprojects), and just proceed to implement app features. Consider this to be a rough equivalent of what Hilt does with its component hierarchy.
- apply and configure the plugin via
orderly
extension - invoke
createAllSubprojects
task to create all layers - sync the new configuration and enjoy development
name|type|what has -|-|-
:api:common|java-library|reusable external API code, e.g. Retrofit
dependency
:api:mock|java-library|mocked external API answers
:api:live|java-library|actual external API client code
:domain|java-library|data classes used by business logic, e.g. in UseCase
layers
:dto|java-library|data classes expected from external APIs
:common:kotlin|java-library|reusable plain Kotlin code
:common:android|android-library|reusable Android code
- list properties as of now should be extended in the following manner to not lose default values:
orderly {
plugins.set(plugins.get() + "org.jlleitschuh.gradle.ktlint")
}
plugin links all subprojects
test is nice for checking subprojects' visibility- functional tests are much more reliable when
assemble
tasks are invoked as opposed to parsingdependencies
output, which will not fail if a dependency could not be resolved. Also,--dry-run
will not detect a circular dependency. - use this to publish the plugin locally:
./gradlew plugin:publishToMavenLocal
- add
--stacktrace
to runner arguments if a test fails without obvious error message