Gradle Script Kotlin - Configure App Engine Plugin


#1

I’m trying to use Gradle Script Kotlin to configure the build on my App Engine project but cannot figure out how to set the cloudSdkHome property (or any configuration of the plugin at all!)

In a groovy gradle script this is done something like this:

model {
  appengine {
    tools {
      cloudSdkHome = "/path/to/cloud/sdk"
    }
  }
}

Here is my build.gradle.kts which

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url = uri("https://plugins.gradle.org/m2/")
        }
    }
    dependencies {
        classpath("com.google.cloud.tools:appengine-gradle-plugin:+")
        classpath("net.ltgt.gradle:gradle-apt-plugin:0.10")
        classpath(kotlinModule("gradle-plugin"))
    }
}

repositories {
    jcenter()
    mavenCentral()
}

plugins {
    java
    war
}

apply {
    plugin("com.google.cloud.tools.appengine")
    plugin("net.ltgt.apt")
}

java {
    sourceSets {
        "main" {
            java {
                srcDir(files("src/main"))
                srcDir(files("src/share/util”))
            }
        }
    }
}

dependencies {
    compile("com.google.appengine:appengine:+")
    compile("com.google.appengine:appengine-api-1.0-sdk:+")
    <more dependencies>
 }

configure<AppEngineExtension> {
  // What to do here?
}

// configure<ToolsExtension> {
//   // Runtime exception ToolsExtension not registered.
//     setCloudSdkHome("/path/to/cloudsdk")    
// }

I can see that the AppEngineStandardPlugin does register the “tools” extension in a different way than the main extension “appengine” AppEngineStandardPlugin

Any hints appreciated!

Sorry for the cross post on stackoverflow.com - there were no bites there so trying again here.

Thanks!