https://github.com/stephanenicolas/morpheus
An Android gradle plugin to transform classes via javassist.
https://github.com/stephanenicolas/morpheus
Last synced: 10 months ago
JSON representation
An Android gradle plugin to transform classes via javassist.
- Host: GitHub
- URL: https://github.com/stephanenicolas/morpheus
- Owner: stephanenicolas
- License: apache-2.0
- Created: 2014-08-19T19:46:35.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-06-26T15:28:32.000Z (over 8 years ago)
- Last Synced: 2025-03-18T10:21:18.590Z (10 months ago)
- Language: Java
- Homepage:
- Size: 1.26 MB
- Stars: 80
- Watchers: 3
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Morpheus [](https://maven-badges.herokuapp.com/maven-central/com.github.stephanenicolas.morpheus/morpheus-plugin)
========
An Android gradle plugin to transform classes via javassist.

### Credits
The logo of morpheus is a painting by [H Homampour](http://www.yessy.com/homampourarts/gallery.html?i=30994). We use this logo with his kind and generous permission.
### Usage
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.
### Use a Javassist based class(es) transformer(s)
Add morpheus to your `build.gradle` file:
```groovy
apply plugin: 'morpheus'
````
Then configure morpheus to use one or multiple [`ClassTransformer`](https://github.com/stephanenicolas/javassist-build-plugin-api/blob/master/src/main/java/javassist/build/IClassTransformer.java):
```groovy
android {
...
}
import foo.MyTransformer
morpheus {
transformers = new MyTransformer()
}
```
Morpheus will then add a few tasks to your gradle android app (or lib) automatically :
```bash
gradle tasks --all
transformMyTransformerDebug
copyTransformedMyTransformerDebug
...
```
All variants of the build are enhanced to apply the transformations.
### Example
This repo contains an example to invoke a class transformer to an android projet.
### Create a new gradle plugin to apply to an Android project.
Here are some examples of android gradle plugins based on morpheus :
* [LogLifeCycle](https://github.com/stephanenicolas/loglifecycle) to log the life cycle of annotated activities, fragments, etc..
* [InjectView](https://github.com/stephanenicolas/injectview) to automatically inject views and fragments into activities, fragments, views, place holder, etc. Works a la [RoboGuice](https://github.com/roboguice/roboguice).
### Related projects
It is related to :
* [javassist-build-plugin-api](https://github.com/stephanenicolas/javassist-build-plugin-api)
* [javassist-gradle-plugin](https://github.com/darylteo/javassist-gradle-plugin)
### CI
[](https://travis-ci.org/stephanenicolas/morpheus)
[](https://coveralls.io/r/stephanenicolas/morpheus)
License
-------
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.