DroidCook is a bytecode manipulation library for injecting android boilerplate code. How it works:
- Annotate classes, methods, and fields.
- During post-compile of a build (before conversion to dex format), annotations will be read from compiled java classes and be used to inject boilerplate into the class file.
Currently ANT only. Jars are not yet being provided.
$ git clone [email protected]:thesmythgroup/DroidCook.git
$ cd DroidCook
$ ant -Dp=/home/user/workspace/projectroot installImport the cook_rules.xml now located in your project root.
Test the project build:
$ cd $PROJECT
$ ant debugInspect the -post-compile output which should show class transformations that have occured.
$ git clone [email protected]:thesmythgroup/DroidCook.git
$ cd DroidCook
$ ant asm apiThis builds two jars, droidcook.jar and droidcook-api.jar. The first is the bytecode transformer that should run during -post-compile. The second provides the annotations api and should be included in an android project like any other library.
Copy the assets to android project:
$ mkdir $PROJECT/compile-libs
$ cp bin/DroidCook.jar $PROJECT/compile-libs/
$ cp bin/DroidCook-api.jar $PROJECT/libs/
$ cp cook_rules.xml $PROJECTFinally, update the project's custom_rules.xml to include cook_rules.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="imported" default="help">
<import file="cook_rules.xml" />
</project>For now, have a look at:
https://github.com/thesmythgroup/DroidCook/blob/master/src/org/tsg/android/api/Annotations.java
Quick list of differences for similar projects.
- Requires extending the library's classes
- Performs work during runtime via reflection
- Generates raw source code before compiling that extends an app's current activities
- Requires one to reference the generated classes with an underscore suffix throughout the app and manifest