Guest User

Untitled

a guest
Jun 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. buildscript {
  2. repositories {
  3. mavenCentral()
  4. }
  5. dependencies {
  6. classpath 'org.aspectj:aspectjtools:1.8.13'
  7. }
  8. }
  9.  
  10. final def log = project.logger
  11. final def variants = project.android.hasProperty("applicationVariants") ?
  12. project.android."applicationVariants" :
  13. project.android."libraryVariants"
  14.  
  15. variants.all { variant ->
  16. JavaCompile javaCompile = variant.javaCompile
  17. javaCompile.doLast {
  18. String[] args = ["-showWeaveInfo",
  19. "-1.7",
  20. "-inpath", javaCompile.destinationDir.toString(),
  21. "-aspectpath", javaCompile.classpath.asPath,
  22. "-d", javaCompile.destinationDir.toString(),
  23. "-classpath", javaCompile.classpath.asPath,
  24. "-bootclasspath", project.android.bootClasspath.join(File.pathSeparator)]
  25. log.debug "ajc args: " + Arrays.toString(args)
  26.  
  27. MessageHandler handler = new MessageHandler(true)
  28. new Main().run(args, handler)
  29. for (IMessage message : handler.getMessages(null, true)) {
  30. switch (message.getKind()) {
  31. case IMessage.ABORT:
  32. case IMessage.ERROR:
  33. case IMessage.FAIL:
  34. log.error message.message, message.thrown
  35. break
  36. case IMessage.WARNING:
  37. log.warn message.message, message.thrown
  38. break
  39. case IMessage.INFO:
  40. log.info message.message, message.thrown
  41. break
  42. case IMessage.DEBUG:
  43. log.debug message.message, message.thrown
  44. break
  45. }
  46. }
  47. }
  48. }
  49.  
  50. dependencies {
  51. api 'org.aspectj:aspectjrt:1.8.13'
  52. }
Add Comment
Please, Sign In to add comment