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

SmithyExtension options are not correctly modeled as task inputs #72

Closed
rschmitt opened this issue Mar 8, 2023 · 2 comments
Closed

Comments

@rschmitt
Copy link
Contributor

rschmitt commented Mar 8, 2023

The SmithyBuildJar task runs the following code at execution time (i.e. in SmithyBuildJar::execute):

        // Merge or overwrite?
        if (smithyBuildConfigs == null) {
            setSmithyBuildConfigs(extension.getSmithyBuildConfigs());
            getLogger().debug("Setting SmithyBuildJar smithyBuildConfigs from extension: {}", smithyBuildConfigs);
        }

This is effectively an unmodeled task input and is therefore incorrect. It can cause Gradle to skip this task entirely, or to fail to evaluate a lazy file collection provided to the extension as an input. To fix this, you either have to share the same FileCollection instance between SmithyExtension and SmithyBuildJar, or you have to return both instances as @InputFiles from SmithyBuildJar.

@brandondahler
Copy link
Contributor

Encountered a situation where this specifically impacted me, was able to work around it via:

tasks {
  smithyBuildJar {
    smithyBuildConfigs = smithy.smithyBuildConfigs
  }
}

brandondahler pushed a commit to brandondahler/smithy-gradle-plugin that referenced this issue Apr 6, 2023
Configures the tasks to have their first configuration action
to be copying the value from the extension to the task.
brandondahler pushed a commit to brandondahler/smithy-gradle-plugin that referenced this issue Apr 6, 2023
Configures the tasks to have their first configuration action
to be copying the value from the extension to the task.
hpmellema pushed a commit that referenced this issue Apr 12, 2023
Configures the tasks to have their first configuration action
to be copying the value from the extension to the task.

Co-authored-by: Brandon Dahler <bnd@amazon.com>
@hpmellema
Copy link
Contributor

hpmellema commented Aug 23, 2023

The 0.8.0 release to has updated plugin tasks correctly model task inputs.
If you find there are still issues when testing out this new release please feel free to re-open this ticket.

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

3 participants