• Stars
    star
    143
  • Rank 257,007 (Top 6 %)
  • Language
    Java
  • Created about 8 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android Library for Logging RxJava2 Components

Frodo 2 Build Status

Hex.pm Platform Platform Platform

Frodo 2 is the second version of Frodo, mainly used to make easier debugging projects where RxJava 2 is used. Just annotated your code and voilรก!

  • On Android projects (both Kotlin and Java): It is safe to persist any Frodo 2 annotation in the codebase since the code generator will ONLY work on debug versions of the application where the plugin is applied.

  • On pure Kotlin/Java projects: EXPERIMENTAL, you can keep the annotation in the source code but you have to manually enable/disable the code generation (check Enabling Frodo 2 section).

RxJava 2 building blocks supported:

  • Flowable<T>
  • Observable<T>
  • Single<T>
  • Maybe<T>
  • Completable

Check Main Features Section below for more details.

frodo_hug

Main Features

  • @RxLogFlowable: Annotated functions which return io.reactivex.Flowable<T> will print the following information on the log output:
@RxLogFlowable
Flowable<Integer> numbers() {
  return Flowable.just(1, 2, 3, 4);
}
Frodo2 => [@Flowable :: @InClass -> FlowableSamples :: @Method -> numbers()]
Frodo2 => [@Flowable#numbers -> onSubscribe()]
Frodo2 => [@Flowable#numbers -> onRequest() -> 9223372036854775807]
Frodo2 => [@Flowable#numbers -> onNext() -> 1]
Frodo2 => [@Flowable#numbers -> onNext() -> 2]
Frodo2 => [@Flowable#numbers -> onNext() -> 3]
Frodo2 => [@Flowable#numbers -> onNext() -> 4]
Frodo2 => [@Flowable#numbers -> onComplete()]
Frodo2 => [@Flowable#numbers -> onTerminate()]
Frodo2 => [@Flowable#numbers -> @Emitted -> 4 elements :: @Time -> 1 ms]
Frodo2 => [@Flowable#numbers -> @ObserveOn -> RxNewThreadScheduler-3]
  • @RxLogObservable: Annotated functions which return io.reactivex.Observable<T> will print the following information on the log output:
@RxLogObservable
Observable<String> strings() {
  return Observable.just("Hello", "My", "Name", "Is", "Fernando");
}
Frodo2 => [@Observable :: @InClass -> ObservableSamples :: @Method -> strings()]
Frodo2 => [@Observable#strings -> onSubscribe()]
Frodo2 => [@Observable#strings -> onNext() -> Hello]
Frodo2 => [@Observable#strings -> onNext() -> My]
Frodo2 => [@Observable#strings -> onNext() -> Name]
Frodo2 => [@Observable#strings -> onNext() -> Is]
Frodo2 => [@Observable#strings -> onNext() -> Fernando]
Frodo2 => [@Observable#strings -> onComplete()]
Frodo2 => [@Observable#strings -> onTerminate()]
Frodo2 => [@Observable#strings -> @Emitted -> 5 elements :: @Time -> 9 ms]
Frodo2 => [@Observable#strings -> @ObserveOn -> RxCachedThreadScheduler-1]
  • @RxLogSingle: Annotated functions which return io.reactivex.Single<T> will print the following information on the log output:
@RxLogSingle
Single<String> string() {
  return Single.just("My Value");
}
Frodo2 => [@Single :: @InClass -> SingleSamples :: @Method -> string()]
Frodo2 => [@Single#string -> onSubscribe()]
Frodo2 => [@Single#string -> onSuccess() -> My Value]
Frodo2 => [@Single#string -> @Emitted -> 1 element :: @Time -> 0 ms]
Frodo2 => [@Single#string -> @ObserveOn -> RxCachedThreadScheduler-1]
  • @RxLogMaybe: Annotated functions which return io.reactivex.Maybe<T> will print the following information on the log output:
@RxLogMaybe
Maybe<Integer> number() {
  return Maybe.just(1);
}
Frodo2 => [@Maybe :: @InClass -> MaybeSamples :: @Method -> number()]
Frodo2 => [@Maybe#number -> onSubscribe()]
Frodo2 => [@Maybe#number -> onSuccess() -> 1]
Frodo2 => [@Maybe#number -> @Emitted -> 1 element :: @Time -> 0 ms]
Frodo2 => [@Maybe#number -> @ObserveOn -> RxNewThreadScheduler-1]
  • @RxLogCompletable: Annotated functions which return io.reactivex.Completable will print the following information on the log output:
@RxLogCompletable
Completable doSomething() {
  return Completable.fromAction(new Action() {
    @Override public void run() throws Exception {
      Thread.sleep(1000);
    }
  });
}
Frodo2 => [@Completable :: @InClass -> CompletableSamples :: @Method -> doSomething()]
Frodo2 => [@Completable#doSomething -> onSubscribe()]
Frodo2 => [@Completable#doSomething -> onComplete()]
Frodo2 => [@Completable#doSomething -> @Emitted -> 0 elements :: @Time -> 1003 ms]

Enabling Frodo 2

To enable Frodo, a gradle plugin must be applied in your build.gradle:

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath "com.fernandocejas.frodo2:frodo2-plugin:$project.version"
  }
}

apply plugin: 'com.fernandocejas.frodo2'

//By default frodo2 is ON, although
//we can enable-disable it with this configuration.
frodo2 {
  enabled = true
}

Experimental

  • Frodo 2 works only on Android, Java and Kotlin* projects using Gradle as Build System.

  • In pure Java/Kotlin projects all the debug information will be display using System.out (NOT the case of Android which displays on the logcat). The idea for future versions is to be able to use different Loggers like Log4J or any other alternative for example.

  • Contributions are more than welcome.

Architecture Overview

It generates and weaves code based on annotations at compile time. This code is injected using Aspect Oriented Programming with AspectJ.

For more details please check these articles where there is a deeper explanation with implementation details:

aspectweaving

Known issues

1 - Limitation: Frodo 1 has the ability to detect @SubscribeOn thread but RxJava 2 does not offer any way to grab this information so only @ObserveOn thread information is displayed at the moment.

2 - On Android: Multi module setup (application + android library) will not log annotated methods/classes from Android Library Module but will do it on Android Application Module. The reason behind this, is that the Android Gradle Plugin will build all Android Libraries as release versions, for instance, Frodo is not able to weave any code on the annotated methods/classes (Remember that only weaves in debug versions). There is a workaround for forcing debug versions of your Android Libraries (just be careful in case this is forgotten and you end up shipping a version of your app with RxJava Logging enabled) by adding this line in your build.gradle file:

android {
  defaultPublishConfig "debug"
}

Local Development

Clone the repo and use the scripts listed below in order to to run/install/execute frodo 2 locally:

  • ./install_frodo2.sh - One time execution command for installing frodo library and dependencies.
  • ./run_frodo2_android.sh - Compiles frodo2 and run the android sample application.
  • ./run_frodo2_java - Compiles frodo2 and run the java sample application.
  • ./gradlew runUnitTests - Execute all unit tests in the project.

Contribution

Here you can download and install the java codestyle. https://github.com/android10/java-code-styles

License

Copyright 2018 Fernando Cejas

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.

http://www.fernandocejas.com

More Repositories

1

Android-CleanArchitecture

This is a sample app that is part of a series of blog posts I have written about how to architect an android application using Uncle Bob's clean architecture approach.
Java
15,521
star
2

Android-CleanArchitecture-Kotlin

This is a movies sample app in Kotlin, which is part of a serie of blog posts I have written about architecting android application using different approaches.
Kotlin
4,686
star
3

frodo

Android Library for Logging RxJava Observables and Subscribers.
Java
1,475
star
4

arrow

Arrow is Lightweight library toolbox for Java and Android Development.
Java
440
star
5

Android-AOPExample

This is a simple example of Aspect Oriented Programming in Android
Java
421
star
6

Android-ReactiveProgramming

This is a sample app that is part of a serie of blog posts I will be writting about experiences with Reactive Programming on Android
Java
225
star
7

Android-KotlinInTests

This is a sample app that is part of blog posts I have written about how to test android applications using Kotlin.
Java
89
star
8

android-trinity

android-trinity is tiny proactive framework with much of the scaffolding code required to start a new Android Application.
Kotlin
54
star
9

Inside_Android_Testing

This are android testing samples for the talk: How ANDROID TESTING changed how we think about Death
Java
53
star
10

Kotlin-Cracking-The-Engineer-Interview

WIP
Kotlin
41
star
11

Multi-Threading-Samples

WIP
Kotlin
41
star
12

engineering-leadership

Repository with all types of content related to engineering leadership.
40
star
13

DynamicProxy_Java_Sample

This is an example written in Java that demonstrates how to implement a simple dynamic proxy for intercepting method calls.
Java
34
star
14

Kotlin-Everywhere

Kotrlin Programming Language Cross-Platform Development which includes Android, iOS and Backend. Pretty much everwhere.
Kotlin
31
star
15

nfc_android_sample

[DEPRECATED] This is a sample app that demonstrates how to work with android and NFC technology
Java
26
star
16

Rust-Cross-Platform-Development

Rust Programming Language Cross-Platform Development which includes Mobile, Web, CLI and Desktop.
Rust
26
star
17

Cognitive-Samples

This is meant to be a repository with examples of cognitive computing brought to the android platform
Kotlin
23
star
18

Workshop-Android-Chatbot

Code scaffolding in order to build a Pizza Delivery Chatbot.
Kotlin
22
star
19

Fast-Food-Reality

[DEPRECATED] An Augmented Reality Fast Food Restaurant Finder Application for Android
Java
22
star
20

RaspberryPi-Wireguard

WireGuard is an interesting new VPN protocol that has the potential to bring major change to the VPN industry. In comparison to existing VPN protocols, such as OpenVPN and IPSec, WireGuard may offer faster speeds and better reliability with new and improved encryption standards. This repository aims to help with the installation of Wireguard, tested on a Raspberry Pi 3 B.
18
star
21

legacy-android10.github.io

Legacy Jekyll project for my personal blog: fernandocejas.com.
HTML
16
star
22

sketches

These are technical sketches related to Software engineering: architecture, projects, workflows
14
star
23

Android-FeatureFlags

Simple Feature Flags Framework for Android
Kotlin
13
star
24

two-daggers

This is a sample app that is part of a blog post I have written about how Dagger 1 and Dagger 2 can live together in order to facilitate a potential gradual migration process in big codebases with many contributors.
Java
12
star
25

MyResumeAndroidApp

[DEPRECATED] This application is basically an Android "my Resume" App. Used mainly for CV as an example.
Java
12
star
26

Android-AnnotationsSample

Java
11
star
27

java-code-examples

A java command line application with code samples
Java
11
star
28

Presentations

Presentations at conferences
8
star
29

Sample-Data

Sample data for sample applications
CSS
7
star
30

linux.github.io

Linux how to, guides, recipes, tips and tricks, troubleshooting, etc
CSS
7
star
31

AndroidApplicationTestingSample

[DEPRECATED] Android application sample using junit, roboelectric and mockito for testing it
Java
6
star
32

arch-linux-utils

Arch Linux utils which include scripts, tips and tricks to facilitate your linux user life :)
Shell
5
star
33

android10

My github public profile page
5
star
34

Inside_Android_ListView

[DEPRECATED]
Java
5
star
35

Frontend-Architecture-Modular-Monolith

This is a movies sample app in Typescript using Vue, React and Angular. It aims to demonstrate how to architect frontends using a modular monolith approach as inspiration, for a later evolution to micro-frontends
Vue
5
star
36

Rust-Proactive-Learning

Just a personal Rust Playground to play around and understand the language.
Rust
4
star
37

doggy

Your friendly command line utility tool (WIP)
Rust
4
star
38

Docker-Examples

Repository with docker images examples. https://www.docker.com/
Dockerfile
4
star
39

gandalf

Gandalf --> Refer to Frodo: https://github.com/android10/frodo
Java
4
star
40

ktor-rest-api-docker-bootstrap

Scaffolding for a REST Api using Ktor Framework. Already dockerized.
Kotlin
3
star
41

Javascript-Samples

Javascript learning samples using either plain javascript or different frameworks
HTML
3
star
42

ktor-dockerizer

Gradle Plugin that facilitates docker integration when using gradle as a build system.
Kotlin
3
star
43

Kotlin-Playground

Just a console application used as a playground for trying Kotlin stuff out: new features, experiments, etc
Kotlin
2
star
44

learning-web-development

Vue
2
star
45

Scala_ExercisesAndPractices

Playing around some scala exercises.
Scala
2
star
46

Typescript-Playground

TypeScript
1
star
47

aragorn

Test project for playing around annotation processor in Java
Java
1
star
48

Linux

Linux automation scripts, tutorials, documentation and more...
Python
1
star
49

Instapixel

This is complete project which demonstrates how to architecture a modern application which includes a serverless backand plus android and web client.
Scala
1
star