blob: 985e331b0b7531f19e8fc9f0cb3cac3ca31ffd23 [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
*
********************************************************************************/
description = 'MDM API - ODSAdapter'
group = 'org.eclipse.mdm'
version = '5.2.0M1'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'com.google.protobuf'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.1'
}
}
repositories {
jcenter()
mavenLocal()
mavenCentral()
}
sourceSets {
generated {
java {
srcDir 'src/gen/java'
srcDir 'build/generated/source/proto/main/java'
}
}
main {
compileClasspath += generated.output
runtimeClasspath += generated.output
}
test {
compileClasspath += generated.output
runtimeClasspath += generated.output
}
}
configurations.all {
exclude group: 'javax.inject', 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 {
compileOnly 'javax:javaee-api:7.0'
// logging
compile 'org.slf4j:slf4j-api:1.7.25'
// httpclient uses commons-logging
compile 'org.slf4j:jcl-over-slf4j:1.7.25'
// MDM5 API
compile "org.eclipse.mdm:org.eclipse.mdm.api.base:${version}"
compile "org.eclipse.mdm:org.eclipse.mdm.api.default:${version}"
// compile CORBA idl using JDK tools
generatedCompile files(System.getenv('JAVA_HOME') + '/lib/tools.jar')
generatedCompile files('src/main/idl/')
// Peak notification service
compile 'com.google.protobuf:protobuf-java:3.2.0'
compile 'com.google.protobuf:protobuf-java-util:3.2.0'
compile 'com.google.guava:guava:25.0-jre'
compile 'org.glassfish.jersey.core:jersey-client:2.23.2'
compile 'org.glassfish.jersey.media:jersey-media-sse:2.23.2'
generatedCompile 'com.google.protobuf:protobuf-java:3.2.0'
// querying es
compile 'commons-httpclient:commons-httpclient:3.1'
compile 'org.apache.commons:commons-text:1.6'
// testing
testCompile 'junit:junit:4.12'
testRuntime 'org.slf4j:slf4j-simple:1.7.25'
testCompile 'org.mockito:mockito-core:2.13.0'
testCompile 'org.assertj:assertj-core:3.6.2'
testCompile "org.elasticsearch.client:elasticsearch-rest-client:6.4.1"
testCompile "org.testcontainers:elasticsearch:1.12.5"
}
test {
if(project.hasProperty('host')) {
systemProperty 'host', project.property('host')
} else {
systemProperty 'host', '<host>'
}
if(project.hasProperty('port')) {
systemProperty 'port', project.property('port')
} else {
systemProperty 'port', '2809'
}
if(project.hasProperty('service')) {
systemProperty 'service', project.property('service')
} else {
systemProperty 'service', '<service>'
}
jvmArgs '-Dorg.slf4j.simpleLogger.defaultLogLevel=debug'
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.2.0'
}
}
task compileIDL(type: JavaExec) {
classpath = configurations.generatedCompile
main = 'com.sun.tools.corba.se.idl.toJavaPortable.Compile'
// add 'fallTIE' if <Type>POA & <Type>POATie have to be generated
args '-fallTIE', '-td', 'src/gen/java/', 'src/main/idl/ods530.idl'
outputs.dir("src/gen/java")
}
task compileNotificationServiceIDL(type: JavaExec) {
classpath = configurations.generatedCompile
main = 'com.sun.tools.corba.se.idl.toJavaPortable.Compile'
args '-emitAll', '-fallTIE', '-i', 'src/main/idl/', '-td', 'src/gen/java/', 'src/main/idl/CosNotifyChannelAdmin.idl'
outputs.dir("src/gen/java")
outputs.upToDateWhen { false }
}
compileGeneratedJava {
inputs.dir("build/generated/source")
inputs.dir("src/gen/java")
}
// generate classes from idl and compile them
compileGeneratedJava.dependsOn compileIDL
compileGeneratedJava.dependsOn compileNotificationServiceIDL
compileJava.dependsOn compileGeneratedJava
jar {
from sourceSets.generated.output
dependsOn generatedClasses
metaInf { from 'NOTICE.txt' }
metaInf { from 'LICENSE.txt' }
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
task deleteGenerated(type: Delete) {
delete 'src/gen'
delete 'build'
}
clean.dependsOn deleteGenerated