Skip to content

nugetPack.basePath incorrect annotated as a file #88

@pklima

Description

@pklima

Hello!

In Gradle 7.3.3, providing a directory path to nugetPack.basePath:

plugins {
    id 'com.ullink.nuget' version '2.23'
}

nugetPack {
    basePath = new File(projectDir, 'ThisIsADirectory')
}

...results in an error when nugetPack task is run:

> Task :nugetPack FAILED
:nugetPack (Thread[Execution worker for ':',5,main]) completed. Took 0.002 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':nugetPack' (type 'NuGetPack').
  - In plugin 'nuget-base' type 'com.ullink.NuGetPack' property 'basePath' specifies file 'W:\Repositories\gradle-plugins\gradle-test\ThisIsADirectory' which doesn't exist.

    Reason: An input file was expected to be present but it doesn't exist.

    Possible solutions:
      1. Make sure the file exists before the task is called.
      2. Make sure that the task which produces the file is declared as an input.

    Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#input_file_does_not_exist for more details about this problem.

Looking at the source, this is because the property is annotated as @InputFile which is incorrect in this case.

Changing it to @InputDirectory would fix the error, but then the contents of the directory would be considered for determining whether the task is up-to-date which in this case doesn't make sense, so this should just be @Input instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions