Last active
December 19, 2015 23:49
-
-
Save skyisle/6036858 to your computer and use it in GitHub Desktop.
Using annotation processing in gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.5.+' | |
} | |
} | |
apply plugin: 'android' | |
repositories { | |
mavenCentral() | |
} | |
configurations { | |
apt | |
} | |
dependencies { | |
compile 'com.android.support:support-v4:13.0.+' | |
compile 'com.google.android.gms:play-services:3.1.+' | |
compile 'com.jakewharton:butterknife:2.0.+' | |
apt 'com.jakewharton:butterknife:2.0.+' | |
} | |
android { | |
compileSdkVersion 17 | |
buildToolsVersion "17.0.0" | |
defaultConfig { | |
minSdkVersion 8 | |
targetSdkVersion 16 | |
} | |
} | |
android.applicationVariants.each { variant -> | |
ext.aptOutput = file("${project.buildDir}/source/apt_generated/${variant.dirName}") | |
variant.javaCompile.doFirst { | |
aptOutput.mkdirs() | |
variant.javaCompile.options.compilerArgs += [ | |
'-processorpath', configurations.apt.getAsPath(), | |
'-s', aptOutput | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment