This commit is contained in:
41
gradle/common.gradle
Normal file
41
gradle/common.gradle
Normal file
@@ -0,0 +1,41 @@
|
||||
// SPDX-FileCopyrightText: The openTCS Authors
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//
|
||||
// This file is to be applied to every subproject.
|
||||
//
|
||||
|
||||
// If we do not have a build number, we're building on a developer's system, so
|
||||
// mark the artifact as a snapshot build.
|
||||
def versionBuild = "SNAPSHOT"
|
||||
if (System.env.BUILD_NUMBER) {
|
||||
versionBuild = "b" + System.env.BUILD_NUMBER
|
||||
}
|
||||
else if (System.env.CI_PIPELINE_IID) {
|
||||
versionBuild = "b" + System.env.CI_PIPELINE_IID
|
||||
}
|
||||
|
||||
// Semantic versioning:
|
||||
// - The major version number should be incremented with major API-breaking
|
||||
// changes.
|
||||
// - The minor version number should be incremented when new feature were added.
|
||||
// - The patch level should be incremented with every small change to the code
|
||||
// (e.g. bugfixes).
|
||||
project.version = "6.2.0"
|
||||
if (!(project.hasProperty("NO_BUILD_NUMBER")
|
||||
&& Boolean.valueOf(project.getProperties().get("NO_BUILD_NUMBER")))) {
|
||||
project.version += "-$versionBuild"
|
||||
}
|
||||
|
||||
project.ext.buildDate = new Date().format('yyyy-MM-dd HH:mm:ss')
|
||||
|
||||
group = 'org.opentcs'
|
||||
|
||||
task createFolders(description: 'Creates the source folders if they do not exist.') doLast {
|
||||
sourceSets*.allSource*.srcDirs*.each { File srcDir ->
|
||||
if (!srcDir.isDirectory()) {
|
||||
println "Creating source folder: ${srcDir}"
|
||||
srcDir.mkdirs()
|
||||
}
|
||||
}
|
||||
}
|
||||
29
gradle/guice-application.gradle
Normal file
29
gradle/guice-application.gradle
Normal file
@@ -0,0 +1,29 @@
|
||||
// SPDX-FileCopyrightText: The openTCS Authors
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
apply from: "${rootDir}/gradle/guice-project.gradle"
|
||||
apply plugin: 'application'
|
||||
|
||||
run {
|
||||
dependsOn installDist
|
||||
workingDir new File(new File(buildDir, 'install'), project.name)
|
||||
enableAssertions true
|
||||
classpath sourceSets.guiceConfig.output
|
||||
}
|
||||
|
||||
task(debug, type:JavaExec) {
|
||||
dependsOn installDist
|
||||
|
||||
doFirst {
|
||||
workingDir = run.workingDir
|
||||
enableAssertions = run.enableAssertions
|
||||
|
||||
main = run.main
|
||||
args = run.args
|
||||
classpath = run.classpath
|
||||
jvmArgs = run.jvmArgs
|
||||
systemProperties = run.systemProperties
|
||||
|
||||
debug true
|
||||
}
|
||||
}
|
||||
32
gradle/guice-project.gradle
Normal file
32
gradle/guice-project.gradle
Normal file
@@ -0,0 +1,32 @@
|
||||
// SPDX-FileCopyrightText: The openTCS Authors
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
sourceSets {
|
||||
guiceConfig
|
||||
}
|
||||
|
||||
configurations {
|
||||
guiceConfigApi.extendsFrom api
|
||||
guiceConfigImplementation.extendsFrom implementation
|
||||
}
|
||||
|
||||
dependencies {
|
||||
guiceConfigImplementation sourceSets.main.runtimeClasspath
|
||||
}
|
||||
|
||||
// Attributes for the AsciiDoc documentation to include code from source files
|
||||
ext.guiceSrcDir = sourceSets.guiceConfig.java.srcDirs[0]
|
||||
|
||||
compileGuiceConfigJava {
|
||||
options.release = 21
|
||||
options.compilerArgs << "-Werror"
|
||||
options.compilerArgs << "-Xlint:all"
|
||||
options.compilerArgs << "-Xlint:-serial"
|
||||
}
|
||||
|
||||
jar {
|
||||
from sourceSets.guiceConfig.output
|
||||
// This merely tells NetBeans where to look for classes in case of other
|
||||
// subprojects depending on this one. By default, it only scans 'main'.
|
||||
ext.netBeansSourceSets = [sourceSets.guiceConfig, sourceSets.main]
|
||||
}
|
||||
18
gradle/java-codequality.gradle
Normal file
18
gradle/java-codequality.gradle
Normal file
@@ -0,0 +1,18 @@
|
||||
// SPDX-FileCopyrightText: The openTCS Authors
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
checkstyle {
|
||||
toolVersion = '10.18.2'
|
||||
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
||||
showViolations = false
|
||||
}
|
||||
|
||||
project.afterEvaluate { project ->
|
||||
project.tasks.withType(Checkstyle) {
|
||||
reports {
|
||||
html.stylesheet resources.text.fromFile(rootProject.file("config/checkstyle/checkstyle-noframes-severity-sorted.xsl"))
|
||||
}
|
||||
}
|
||||
}
|
||||
87
gradle/java-project.gradle
Normal file
87
gradle/java-project.gradle
Normal file
@@ -0,0 +1,87 @@
|
||||
// SPDX-FileCopyrightText: The openTCS Authors
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
|
||||
base.archivesName = name.toLowerCase()
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.16'
|
||||
|
||||
compileOnly group: 'jakarta.inject', name: 'jakarta.inject-api', version: '2.0.1'
|
||||
|
||||
compileOnly group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '3.0.0'
|
||||
testCompileOnly group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '3.0.0'
|
||||
|
||||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.11.2'
|
||||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.11.2'
|
||||
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.11.2'
|
||||
testRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.11.2'
|
||||
|
||||
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '3.0'
|
||||
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.14.2'
|
||||
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.26.3'
|
||||
testImplementation group: 'com.approvaltests', name: 'approvaltests', version: '24.8.0'
|
||||
|
||||
testRuntimeOnly group: 'org.slf4j', name: 'slf4j-jdk14', version: '2.0.16'
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.release = 21
|
||||
options.compilerArgs << "-Werror"
|
||||
options.compilerArgs << "-Xlint:all"
|
||||
options.compilerArgs << "-Xlint:-serial"
|
||||
}
|
||||
|
||||
compileTestJava {
|
||||
options.release = 21
|
||||
options.compilerArgs << "-Werror"
|
||||
options.compilerArgs << "-Xlint:all"
|
||||
options.compilerArgs << "-Xlint:-serial"
|
||||
}
|
||||
|
||||
javadoc {
|
||||
title = "openTCS ${project.version} API documentation: ${project.name}"
|
||||
|
||||
options {
|
||||
header = "openTCS ${project.version}"
|
||||
overview = "${projectDir}/src/main/java/overview.html"
|
||||
addBooleanOption('Werror', true)
|
||||
addBooleanOption('Xdoclint:all,-missing', true)
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
|
||||
archiveClassifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
// ignoreFailures = true
|
||||
systemProperties.put("java.awt.headless", "true")
|
||||
}
|
||||
|
||||
ext {
|
||||
// Attributes for the AsciiDoc documentation to include code from source files
|
||||
javaSrcDir = sourceSets.main.java.srcDirs[0]
|
||||
javaClassesDir = sourceSets.main.output.classesDirs
|
||||
testSrcDir = sourceSets.test.java.srcDirs[0]
|
||||
}
|
||||
|
||||
spotless {
|
||||
java {
|
||||
// Use the default import order configuration
|
||||
importOrder()
|
||||
|
||||
// Use the Eclipse JDT formatter
|
||||
eclipse('4.26').configFile("${rootDir}/config/eclipse-formatter-preferences.xml")
|
||||
}
|
||||
}
|
||||
26
gradle/publishing-gitlab.gradle
Normal file
26
gradle/publishing-gitlab.gradle
Normal file
@@ -0,0 +1,26 @@
|
||||
// SPDX-FileCopyrightText: The openTCS Authors
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
if (Boolean.valueOf(project.findProperty('DO_DEPLOY_PRIVATE'))
|
||||
&& System.getenv('CI_API_V4_URL') != null
|
||||
&& System.getenv('CI_PROJECT_ID') != null
|
||||
&& System.getenv('CI_JOB_TOKEN') != null) {
|
||||
|
||||
maven {
|
||||
name = 'deploy-repo-gitlab'
|
||||
url = "${System.env.CI_API_V4_URL}/projects/${System.env.CI_PROJECT_ID}/packages/maven"
|
||||
|
||||
credentials(HttpHeaderCredentials) {
|
||||
name = 'Job-Token'
|
||||
value = "${System.env.CI_JOB_TOKEN}"
|
||||
}
|
||||
authentication {
|
||||
header(HttpHeaderAuthentication)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
49
gradle/publishing-java.gradle
Normal file
49
gradle/publishing-java.gradle
Normal file
@@ -0,0 +1,49 @@
|
||||
// SPDX-FileCopyrightText: The openTCS Authors
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
apply from: "${rootDir}/gradle/signing.gradle"
|
||||
|
||||
// Enable javadoc and sources JARs to be created.
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create(project.name + '_mavenJava', MavenPublication) {
|
||||
from(components.java)
|
||||
|
||||
pom {
|
||||
// Override artifactId since project.name is used by default and is mixed-case.
|
||||
artifactId = project.name.toLowerCase()
|
||||
|
||||
name = project.name
|
||||
description = project.name
|
||||
url = "https://www.opentcs.org/"
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name = "MIT License"
|
||||
url = "https://opensource.org/license/mit"
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
name = "The openTCS Authors"
|
||||
email = "info@opentcs.org"
|
||||
organization = "The open Transportation Control System"
|
||||
organizationUrl = "https://www.opentcs.org/"
|
||||
}
|
||||
}
|
||||
|
||||
scm {
|
||||
connection = "scm:git:git://github.com/opentcs/opentcs.git"
|
||||
developerConnection = "scm:git:ssh://github.com:opentcs/opentcs.git"
|
||||
url = "https://github.com/opentcs/opentcs"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
gradle/publishing-ossrh.gradle
Normal file
18
gradle/publishing-ossrh.gradle
Normal file
@@ -0,0 +1,18 @@
|
||||
// SPDX-FileCopyrightText: The openTCS Authors
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
nexusPublishing {
|
||||
if (Boolean.valueOf(project.findProperty('DO_DEPLOY_OSSRH'))
|
||||
&& project.hasProperty('DEPLOY_REPO_OSSRH_USERNAME')
|
||||
&& project.hasProperty('DEPLOY_REPO_OSSRH_PASSWORD')) {
|
||||
repositories {
|
||||
sonatype {
|
||||
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
|
||||
snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/'))
|
||||
|
||||
username = project.property('DEPLOY_REPO_OSSRH_USERNAME')
|
||||
password = project.property('DEPLOY_REPO_OSSRH_PASSWORD')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
gradle/signing.gradle
Normal file
17
gradle/signing.gradle
Normal file
@@ -0,0 +1,17 @@
|
||||
// SPDX-FileCopyrightText: The openTCS Authors
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
signing {
|
||||
useInMemoryPgpKeys(
|
||||
project.hasProperty('SIGNING_KEY') ? project.property('SIGNING_KEY') : '',
|
||||
project.hasProperty('SIGNING_PASSWORD') ? project.property('SIGNING_PASSWORD') : ''
|
||||
)
|
||||
sign publishing.publications
|
||||
}
|
||||
|
||||
tasks.withType(Sign) {
|
||||
onlyIf {
|
||||
project.hasProperty('SIGNING_KEY') && !project.property('SIGNING_KEY').toString().isEmpty() \
|
||||
&& project.hasProperty('SIGNING_PASSWORD') && !project.property('SIGNING_PASSWORD').toString().isEmpty()
|
||||
}
|
||||
}
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.jar.license
vendored
Normal file
2
gradle/wrapper/gradle-wrapper.jar.license
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
SPDX-FileCopyrightText: The Gradle Authors
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
2
gradle/wrapper/gradle-wrapper.properties.license
vendored
Normal file
2
gradle/wrapper/gradle-wrapper.properties.license
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
SPDX-FileCopyrightText: The Gradle Authors
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
Reference in New Issue
Block a user