Files
mowesta/web-angular/build.gradle
T
handte ac8b771ecf
LocationBasedServices/mowesta/pipeline/head This commit looks good
Cleanup Angular elements and improve nodejs build scripts to support incremental builds.
Change project structure to get rid of copied assets and configuration files.
Import fonts in css using absolute paths to avoid duplication by webpack pipeline.
Stage output of ng build executions in build directory to separate ng app and elements.
Change concat scripts to assemble final output in dist folder without modifying build directory.
Add video.js files to supported modules (https://github.com/videojs/video.js/issues/6978).
Move baseRef option in angular file to new location to get rid of deprecation warning.
Change name and location of scripts to avoid copying assets.
Change name of custom element to include mowesta brand name as prefix.
2021-01-24 16:25:11 +01:00

107 lines
2.9 KiB
Groovy

plugins {
id "com.github.node-gradle.node" version "2.2.4"
id 'org.hidetake.swagger.generator' version '2.18.1'
}
description = 'Mowesta Web Angular'
dependencies {
swaggerCodegen 'io.swagger:swagger-codegen-cli:2.4.12'
}
node {
version = '10.16.0'
npmVersion = '6.9.0'
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) {
script = file('node_modules/@angular/cli/bin/ng')
args = ['build', '--prod']
inputDir = project.file('./src/')
outputDir = project.file('./build/outputs/mowesta-app/')
}
task buildApp(type: Copy) {
from 'build/outputs/mowesta-app'
into 'dist'
exclude '**/*.map'
}
task ngBuildForecast(type: IoNodeTask) {
script = file('node_modules/@angular/cli/bin/ng')
args = ['build', '--prod', 'mowesta-forecast']
inputDir = project.file('./src/')
outputDir = project.file('./build/outputs/mowesta-forecast/')
}
task buildForecast(type: IoNodeTask) {
script = file('./ng-element-concat.js')
args = ['mowesta-forecast']
inputDir = project.file('./build/outputs/mowesta-forecast/')
outputDir = project.file('./dist/')
}
task ngBuildSearch(type: IoNodeTask) {
script = file('node_modules/@angular/cli/bin/ng')
args = ['build', '--prod', 'mowesta-search']
inputDir = project.file('./src/')
outputDir = project.file('./build/outputs/mowesta-search/')
}
task buildSearch(type: IoNodeTask) {
script = file('./ng-element-concat.js')
args = ['mowesta-search']
inputDir = project.file('./build/outputs/mowesta-search/')
outputDir = project.file('./dist/')
}
swaggerSources {
mowesta {
inputFile = file(project(':common-api:').buildDir.path + '/swagger/mowesta.json')
code {
outputDir = file("./src/api/")
language = 'typescript-angular'
configFile = file('apiconfig.json')
components = [models: true, apis: 'Default', supportingFiles: 'configuration.ts,encoder.ts,api.ts,models.ts,variables.ts']
wipeOutputDir = true
}
}
}
// require api build to access swagger definition
tasks['resolveSwaggerTemplate'].dependsOn(project(':common-api').tasks['build'])
// make sure that common api is built before generating the api
ngBuildApp.dependsOn(npmInstall)
// generate the api before running ng build
ngBuildApp.dependsOn("generateSwaggerCode")
buildApp.dependsOn("ngBuildApp")
// build Angular Element "mowesta-forecast"
ngBuildForecast.dependsOn("ngBuildApp")
buildForecast.dependsOn("ngBuildForecast")
// build Angular Element "mowesta-search"
ngBuildSearch.dependsOn("ngBuildApp")
buildSearch.dependsOn("ngBuildSearch")
// run ng build whenever the project is built unless skipAngular is set
// use e.g. "gradlew site-ear:build -x test -PskipAngular"
if (! project.hasProperty('skipAngular')) {
build.dependsOn("buildApp", "buildSearch", "buildForecast")
}
// clean the api folder upon clean
clean.dependsOn("cleanup")