Last active
July 4, 2016 19:47
-
-
Save xinthink/b893b236f6f3bbb32285 to your computer and use it in GitHub Desktop.
Using ig-json-parser in android studio gradle build script.
This file contains 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
apply plugin: 'com.android.library' | |
ext { | |
generatedSourcesDir = file 'gen/main/java' | |
} | |
android { | |
compileSdkVersion XX | |
buildToolsVersion "XX" | |
defaultConfig { | |
minSdkVersion XX | |
} | |
sourceSets { | |
main { | |
java { | |
srcDir generatedSourcesDir | |
} | |
} | |
} | |
} | |
// generate json parsers http://bit.ly/ZgSkOh | |
tasks.withType(Compile) { | |
doFirst { | |
// regenerate all files | |
if (generatedSourcesDir.exists()) { | |
generatedSourcesDir.deleteDir() | |
} | |
generatedSourcesDir.mkdirs() | |
} | |
options.compilerArgs += [ | |
'-processor', | |
'com.instagram.common.json.annotation.processor.JsonAnnotationProcessor', | |
'-s', | |
generatedSourcesDir | |
] | |
} | |
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
compile 'com.instagram:ig-json-parser-processor:0.0.4+' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment