91 lines
2.5 KiB
Groovy
91 lines
2.5 KiB
Groovy
plugins {
|
|
id "com.github.node-gradle.node" version "2.2.4"
|
|
id 'org.openapi.generator' version '6.0.0'
|
|
}
|
|
|
|
description = 'MoWeSta Web Angular'
|
|
|
|
node {
|
|
version = '22.2.0'
|
|
npmVersion = '10.8.2'
|
|
download = true
|
|
}
|
|
|
|
class IoNodeTask extends com.moowork.gradle.node.task.NodeTask {
|
|
@InputDirectory
|
|
File inputDir;
|
|
@OutputDirectory
|
|
File outputDir;
|
|
}
|
|
|
|
task cleanup(type: Delete) {
|
|
delete './src/api', './dist'
|
|
}
|
|
|
|
task ngBuildApp(type: IoNodeTask) {
|
|
dependsOn 'npmInstall', 'generateClient'
|
|
script = file('node_modules/@angular/cli/bin/ng.js')
|
|
args = ['build', '--output-hashing', 'bundles', '--configuration', 'production', '--source-map=false', 'mowesta-app']
|
|
inputDir = project.file('./src/')
|
|
outputDir = project.file('./build/outputs/mowesta-app/')
|
|
}
|
|
|
|
task buildApp(type: Copy) {
|
|
dependsOn 'ngBuildApp'
|
|
from 'build/outputs/mowesta-app/browser'
|
|
into 'dist'
|
|
exclude '**/*.map'
|
|
}
|
|
|
|
task ngBuildForecast(type: IoNodeTask) {
|
|
dependsOn 'ngBuildApp'
|
|
script = file('node_modules/@angular/cli/bin/ng.js')
|
|
args = ['build', '--output-hashing', 'none', '--configuration', 'production', '--source-map=false', 'mowesta-forecast']
|
|
inputDir = project.file('./src/')
|
|
outputDir = project.file('./build/outputs/mowesta-forecast/')
|
|
}
|
|
|
|
task buildForecast(type: IoNodeTask) {
|
|
dependsOn 'ngBuildForecast'
|
|
script = file('./ng-element-concat.js')
|
|
args = ['mowesta-forecast']
|
|
inputDir = project.file('./build/outputs/mowesta-forecast/browser/')
|
|
outputDir = project.file('./dist/')
|
|
}
|
|
|
|
task ngBuildSearch(type: IoNodeTask) {
|
|
dependsOn 'ngBuildApp'
|
|
script = file('node_modules/@angular/cli/bin/ng.js')
|
|
args = ['build', '--output-hashing', 'none', '--configuration', 'production', '--source-map=false', 'mowesta-search']
|
|
inputDir = project.file('./src/')
|
|
outputDir = project.file('./build/outputs/mowesta-search/')
|
|
}
|
|
|
|
task buildSearch(type: IoNodeTask) {
|
|
dependsOn 'ngBuildSearch'
|
|
script = file('./ng-element-concat.js')
|
|
args = ['mowesta-search']
|
|
inputDir = project.file('./build/outputs/mowesta-search/browser/')
|
|
outputDir = project.file('./dist/')
|
|
}
|
|
|
|
task generateClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
|
|
dependsOn 'cleanup', ':service-api:resolve'
|
|
generatorName = "typescript-angular"
|
|
inputSpec = "$projectDir/../service-api/build/swagger/mowesta.json"
|
|
outputDir = "$projectDir/src/api/"
|
|
configOptions = [
|
|
apiModulePrefix: "MoWeSta",
|
|
configurationPrefix: "MoWeSta"
|
|
]
|
|
}
|
|
|
|
|
|
build {
|
|
dependsOn 'buildApp', 'buildSearch', 'buildForecast'
|
|
}
|
|
|
|
clean {
|
|
dependsOn 'cleanup'
|
|
}
|