
com.darylteo.vertx.gradle.tasks.GenerateDeploymentConfig.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vertx-gradle-plugin Show documentation
Show all versions of vertx-gradle-plugin Show documentation
A Gradle Plugin for building, assembling and running Vert.x projects.
The newest version!
package com.darylteo.vertx.gradle.tasks
import com.darylteo.vertx.gradle.deployments.Deployment
import com.darylteo.vertx.gradle.util.MapToJson
import groovy.json.JsonOutput
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
class GenerateDeploymentConfig extends DefaultTask {
Deployment deployment
def outputFile
public setDeployment(Deployment deployment) {
this.deployment = deployment
this.inputs.property('config', { MapToJson.convert(deployment.config) })
this.outputFile = { "${project.buildDir}/configs/${deployment.name}.conf" }
this.outputs.file outputFile
}
public GenerateDeploymentConfig() {
}
@TaskAction
public def run() {
def file = project.file(outputFile)
def dir = file.parentFile
file.delete()
if (dir.isDirectory() || dir.mkdirs()) {
file << JsonOutput.toJson(deployment.config)
} else {
throw new Exception("Could not create directory: $dir")
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy