Philip W
04/28/2026, 5:26 AMmyMap += mapOf(„foo“ to providers.gradleProperty(„bar“))Vampire
04/28/2026, 6:48 AMmyMap.put(...)
Probably not, I should play with dcl myself a bit. :-DPhilip W
04/28/2026, 7:10 AMDeclarativeWithHiddenMembers, so only the type is available with no members.
And only a subset of stdlib functions are available (mapOf, listOf, `to`: https://github.com/gradle/gradle/blob/94e17d7dc67cff8de74938855042393a5e165cd4/platforms/core-configuration/declarative-dsl-provider/src/main/kotlin/org/gradle/internal/declarativedsl/common/StandardLibraryComponent.kt), but I should just look at the sources and the error message: providers is not available. And turns out, project.providers is also marked as HiddenInDefinition and there is no intrinsic providers like layout.
As a workaround, I use this implementation:
// Before, safe definition
interface JavaDclForkOptions {
val environment: MapProperty<String, String>
}
// Workaround, unsafe definition
abstract class JavaDclForkOptions {
@get:HiddenInDefinition
@get:Inject
internal abstract val providers: ProviderFactory
abstract val environment: MapProperty<String, String>
@Adding
fun environmentOfProperty(key: String, propertyName: String) {
environment.put(key, providers.gradleProperty(propertyName))
}
}Javi
04/28/2026, 10:21 AMappend I guessPhilip W
04/28/2026, 1:08 PMTapchicoma
04/30/2026, 7:31 AMgradleProperty should not be part of definition/available in it. And if you want to set map value from Gradle property - you need to create custom software featurePhilip W
04/30/2026, 7:40 AMTapchicoma
04/30/2026, 8:32 AMPlugin doesn't make sense and we've discussed it, so most probably it will go awayTapchicoma
04/30/2026, 8:32 AMBinding + `ProjectFeatureApplyAction`s are only neededJavi
05/02/2026, 4:21 PMProvider<String> and I need to create a custom feature for each feature, that would be madness. The same for environment variables.Tapchicoma
05/04/2026, 1:12 PM