Skip to content

bijukunjummen/gcp-cloudfunction-gradle-plugin

Repository files navigation

Google Cloud Function Gradle Plugin

This is a Gradle Plugin that makes it easy to test a Java based Google Cloud Function locally for Gradle based projects.

Using the Plugin

Add the plugin to the build.gradle file the following way:

plugins{
  id 'java'
  id "io.github.bijukunjummen.cloudfunction"
}

Note that the plugin depends on java plugin being present.

Provide details of the endpoint that the function exposes:

cloudFunction {
  target = "functions.HelloHttp"
  port = 8080
}

This snippet indicates that the function being exposed is from functions.HelloHttp class, and the endpoint should be available locally at port 8080.

A local version of the function can now be started up this way:

./gradlew cloudFunctionRun

Samples

Here are two sample projects which use the plugin:

  1. Http Cloud Function
  2. Pub/Sub Cloud Function

About

Gradle plugin to work with GCP Cloud Functions

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages