JakeWharton / hugo

Annotation-triggered method call logging for your debug builds.
Apache License 2.0
7.92k stars 797 forks source link

- #85

Open ghost opened 9 years ago

ghost commented 9 years ago

-

mastimela commented 8 years ago

I am getting the same issue. It will be nice to have support for AAR dependencies

sperzion commented 8 years ago

I don't think it would, because Hugo is disabled for release builds. Library projects are built in release mode by default unless you explicitly set them not to.

That said, I set up my library project to produce debug builds, and Hugo still isn't working for me. I even forked Hugo locally and removed the bit of the code in the plugin to disable Hugo in non-debug builds, but it still didn't work.

fangzhzh commented 8 years ago

@sperzion remove "debugCompile 'com.jakewharton.hugo:hugo-runtime:1.2.2XXX" in hugo-plugin/src/main/groovy/hugo/weaving/plugin/HugoPlugin.groovy publish the plugin into your local maven repo.

and added releaseCompile 'com.jakewharton.hugo:hugo-runtime:1.2.2.X-XXX' in your library build.gradle

sperzion commented 8 years ago

@fangzhzh Unfortunately, I was unable to get that to work. I added "compile 'com.jakewharton.hugo:hugo-runtime:1.2.2-SNAPSHOT' to my library project instead of releaseCompile, just to avoid any confusion. Still no output from the library. One thing to note is that it also no longer works for the normal app module.

One additional thing I did was also remove the block of code in the variants.all closure that skips the javaCompile stuff. By all accounts, this should work, but for whatever reason, it just doesn't.

I imagine that's what motivated others to seek other solutions (i.e. https://github.com/promeG/XLog).

fangzhzh commented 8 years ago

@sperzion https://github.com/fangzhzh/hugo/commit/4577489f3bd1cc724826020d8c326a90f95e137c check this commit, I managed to enable hugo library to debug and internal, and disable it to release.

One thing don't forget is that after every local library publish, you need to clear local library cache for you application or library which uses hugo library.

    cd $HOME/.gralde && find . -name "\*hugo\*" -exec rm {}\;
sperzion commented 8 years ago

Thanks for your help, @fangzhzh . I finally managed to find out what was going wrong. It actually had nothing to do with the edits on the Hugo side, but rather the fact that I was using an older version of retrolambda in the library project that was also using Hugo. Updating to the latest version of retrolambda (3.2.4 is what I ended up on) fixed the issue. I'm seeing output from my library project now.

tryprasannan commented 8 years ago

Without any changes to hugo, you can force gradle to build debug version of app with debug version of a library project/AAR with following changes to the app's and the library's build.gradle

Available as a gist here

app/build.gradle

dependencies {
    releaseCompile project(path: ':library_module', configuration: 'release') 
    debugCompile project(path: ':library_module', configuration: 'debug') 
}

library/build.gradle

android {
    compileSdkVersion 23
    //...
    publishNonDefault true
}