⌘K

Gradle plugin

Nativeblocks provides gradle plugin to upload generated codes to its server

The Nativeblocks gradle plugin is a tool that for uploading JSON generated and prepare schema by compiler to Nativeblocks servers

How it works

Before starting we need to add necessary dependencies

plugins {
    id("io.nativeblocks.nativeblocks-gradle-plugin").version("1.1.0")
}

Then it needed to provide plugin arguments, Properties belongs to each Studio account, from Nativeblocks Studio, find Link Device and copy properties

nativeblocks.properties
endpoint=
authToken=
organizationId=

Note: if you are using community version, there is no need to add endpoint, authToken and organizationId

def nativeblocksProps = new Properties()
file("nativeblocks.properties").withInputStream { props.load(it) }

nativeblocks {
    endpoint = nativeblocksProps.getProperty("endpoint").toString()
    authToken = nativeblocksProps.getProperty("authToken").toString()
    organizationId = nativeblocksProps.getProperty("organizationId").toString()
    basePackageName = "your.packagename.appname"
    moduleName = "your_module_name"
}

After you add the plugin it adds 2 tasks to your module, keep in your mind that each command will bind to the each flavor of the application

Sync

To upload generated JSON to nativeblocks servers, run nativeblocksSync command

 ./gradlew :app:nativeblocksSyncDebug

PrepareSchema

To prepare JSON to nativeblocks DSL and CLI, run nativeblocksPrepareSchema command

 ./gradlew :app:nativeblocksPrepareSchemaDebug