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

Building an app that has this applied and using --debug can lead to failures #169

Closed
1 task done
autonomousapps opened this issue Feb 8, 2019 · 4 comments
Closed
1 task done

Comments

@autonomousapps
Copy link
Contributor

What kind of issue is this?

  • Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests
    get fixed. See here
    for some example tests.

I have a reproducible sample project, with instructions, here. To summarize it, ./gradlew :app:assembleDebug succeeds, but ./gradlew clean && ./gradlew :app:assembleDebug --debug fails with a weird error. Even though I'm only requesting the debug variant, the plugin is trying to resolve the debugUnitTest variant, which it should not be doing.

When I asked someone at Gradle about it (thinking it a Gradle bug due to the --debug connection), they said:

Most likely a logging message is issued with a configuration as a parameter. Something like:

logger.debug("hi there {}", configurations.myConf.incoming.files)

Any ideas on where this is coming from?

@autonomousapps
Copy link
Contributor Author

I would be willing to take a look at creating a PR for this, but I don't even know where to start with respect to finding the root cause. Any pointers?

@AndrewReitz
Copy link
Collaborator

@autonomousapps I guess I would search the code for debug log messages and see ones that are logging files. I'm pretty sure there are a few in the GroovyAndroidPlugin. The easiest way to test would be to create something in the GroovyAndroidPluginSpec that replicates the issue, that way you can attach the debugger.

@autonomousapps
Copy link
Contributor Author

Ok, I'm thinking it's basically

log.debug('groovy sources for {}: {}', variantName, groovyTask.source.files)
// or
log.debug('Groovy classpath: {}', groovyTask.classpath.files)

@autonomousapps
Copy link
Contributor Author

Cool, definitely

log.debug('Groovy classpath: {}', groovyTask.classpath.files)

I have a test case that proves my change passes. Will probably submit PR tomorrow.

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