53 lines
1.3 KiB
Groovy
53 lines
1.3 KiB
Groovy
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
|
|
|
|
plugins {
|
|
id "base"
|
|
id "org.openapi.generator" version "7.17.0"
|
|
id "com.github.node-gradle.node" version "7.0.2"
|
|
}
|
|
|
|
node {
|
|
download = true
|
|
version = "26.2.0"
|
|
npmVersion = "10.7.0"
|
|
}
|
|
|
|
task cleanNgBuild(type: Delete) {
|
|
delete files("${projectDir}/dist/inse")
|
|
}
|
|
|
|
task ngBuild(type: NodeTask) {
|
|
dependsOn 'npmInstall', cleanNgBuild
|
|
script = file('node_modules/@angular/cli/bin/ng.js')
|
|
args = ['build', '--configuration', 'production', '--source-map=false', '--base-href', '/inse-webapp/']
|
|
}
|
|
|
|
task serve(type: NodeTask) {
|
|
dependsOn 'npmInstall'
|
|
script = file('node_modules/@angular/cli/bin/ng.js')
|
|
args = ['serve', '--configuration', 'development', '--proxy-config', 'src/proxy.conf.json', '--open']
|
|
workingDir = projectDir
|
|
}
|
|
|
|
task deleteOpenApiClient(type: Delete) {
|
|
delete file("src/app/api")
|
|
}
|
|
|
|
task generateOpenApiClient(type: GenerateTask) {
|
|
dependsOn 'deleteOpenApiClient',':service:exportOpenApiSpec'
|
|
group = "apiClient"
|
|
description = "Generates the API client using OpenAPI Generator"
|
|
|
|
generatorName = "typescript-angular"
|
|
inputSpec = file("../service/build/openapi/inse-service.openapi.json").toURI().toString()
|
|
outputDir = file("src/app/api").path
|
|
}
|
|
|
|
build {
|
|
dependsOn ngBuild
|
|
}
|
|
|
|
clean {
|
|
dependsOn cleanNgBuild
|
|
}
|