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

With configPath, Gradle uses task without declaring an explicit or implicit dependency #936

Closed
7 tasks done
blundell opened this issue Nov 19, 2023 · 8 comments · Fixed by #948
Closed
7 tasks done
Assignees

Comments

@blundell
Copy link
Contributor

blundell commented Nov 19, 2023

About this issue

I have an app that uses config path:

aboutLibraries {
    configPath = "my-module"
}

Gradle doesn't seem to like that, (if I delete the above config, the error goes away)

1: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':app:prepareLibraryDefinitionsDebug' (type 'AboutLibrariesTask').
  - Gradle detected a problem with the following location: '/Users/blundell/dev/my-app/my-module'.
    
    Reason: Task ':app:prepareLibraryDefinitionsDebug' uses this output of task ':my-module:generateDebugResValues' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':my-module:generateDebugResValues' as an input of ':app:prepareLibraryDefinitionsDebug'.
      2. Declare an explicit dependency on ':my-module:generateDebugResValues' from ':app:prepareLibraryDefinitionsDebug' using Task#dependsOn.
      3. Declare an explicit dependency on ':my-module:generateDebugResValues' from ':app:prepareLibraryDefinitionsDebug' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.4/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

This is a warning when AGP < 8, but build fails > 8.


One change I attempted was moving the configPath configuration to the my-module but the same error occurs with the error changing to be just that modules tasks.

1: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':my-module:prepareLibraryDefinitionsDebug' (type 'AboutLibrariesTask').
  - Gradle detected a problem with the following location: '/Users/blundell/dev/my-app/my-module'.
    
    Reason: Task ':my-module:prepareLibraryDefinitionsDebug' uses this output of task ':my-module:generateDebugResValues' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':my-module:generateDebugResValues' as an input of ':my-module:prepareLibraryDefinitionsDebug'.
      2. Declare an explicit dependency on ':my-module:generateDebugResValues' from ':my-module:prepareLibraryDefinitionsDebug' using Task#dependsOn.
      3. Declare an explicit dependency on ':my-module:generateDebugResValues' from ':my-module:prepareLibraryDefinitionsDebug' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.4/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

Details

  •  Used library version 10.9.2
  •  Used gradle build tools version 8.1.3

Checklist

@mikepenz
Copy link
Owner

Thank you for the report @blundell

Is this something you can also reproduce in the sample app?
We use the configPath there too, and it does not seem to show the same behavior: https://github.com/mikepenz/AboutLibraries/blob/develop/app/build.gradle#L92

@mikepenz mikepenz self-assigned this Nov 22, 2023
@blundell
Copy link
Contributor Author

Hmm thanks let me see if I can!

Repository owner deleted a comment from enimamms Nov 24, 2023
Repository owner deleted a comment from enimamms Nov 24, 2023
@blundell
Copy link
Contributor Author

blundell commented Jan 2, 2024

Finally got round to this @mikepenz (Happy New Year!), sorry for the delay! :-)

Here is the error message being reproduced in your sample app: https://scans.gradle.com/s/5t6xzwhjzmxwo

Reason: 
Task ':app:prepareLibraryDefinitionsDebug' uses this output of task ':aboutlibraries:packageDebugResources' without declaring an explicit or implicit dependency. 
This can lead to incorrect results being produced, depending on what order the tasks are executed.

These are the only changes I made:

image

I made the :app module use the :aboutlibraries module (folder) as the source for the json files.

@mikepenz
Copy link
Owner

mikepenz commented Jan 4, 2024

Happy new year to you too! I'll try to come back to this as soon as possible. Thank you!

@mikepenz
Copy link
Owner

mikepenz commented Jan 6, 2024

I had a chance to look into this. So it seems the problem is because the aboutlibraries folder itself gets modified by tasks prior to the generation of the libs. (given it includes the build folder)

If you modify the location to something like aboutlibraries/configs then the problem will also go away.

Screenshot 2024-01-06 at 09 47 30

I am not sure if this is something the plugin needs to handle 🤔

Can you perhaps explain more, if you need to have the libraries and licenses in the root of the module instead of in a folder within your module?

@blundell
Copy link
Contributor Author

blundell commented Jan 6, 2024

Thanks for finding the time.

Can you perhaps explain more ... [why they are] in the root of the module instead of in a folder within your module?

It's an inherited legacy project, so I don't have an answer sorry :-)

However there is nothing blocking me from creating a new configs subfolder so that's a good workaround fix 👍

Thanks for the help! At least you know now if someone else raises it, perhaps a really small footnote in the documentation, but it now seems a very small edge case!

@blundell
Copy link
Contributor Author

blundell commented Jan 6, 2024

(Confirmed, making a subfolder under the project folder in the original project that had this issue, fixed the problem / stopped gradle raising a warning 👍 )

aboutLibraries {
    configPath = "my-module/configs"
}

@mikepenz
Copy link
Owner

mikepenz commented Jan 6, 2024

You are welcome!

Thank you very much for confirming!

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

Successfully merging a pull request may close this issue.

2 participants