/** | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file | |
* to you under the Apache License, Version 2.0 (the | |
* "License"); you may not use this file except in compliance | |
* with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, | |
* software distributed under the License is distributed on an | |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
* KIND, either express or implied. See the License for the | |
* specific language governing permissions and limitations | |
* under the License. | |
*/ | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
} | |
plugins { | |
id "java" | |
id "org.openapi.generator" version "5.2.1" | |
id "com.github.hierynomus.license" version"0.15.0" | |
} | |
description = 'Fineract Credit Scorecard Build Tool' | |
ext['openapiSpecFile'] = "$rootDir/openapi.yml".toString() | |
java { | |
sourceCompatibility = JavaVersion.VERSION_1_8 | |
targetCompatibility = JavaVersion.VERSION_1_8 | |
} | |
license { | |
header rootProject.file("$rootDir/APACHE_LICENSETEXT.md") | |
excludes([ | |
"**/gradlew*" | |
]) | |
strictCheck true | |
} | |
task licenseFormatBuildScripts (type:nl.javadude.gradle.plugins.license.License) { | |
source = fileTree(dir: "$rootDir/", includes: [ | |
'**/*.bat', | |
'**/*.sh', | |
'**/*.sql', | |
'**/*.java' | |
], excludes: [ | |
'**/gradlew*' | |
]) | |
} | |
licenseFormat.dependsOn licenseFormatBuildScripts | |
task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){ | |
inputSpec = "$openapiSpecFile" | |
} | |
openApiMeta { | |
generatorName = 'Fineract' | |
packageName = 'org.apache.fineract.credit.scorecard' | |
outputFolder = "$buildDir/meta".toString() | |
} | |
openApiValidate { | |
inputSpec = "$openapiSpecFile" | |
recommend = true | |
} | |
task buildJavaSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) { | |
generatorName = 'java' | |
verbose = false | |
validateSpec = true | |
skipValidateSpec = true | |
inputSpec = "$openapiSpecFile" | |
outputDir = "$buildDir/generated/java".toString() | |
groupId = 'org.apache.fineract' | |
id = 'credit-scorecard-java-client' | |
apiPackage = 'org.apache.fineract.credit.scorecard.services' | |
invokerPackage = 'org.apache.fineract.credit.scorecard' | |
modelPackage = 'org.apache.fineract.credit.scorecard.models' | |
configOptions = [ | |
fullJavaUtil: 'true', | |
dateLibrary: 'java8', | |
hideGenerationTimestamp: 'true', | |
developerEmail: 'dev@fineract.apache.org', | |
developerName: 'Apache Fineract', | |
developerOrganization: 'Apache Software Foundation', | |
developerOrganizationUrl: 'https://apache.org' | |
] | |
generateModelTests = false | |
generateApiTests = false | |
finalizedBy = [licenseFormat] | |
} | |
sourceSets { | |
generated { | |
java { | |
srcDir "$buildDir/generated/java/src/main/java" | |
} | |
} | |
} | |
compileJava { | |
source += sourceSets.generated.java | |
} | |
configurations { | |
generatedCompile.extendsFrom implementation | |
generatedRuntime.extendsFrom runtime | |
} |