FINERACT-1082: Changing version from hardcoded to autogenerated for Swagger

This commit is contained in:
Petri Tuomola
2020-08-19 17:51:29 +02:00
committed by Michael Vorburger ⛑️
parent 899eab8ebc
commit 39290a0ae5
3 changed files with 35 additions and 3 deletions
+33 -1
View File
@@ -195,6 +195,20 @@ openjpa {
// Configuration for Swagger documentation generation task
// https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-gradle-plugin
import org.apache.tools.ant.filters.ReplaceTokens
task prepareInputYaml(dependsOn: 'generateGitProperties') {
doLast {
copy {
from file('config/swagger/fineract-input.yaml.template')
into file('config/swagger')
rename { String filename -> return 'fineract-input.yaml' }
filter(ReplaceTokens, tokens: [VERSION: project.ext.gitProps['git.commit.id.describe']])
}
}
}
resolve {
logging.captureStandardOutput LogLevel.INFO
outputFileName = 'fineract'
@@ -205,6 +219,8 @@ resolve {
openApiFile = file("config/swagger/fineract-input.yaml")
}
resolve.dependsOn prepareInputYaml
// Configuration for JaCoCo code coverage task
// https://www.eclemma.org/jacoco/
jacoco {
@@ -290,6 +306,7 @@ rat {
'**/*.github/**',
'**/MANIFEST.MF',
'**/*.json',
'**/*.json.template',
'**/*.txt',
'**/*.log',
'**/fineractdev-eclipse-preferences.epf',
@@ -846,16 +863,29 @@ gitProperties {
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "GMT"
failOnNoGitDirectory = false
extProperty = 'gitProps'
}
// make sure the generateGitProperties task always executes (even when git.properties is not changed)
generateGitProperties.outputs.upToDateWhen { false }
//This is for swagger code generation
// This is for swagger code generation
// https://github.com/int128/gradle-swagger-generator-plugin
dependencies {
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.18'
}
task prepareConfigJson(dependsOn: 'generateGitProperties') {
doLast {
copy {
from file('config/swagger/config.json.template')
into file('config/swagger')
rename { String filename -> return 'config.json' }
filter(ReplaceTokens, tokens: [VERSION: project.ext.gitProps['git.commit.id.describe']])
}
}
}
swaggerSources {
fineract {
inputFile = file('../build/classes/java/main/static/swagger-ui/fineract.yaml')
@@ -865,3 +895,5 @@ swaggerSources {
}
}
}
generateSwaggerCodeFineract.dependsOn prepareConfigJson
@@ -1,7 +1,7 @@
{
"groupId": "org.apache.fineract",
"artifactId": "client",
"artifactVersion": "1.4.0",
"artifactVersion": "@VERSION@",
"invokerPackage": "org.apache.fineract.client",
"modelPackage": "org.apache.fineract.client.models",
"apiPackage": "org.apache.fineract.client.services",
@@ -1,6 +1,6 @@
openapi: 3.0.3
info:
version: 1.4.0
version: @VERSION@
title: Apache Fineract
description: |-
Apache Fineract is a secure, multi-tenanted microfinance platform