项目作者: dikeboy

项目描述 :
A gradle plugin for android aspectj, android aop,support kotlin,multiple flavors,multiple module
高级语言: Groovy
项目地址: git://github.com/dikeboy/dhaspject.git
创建时间: 2019-03-30T09:44:01Z
项目社区:https://github.com/dikeboy/dhaspject

开源协议:

下载


What’s this

An gradle plugin for android project aspectj

Support for multiple library, Kotlin, Java

Support for debug mode,release mode or close

Support for multiple flavors

If use kotlin make sure the @Aspect annotion class file use kotlin

How to use

project: build.gradle

  1. dependencies {
  2. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  3. classpath 'org.aspectj:aspectjtools:1.8.9'
  4. classpath 'com.dhaspject:dhaspject:1.1.1'
  5. }

javafiles and kotlinfiles all empty will compile all the file of current module,one of this empty will comile only select

app module(main module): build.gradle

  1. apply plugin: "com.dhaspject"
  2. laop{
  3. kotlinfiles("testpro.com","com.kotlin") //kotlin package need to be aspject
  4. javafiles("com.lin") //java package need to be aspject
  5. aopModule("api_log") // the aop library name
  6. aopType("debug") // aop type, debug: debug mode, default: always use, close: unuse
  7. hasFlavors(true) //if have flavors

}

dependencies{ ... implementation 'org.aspectj:aspectjrt:1.8.9' }

api_log( aop module): build.gradle( the aop module, you can modify the name by yourself)

  1. apply plugin: "com.dhaspject"
  2. laop{
  3. aopModule("api_log")
  4. aopType("debug")
  5. useJavaTask(true) //(Opertion) IF kotlin file not effective

}

dependencies{ ... implementation 'org.aspectj:aspectjrt:1.8.9' }

other module need aspject:
my_lib: build.gradle

  1. apply plugin: "com.dhaspject"
  2. laop{
  3. javafiles("com.lance.aspectlib") // witch package need to be aspject
  4. aopModule("api_log") //the aop modle
  5. aopType("debug")

}

dependencies{ ... implementation 'org.aspectj:aspectjrt:1.8.9' }

参考