Skip to content

Commit 162950a

Browse files
Merge pull request #7 from DylanCaiCoding/master
修复使用 kotlin 模板时不会自动创建 Dagger**Component 的问题
2 parents 3b560bd + 2503ce6 commit 162950a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

NewArmsModule/dagger2_macros.ftl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<#macro addKaptPlugins>
2+
<#if generateKotlin>
3+
<#compress>
4+
apply plugin: 'kotlin-kapt'
5+
</#compress>
6+
</#if>
7+
</#macro>
8+
9+
<#macro addKaptDependencies>
10+
<#if generateKotlin>
11+
<#compress>
12+
kapt rootProject.ext.dependencies["dagger2-compiler"]
13+
</#compress>
14+
</#if>
15+
</#macro>

NewArmsModule/root/build.gradle.ftl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<#import "root://activities/common/kotlin_macros.ftl" as kt>
2+
<#import "root://gradle-projects/NewArmsModule/dagger2_macros.ftl" as dagger2>
23
apply plugin: 'com.android.application'
34
<@kt.addKotlinPlugins />
45

6+
<@dagger2.addKaptPlugins />
7+
58
android {
69
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
710
<#if compareVersionsIgnoringQualifiers(gradlePluginVersion, '3.0.0') lt 0>buildToolsVersion rootProject.ext.android["buildToolsVersion"]</#if>
@@ -59,6 +62,7 @@ dependencies {
5962

6063
//tools
6164
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
65+
<@dagger2.addKaptDependencies />
6266

6367
//注意 Arms 核心库现在并不会依赖某个 EventBus, 要想使用 EventBus, 还请在项目中自行依赖对应的 EventBus
6468
//现在支持两种 EventBus, greenrobot 的 EventBus 和畅销书 《Android源码设计模式解析与实战》的作者 何红辉 所作的 AndroidEventBus

0 commit comments

Comments
 (0)