Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin uses stale outputFile #40

Closed
eleventigers opened this issue Jan 12, 2016 · 6 comments
Closed

Plugin uses stale outputFile #40

eleventigers opened this issue Jan 12, 2016 · 6 comments

Comments

@eleventigers
Copy link

Since 0.3.1 (more specifically commit) the outputFile that gets used to report dexcount will be stale if user rewrites apk name with applicationVariants.all { variant -> ... } logic.

@benjamin-bader
Copy link
Collaborator

Interesting. I was wondering if we'd see problems from that commit - I guess we do! Thanks for reporting.

Can you please post a build script and commandline invocation that reproduces the problem? I'm pretty sure that I've used this kind of apk name rewriting without having this problem in the past, and haven't been able to reproduce it.

@benjamin-bader
Copy link
Collaborator

Seems to be identical to issue #46, which I can reproduce and confirm.

benjamin-bader added a commit to benjamin-bader/dexcount-gradle-plugin that referenced this issue Jan 26, 2016
This fixes a bug wherein the dexcount task fails if the variant's output
is renamed after the dexcount plugin is applied and prior to task execution.

This also opts dexcount out of Gradle's incremental compilation cache.  The
proximate cause of this bug is that we're holding a stale `java.io.File`
object; the cure is to instead hold a reference to the variant's output.
This doesn't work with incremental compliation, because variant output
implementations aren't `Serializable` (noted in KeepSafe#32), and Gradle depends
on task state being serializable.  This mismatch means that dexcount will
appear to randomly crash.

The least-bad solution is to just remove the task-input annotation, and
run the count task every time.  Not great, but better than not working.

Fixes KeepSafe#40 and KeepSafe#46.
@benjamin-bader
Copy link
Collaborator

I think this is fixed in the latest snapshot build; would you please try again using 0.4.1-SNAPSHOT and confirm?

@eleventigers
Copy link
Author

Hey @benjamin-bader the 0.4.1-SNAPSHOT seems to work fine for me ;]

@benjamin-bader
Copy link
Collaborator

Awesome, thanks!

@benjamin-bader
Copy link
Collaborator

FYI, version 0.4.1 (including this bugfix) is now available in Maven Central, or it will be in an hour or two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants