GoogleCloudPlatform / gradle-appengine-templates

Freemarker based templates that build with the gradle-appengine-plugin
438 stars 205 forks source link

Discovery docs for Cloud Endpoints API not generated #48

Open eliotstock opened 9 years ago

eliotstock commented 9 years ago

Discovery docs used to show up under the build directory for my Google Cloud Endpoints module. They no longer do.

My Gradle build file for the API module contains:

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
...
appengine {
    downloadSdk = true
    appcfg {
        oauth2 = true
    }
    endpoints {
        getClientLibsOnBuild = true
        getDiscoveryDocsOnBuild = true
    }
}

and in the Android project next door:

    compile project(path: ':service', configuration: 'android-endpoints')

I'm on Android Studio 1.2.1.1. Can't figure out when this stopped working, but possibly when I bumped the API version number, or possibly on the last AS upgrade.

loosebazooka commented 9 years ago

The IDE Build->Make Project doesn't generate the discovery docs automatically because it calls "compile" to allow the IDE to do the necessary work to be useful. The dependency in the Android Project forces the creation of client libraries but NOT discovery docs (because they aren't need for the client libraries or the Android project). The discovery generation can be triggered by the gradle task assemble which is also called before any run or deploy or explicitly by calling the appengineEndpointsGetDiscoveryDocs task. If you really want to make it always happen, you can add a task dependency to the appengine side's build.gradle so they are always generated when client libraries are generated.

appengineEndpointsGetClientLibs.dependsOn appengineEndpointsGetDiscoveryDocs
eliotstock commented 9 years ago

OK, so it was always working for me as long as I deployed to GAE right before I looked for the discovery doc. That's quite obscure and hard to understand, especially when staring at getDiscoveryDocsOnBuild = true in the build.gradle. At the least, I think this should be in the README.

loosebazooka commented 9 years ago

Yes, but build in the context of the gradle/appengine plugin is assemble which creates your application archive (war) and expands it out to run and deploy. I believe the IDE is choosing not to package a war for Make Project for efficiency reasons.

I'll modify the README to reflect this.