项目作者: petedoyle

项目描述 :
Best-practices infrastructure for starting your next Android app, fast. 🔥
高级语言: Kotlin
项目地址: git://github.com/petedoyle/kindling.git
创建时间: 2019-03-25T00:49:16Z
项目社区:https://github.com/petedoyle/kindling

开源协议:Apache License 2.0

下载


Best-practices infrastructure for starting a new Android app, fast. 🔥

Kindling is boilerplate for your next app with full support for the Gradle Kotlin DSL, Dagger 2, multi-module builds, and CI.

Minimally opinionated, it provides:

  • 100% Kotlin
  • Generated Android project as created by Android Studio (3.5 Canary 10)
  • Gradle Kotlin DSL
  • buildSrc pattern for better dependency management and multi-module development
  • Dagger 2 pre-configured - with just enough code to help understand the tricky Kotlin syntax
  • Kotlin experimental extensions so you can use Parcelize on data classes
  • Packaging by feature - Lots of benefits, but also makes it easier to later use Gradle modules to improve build speeds
  • Kotlin code formatting - based on the official Kotlin coding conventions, with small tweaks:
    • 120 character line limit
    • 4 space continuation indent (instead of 8)
    • Support for @formatter:on and @formatter:off tags

It does not provide:

  • Architecture - Use MVVM, MVP, MVI, or roll your own.
  • Persistence - Use Room, SQLDelight, etc.
  • Other Libraries -
    • Async - Use RxJava, Coroutines, etc.
    • HTTP loading - Use Retrofit, etc.
    • JSON parsing - Use GSON, Moshi, etc.
    • Photo loading - Use Picasso, Glide, etc.
    • Logging - Use Timber, etc.
    • Crash logging - Use Crashlytics, etc.

Coming soon

  • Rename default package (currently dev.petedoyle.starter)
  • Incremental annotation processing - for faster builds (waiting for a few more annotation processors to support it)
  • Automatic versionCode management - for CI builds
  • Sample CircleCI config that:
    • Runs espresso tests on an emulator
    • Manual approval step to automatically the development branch to master
    • Manual approval step to push the newest build from master to Google Play
    • (as samples to start from)

Investigating

  • Fastlane support

Starting a new app

  1. Decide on your app’s repo name (e.g. myapp)

    1. $ KINDLING_REPO_NAME=myapp
  2. Create your new repo:

    1. $ git clone https://github.com/petedoyle/kindling.git $KINDLING_REPO_NAME && \
    2. cd $KINDLING_REPO_NAME && \
    3. AS_VERSION="$(git rev-parse --abbrev-ref HEAD)@$(git rev-parse --short HEAD)" && \
    4. rm -rf .git && \
    5. git init && \
    6. git add . && \
    7. git commit -m "Create new project from github.com/petedoyle/kindling ($AS_VERSION)" && \
    8. unset KINDLING_REPO_NAME
  3. Open myapp/build.gradle.kts in Android Studio. Or, if you’ve installed the command line launcher:

    1. $ studio build.gradle.kts

That’s it! You’re ready to dev! 🔥

Finding your way around

  • See MainActivity to see the sample activity. Note the package: dev.petedoyle.starter.feature.main.
  • See MainModule to see how MainActivity‘s dependencies can be provided. The lifetime of MainModule‘s object graph is scoped to MainActivity (because @ContributesAndroidInjector in ActivityBindingModule created a Dagger Subcomponent under the hood, scoped to MainActivity).
  • See AppModule to see how app-wide dependencies can be provided.
  • See buildSrc/src/main/java/Dependencies.kt for declaring libraries and their versions.
  • See app/build.gradle to see how to consume libraries, e.g.

    1. implementation(Deps.androidx_appcompat)
  • See daggerutil/build.gradle.kts to see how to set up a module’s build script.
  • See how multiple modules’ build.gradle.kts refer to Deps.[name], thus allowing you to update dependency versions across many gradle modules at once.

License

  1. Copyright 2019 Pete Doyle
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.