Open ZakTaccardi opened 8 years ago
May be... If you see this project as gradle plugin and have a time to create this plugin, my project is open for improvements !
Simple gradle task to generate sql entities in the build folder and add them to the classpath.
All your sql files go in src/main/sql
CodeGenUnderStorIO.jar is in app/codegen
def sqlPath = 'src/main/sql'
def sqlGeneratedPath = 'build/generated/source/sql/'
android {
sourceSets {
main.java.srcDirs += sqlGeneratedPath
}
}
task generateStorIOEntities {
description = 'Generate sqlite tables and storio entities'
fileTree(dir: sqlPath, include: '**/*.sql').each { File file ->
doLast {
javaexec {
main = "-jar";
classpath = buildscript.configurations.classpath
args = ["codegen/CodeGenUnderStorIO.jar", "${file}", "com.sendkoin.sql", "${sqlGeneratedPath}"]
}
}
}
}
preBuild.dependsOn generateStorIOEntities
This should be a gradle plugin!