Skip to content

Support lazy property evaluation (appengine.stage.setArtifact() doesn't carry task dependencies) #999

@martinbonnin

Description

@martinbonnin

The follow Gradle configuration:

val myTask = tasks.register("myTask", Jar::class.java) {
  archiveBaseName.set("myJar")
}
appengine {
  stage {
    setArtifact(myTask.flatMap { it.archiveFile })
  }
}

Fails with the below:

$ ./gradlew appengineDeploy
> Task :backend:service-import:appengineStage FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':appengineStage' (type 'StageAppYamlTask').
  - In plugin 'com.google.cloud.tools.gradle.appengine.appyaml.AppEngineAppYamlPlugin' type 'com.google.cloud.tools.gradle.appengine.appyaml.StageAppYamlTask' property 'stagingExtension.artifact' specifies file '/Users/mbonnin/git/[...]/build/libs/myJar.jar' which doesn't exist.
    
    Reason: An input file was expected to be present but it doesn't exist.

I would have expected the provider to call myTask as a dependency automatically as outlined in https://docs.gradle.org/current/userguide/lazy_configuration.html#lazy_properties.

Without this, one has to rely on manual dependency wiring

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions