java - where to configure AspectJ in Android Studio gradle plugin -


i attempting create android studio gradle plugin.

i employing jake whartons hugo plugin guide.

the plugin developing differs hugo in folloiwng ways:-

1). not wish use marker annotation 2). want develop plugin using java , not groovy

however in other respects plugin similar, e.g. uses aspectj weave android apps and/or libraries.

i believe need develop plugin module , associated runtime module. not understand why both hugo plugin , runtime modules have folloiwng (gradle) configuartion e.g. starting "javacompile javacompile = variant.javacompiler"

hugo-runtime (build.gradle)

import org.aspectj.bridge.imessage import org.aspectj.bridge.messagehandler import org.aspectj.tools.ajc.main  apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven'  dependencies {     compile 'org.aspectj:aspectjrt:1.8.10'     compile project(':hugo-annotations')      testcompile 'junit:junit:4.12' }  android {     compilesdkversion rootproject.ext.compilesdkversion     buildtoolsversion rootproject.ext.buildtoolsversion      compileoptions {         sourcecompatibility javaversion.version_1_8         targetcompatibility javaversion.version_1_8     }     buildtoolsversion '26.0.1' }  android.libraryvariants.all { variant ->     javacompile javacompile = variant.javacompiler     javacompile.dolast {         string[] args = [                 "-showweaveinfo",                 "-1.5",                 "-inpath", javacompile.destinationdir.tostring(),                 "-aspectpath", javacompile.classpath.aspath,                 "-d", javacompile.destinationdir.tostring(),                 "-classpath", javacompile.classpath.aspath,                 "-bootclasspath", android.bootclasspath.join(file.pathseparator)         ]          messagehandler handler = new messagehandler(true);         new main().run(args, handler)          def log = project.logger         (imessage message : handler.getmessages(null, true)) {             switch (message.getkind()) {                 case imessage.abort:                 case imessage.error:                 case imessage.fail:                     log.error message.message, message.thrown                     break;                 case imessage.warning:                 case imessage.info:                     log.info message.message, message.thrown                     break;                 case imessage.debug:                     log.debug message.message, message.thrown                     break;             }         }     } } 

hugo-plugin (groovy class - apply method)

   @override     void apply(project project) {         def hasapp = project.plugins.withtype(appplugin)         def haslib = project.plugins.withtype(libraryplugin)         if (!hasapp && !haslib) {             throw new illegalstateexception("'android' or 'android-library' plugin required.")         }          final def log = project.logger         final def variants         if (hasapp) {             variants = project.android.applicationvariants         } else {             variants = project.android.libraryvariants         }          project.dependencies {             debugcompile 'com.jakewharton.hugo:hugo-runtime:1.2.2-snapshot'             // todo should come transitively             debugcompile 'org.aspectj:aspectjrt:1.8.6'             compile 'com.jakewharton.hugo:hugo-annotations:1.2.2-snapshot'         }          project.extensions.create('hugo', hugoextension)          variants.all { variant ->             if (!variant.buildtype.isdebuggable()) {                 log.debug("skipping non-debuggable build type '${variant.buildtype.name}'.")                 return;             } else if (!project.hugo.enabled) {                 log.debug("hugo not disabled.")                 return;             }              javacompile javacompile = variant.javacompile             javacompile.dolast {                 string[] args = [                         "-showweaveinfo",                         "-1.5",                         "-inpath", javacompile.destinationdir.tostring(),                         "-aspectpath", javacompile.classpath.aspath,                         "-d", javacompile.destinationdir.tostring(),                         "-classpath", javacompile.classpath.aspath,                         "-bootclasspath", project.android.bootclasspath.join(file.pathseparator)                 ]                 log.debug "ajc args: " + arrays.tostring(args)                  messagehandler handler = new messagehandler(true);                 new main().run(args, handler);                 (imessage message : handler.getmessages(null, true)) {                     switch (message.getkind()) {                         case imessage.abort:                         case imessage.error:                         case imessage.fail:                             log.error message.message, message.thrown                             break;                         case imessage.warning:                             log.warn message.message, message.thrown                             break;                         case imessage.info:                             log.info message.message, message.thrown                             break;                         case imessage.debug:                             log.debug message.message, message.thrown                             break;                     }                 }             }         }     } } 

isnt required in hugo-runtime module aspectj located?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -