Skip to content

Instantly share code, notes, and snippets.

@galex
Created November 2, 2013 15:29
Show Gist options
  • Save galex/7280110 to your computer and use it in GitHub Desktop.
Save galex/7280110 to your computer and use it in GitHub Desktop.
storm-gen gradle script
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android-library'
repositories {
mavenCentral()
}
dependencies {
compile 'log4j:log4j:1.2.16'
//compile 'org.slf4j:slf4j-log4j12:1.6.1'
compile files('libs/storm-apt-0.97.jar')
}
def getSourceSetName(variant) {
return new File(variant.dirName).getName();
}
android.libraryVariants.all { variant ->
def aptOutputDir = project.file("${project.projectDir}/src/main/generated")
android.sourceSets[getSourceSetName(variant)].java.srcDirs += aptOutputDir.getPath()
variant.javaCompile.options.compilerArgs += [
"-processor", "com.turbomanage.storm.apt.MainProcessor",
'-AandroidManifestFile=' + variant.processResources.manifestFile,
'-s', aptOutputDir
]
variant.javaCompile.source = variant.javaCompile.source.filter { p ->
return !p.getPath().startsWith(aptOutputDir.getPath())
}
variant.javaCompile.doFirst {
aptOutputDir.mkdirs()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment