FINERACT-1082: Changing version from hardcoded to autogenerated for Swagger
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
899eab8ebc
commit
39290a0ae5
@@ -195,6 +195,20 @@ openjpa {
|
|||||||
|
|
||||||
// Configuration for Swagger documentation generation task
|
// Configuration for Swagger documentation generation task
|
||||||
// https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-gradle-plugin
|
// 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 {
|
resolve {
|
||||||
logging.captureStandardOutput LogLevel.INFO
|
logging.captureStandardOutput LogLevel.INFO
|
||||||
outputFileName = 'fineract'
|
outputFileName = 'fineract'
|
||||||
@@ -205,6 +219,8 @@ resolve {
|
|||||||
openApiFile = file("config/swagger/fineract-input.yaml")
|
openApiFile = file("config/swagger/fineract-input.yaml")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resolve.dependsOn prepareInputYaml
|
||||||
|
|
||||||
// Configuration for JaCoCo code coverage task
|
// Configuration for JaCoCo code coverage task
|
||||||
// https://www.eclemma.org/jacoco/
|
// https://www.eclemma.org/jacoco/
|
||||||
jacoco {
|
jacoco {
|
||||||
@@ -290,6 +306,7 @@ rat {
|
|||||||
'**/*.github/**',
|
'**/*.github/**',
|
||||||
'**/MANIFEST.MF',
|
'**/MANIFEST.MF',
|
||||||
'**/*.json',
|
'**/*.json',
|
||||||
|
'**/*.json.template',
|
||||||
'**/*.txt',
|
'**/*.txt',
|
||||||
'**/*.log',
|
'**/*.log',
|
||||||
'**/fineractdev-eclipse-preferences.epf',
|
'**/fineractdev-eclipse-preferences.epf',
|
||||||
@@ -846,16 +863,29 @@ gitProperties {
|
|||||||
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
|
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
|
||||||
dateFormatTimeZone = "GMT"
|
dateFormatTimeZone = "GMT"
|
||||||
failOnNoGitDirectory = false
|
failOnNoGitDirectory = false
|
||||||
|
extProperty = 'gitProps'
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the generateGitProperties task always executes (even when git.properties is not changed)
|
// make sure the generateGitProperties task always executes (even when git.properties is not changed)
|
||||||
generateGitProperties.outputs.upToDateWhen { false }
|
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 {
|
dependencies {
|
||||||
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.18'
|
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 {
|
swaggerSources {
|
||||||
fineract {
|
fineract {
|
||||||
inputFile = file('../build/classes/java/main/static/swagger-ui/fineract.yaml')
|
inputFile = file('../build/classes/java/main/static/swagger-ui/fineract.yaml')
|
||||||
@@ -865,3 +895,5 @@ swaggerSources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateSwaggerCodeFineract.dependsOn prepareConfigJson
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"groupId": "org.apache.fineract",
|
"groupId": "org.apache.fineract",
|
||||||
"artifactId": "client",
|
"artifactId": "client",
|
||||||
"artifactVersion": "1.4.0",
|
"artifactVersion": "@VERSION@",
|
||||||
"invokerPackage": "org.apache.fineract.client",
|
"invokerPackage": "org.apache.fineract.client",
|
||||||
"modelPackage": "org.apache.fineract.client.models",
|
"modelPackage": "org.apache.fineract.client.models",
|
||||||
"apiPackage": "org.apache.fineract.client.services",
|
"apiPackage": "org.apache.fineract.client.services",
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
openapi: 3.0.3
|
openapi: 3.0.3
|
||||||
info:
|
info:
|
||||||
version: 1.4.0
|
version: @VERSION@
|
||||||
title: Apache Fineract
|
title: Apache Fineract
|
||||||
description: |-
|
description: |-
|
||||||
Apache Fineract is a secure, multi-tenanted microfinance platform
|
Apache Fineract is a secure, multi-tenanted microfinance platform
|
||||||
Reference in New Issue
Block a user