blob: 5381e3591d7de24166fa69df75add747644edcd6 [file] [log] [blame]
/********************************************************************************
* 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
*
********************************************************************************/
import org.apache.tools.ant.taskdefs.condition.Os
import org.apache.tools.ant.filters.ConcatFilter
description = 'MDM Web Application'
apply plugin: 'com.moowork.node'
System.setProperty('file.encoding', 'UTF-8')
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", "src/main/webapp/src,src/main/java"
property "sonar.exclusions", "src/main/webapp/node_modules/**, src/main/webapp/coverage/**, src/main/webapp/dist/**,**/*.spec.ts, **/*.js"
property "sonar.tests", "src/main/webapp/src"
property "sonar.test.inclusions", "**/*.spec.ts"
property "sonar.ts.tslint.configPath", "src/main/webapp"
property "sonar.ts.tslint.projectPath", "src/main/webapp"
property "sonar.ts.tslint.outputPath", "${project.buildDir}/node/coverage/tslint_out_mapped.json"
property "sonar.ts.coverage.lcovReportpath", "${project.buildDir}/node/coverage/lcov.info"
}
}
dependencies {
runtime 'org.glassfish.jersey.containers:jersey-container-servlet:2.23.2'
compile 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.9.2'
compile project(':org.eclipse.mdm.businessobjects')
compile project(':org.eclipse.mdm.filerelease')
compile project(':org.eclipse.mdm.property')
compile project(':org.eclipse.mdm.freetextindexer')
compile project(':org.eclipse.mdm.preferences')
}
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies { classpath "com.moowork.gradle:gradle-node-plugin:1.3.1" }
}
jar {
metaInf { from '../NOTICE.txt' }
metaInf { from '../LICENSE.txt' }
}
task copy_websources(type: Copy) {
from('./src/main/webapp') {
exclude 'dist'
exclude 'node_modules'
exclude 'NOTICE.html'
}
into "${project.buildDir}/node"
}
task copyNoticeFile() {
file("${project.buildDir}/node/src/app/").mkdirs()
def html = file("${project.buildDir}/node/src/app/NOTICE.html")
html.text = '<pre>' + file('../NOTICE.txt').text + '</pre>'
}
node {
version = '10.14.0'
npmVersion = '6.4.1'
distBaseUrl = 'https://nodejs.org/dist'
download = true
workDir = file("${project.buildDir}/node/nodejs")
npmWorkDir = file("${project.buildDir}/node")
nodeModulesDir = file("${project.buildDir}/node")
if (!nodeModulesDir.isDirectory()) {
nodeModulesDir.mkdirs()
}
}
npm_install { args = ["${project.buildDir}"] }
task runBuild(type: NpmTask) {
args = ['run', 'ci_build']
inputs.dir 'src'
outputs.dir 'build'
}
task copy_loginsites(type: Copy) {
from "${project.buildDir}/node/src/login.jsp",
"${project.buildDir}/node/src/login.css",
"${project.buildDir}/node/src/error.jsp"
into "${project.buildDir}/node/dist"
}
task copyFilesForRunningWithoutNpm(type: Copy){
from "${project.buildDir}/node/src/index.html"
into "${project.buildDir}/node/dist"
}
if (hasProperty('skipNode')) {
compileJava.dependsOn(copy_loginsites)
} else {
compileJava.dependsOn(copy_loginsites)
map_tslint.dependsOn(runBuild)
copy_loginsites.dependsOn(runBuild)
runBuild.dependsOn(npmInstall)
npmInstall.dependsOn(copy_websources)
npmInstall.dependsOn(copyNoticeFile)
copy_websources.dependsOn(npmSetup)
npmSetup.dependsOn(nodeSetup)
}