GoogleCloudPlatform / GoogleCloudPlatform/appengine-plugins

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

Open
#999 5 comments 0 reactions 0 assignees View on GitHub
enhancement p3
Dominant language
Java
Stars
47
Forks
27
PR merge metrics
No merged PRs in 30d

Description

The follow Gradle configuration:

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

Fails with the below:

```kotlin
$ ./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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.