typesafehub/sbt-aspectj — pull request #2 by ezh (2012-02-09 16:53:57+00:00)
Title: add ability to weave classes directory

Here example of use from my build.sbt

input - I don't what to weave all available jars, so there is only one in filter

inputs in Aspectj <<= (fullClasspath in Compile, streams) map { (cp, s) => {
val result = cp.map(_.data).filter(_.getName match {
case "classes" => true
case "digilib_2.8.2-0.0.1.jar" => true
case skip => s.log.debug("aspectj skip entity: " + skip); false
})
result.foreach(e => s.log.debug("aspectj add entity: " + e))
result
}
}

example AOP source files at
[https://github.com/ezh/android-component-DigiSSHD/tree/master/src/main/aspectj/org/digimead/digi/inetd/sshd](https://github.com/ezh/android-component-DigiSSHD/tree/master/src/main/aspectj/org/digimead/digi/inetd/sshd)

aspectFilter in Aspectj := {
(input, aspects) => {
input.name match {
case "classes" => aspects filter (_.toString.contains("/aspectj/org/digimead/digi/inetd/aop/"))
case "digilib_2.8.2-0.0.1.jar" => aspects filter (_.toString.contains("/aspectj/org/digimead/digi/inetd/lib/aop/"))
case file =>
Seq.empty[File]
}
}
}

patch positive sides:

* backward compatible
* weaving directories
* more than nothing

patch (all code?) negative sides:

* project __must__ have AspectJ files with same content in difference classes for runtime and jar sources.
If you try to use only one AspectJ for jar library and class directory there possible will be error. Android dex tool crashed with "class already exists" error. And, It is indeed. But nothing critical.

King regards,
Alexey