appengine-plugins icon indicating copy to clipboard operation
appengine-plugins copied to clipboard

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

Open martinbonnin opened this issue 1 year ago • 5 comments

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

martinbonnin avatar Sep 04 '22 21:09 martinbonnin