Skip to content

stephanenicolas/morpheus

Repository files navigation

Morpheus Maven Central

An Android gradle plugin to transform classes via javassist.

Credits

The logo of morpheus is a painting by H Homampour. 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:

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.

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 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.

Related projects

It is related to :

CI

Travis Build Coverage Status

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.

About

An Android gradle plugin to transform classes via javassist.

Resources

License

Stars

Watchers

Forks

Packages

No packages published