extraDirectories.permissions broken in gradle kotlin
Environment:
- Jib version: 3.3.0
- Build tool: Gradle kotlin 7.4+
- OS: MacOS
Description of the issue:
Since version 3.3.0 extraDirectories.permissions cannot be assigned in Gradle kotlin. This change has removed the setter for the permissions property and thus build script compilation breaks in Kotlin with Val cannot be reassigned error message.
Expected behavior: Kotlin build script works similarly to Groovy examples.
Steps to reproduce: Try this gradle build file:
plugins {
java
id("com.google.cloud.tools.jib") version "3.3.0"
}
jib {
extraDirectories {
extraDirectories {
setPaths(layout.buildDirectory.dir("extra-directory"))
permissions = mapOf("/run.sh" to "755")
}
}
}
Changing plugin version to 3.2.1 makes the script compile.
Log output:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/vsor/workspace/splunk/jib-bug/build.gradle.kts' line: 10
* What went wrong:
Script compilation errors:
Line 10: permissions = mapOf("/run.sh" to "755")
^ Val cannot be reassigned
Line 10: permissions = mapOf("/run.sh" to "755")
^ Type mismatch: inferred type is Map<String, String> but MapProperty<String!, String!>! was expected
Line 10: permissions = mapOf("/run.sh" to "755")
^ Type mismatch: inferred type is Map<String, String> but MapProperty<String!, String!>! was expected
3 errors
Could you try permissions.set(mapOf("/run.sh" to "755")) and see if that works for the Kotlin build script? Since extraDirectories.permissions has been updated to a MapProperty, Gradle docs mentions that in Kotlin DSL, the set() method on the property needs to be used instead of =.
Hopefully this helps!
Oh, great, permissions.set(mapOf("/run.sh" to "755")) is working with 3.3.0. Thanks!