Skip to content

Programmatic API

Nmcp supports a programmatic API for plugins that need to interact with the publishing process.

NmcpExtension.extraFiles()

Nmcp supports adding files to your deployment. This is useful when you don’t know the coordinates of your publication until execution time.

val someTask = TODO() // A task that generates a publication at execution time
val nmcpExtension = extensions.findByType(NmcpExtension::class.java)
nmcpExtension!!.extraFiles(someTask.map { it.output })

NmcpAggregationExtension.allFiles

Symmetrically, Nmcp supports retrieving the deployment files at execution time to upload them to custom repositories such as Google Cloud and/or AWS:

val nmcpAggregationExtension = extensions.findByType(NmcpAggregationExtension::class.java)
tasks.register("uploadFilesToGoogleCloud", UploadToGoogleCloud::class.java) {
inputFiles.from(nmcpAggregationExtension.allFiles)
}