diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8f399cc..8fd239b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,9 +19,18 @@ jobs: # Run `git checkout` - uses: actions/checkout@v3 - - name: Retrieve current version from pom + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Retrieve current version from gradle.properties run: | - echo RELEASE_VERSION=$(cat pom.xml | grep -o -P '(?<=revision\>).*(?=\<\/revision)') >> $GITHUB_ENV + echo RELEASE_VERSION=$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{print $2}') >> $GITHUB_ENV echo GIT_HASH_SHORT=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_ENV - name: Remove SNAPSHOT suffix for release @@ -32,18 +41,12 @@ jobs: - name: Add git hash to snapshot release if: startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/tags/v') run: | - echo CHANGELIST=${{ env.CHANGELIST }}.${{ env. GIT_HASH_SHORT }} >> $GITHUB_ENV - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' + echo CHANGELIST=${{ env.CHANGELIST }}.${{ env.GIT_HASH_SHORT }} >> $GITHUB_ENV - name: Run headless test uses: GabrielBB/xvfb-action@v1 with: - run: mvn verify -Dchangelist=${{ env.CHANGELIST }} -f pom.xml + run: ./gradlew check -Prevision=${{ env.RELEASE_VERSION }} -Pchangelist=${{ env.CHANGELIST }} working-directory: ./ #optional options: #optional env: @@ -53,25 +56,25 @@ jobs: id: jre-cache uses: actions/cache@v3 with: - path: sdccc/target/jre + path: sdccc/build/jre key: jre-cache - name: Build package and download license information run: | - mvn package -Dchangelist=${{ env.CHANGELIST }} -DskipTests=true -f pom.xml -Pexecutable + ./gradlew build -x test -Prevision=${{ env.RELEASE_VERSION }} -Pchangelist=${{ env.CHANGELIST }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Collect executable artifacts run: | - mkdir sdccc/target/zip - cp -r sdccc/target/lib sdccc/target/zip/ - cp -r sdccc/target/jre sdccc/target/zip/ - cp -r sdccc/target/generated-resources/licenses sdccc/target/zip/lib/ - cp -r sdccc/target/generated-resources/licenses.xml sdccc/target/zip/lib/ - cp -r configuration sdccc/target/zip/ - cp sdccc/target/sdccc-*.exe sdccc/target/zip/ - cp README.md sdccc/target/zip/ + mkdir sdccc/build/zip + cp -r sdccc/build/lib sdccc/build/zip/ + cp -r sdccc/build/jre sdccc/build/zip/ + cp -r sdccc/build/reports/dependency-license/downloaded-licenses/ sdccc/build/zip/lib/ + cp -r sdccc/build/reports/dependency-license/index.xml sdccc/build/zip/lib/ + cp -r configuration sdccc/build/zip/ + cp sdccc/build/launch4j/SDCcc-*.exe sdccc/build/zip/ + cp README.md sdccc/build/zip/ - name: Set zip file name for release if: startsWith(github.ref, 'refs/tags/') @@ -84,15 +87,15 @@ jobs: - name: Zip executable if: startsWith(github.ref, 'refs/tags/') - working-directory: sdccc/target/zip + working-directory: sdccc/build/zip run: | zip -qq -r ${{ env.ZIP_FILE_NAME }} . - name: Zip test results if: startsWith(github.ref, 'refs/tags/') - working-directory: sdccc/target/ + working-directory: sdccc/build/ run: | - zip -qq -r test-results.zip failsafe-reports surefire-reports checkstyle-result.xml spotbugsXml.xml detekt.html + zip -qq -r test-results.zip reports/tests reports/checkstyle reports/spotbugs reports/detekt - name: Attach artifacts to snapshot uses: softprops/action-gh-release@v1 @@ -100,7 +103,7 @@ jobs: with: files: | CHANGELOG.md - sdccc/target/zip/${{ env.ZIP_FILE_NAME }} - sdccc/target/test-results.zip + sdccc/build/zip/${{ env.ZIP_FILE_NAME }} + sdccc/build/test-results.zip prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }} - body_path: CHANGELOG.md \ No newline at end of file + body_path: CHANGELOG.md diff --git a/.gitignore b/.gitignore index 22238c43..0da859bb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,15 @@ sdccc/testruns # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + # User-specific stuff .idea/**/workspace.xml .idea/**/tasks.xml @@ -29,8 +38,19 @@ sdccc/testruns .idea/**/dbnavigator.xml # Gradle -.idea/**/gradle.xml .idea/**/libraries +build/ +!src/**/build/ +.gradle/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Avoid ignore Gradle wrappper properties +!gradle-wrapper.properties # Gradle and Maven with auto-import # When using Gradle or Maven with auto-import, you should exclude module files, @@ -104,14 +124,6 @@ modules.xml # Mobile Tools for Java (J2ME) .mtj.tmp/ -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* diff --git a/biceps-model/build.gradle.kts b/biceps-model/build.gradle.kts new file mode 100644 index 00000000..55f78688 --- /dev/null +++ b/biceps-model/build.gradle.kts @@ -0,0 +1,41 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + + +plugins { + id("com.draeger.medical.java-conventions") + id("org.somda.sdc.xjc") +} + +val jaxb: Configuration by configurations.creating +val schemaDir = "src/main" + + +dependencies { + api(libs.org.glassfish.jaxb.jaxb.core) + api(libs.org.glassfish.jaxb.jaxb.runtime) + api(libs.jakarta.xml.bind.jakarta.xml.bind.api) + api(libs.io.github.threeten.jaxb.threeten.jaxb.core) + api(libs.org.jvnet.jaxb.jaxb.plugins) + api(libs.org.checkerframework.checker.qual) + api(libs.org.jetbrains.annotations) + + testImplementation(libs.org.junit.jupiter.junit.jupiter.api) + testImplementation(libs.org.junit.jupiter.junit.jupiter.engine) +} + +description = "SDCri is a set of Java libraries that implements a network communication framework conforming " + + "with the IEEE 11073 SDC specifications. This project implements the model for IEEE 11073-10207." + +xjc { + jaxbClasspath = jaxb + schemaLocation = layout.projectDirectory.dir(schemaDir) +} + +description = "BICEPS model" + +val testsJar by tasks.registering(Jar::class) { + archiveClassifier.set("tests") + from(sourceSets["test"].output) +} diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts new file mode 100644 index 00000000..090cd30d --- /dev/null +++ b/build-logic/build.gradle.kts @@ -0,0 +1,36 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +plugins { + // Support convention plugins written in Kotlin. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. + `kotlin-dsl` +} + +repositories { + // Use the plugin portal to apply community plugins in convention plugins. + gradlePluginPortal() +} + +gradlePlugin { + plugins { + create("XjcPlugin") { + id = "org.somda.sdc.xjc" + implementationClass = "org.somda.sdc.XjcPlugin" + } + create("licenseReport") { + id = "com.example.license-report" + implementationClass = "LicenseReportPlugin" + } + } +} + +dependencies { + implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) + implementation(libs.com.github.jk1.license.report) + implementation(libs.gradleplugins.spotbugs) + implementation(libs.gradleplugins.spotless) + implementation(libs.gradleplugins.kotlin.jvm) + implementation(libs.gradleplugins.download) + implementation(libs.gradleplugins.launch4j) +} diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 00000000..b0d57134 --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,11 @@ +rootProject.name = "build-logic" + +// make libs.versions.toml available +// see https://stackoverflow.com/a/70878181 +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} diff --git a/build-logic/src/main/kotlin/Common.kt b/build-logic/src/main/kotlin/Common.kt new file mode 100644 index 00000000..c187e4c1 --- /dev/null +++ b/build-logic/src/main/kotlin/Common.kt @@ -0,0 +1,8 @@ +import org.gradle.api.Project +import org.gradle.api.provider.Provider +import org.gradle.kotlin.dsl.the + + +// workaround for making libs available in build-logic +val Project.libs + get() = the() diff --git a/build-logic/src/main/kotlin/LicenseDownloaderRenderer.kt b/build-logic/src/main/kotlin/LicenseDownloaderRenderer.kt new file mode 100644 index 00000000..876dc027 --- /dev/null +++ b/build-logic/src/main/kotlin/LicenseDownloaderRenderer.kt @@ -0,0 +1,96 @@ +import com.github.jk1.license.LicenseReportExtension +import com.github.jk1.license.ModuleData +import com.github.jk1.license.ProjectData +import com.github.jk1.license.render.ReportRenderer +import org.gradle.api.Project +import java.io.File +import java.net.URL + +class LicenseDownloaderRenderer( + private val outputDirName: String = "downloaded-licenses" +) : ReportRenderer { + + companion object { + private const val CONNECT_TIMEOUT = 5000 // 5 seconds + private const val READ_TIMEOUT = 10000 // 10 seconds + } + + private lateinit var project: Project + private lateinit var outputDir: File + private val downloadedLicenses = mutableSetOf() + + override fun render(data: ProjectData) { + project = data.project + val config = project.extensions.getByType(LicenseReportExtension::class.java) + outputDir = File(config.outputDir, outputDirName) + outputDir.mkdirs() + + data.allDependencies.forEach { moduleData -> + val moduleName = "${moduleData.group}-${moduleData.name}-${moduleData.version}" + val licenseDetails = extractPomLicenseDetails(moduleData) + + if (licenseDetails.isNotEmpty()) { + licenseDetails.forEach { (licenseUrl, fileName) -> + try { + if (downloadedLicenses.add(licenseUrl)) { + downloadLicense(licenseUrl, moduleName, fileName) + } else { + project.logger.lifecycle("Skipping duplicate license download for $licenseUrl") + } + } catch (e: Exception) { + project.logger.warn("Failed to download license from $licenseUrl for $moduleName: ${e.message}") + } + } + } else { + project.logger.warn("No POM license URLs found for $moduleName") + } + } + } + + private fun extractPomLicenseDetails(moduleData: ModuleData): List> { + val licenseDetails = mutableListOf>() + + moduleData.poms.forEach { pomData -> + pomData.licenses.forEach { license -> + val url = license.url?.trim() + val fileName = license.name ?: "LICENSE" + if (!url.isNullOrEmpty()) { + licenseDetails.add(url to fileName) + } + } + } + + return licenseDetails + } + + private fun downloadLicense(licenseUrl: String, moduleName: String, fileName: String) { + val sanitizedUrl = licenseUrl.trim() + val url = URL(sanitizedUrl) + + val connection = url.openConnection() + connection.connectTimeout = CONNECT_TIMEOUT + connection.readTimeout = READ_TIMEOUT + connection.connect() + + val contentType = connection.contentType ?: "application/octet-stream" + + val extension = when { + contentType.contains("text/html", ignoreCase = true) -> ".html" + contentType.contains("text/plain", ignoreCase = true) -> ".txt" + contentType.contains("application/pdf", ignoreCase = true) -> ".pdf" + contentType.contains("text/markdown", ignoreCase = true) -> ".md" + else -> ".txt" + } + + val file = File(outputDir, "$fileName$extension") + + connection.getInputStream().use { input -> + file.outputStream().use { output -> + input.copyTo(output) + } + } + + project.logger.lifecycle("Downloaded license for $moduleName from $licenseUrl to $file") + } + +} diff --git a/build-logic/src/main/kotlin/com.draeger.medical.executable-conventions.gradle.kts b/build-logic/src/main/kotlin/com.draeger.medical.executable-conventions.gradle.kts new file mode 100644 index 00000000..80fcde0e --- /dev/null +++ b/build-logic/src/main/kotlin/com.draeger.medical.executable-conventions.gradle.kts @@ -0,0 +1,80 @@ +import org.gradle.api.tasks.Copy +import org.gradle.kotlin.dsl.register + + +plugins { + id("com.draeger.medical.java-conventions") + id("com.draeger.medical.kotlin-conventions") + id("de.undercouch.download") + id("edu.sc.seis.launch4j") +} + +val javaVersion = property("javaVersion").toString() +val jreDirectoryName = "jdk-17.0.5+8-jre" +val jreBasePath = "jre" +val jreFullPath = "${jreBasePath}/${jreDirectoryName}" +val jreDownloadUrlPrefix = "https://github.com/adoptium/temurin17-binaries/releases/download/" +val jreDownloadFileName = "OpenJDK17U-jre_x64_windows_hotspot_17.0.5_8.zip" +val jreDownloadUrlSuffix = "jdk-17.0.5%2B8/${jreDownloadFileName}" +val jreDownloadUrl = "${jreDownloadUrlPrefix}${jreDownloadUrlSuffix}" + +tasks.register("downloadJre") { + src(jreDownloadUrl) + dest(file("${layout.buildDirectory.get().asFile}/${jreBasePath}/${jreDownloadFileName}")) + overwrite(false) + onlyIfModified(true) +} + +tasks.register("unpackJre") { + doFirst { + file("${layout.buildDirectory.get().asFile}/${jreBasePath}").walk().forEach { file -> + if (!file.setWritable(true)) { + println("Failed to set writable permission for ${file.absolutePath}") + } + } + } + dependsOn("downloadJre") + from(zipTree(file("${layout.buildDirectory.get().asFile}/${jreBasePath}/${jreDownloadFileName}"))) + into("${layout.buildDirectory.get().asFile}/${jreBasePath}") +} + +tasks.register("downloadAndUnpackJre") { + dependsOn("unpackJre") +} + +tasks.register("copyRuntimeLibs") { + from(configurations.runtimeClasspath) { + exclude { it.isDirectory } + } + into("${layout.buildDirectory.get().asFile}/lib") +} + +val projectName = "SDCcc-gradle" + +tasks.createExe { + headerType = "console" + jar = "${layout.buildDirectory.get().asFile}/libs/${projectName}-${project.version}.jar" + outfile = "${projectName}-${project.version}.exe" // Absolute path not allowed. File gets placed in build/launch4j + mainClassName = "com.draeger.medical.sdccc.TestSuite" + classpath = setOf("lib/**") + jreMinVersion = javaVersion + bundledJrePath = "../${jreFullPath}" + + version = "${project.version}.0" + textVersion = "${project.version}" + fileDescription = "${project.name}" + copyright = "2023-2024 Draegerwerk AG & Co. KGaA" + + productName = "${project.name}" + companyName = "Draegerwerk AG & Co. KGaA" + internalName = "sdccc" +} + +tasks.named("createExe") { + dependsOn("copyRuntimeLibs", "downloadAndUnpackJre") +} + +tasks.named("build") { + dependsOn("createExe") +} + diff --git a/build-logic/src/main/kotlin/com.draeger.medical.java-analysis.gradle.kts b/build-logic/src/main/kotlin/com.draeger.medical.java-analysis.gradle.kts new file mode 100644 index 00000000..f7b36eb8 --- /dev/null +++ b/build-logic/src/main/kotlin/com.draeger.medical.java-analysis.gradle.kts @@ -0,0 +1,27 @@ +plugins { + id("com.draeger.medical.java-conventions") + id("com.github.spotbugs") + id("com.diffplug.spotless") + checkstyle +} + +tasks.check { + dependsOn("spotbugsMain") + dependsOn("spotbugsTest") +} + +tasks.withType { + excludeFilter.set(file("$projectDir/../dev_config/filter.xml")) + reports.create("xml") { required = true } +} + +spotless { + java { + palantirJavaFormat() + target("src/**/*.java") + } +} + +checkstyle { + configFile = file("../checkstyle/checkstyle.xml") +} \ No newline at end of file diff --git a/build-logic/src/main/kotlin/com.draeger.medical.java-conventions.gradle.kts b/build-logic/src/main/kotlin/com.draeger.medical.java-conventions.gradle.kts new file mode 100644 index 00000000..9bb365ee --- /dev/null +++ b/build-logic/src/main/kotlin/com.draeger.medical.java-conventions.gradle.kts @@ -0,0 +1,44 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +plugins { + `java-library` +} + +repositories { + mavenLocal() + + maven { + url = uri("https://maven.pkg.github.com/Draegerwerk/t2iapi") + } + + mavenCentral() + + maven { + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + } +} + +val javaVersion = property("javaVersion").toString() + +val defaultVersion = "9.1.0-SNAPSHOT" +val actualRevision = project.findProperty("revision") ?: defaultVersion +val actualChangeList = project.findProperty("changelist") ?: "" + +group = "com.draeger.medical" +version = "$actualRevision$actualChangeList" + +java { + sourceCompatibility = JavaVersion.toVersion(javaVersion) + targetCompatibility = JavaVersion.toVersion(javaVersion) +} + +tasks.withType() { + options.encoding = "UTF-8" +} + +tasks.withType() { + options.encoding = "UTF-8" +} + diff --git a/build-logic/src/main/kotlin/com.draeger.medical.kotlin-conventions.gradle.kts b/build-logic/src/main/kotlin/com.draeger.medical.kotlin-conventions.gradle.kts new file mode 100644 index 00000000..b2c17ac4 --- /dev/null +++ b/build-logic/src/main/kotlin/com.draeger.medical.kotlin-conventions.gradle.kts @@ -0,0 +1,52 @@ +import org.gradle.api.tasks.JavaExec +import org.gradle.kotlin.dsl.creating +import org.gradle.kotlin.dsl.getValue +import org.gradle.kotlin.dsl.register + +plugins { + id("com.draeger.medical.java-conventions") + id("org.jetbrains.kotlin.jvm") +} + +val javaVersion = property("javaVersion").toString() + +tasks.withType { + kotlinOptions { + jvmTarget = javaVersion + } +} + +val detekt by configurations.creating + +val detektTask = tasks.register("detekt") { + mainClass.set("io.gitlab.arturbosch.detekt.cli.Main") + classpath = detekt + + val input = projectDir + val config = "$projectDir/../dev_config/detekt.yml" + val exclude = ".*/build/.*,.*/resources/.*,**/build.gradle.kts,**/settings.gradle.kts" + val classpathNeededForDetekt = files( + sourceSets.main.get().runtimeClasspath, + sourceSets.test.get().runtimeClasspath + ) + val jdkHome = System.getProperty("java.home") + args( + "--input", input.absolutePath, + "--config", config, + "--excludes", exclude, + "--report", "html:${layout.buildDirectory.get().asFile}/reports/detekt/detekt.html", + "--classpath", classpathNeededForDetekt, + "--jdk-home", jdkHome, + "--jvm-target", javaVersion, + "--build-upon-default-config" + ) +} + +tasks.check { + dependsOn(detektTask) +} + +dependencies { + detekt(libs.detekt.cli) + api(libs.org.jetbrains.kotlin.kotlin.stdlib) +} \ No newline at end of file diff --git a/build-logic/src/main/kotlin/license-report.gradle.kts b/build-logic/src/main/kotlin/license-report.gradle.kts new file mode 100644 index 00000000..ac05221b --- /dev/null +++ b/build-logic/src/main/kotlin/license-report.gradle.kts @@ -0,0 +1,13 @@ +// buildSrc/src/main/kotlin/license-report.gradle.kts + +plugins { + id("com.github.jk1.dependency-license-report") +} + +licenseReport { + renderers = arrayOf( + com.github.jk1.license.render.XmlReportRenderer(), + com.github.jk1.license.render.SimpleHtmlReportRenderer(), + LicenseDownloaderRenderer(), + ) +} diff --git a/build-logic/src/main/kotlin/org.somda.sdc/XjcPlugin.kt b/build-logic/src/main/kotlin/org.somda.sdc/XjcPlugin.kt new file mode 100644 index 00000000..0c299277 --- /dev/null +++ b/build-logic/src/main/kotlin/org.somda.sdc/XjcPlugin.kt @@ -0,0 +1,155 @@ +package org.somda.sdc + +import org.gradle.api.Action +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.Task +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.api.file.ConfigurableFileCollection +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.file.FileCollection +import org.gradle.api.file.SourceDirectorySet +import org.gradle.api.provider.ListProperty +import org.gradle.api.provider.Property +import org.gradle.api.tasks.JavaExec +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.jvm.tasks.Jar + +interface CompileXjc { + val jaxbClasspath: Property + val args: ListProperty + val schemaLocation: DirectoryProperty +} + +const val EXTENSION_NAME = "xjc" +const val CREATE_DIRECTORY_TASK_NAME = "createXjcOutputDir" +const val MAIN_SOURCE_SET = "main" +const val XJC_MAIN_CLASS = "com.sun.tools.xjc.XJCFacade" +const val XJC_TASK_NAME = "xmlSchemaToJava" +const val CONFIG_NAME = "xjc" +const val EPISODE_FILE_NAME = "sun-jaxb.episode" + +const val GENERATED_SOURCES_BASE = "generated/sources/xjc" +const val GENERATED_SOURCES_FOLDER_PATH = "$GENERATED_SOURCES_BASE/main" +const val GENERATED_SOURCES_EPISODE_PATH = "$GENERATED_SOURCES_BASE/$EPISODE_FILE_NAME" + +class XjcPlugin : Plugin { + override fun apply(project: Project) { + val extension = project.extensions.create( + EXTENSION_NAME, + CompileXjc::class.java + ) + + // retrieve the version catalog from the toml, sadly not in a type safe manner here + val libs = project + .extensions + .getByType(VersionCatalogsExtension::class.java) + .named("libs") + + val xjcOutputDir = project.layout.buildDirectory.dir(GENERATED_SOURCES_FOLDER_PATH).get() + val episodeOutputFile = project.layout.buildDirectory.file(GENERATED_SOURCES_EPISODE_PATH).get() + + @Suppress("ObjectLiteralToLambda") // conversion doesn't work, SAM support is messed up + val createXjcOutputDirAction = object : Action { + override fun execute(it: Task) { + it.doLast { + project.layout.buildDirectory.dir(GENERATED_SOURCES_FOLDER_PATH).get().asFile.mkdirs() + } + } + } + val createXjcOutputDir = project.tasks.register(CREATE_DIRECTORY_TASK_NAME, createXjcOutputDirAction) + + @Suppress("ObjectLiteralToLambda") // conversion doesn't work, SAM support is messed up + val xjcTaskAction = object : Action { + override fun execute(javaExec: JavaExec) { + // always add the base dependencies needed for our models + val jaxb = project.configurations.create(CONFIG_NAME) + project.dependencies.add(CONFIG_NAME, libs.findLibrary("org.glassfish.jaxb.jaxb.core").get().get()) + project.dependencies.add(CONFIG_NAME, libs.findLibrary("org.glassfish.jaxb.jaxb.runtime").get().get()) + project.dependencies.add(CONFIG_NAME, libs.findLibrary("org.glassfish.jaxb.jaxb.xjc").get().get()) + project.dependencies.add(CONFIG_NAME, libs.findLibrary("org.jvnet.jaxb.jaxb.plugins").get().get()) + project.dependencies.add(CONFIG_NAME, libs.findLibrary("org.jvnet.jaxb.jaxb.plugins.tools").get().get()) + + // append additional user-specified arguments + val newClassPath = jaxb + extension.jaxbClasspath.getOrElse(project.objects.fileCollection()) + + javaExec.dependsOn(createXjcOutputDir) + javaExec.classpath = newClassPath + javaExec.mainClass.set(XJC_MAIN_CLASS) + + project.logger.debug("episodeOutputFile = {}", episodeOutputFile) + project.logger.debug("newClassPath = {}", newClassPath) + project.logger.debug("currentJaxbClasspath = {}", extension.jaxbClasspath.orNull) + project.logger.debug("args = {}", extension.args.orNull) + project.logger.debug("schemaLocation = {}", extension.schemaLocation.orNull) + + // force generated javadoc to english + javaExec.jvmArgs = listOf("-Duser.language=en-US") + + javaExec.args = mutableListOf( + "-d", + xjcOutputDir.toString(), + "-episode", + episodeOutputFile.toString(), + "-encoding", + "UTF-8", + "-quiet", + "-extension", + "-npa", + "-no-header", + ) + extension.args.orElse(emptyList()).get() + listOf( + "-b", + extension.schemaLocation.get().toString(), + extension.schemaLocation.get().toString() + ) + } + + } + val xjcTask = project.tasks.register(XJC_TASK_NAME, JavaExec::class.java, xjcTaskAction) + + // ensure xjc as run before any java compilation + @Suppress("ObjectLiteralToLambda") // conversion doesn't work, SAM support is messed up + val dependsOnAction = object : Action { + override fun execute(it: JavaCompile) { + it.dependsOn(xjcTask) + } + + } + project.tasks.withType(JavaCompile::class.java, dependsOnAction) + + + // claim the generated sources as ours + val sourceSets: SourceSetContainer = project.extensions.getByType(SourceSetContainer::class.java) + val mainSourceSet = sourceSets.findByName(MAIN_SOURCE_SET)!! + + @Suppress("ObjectLiteralToLambda") // conversion doesn't work, SAM support is messed up + val mainSourceSetBuildByAction = object : Action { + override fun execute(it: ConfigurableFileCollection) { + it.builtBy(xjcTask) + } + } + @Suppress("ObjectLiteralToLambda") // conversion doesn't work, SAM support is messed up + val mainSourceSetAction = object : Action { + override fun execute(javaSourceDir: SourceDirectorySet) { + javaSourceDir.srcDirs( + project.files(xjcOutputDir, mainSourceSetBuildByAction) + ) + } + } + + // add episode file to jars + @Suppress("ObjectLiteralToLambda") // conversion doesn't work, SAM support is messed up + val jarAction = object : Action { + override fun execute(jar: Jar) { + jar.metaInf { + from(episodeOutputFile) + } + } + } + project.tasks.withType(Jar::class.java, jarAction) + + mainSourceSet.java(mainSourceSetAction) + + } +} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..429ead80 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,3 @@ +plugins { + id("com.draeger.medical.java-conventions") +} \ No newline at end of file diff --git a/dpws-model/build.gradle.kts b/dpws-model/build.gradle.kts new file mode 100644 index 00000000..693e5909 --- /dev/null +++ b/dpws-model/build.gradle.kts @@ -0,0 +1,36 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +plugins { + id("com.draeger.medical.java-conventions") + id("org.somda.sdc.xjc") +} + +dependencies { + api(libs.org.glassfish.jaxb.jaxb.core) + api(libs.org.glassfish.jaxb.jaxb.runtime) + api(libs.jakarta.xml.bind.jakarta.xml.bind.api) + api(libs.io.github.threeten.jaxb.threeten.jaxb.core) + api(libs.org.jvnet.jaxb.jaxb.plugins) + implementation(libs.jakarta.xml.bind.jakarta.xml.bind.api) +} + +description = "DPWS model" + + +description = "Implements the model for Devices Profile for Web-Services (DPWS) 1.1 and referenced standards." + +val schemaDir = "src/main/" + +xjc { + schemaLocation = layout.projectDirectory.dir(schemaDir) + args = listOf( + "-nv", // false + ) +} + +val testsJar by tasks.registering(Jar::class) { + archiveClassifier.set("tests") + from(sourceSets["test"].output) +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..c0528e65 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +revision=9.1.0 +changelist=-SNAPSHOT +javaVersion=17 \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..dacba77a --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,89 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format +[versions] +com-draeger-medical-t2iapi = "4.1.0" +com-github-spotbugs = "5.0.14" +com-github-spotbugs-annotations = "4.7.3" +com-google-code-gson = "2.11.0" +detekt = "1.23.3" +guice = "7.0.0" +com-lemonappdev-konsist = "0.15.1" +com-lmax-disruptor = "3.4.2" +com-tngtech-archunit-junit5 = "1.2.1" +commons-cli = "1.4" +jakarta-inject = "2.0.1" +net-sf-saxon-he = "9.9.1-7" +org-apache-derby = "10.15.2.0" +org-apache-logging-log4j = "2.24.1" +org-bouncycastle = "1.67" +org-glassfish-jaxb = "4.0.5" +org-hibernate-core = "5.4.24.Final" +org-jetbrains-kotlin = "1.9.23" +org-junit = "5.10.3" +org-junit-platform = "1.10.2" +org-mockito = "5.12.0" +org-mockito-kotlin = "5.4.0" +org-somda-sdc = "6.2.0-SNAPSHOT" +org-tomlj = "1.0.0" +threeten-jaxb-core = "2.2.0" +jakarta-xml-bind = "4.0.2" +org-checkerframework = "3.44.0" +org-jetbrains-annotations = "24.1.0" +org-jvnet-jaxb-plugins = "4.0.8" +edu-sc-seis-launch4j = "2.5.0" +com-diffplug-spotless = "6.21.0" +de-undercouch-download = "5.3.0" +com-github-jk1-license = "2.9" + +[libraries] +com-google-inject-guice = { module = "com.google.inject:guice", version.ref = "guice" } +com-google-inject-extensions-guice-assistedinject = { module = "com.google.inject.extensions:guice-assistedinject", version.ref = "guice" } +detekt-cli = { module = "io.gitlab.arturbosch.detekt:detekt-cli", version.ref = "detekt" } +io-github-threeten-jaxb-threeten-jaxb-core = { module = "io.github.threeten-jaxb:threeten-jaxb-core", version.ref = "threeten-jaxb-core" } +jakarta-xml-bind-jakarta-xml-bind-api = { module = "jakarta.xml.bind:jakarta.xml.bind-api", version.ref = "jakarta-xml-bind" } +org-checkerframework-checker-qual = { module = "org.checkerframework:checker-qual", version.ref = "org-checkerframework" } +org-glassfish-jaxb-jaxb-core = { module = "org.glassfish.jaxb:jaxb-core", version.ref = "org-glassfish-jaxb" } +org-glassfish-jaxb-jaxb-runtime = { module = "org.glassfish.jaxb:jaxb-runtime", version.ref = "org-glassfish-jaxb" } +org-glassfish-jaxb-jaxb-xjc = { module = "org.glassfish.jaxb:jaxb-xjc", version.ref = "org-glassfish-jaxb" } +org-jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "org-jetbrains-annotations" } +org-junit-jupiter-junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "org-junit" } +org-junit-jupiter-junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "org-junit" } +org-jvnet-jaxb-jaxb-plugins = { module = "org.jvnet.jaxb:jaxb-plugins", version.ref = "org-jvnet-jaxb-plugins" } +org-jvnet-jaxb-jaxb-plugin-annotate = { module = "org.jvnet.jaxb:jaxb-plugin-annotate", version.ref = "org-jvnet-jaxb-plugins" } +org-jvnet-jaxb-jaxb-plugins-tools = { module = "org.jvnet.jaxb:jaxb-plugins-tools", version.ref = "org-jvnet-jaxb-plugins" } +com-github-spotbugs = { module = "com.github.spotbugs:spotbugs", version.ref = "com-github-spotbugs" } +com-draeger-medical-t2iapi = { module = "com.draeger.medical:t2iapi", version.ref = "com-draeger-medical-t2iapi" } +com-github-spotbugs-spotbugs-annotations = { module = "com.github.spotbugs:spotbugs-annotations", version.ref = "com-github-spotbugs-annotations" } +com-google-code-gson-gson = { module = "com.google.code.gson:gson", version.ref = "com-google-code-gson" } +com-lemonappdev-konsist = { module = "com.lemonappdev:konsist", version.ref = "com-lemonappdev-konsist" } +com-lmax-disruptor = { module = "com.lmax:disruptor", version.ref = "com-lmax-disruptor" } +com-tngtech-archunit-archunit-junit5 = { module = "com.tngtech.archunit:archunit-junit5", version.ref = "com-tngtech-archunit-junit5" } +commons-cli-commons-cli = { module = "commons-cli:commons-cli", version.ref = "commons-cli" } +jakarta-inject-jakarta-inject-api = { module = "jakarta.inject:jakarta.inject-api", version.ref = "jakarta-inject" } +net-sf-saxon-saxon-he = { module = "net.sf.saxon:Saxon-HE", version.ref = "net-sf-saxon-he" } +org-apache-derby-derby = { module = "org.apache.derby:derby", version.ref = "org-apache-derby" } +org-apache-logging-log4j-log4j-api = { module = "org.apache.logging.log4j:log4j-api", version.ref = "org-apache-logging-log4j" } +org-apache-logging-log4j-log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "org-apache-logging-log4j" } +org-apache-logging-log4j-log4j-slf4j-impl = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version.ref = "org-apache-logging-log4j" } +org-bouncycastle-bcpkix-jdk15on = { module = "org.bouncycastle:bcpkix-jdk15on", version.ref = "org-bouncycastle" } +org-bouncycastle-bcprov-jdk15on = { module = "org.bouncycastle:bcprov-jdk15on", version.ref = "org-bouncycastle" } +org-hibernate-hibernate-core = { module = "org.hibernate:hibernate-core", version.ref = "org-hibernate-core" } +org-jetbrains-kotlin-kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "org-jetbrains-kotlin" } +org-jetbrains-kotlin-kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "org-jetbrains-kotlin" } +org-jetbrains-kotlin-kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "org-jetbrains-kotlin" } +org-junit-jupiter-junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "org-junit" } +org-junit-platform-junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "org-junit-platform" } +org-junit-platform-junit-platform-reporting = { module = "org.junit.platform:junit-platform-reporting", version.ref = "org-junit-platform" } +org-mockito-kotlin-mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "org-mockito-kotlin" } +org-mockito-mockito-core = { module = "org.mockito:mockito-core", version.ref = "org-mockito" } +org-somda-sdc-common = { module = "org.somda.sdc:common", version.ref = "org-somda-sdc" } +org-somda-sdc-glue = { module = "org.somda.sdc:glue", version.ref = "org-somda-sdc" } +org-tomlj-tomlj = { module = "org.tomlj:tomlj", version.ref = "org-tomlj" } +com-github-jk1-license-report= { module = "com.github.jk1:gradle-license-report", version.ref = "com-github-jk1-license" } + +# workaround for making these available in build-logic +gradleplugins-spotbugs = { module = "com.github.spotbugs.snom:spotbugs-gradle-plugin", version.ref = "com-github-spotbugs" } +gradleplugins-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "com-diffplug-spotless" } +gradleplugins-kotlin-jvm = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "org-jetbrains-kotlin" } +gradleplugins-download = { module = "de.undercouch:gradle-download-task", version.ref = "de-undercouch-download" } +gradleplugins-launch4j = { module = "edu.sc.seis.launch4j:launch4j", version.ref = "edu-sc-seis-launch4j" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..d64cd491 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..df97d72b --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..1aa94a42 --- /dev/null +++ b/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..93e3f59f --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/sdccc/build.gradle.kts b/sdccc/build.gradle.kts new file mode 100644 index 00000000..112f1b5f --- /dev/null +++ b/sdccc/build.gradle.kts @@ -0,0 +1,64 @@ +plugins { + id("com.draeger.medical.java-conventions") + id("com.draeger.medical.kotlin-conventions") + id("com.draeger.medical.executable-conventions") + id("com.draeger.medical.java-analysis") + id("com.example.license-report") +} + +val javaVersion = property("javaVersion").toString() + +tasks.named("build") { + dependsOn("generateLicenseReport") +} + +dependencies { + api(libs.org.junit.jupiter.junit.jupiter.api) + api(libs.org.junit.jupiter.junit.jupiter.engine) + api(libs.org.junit.platform.junit.platform.launcher) + api(libs.org.junit.platform.junit.platform.reporting) + api(libs.org.somda.sdc.glue) + api(libs.org.somda.sdc.common) + api(libs.commons.cli.commons.cli) + + api(libs.com.google.inject.guice) + api(libs.com.google.inject.extensions.guice.assistedinject) + + api(libs.org.tomlj.tomlj) + + api(libs.org.apache.logging.log4j.log4j.api) + api(libs.org.apache.logging.log4j.log4j.core) + api(libs.org.apache.logging.log4j.log4j.slf4j.impl) + + api(libs.com.github.spotbugs.spotbugs.annotations) + api(libs.net.sf.saxon.saxon.he) + api(libs.org.apache.derby.derby) + api(libs.org.hibernate.hibernate.core) + api(libs.com.draeger.medical.t2iapi) + api(libs.jakarta.xml.bind.jakarta.xml.bind.api) + api(libs.org.glassfish.jaxb.jaxb.core) + api(libs.org.glassfish.jaxb.jaxb.runtime) + api(libs.org.bouncycastle.bcprov.jdk15on) + api(libs.org.bouncycastle.bcpkix.jdk15on) + api(libs.com.lmax.disruptor) + api(libs.jakarta.inject.jakarta.inject.api) + api(libs.org.jetbrains.kotlin.kotlin.reflect) + api(libs.com.lemonappdev.konsist) + api(libs.com.google.code.gson.gson) + testImplementation(libs.org.mockito.mockito.core) + testImplementation(libs.org.mockito.kotlin.mockito.kotlin) + testImplementation(projects.bicepsModel) + testImplementation(projects.dpwsModel) + testImplementation(libs.com.tngtech.archunit.archunit.junit5) + testImplementation(libs.org.junit.jupiter.junit.jupiter.params) + testImplementation(libs.org.jetbrains.kotlin.kotlin.test.junit5) +} + +description = "sdccc" + +tasks.test { + useJUnitPlatform() + exclude("it/com/draeger/medical/sdccc/testsuite_it_mock_tests/**") + maxHeapSize = "3g" + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) +} diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..17ab2efd --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,16 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +pluginManagement { + // Include 'plugins build' to define convention plugins. + includeBuild("build-logic") +} + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +rootProject.name = "sdccc_parent" +include(":biceps-model") +include(":dpws-model") +include(":sdccc") +