An Android gradle plugin to transform classes via javassist.
The logo of morpheus is a painting by H Homampour. We use this logo with his kind and generous permission.
Morpheus can be used in 2 different ways :
- to use a Javassist based class(es) transformer(s) via a gradle DSL
- to create a new gradle plugin to apply to an Android project.
Add morpheus to your build.gradle
file:
apply plugin: 'morpheus'
Then configure morpheus to use one or multiple ClassTransformer
:
android {
...
}
import foo.MyTransformer
morpheus {
transformers = new MyTransformer()
}
Morpheus will then add a few tasks to your gradle android app (or lib) automatically :
gradle tasks --all
transformMyTransformerDebug
copyTransformedMyTransformerDebug
...
All variants of the build are enhanced to apply the transformations.
This repo contains an example to invoke a class transformer to an android projet.
Here are some examples of android gradle plugins based on morpheus :
- LogLifeCycle to log the life cycle of annotated activities, fragments, etc..
- InjectView to automatically inject views and fragments into activities, fragments, views, place holder, etc. Works a la RoboGuice.
It is related to :
Copyright (C) 2014 Stéphane NICOLAS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.