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

Not support renamed output file #46

Closed
msdx opened this issue Jan 25, 2016 · 7 comments
Closed

Not support renamed output file #46

msdx opened this issue Jan 25, 2016 · 7 comments

Comments

@msdx
Copy link

msdx commented Jan 25, 2016

Build failed if I rename the output file like this:

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def file = output.outputFile
            def name = "xxx" + variant.name + "-v" + defaultConfig.versionName + ".apk";
            output.outputFile = new File(file.parent, name)
        }
    }

log:

Execution failed for task ':app:assembleDevelopDebug'.
> /workspace/project/park-here-android/app/build/outputs/apk/app-Develop-debug.apk (没有那个文件或目录)
@benjamin-bader
Copy link
Collaborator

Thanks for the report. It seems like this is caused by #32, and we'll need to think harder about how to fix this.

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?

@msdx
Copy link
Author

msdx commented Jan 27, 2016

@benjamin-bader I'd like to. Has this version be published?

@benjamin-bader
Copy link
Collaborator

Yes; it has been published to Sonatype's snapshot repo. Instructions for using snapshots are in the readme, let me know if you need help. I'd like to confirm that this fixes the issue before making a final release.

@msdx
Copy link
Author

msdx commented Jan 28, 2016

@benjamin-bader It works. ^_^

@benjamin-bader
Copy link
Collaborator

Nice! Thank you!

@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