Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial gradle build #212

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Conversation

midttuna
Copy link
Contributor

@midttuna midttuna commented Oct 8, 2024

// Initial migration to gradle

Checklist

The following aspects have been respected by the author of this pull request, confirmed by both pull request assignee and reviewer:

  • Adherence to coding conventions
    • Pull Request Assignee
    • Reviewer
  • Adherence to javadoc conventions
    • Pull Request Assignee
    • Reviewer
  • Changelog update (necessity checked and entry added or not added respectively)
    • Pull Request Assignee
    • Reviewer
  • README update (necessity checked and entry added or not added respectively)
    • Pull Request Assignee
    • Reviewer
  • config update (necessity checked and entry added or not added respectively)
    • Pull Request Assignee
    • Reviewer
  • SDCcc executable ran against a test device (if necessary)
    • Pull Request Assignee
    • Reviewer

@midttuna midttuna requested a review from ldeichmann October 8, 2024 08:48
gradle/libs.versions.toml Outdated Show resolved Hide resolved
gradle/wrapper/gradle-wrapper.properties Outdated Show resolved Hide resolved
build.gradle.kts Outdated Show resolved Hide resolved
biceps-model/build.gradle.kts Outdated Show resolved Hide resolved
biceps-model/build.gradle.kts Outdated Show resolved Hide resolved
buildSrc/src/main/kotlin/LicenseDownloaderRenderer.kt Outdated Show resolved Hide resolved
buildSrc/build.gradle.kts Outdated Show resolved Hide resolved
buildSrc/src/main/kotlin/LicenseDownloaderRenderer.kt Outdated Show resolved Hide resolved

val projectName = "SDCcc-gradle"

launch4j {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider providing something we can reuse in other places instead of hardcoding it here - convention plugin? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other places where?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sdccc-internal basically, having to repeat almost the same configuration there isn't great

@ldeichmann
Copy link
Member

Also remove the maven files ;)

}

tasks.withType<JavaCompile>() {
options.release.set(javaVersion.toInt())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to documentation, setting this overrides sourceCompatibility and targetCompatibility for JavaCompile, but those were already set properly. Seems this one is redundant for now.


val detekt by configurations.creating

val detektTask = tasks.register<JavaExec>("detekt") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this task into a kotlin-conventions plugin, just like the java-conventions, which we can reuse internally.

from(sourceSets["test"].output)
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this task into a kotlin-conventions plugin, just like the java-conventions, which we can reuse internally.

configFile = file("../checkstyle/checkstyle.xml")
}

spotless {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move configuration to java-conventions or better yet a separate java-analysis plugin for reuse.

reports.create("xml") { required = true }
}

checkstyle {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move configuration to java-conventions or better yet a separate java-analysis plugin for reuse.

Comment on lines +82 to +83
testImplementation(project(":biceps-model"))
testImplementation(project(":dpws-model"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider opting into the TYPESAFE_PROJECT_ACCESSORS feature so that you can write

    testImplementation(projects.bicepsModel)
    testImplementation(projects.dpwsModel)

instead of having these awkward strings

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is producing a SDCcc-gradle-unspecified.exe, as project version isn't set for the sdccc module, only in the parent build.gradle.kts. Move setting the version to a convention plugin and apply them to the subprojects.

mainClassName = "com.draeger.medical.sdccc.TestSuite"
classpath = mutableSetOf("lib/**")
jreMinVersion = javaVersion
bundledJrePath = "${layout.buildDirectory.get().asFile}/${jreFullPath}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is encoding an absolute path to look for the jre into the executable, for example:
image
This path only exists on my machine.

We used to have a relative path here, ./jre I think

jaxbClasspath = jaxb
schemaLocation = layout.projectDirectory.dir(schemaDir)
args = listOf(
"-Xannotate",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag was also not enabled by our model previously. Now, it doesn't do anything, as we have no annotations in the .xjb file, but still.

testImplementation(libs.org.junit.jupiter.junit.jupiter.engine)

jaxb(libs.org.jetbrains.annotations)
jaxb(libs.org.jvnet.jaxb.jaxb.plugin.annotate)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the same vein as the other remark in this file, we don't use the annotate plugin

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 = mutableSetOf("lib/**")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be mutable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants