ext { swagger_version = "1.5.8" } dependencies { plugin 'io.swagger:swagger-codegen-cli:2.1.5' compile fileTree(dir: 'vendor', include: '*.jar', exclude: '*-sources.jar') vendor 'com.google.guava:guava:19.0' vendor 'com.google.guava:guava:19.0:sources' vendor 'org.apache.commons:commons-lang3:3.4' vendor "io.swagger:swagger-annotations:${swagger_version}" vendor "io.swagger:swagger-annotations:${swagger_version}:sources" vendor "io.swagger:swagger-core:${swagger_version}" vendor "io.swagger:swagger-core:${swagger_version}:sources" vendor "io.swagger:swagger-models:${swagger_version}" vendor "io.swagger:swagger-models:${swagger_version}:sources" vendor "io.swagger:swagger-parser:1.0.17" vendor "io.swagger:swagger-parser:1.0.17:sources" vendor 'org.antlr:stringtemplate:4.0.2' vendor 'org.antlr:stringtemplate:4.0.2:sources' } task swaggerToAsciidoc(type: JavaExec) { description 'Create asciidoc fragments from current Swagger definition' classpath = sourceSets.main.runtimeClasspath main = 'com.perforce.hws.swagger.GenerateAsciidoc' args file('src/docs/swagger/helix-web-services-2016.1.0.yaml').canonicalPath, file("${buildDir}/asciidoc").canonicalPath } task generateJavaClient(type: JavaExec) { description 'Regenerate the java client project' classpath = fileTree(dir: 'plugins', include: '*.jar', exclude: '*-sources.jar') main 'io.swagger.codegen.SwaggerCodegen' args 'generate', '-i', file('src/docs/swagger/helix-web-services-2016.1.0.yaml').canonicalPath, '-l', 'java', '-c', file('java_config.json').canonicalPath, '-o', file('../client-java').canonicalPath, '-t', file('templates/Java').canonicalPath, '--import-mappings', 'JobCommand=com.perforce.hwsclient.models.JobCommand,' + 'JobsCommand=com.perforce.hwsclient.models.JobsCommand' } task generateRubyClient(type: JavaExec) { description 'Regenerate the ruby client project' classpath = fileTree(dir: 'plugins', include: '*.jar', exclude: '*-sources.jar') main 'io.swagger.codegen.SwaggerCodegen' args 'generate', '-i', file('src/docs/swagger/helix-web-services-2016.1.0.yaml').canonicalPath, '-t', file('templates/ruby').canonicalPath, '-l', 'ruby', '-c', file('ruby_config.json').canonicalPath, '-o', file('../client-ruby').canonicalPath, '--import-mappings', 'JobCommand=HelixWebServices::JobCommand,' + 'JobsCommand=HelixWebServices::JobsCommand' } task generatePHPClient(type: JavaExec) { description 'Regenerate the PHP client project' classpath = fileTree(dir: 'plugins', include: '*.jar', exclude: '*-sources.jar') main 'io.swagger.codegen.SwaggerCodegen' args 'generate', '-i', file('src/docs/swagger/helix-web-services-2016.1.0.yaml').canonicalPath, '-t', file('templates/php').canonicalPath, '-l', 'php', '-c', file('php_config.json').canonicalPath, '-o', file('../client-php').canonicalPath, '--import-mappings', 'CommandResponse=HelixWebServices\\CommandResponse,' + 'JobCommand=HelixWebServices\\JobCommand,' + 'JobsCommand=HelixWebServices\\JobsCommand' } task generatePythonClient(type: JavaExec) { description 'Regenerate the Python client project' classpath = fileTree(dir: 'plugins', include: '*.jar', exclude: '*-sources.jar') main 'io.swagger.codegen.SwaggerCodegen' args 'generate', '-i', file('src/docs/swagger/helix-web-services-2016.1.0.yaml').canonicalPath, '-t', file('templates/python').canonicalPath, '-l', 'python', '-c', file('python_config.json').canonicalPath, '-o', file('../client-python').canonicalPath, '--import-mappings', 'JobCommand=helix_web_services_client.models.JobCommand,' + 'JobsCommand=helix_web_services_client.models.JobsCommand' } task generateJavaScriptClient(type: JavaExec) { description = 'Regenerate the JavaScript client project' classpath = sourceSets.main.runtimeClasspath main 'com.perforce.hws.swagger.GenerateJavaScriptClient' args "${project.projectDir}/src/docs/swagger/helix-web-services-2016.1.0.yaml", "${project.projectDir}/../client-javascript" } task generateAll { description "Regenerate all 2016.1.0 client libraries" dependsOn generateJavaClient, generateRubyClient, generatePHPClient, generatePythonClient, generateJavaScriptClient } task javaConfigHelp(type: JavaExec) { description 'Print help statement for Java configuration' classpath = fileTree(dir: 'plugins', include: '*.jar', exclude: '*-sources.jar') main 'io.swagger.codegen.SwaggerCodegen' args 'config-help', '-l', 'java' } task rubyConfigHelp(type: JavaExec) { description 'Print help statement for Ruby configuration' classpath = fileTree(dir: 'plugins', include: '*.jar', exclude: '*-sources.jar') main 'io.swagger.codegen.SwaggerCodegen' args 'config-help', '-l', 'ruby' } task phpConfigHelp(type: JavaExec) { description 'Print help statement for PHP configuration' classpath = fileTree(dir: 'plugins', include: '*.jar', exclude: '*-sources.jar') main 'io.swagger.codegen.SwaggerCodegen' args 'config-help', '-l', 'php' } task pythonConfigHelp(type: JavaExec) { description 'Print help statement for Python configuration' classpath = fileTree(dir: 'plugins', include: '*.jar', exclude: '*-sources.jar') main 'io.swagger.codegen.SwaggerCodegen' args 'config-help', '-l', 'python' } task swaggerJar(type: Jar) { description "Swagger jar distribution (for inclusion into the server as static data)" baseName = 'helix-web-services-swagger' from "src/docs/swagger" into 'publicsite/api/doc-swagger' }