| /******************************************************************************** |
| * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| ********************************************************************************/ |
| |
| plugins { |
| id "com.github.node-gradle.node" version "2.2.3" |
| } |
| |
| apply plugin: 'java' |
| apply plugin: 'maven' |
| apply plugin: 'eclipse' |
| |
| description = 'MDM Web Client' |
| |
| def distDir = "${project.buildDir}/dist" |
| def srcDir = "src/main/webapp" |
| |
| System.setProperty('file.encoding', 'UTF-8') |
| |
| /* TODO mko, 14.05.2020: configure linting |
| task map_tslint(type: Copy) { |
| File tsLintFile = file("${project.buildDir}/node/coverage/tslint_out.json") |
| File mappedTsLintFile = file("${project.buildDir}/node/coverage/tslint_out_mapped.json") |
| |
| if (tsLintFile.exists()) { |
| String contents = tsLintFile.getText('UTF-8') |
| contents = contents.replaceAll( 'src/app', 'src/main/webapp/src/app' ) |
| mappedTsLintFile.write(contents, 'UTF-8') |
| } |
| } |
| */ |
| |
| sonarqube { |
| properties { |
| property "sonar.sources", "${srcDir}/src,src/main/java" |
| property "sonar.exclusions", "${srcDir}/node_modules/**, ${srcDir}/coverage/**, ${distDir}/**,**/*.spec.ts, **/*.js" |
| property "sonar.tests", "${srcDir}/src" |
| property "sonar.test.inclusions", "**/*.spec.ts" |
| |
| property "sonar.ts.tslint.configPath", distDir |
| property "sonar.ts.tslint.projectPath", distDir |
| property "sonar.ts.tslint.outputPath", "${project.buildDir}/node/coverage/tslint_out_mapped.json" |
| property "sonar.ts.coverage.lcovReportpath", "${project.buildDir}/node/coverage/lcov.info" |
| } |
| } |
| |
| |
| node { |
| version = '10.14.0' |
| npmVersion = '6.4.1' |
| distBaseUrl = 'https://nodejs.org/dist' |
| download = true |
| npmInstallCommand = 'ci' |
| workDir = file("${project.buildDir}/node/nodejs") |
| npmWorkDir = file("${project.buildDir}/node") |
| nodeModulesDir = file(srcDir) |
| } |
| |
| task runTest(type: NpmTask) { |
| dependsOn npmInstall |
| args = ['run', 'ci_test'] |
| |
| inputs.files("${srcDir}/package.json", "${srcDir}/package-lock.json", "${srcDir}/angular.json", "${srcDir}/tsconfig.json", "${srcDir}/tsconfig.app.json") |
| inputs.dir(fileTree("${srcDir}/src")) |
| inputs.dir(fileTree("${srcDir}/node_modules").exclude(".cache")) |
| outputs.dir(distDir) |
| } |
| |
| task runBuild(type: NpmTask) { |
| dependsOn npmInstall |
| dependsOn runTest |
| args = ['run', 'build', "--", "--output-path=${distDir}"] |
| |
| inputs.files("${srcDir}/package.json", "${srcDir}/package-lock.json", "${srcDir}/angular.json", "${srcDir}/tsconfig.json", "${srcDir}/tsconfig.app.json") |
| inputs.dir(fileTree("${srcDir}/src")) |
| inputs.dir(fileTree("${srcDir}/node_modules").exclude(".cache")) |
| outputs.dir(distDir) |
| } |
| |
| |
| jar { |
| dependsOn runBuild |
| metaInf { |
| from('../../') { |
| include 'NOTICE.txt' |
| include 'LICENSE.txt' |
| } |
| } |
| metaInf { |
| from (distDir) |
| into 'resources' |
| } |
| } |
| |
| clean.doLast { |
| file("${srcDir}/node_modules").deleteDir() |
| file("${srcDir}/coverage").deleteDir() |
| } |