blob: e4b8154245d342d77bb99cddc60ba618d3e9d1c1 [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
*
********************************************************************************/
plugins {
id "org.sonarqube" version "2.5"
id "io.swagger.core.v3.swagger-gradle-plugin" version "2.0.8"
}
group = 'org.eclipse.mdm'
version = '5.2.0M1-SNAPSHOT'
description = 'mdm nucleus'
apply plugin: 'war'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: 'org.sonarqube'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
subprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module("de.rechner:openatfx") with project(":org.eclipse.mdm.openatfx")
}
}
group = rootProject.group
version = rootProject.version
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'jacoco'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compileOnly 'org.slf4j:slf4j-api:1.7.25'
compileOnly 'javax:javaee-api:7.0'
compile 'io.swagger.core.v3:swagger-annotations:2.0.8'
runtime 'ch.qos.logback:logback-classic:1.2.3'
testCompile 'junit:junit:4.12'
testCompile 'org.assertj:assertj-core:3.6.2'
testCompile 'org.mockito:mockito-core:2.13.0'
testCompile 'javax:javaee-api:7.0'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
}
clean {
dependsOn gradle.includedBuilds*.task(':clean')
}
configurations.runtime {
resolutionStrategy.dependencySubstitution {
substitute module("de.rechner:openatfx") with project(":org.eclipse.mdm.openatfx")
}
exclude group: 'com.sun.mail', module: 'javax.mail'
exclude group: 'javax.ws.rs', module: 'javax.ws.rs-api'
exclude group: 'javax.activation', module: 'activation'
exclude group: 'javax.annotation', module: 'javax.annotation-api'
exclude group: 'javax.inject', module: 'javax.inject'
exclude group: 'org.glassfish.hk2.external', module: 'javax.inject'
exclude group: 'commons-logging', module: 'commons-logging'
// exclude guava dependencies
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
exclude group: 'com.google.j2objc', module: 'j2objc-annotations'
exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations'
exclude group: 'org.checkerframework', module: 'checker-compat-qual'
}
dependencies {
runtime project(':org.eclipse.mdm.application')
runtime project(':org.eclipse.mdm.apicopy')
compile 'org.webjars:swagger-ui:3.23.0'
// adapters
runtime project(':org.eclipse.mdm.api.atfxadapter')
runtime "org.eclipse.mdm:org.eclipse.mdm.api.odsadapter:${version}"
}
resolve {
outputPath = file('build/openapi')
outputFileName = 'openapi'
outputFormat = 'JSONANDYAML'
prettyPrint = 'TRUE'
classpath = sourceSets.main.runtimeClasspath
resourcePackages = ['org.eclipse.mdm']
openApiFile = file('src/main/openapi/openApiFile.json')
}
tasks.war.dependsOn("resolve")
task collectConfiguration() {
doLast {
subprojects.each { subproject ->
copy {
from "${project.projectDir}/${subproject.name}/src/main/configuration/"
into "${project.projectDir}/build/tmp/openmdm_application/configuration/${subproject.name}"
}
}
}
}
task copySchema(dependsOn: ':org.eclipse.mdm.preferences:generateSchema') {
doLast {
copy {
from "${project.projectDir}/org.eclipse.mdm.preferences/build/generated-schema/"
into "${project.projectDir}/build/tmp/openmdm_application/schema/org.eclipse.mdm.preferences"
}
copy {
from "${project.projectDir}/org.eclipse.mdm.preferences/src/main/sql/"
into "${project.projectDir}/build/tmp/openmdm_application/schema/update"
}
}
}
task distribute(type: Zip) {
archiveName = "openMDM_application-${version}.zip"
from "${project.projectDir}/LICENSE.txt"
from "${project.projectDir}/NOTICE.txt"
from "${project.projectDir}/CONTRIBUTING.md"
from "${project.projectDir}/readme.md"
from "${project.projectDir}/release_notes.md"
from "${project.projectDir}/doc/GettingStarted_mdmbl.pdf"
from "${project.projectDir}/doc/Installation Guide for the openMDM5 Application.pdf"
from "${project.projectDir}/build/tmp/openmdm_application"
from "${project.projectDir}/build/libs/"
}
distribute.dependsOn(collectConfiguration)
distribute.dependsOn(copySchema)
war {
from ('org.eclipse.mdm.application/build/node/dist') {
include('**/*')
}
from ("${project.projectDir}/build/openapi/") {
include('**/*')
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [VERSION: version])
}
from ("${project.projectDir}/src/main/webapp/") {
include('**/*')
}
webXml = file('org.eclipse.mdm.application/src/main/webconfig/web.xml')
webInf {from 'org.eclipse.mdm.application/src/main/webconfig/glassfish-web.xml'}
metaInf { from 'NOTICE.txt' }
metaInf { from 'LICENSE.txt' }
metaInf { from 'CONTRIBUTING.md' }
}
war.finalizedBy(distribute)
jacoco {
toolVersion = "0.7.6.201602180812"
reportsDir = file("${project.buildDir}/jacoco/test.exec")
}
sonarqube {
properties {
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec"
}
}
tasks["sonarqube"].dependsOn "org.eclipse.mdm.application:map_tslint"