cavis/build.gradle

186 lines
7.3 KiB
Groovy

/*
*
* ******************************************************************************
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * See the NOTICE file distributed with this work for additional
* * information regarding copyright ownership.
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.6.0"
classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.0'
}
}
apply plugin: "com.vanniktech.dependency.graph.generator"
apply plugin: 'com.google.osdetector'
ext {
buildTarget = (properties.CAVIS_TARGET ?: osdetector.classifier).toLowerCase() //if not defined otherwise, we build target is the same as build host
logger.quiet("Building host platform is '{}' and build target(s) are '{}'", osdetector.classifier, buildTarget)
buildSupportMatrix = [[host: "windows-x86_64",
canBuild: ["windows-x86_64",
"windows-x86"]
],
[host: "linux-x86_64",
canBuild: ["linux-x86_64", "linux-arm64"]
]]
logger.quiet("Print {}", buildSupportMatrix)
scalaVersion = "2.12"
logger.quiet("Scala main version is set to {}", scalaVersion)
logger.quiet("Running java {}", JavaVersion.current())
}
configurations.all {
resolutionStrategy {
// fail eagerly on version conflict (includes transitive dependencies)
// e.g. multiple different versions of the same dependency (group and name are equal)
failOnVersionConflict()
}
}
allprojects { Project proj ->
apply plugin: 'com.google.osdetector'
version = "1.0.0-SNAPSHOT"
group = "net.brutex.cavis"
plugins.withType(JavaPlugin) {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8
tasks.withType(JavaCompile) {
options.release = 8
}
dependencies {
implementation platform(project(":cavis-common-platform"))
compileOnly platform(project(":cavis-common-platform"))
annotationProcessor platform(project(":cavis-common-platform"))
testCompileOnly platform(project(":cavis-common-platform"))
testAnnotationProcessor platform(project(":cavis-common-platform"))
testImplementation platform(project(":cavis-common-platform"))
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
implementation "org.slf4j:slf4j-api"
implementation "org.slf4j:slf4j-simple"
}
test {
useJUnitPlatform {
if( project.hasProperty("includeTags") ) {
it.includeTags=project.getProperty("includeTags").split(",")
}
if( project.hasProperty("excludeTags") ) {
it.excludeTags=project.getProperty("excludeTags").split(",")
}
}
ignoreFailures = true
testLogging {
events "PASSED", "SKIPPED", "FAILED", "STANDARD_OUT", "STANDARD_ERROR"
}
}
}
plugins.withType(MavenPublishPlugin) {
publishing {
publications {
if(! proj.name.contains("cavis-full")) {
mavenJava(MavenPublication) {
/* Need to verify the property exists, as some
modules may not declare it (i.e. the java-platform plugin)
*/
if (components.hasProperty("java")) {
from components.java
}
}
}
}
repositories {
maven {
name = 'LocalRemote'
def releasesRepoUrl = 'https://archiva.brutex.net/repository/internal/'
def snapshotsRepoUrl = 'https://archiva.brutex.net/repository/snapshots/'
url = proj.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
allowInsecureProtocol = false
credentials {
username = mavenuser
password = mavenpass
}
}
/*
maven {
name = 'OSSRH'
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url = proj.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
*/
/*
maven {
name = 'localGitea'
def releasesRepoUrl = 'http://bru3-pc.fritz.box:3000/api/packages/brutex/maven'
def snapshotsRepoUrl = 'http://bru3-pc.fritz.box:3000/api/packages/brutex/maven'
url = proj.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
allowInsecureProtocol = true
credentials {
username = mavenuser
password = mavenpass
}
}
*/
}
}
}
}
task aggregatedJavadocs(type: Javadoc, description: 'Generate javadocs from all child projects as if it was a single project', group: 'Documentation') {
subprojects.each { proj ->
proj.tasks.withType(Javadoc).each { javadocTask ->
logger.quiet("Adding javadoc for project " + proj.name)
source += javadocTask.source
classpath += javadocTask.classpath
excludes += javadocTask.excludes
includes += javadocTask.includes
}
}
destinationDir = file("$buildDir/docs/javadoc")
title = "$project.name $version API"
options.author true
options.links 'http://docs.oracle.com/javase/8/docs/api/'
options.addStringOption('Xdoclint:none', '-quiet')
}