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

Fixes Issue 33 - 'RegularFileProperty' annotated with @Input cannot determine how to interpret the file #46

Merged
1 commit merged into from
Jun 6, 2024

Conversation

ivanalvarado
Copy link
Contributor

Description

* What went wrong:
A problem was found with the configuration of task ':clearFocus' (type 'ClearFocusTask').
  - Type 'com.dropbox.focus.ClearFocusTask' property 'focusFile' has @Input annotation used on property of type 'RegularFileProperty'.
    
    Reason: A property of type 'RegularFileProperty' annotated with @Input cannot determine how to interpret the file.
    
    Possible solutions:
      1. Annotate with @InputFile for regular files.
      2. Annotate with @InputFiles for collections of files.
      3. If you want to track the path, return File.absolutePath as a String and keep @Input.
    
    For more information, please refer to https://docs.gradle.org/8.5/userguide/validation_problems.html#incorrect_use_of_input_annotation in the Gradle documentation.

Build Stack

  • AGP 8.1.1
  • Kotlin 1.9.20
  • Gradle 8.5
  • focus 0.5.1

@CLAassistant
Copy link

CLAassistant commented May 17, 2024

CLA assistant check
All committers have signed the CLA.

import org.gradle.api.tasks.TaskAction

@CacheableTask
public abstract class ClearFocusTask : DefaultTask() {

@get:Input
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:InputFile
Copy link
Contributor Author

@ivanalvarado ivanalvarado May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addresses:

* What went wrong:
A problem was found with the configuration of task ':clearFocus' (type 'ClearFocusTask').
  - Type 'com.dropbox.focus.ClearFocusTask' property 'focusFile' has @Input annotation used on property of type 'RegularFileProperty'.
    
    Reason: A property of type 'RegularFileProperty' annotated with @Input cannot determine how to interpret the file.
    
    Possible solutions:
      1. Annotate with @InputFile for regular files.
      2. Annotate with @InputFiles for collections of files.
      3. If you want to track the path, return File.absolutePath as a String and keep @Input.
    
    For more information, please refer to https://docs.gradle.org/8.5/userguide/validation_problems.html#incorrect_use_of_input_annotation in the Gradle documentation.

import org.gradle.api.tasks.TaskAction

@CacheableTask
public abstract class ClearFocusTask : DefaultTask() {

@get:Input
@get:PathSensitive(PathSensitivity.RELATIVE)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addresses:

* What went wrong:
Some problems were found with the configuration of task ':clearFocus' (type 'ClearFocusTask').
  - Type 'com.dropbox.focus.ClearFocusTask' property 'focusFile' is annotated with @InputFile but missing a normalization strategy.
    
    Reason: If you don't declare the normalization, outputs can't be re-used between machines or locations on the same machine, therefore caching efficiency drops significantly.
    
    Possible solution: Declare the normalization strategy by annotating the property with either @PathSensitive, @Classpath or @CompileClasspath.
    
    For more information, please refer to https://docs.gradle.org/8.5/userguide/validation_problems.html#missing_normalization_annotation in the Gradle documentation.

https://github.com/gradle/gradle/blob/master/subprojects/core-api/src/main/java/org/gradle/api/tasks/PathSensitivity.java#L50

@ivanalvarado
Copy link
Contributor Author

This is already addressed here: #42

@nsk90
Copy link

nsk90 commented Jun 5, 2024

@ivanalvarado Hi!, why have you closed the PR? the project seems to be abandoned?

@rharter
Copy link
Collaborator

rharter commented Jun 6, 2024

Sorry, this got closed. I'm going to reopen it and pull this in, as it's a good fix and the other PR has been in draft, which is why it hasn't been reviewed.

@rharter rharter reopened this Jun 6, 2024
@rharter rharter closed this pull request by merging all changes into dropbox:main in 1e584e9 Jun 6, 2024
@WhosNickDoglio
Copy link

Sorry that's my fault for not explainig why #42 was stuck in draft and asking for help with the issue I was running into.

I ended up running into this since the .focus file isn't guaranteed to exist or not. I couldn't get any of the workarounds to work in the linked to issue and was going to explore disabling caching for the ClearFocusTask but never got around to it.

The test that was failing in my branch is now failing in main after merging this in

@rharter
Copy link
Collaborator

rharter commented Jun 8, 2024

Sorry @WhosNickDoglio, I appreciate your contribution. I noticed the same issue you pointed out after merging, and have that fixed now. There's a new release which has this taken care of. Thanks to both of you for contributing to the project.

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 this pull request may close these issues.

Gradle 8.0 - clearFocus - ClearFocusTask error
5 participants