microsoft / azure-gradle-plugins

Azure Plugins for Gradle
MIT License
45 stars 28 forks source link

Help for configuration in Kotlin DSL #68

Closed abouquet closed 4 years ago

abouquet commented 4 years ago

I would like to configure this plugin in a Kotlin DSL way.

It seems the proper way is doing this

plugins {
    kotlin("jvm")
    id("com.microsoft.azure.azurefunctions") version "1.4.0"
}

azurefunctions {
    //subscription = <redacted>
    resourceGroup = "azure-functions-beeobs-rg"
    appName = "azure-functions-beeobs"
    pricingTier = "Consumption"
    localDebug = "transport=dt_socket,server=y,suspend=n,address=5005"
    allowTelemetry = false

   // It seems I can't declare any nested properties there
    appSettings["foo"] = "bar"
    runtime.os = "linux"
    authentication.type = "azure_cli"
    deployment.type = "run_from_blob"
     */
}

But when I'm trying to run azureFunctionsRun gradle task, I get the following error

(...)\api\build.gradle.kts:70:5: Unresolved reference: appSettings

Got the same with runtime.os authentication.type and deployment.type

Can anyone point me the right way to configure it in kts ?

Sample project : azure-function-kts-issue-68.zip

Thanks

andxu commented 4 years ago

Hi @abouquet , thank you for using our gradle plugin, I looked your project and had no idea of solving the configuration issue which is related to gradle.kts, I am not familiar with kotlin, sorry. If you solve this problem out, I can put your sample configuration in github wiki page.

abouquet commented 4 years ago

Thanks for your answer !

I'm still learning Kotlin and indeed it's maybe related to the way we have to set nested properties in .kts gradle files. I've been struggling with it for several hours and can't spend more time on it atm.

I think for a workaround, I will stick to a groovy build.gradle and came back after if I find a good solution.

andxu commented 4 years ago

Close this issue since no action is needed.