Skip to content

Commit 0c7cc9d

Browse files
author
archinamon
committed
upgrades to 3.1.1 and readme update
1 parent c9946ee commit 0c7cc9d

File tree

2 files changed

+53
-22
lines changed

2 files changed

+53
-22
lines changed

README.md

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# GradleAspectJ-Android
2-
[![Kotlin](https://img.shields.io/badge/Kotlin-1.1.1-blue.svg)](http://kotlinlang.org) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AspectJ%20Gradle-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/4578) ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg) [![](https://jitpack.io/v/Archinamon/GradleAspectJ-Android.svg)](https://jitpack.io/#Archinamon/GradleAspectJ-Android) [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
2+
[![Kotlin](https://img.shields.io/badge/Kotlin-1.1.51-blue.svg)](http://kotlinlang.org) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AspectJ%20Gradle-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/4578) ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg) [![](https://jitpack.io/v/Archinamon/GradleAspectJ-Android.svg)](https://jitpack.io/#Archinamon/GradleAspectJ-Android) [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
33

44
A Gradle plugin which enables AspectJ for Android builds.
55
Supports writing code with AspectJ-lang in `.aj` files and in java-annotation style.
66
Full support of Android product flavors and build types.
77
Support Kotlin, Groovy, Scala and any other languages that compiles into java bytecode.
88

9-
Actual version: `com.archinamon:android-gradle-aspectj:3.0.3`.
9+
Actual version: `com.archinamon:android-gradle-aspectj:3.1.1`.
1010
<br />
1111
Friendly with <a href="https://zeroturnaround.com/software/jrebel-for-android/" target="_blank">jRebel for Android</a>!
1212

@@ -21,7 +21,8 @@ Key features
2121

2222
Augments Java, Kotlin, Groovy bytecode simultaneously!<br />
2323
Works with background mechanics of jvm-based languages out-of-box!<br />
24-
[How to teach Android Studio to understand the AspectJ!](IDE)
24+
[How to teach Android Studio to understand the AspectJ!](IDE)<br />
25+
May not work for AS 3.0 :(
2526

2627
It is easy to isolate your code with aspect classes, that will be simply injected via cross-point functions, named `advices`, into your core application. The main idea is — code less, do more!
2728

@@ -42,13 +43,12 @@ Usage
4243
First add a maven repo link into your `repositories` block of module build file:
4344
```groovy
4445
mavenCentral()
45-
maven { url "https://jitpack.io" }
4646
```
4747
Don't forget to add `mavenCentral()` due to some dependencies inside AspectJ-gradle module.
4848

4949
Add the plugin to your `buildscript`'s `dependencies` section:
5050
```groovy
51-
classpath 'com.github.Archinamon:GradleAspectJ-Android:3.0.3'
51+
classpath 'com.archinamon:android-gradle-aspectj:3.1.1'
5252
```
5353

5454
Apply the `aspectj` plugin:
@@ -66,7 +66,7 @@ import android.support.v4.app.NotificationCompat;
6666

6767
aspect AppStartNotifier {
6868

69-
pointcut postInit(): within(Application) && execution(* Application.onCreate());
69+
pointcut postInit(): within(Application+) && execution(* Application+.onCreate());
7070

7171
after() returning: postInit() {
7272
Application app = (Application) thisJoinPoint.getTarget();
@@ -86,29 +86,32 @@ Tune extension
8686

8787
```groovy
8888
aspectj {
89-
ajc '1.8.10'
89+
ajc '1.8.10' // default value
9090
9191
/* @see Ext plugin config **/
92-
includeAllJars false
93-
includeJar 'design', 'support-v4', 'dagger'
94-
extendClasspath true
92+
includeAllJars false // default value
93+
includeJar 'design', 'support-v4', 'dagger' // default is empty
94+
excludeJar 'support-v7', 'joda' // default is empty
95+
extendClasspath true // default value
9596
96-
includeAspectsFromJar 'my-aj-logger-lib', 'any-other-libs-with-aspects'
97+
includeAspectsFromJar 'my-aj-logger-lib', 'any-other-libs-with-aspects' // default is empty
9798
ajcArgs << '-referenceInfo' << '-warn:deprecation'
9899
99-
weaveInfo true
100-
debugInfo false
101-
addSerialVersionUID false
102-
noInlineAround false
103-
ignoreErrors false
100+
weaveInfo true // default value
101+
debugInfo false // default value
102+
addSerialVersionUID false // default value
103+
noInlineAround false // default value
104+
ignoreErrors false // default value
104105
105-
breakOnError true
106-
experimental false
106+
breakOnError true // default value
107+
experimental false // default value
108+
buildTimeLog true // default value
107109
108-
transformLogFile 'ajc-transform.log'
109-
compilationLogFile 'ajc-compile.log'
110+
transformLogFile 'ajc-transform.log' // default value
111+
compilationLogFile 'ajc-compile.log' // default value
110112
}
111113
```
114+
Note that you may not include all these options!
112115

113116
All the extension parameters are have default values (all of them are described above, except of includeJar/Aspects/ajcArgs options).
114117
So no need to define them manually.
@@ -118,6 +121,7 @@ So no need to define them manually.
118121

119122
- `includeAllJars` Explicitly include all available jar-files into -inpath to proceed by AJ-compiler
120123
- `includeJar` Name filter to include any jar/aar which name or path satisfies the filter
124+
- `excludeJar` Name filter to exclude any jar/aar which name or path satisfies the filter
121125
- `includeAspectsFromJar` Name filter to include any jar/aar with compiled binary aspects you wanna affect your project
122126
- `ajcExtraArgs` Additional parameters for aspectj compiler
123127

@@ -130,10 +134,12 @@ So no need to define them manually.
130134
- `breakOnError` Allows to continue project building when ajc fails or throws any errors
131135
- `experimental` Enables experimental ajc options: `-XhasMember` and `-Xjoinpoints:synchronization,arrayconstruction`. More details in <a href="https://github.com/Archinamon/GradleAspectJ-Android/issues/18" target="_blank">issue #18</a>
132136

137+
- `buildTimeLog` Appends a BuildTimeListener to current module that prints time spent for every task in build flow, granularity in millis
138+
133139
- `transformLogFile` Defines name for the log file where all Aj compiler info writes to, new separated for Transformer
134140
- `compilationLogFile` Defines name for the log file where all Aj compiler info writes to, new separated for CompileTask
135141

136-
Ext plugin config
142+
Extended plugin config
137143
-----------------
138144
```groovy
139145
apply plugin: 'com.archinamon.aspectj-ext'
@@ -147,6 +153,19 @@ Ext config:
147153
Currently it has some limitations:
148154
- `InstantRun` must be switched off (Plugin detects IR status and fails build if IR will be found).
149155

156+
Provider plugin config
157+
-----------------
158+
```groovy
159+
apply plugin: 'com.archinamon.aspectj-provides'
160+
```
161+
162+
Plugin-provider may be useful for that cases when you need to extract aspect-sources into separate module and include it on demand to that modules where you only need it.
163+
Therefor this behavior will save you build-time due to bypassing aspectj-transformers in provide-only modules.
164+
165+
You ain't limited to describe as much provider-modules as you need and then include them using `includeAspectsFromJar` parameter in the module which code or dependencies you may want to augment.
166+
167+
With <a href="https://github.com/Archinamon/AspectJExampleAndroid" target="_blank">example project</a> you could learn how to write such provider-module.
168+
150169
Working tests
151170
-------
152171
```groovy
@@ -182,6 +201,18 @@ So concrete rule is:
182201

183202
Changelog
184203
---------
204+
#### 3.1.1 -- Useful improvements
205+
* added an extension trigger to append BuildTime logger for current module;
206+
* back from grave — added exclude-filter for `aspectj-ext` plugin;
207+
208+
#### 3.1.0 -- Provider
209+
* implemented `provides` plugin split to effectively extract aspects to external/sub modules;
210+
* small code improvements and cleanups;
211+
212+
#### 3.0.3 -- Minor fixes
213+
* fixed aar detecting mechanism;
214+
* registered plugin in mavenCentral!
215+
185216
#### 3.0.0 -- Grand refactoring in Kotlin
186217
* all groovy classes was obsolete;
187218
* new code-base in Kotlin 1.1.1 stable;

android-gradle-aspectj/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies {
3939
}
4040

4141
group = 'com.archinamon'
42-
version = '3.1.0'
42+
version = '3.1.1'
4343

4444
task sourcesJar(type: Jar, dependsOn: classes) {
4545
classifier = 'sources'

0 commit comments

Comments
 (0)