-
Notifications
You must be signed in to change notification settings - Fork 9
fix: isolate crash reporter dialog on macOS + modernize build #52
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
25d0402
chore: migrate build to Gradle 9.6.1 and Kotlin DSL
soloturn 3902753
fix: isolate the reporter dialog in a subprocess when -XstartOnFirstT…
soloturn 15f9027
fix: point at the current Artifactory host and verify the build end t…
soloturn 27c6a5f
ci: require a java17 agent in Jenkinsfile
soloturn e9129c9
fix: detect isolation need via headless property, not -XstartOnFirstT…
soloturn 45286b6
chore: bump test-only Logback/SLF4J to 1.6.0/2.0.18
soloturn 78aa180
Update gradle/common.gradle.kts
soloturn 03d0c42
Update gradle/common.gradle.kts
soloturn dd9878a
fix: isolate unconditionally on macOS, add a test-only override property
soloturn 9167411
fix: address remaining CodeRabbit review comments
soloturn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| pipeline { | ||
| agent { | ||
| label "light-java" | ||
| label "light-java && java17" | ||
| } | ||
| stages { | ||
| stage('Build') { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| // Copyright 2021 The Terasology Foundation | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import org.gradle.api.plugins.quality.Checkstyle | ||
| import org.gradle.api.plugins.quality.Pmd | ||
|
|
||
| plugins { | ||
| `java-library` | ||
| eclipse | ||
| idea | ||
| checkstyle | ||
| pmd | ||
| `maven-publish` | ||
| } | ||
|
|
||
| apply(from = "$rootDir/gradle/common.gradle.kts") | ||
|
soloturn marked this conversation as resolved.
|
||
|
|
||
| val env: Map<String, String> = System.getenv() | ||
| val versionInfoFile = File(sourceSets.main.get().output.resourcesDir, "versionInfo.properties") | ||
|
|
||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| targetCompatibility = JavaVersion.VERSION_1_8 | ||
| withSourcesJar() | ||
| withJavadocJar() | ||
| } | ||
|
|
||
| // We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on | ||
| repositories { | ||
| mavenCentral { | ||
| content { | ||
| // This is first choice for most java dependencies, but assume we'll need to check our | ||
| // own repository for things from our own organization. | ||
| // (This is an optimization so gradle doesn't try to find our hundreds of modules in 3rd party repos) | ||
| excludeGroupByRegex("org.terasology(..+)?") | ||
| } | ||
| } | ||
| // JBoss Maven Repository requried to fetch `org.jpastebin` dependency for CrashReporter | ||
| // https://developer.jboss.org/docs/DOC-11377 | ||
| maven { | ||
| name = "JBoss Public Maven Repository Group" | ||
| url = uri("https://repository.jboss.org/nexus/content/repositories/public/") | ||
| content { | ||
| includeModule("org", "jpastebin") | ||
| } | ||
| } | ||
| maven { | ||
| name = "Terasology Artifactory" | ||
| url = uri("https://artifactory.terasology.io/artifactory/virtual-repo-live") | ||
| } | ||
| } | ||
|
|
||
| val codeMetrics = configurations.create("codeMetrics") | ||
|
|
||
| dependencies { | ||
|
|
||
| codeMetrics("org.terasology.config:codemetrics:2.2.0@zip") | ||
|
|
||
| checkstyle("com.puppycrawl.tools:checkstyle:10.2") | ||
| pmd("net.sourceforge.pmd:pmd-ant:7.0.0-rc4") | ||
| pmd("net.sourceforge.pmd:pmd-core:7.0.0-rc4") | ||
| pmd("net.sourceforge.pmd:pmd-java:7.0.0-rc4") | ||
|
|
||
| implementation("org:jpastebin:1.0.1") | ||
| implementation("org.apache.httpcomponents:httpclient:4.5.13") | ||
| implementation("org.apache.httpcomponents:httpmime:4.5.13") | ||
|
|
||
| testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1") | ||
| testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1") | ||
| testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.1") | ||
| testRuntimeOnly("org.junit.platform:junit-platform-launcher") | ||
| testImplementation("org.mockito:mockito-core:5.6.0") | ||
| testImplementation("org.slf4j:slf4j-api:2.0.18") | ||
|
|
||
| testRuntimeOnly("ch.qos.logback:logback-classic:1.6.0") | ||
|
|
||
| implementation("com.google.guava:guava:31.1-jre") | ||
|
|
||
| // But on the other hand to be able to run the unit tests successfully while embedded we still do need this | ||
| if (rootProject.name == "Terasology") { | ||
| testImplementation("com.google.http-client:google-http-client-jackson2:1.20.0") | ||
| } | ||
| } | ||
|
|
||
| fun convertGitBranch(gitBranch: String?): String? { | ||
| // Remove "origin/" from "origin/develop" | ||
| return if (gitBranch.isNullOrEmpty()) null else gitBranch.substringAfterLast("/") | ||
| } | ||
|
|
||
| val createVersionInfoFile = tasks.register("createVersionInfoFile") { | ||
| doLast { | ||
| logger.lifecycle("Creating $versionInfoFile") | ||
| ant.withGroovyBuilder { | ||
| "propertyfile"("file" to versionInfoFile) { | ||
| "entry"("key" to "buildNumber", "value" to env["BUILD_NUMBER"]) | ||
| "entry"("key" to "buildId", "value" to env["BUILD_ID"]) | ||
| "entry"("key" to "buildTag", "value" to env["BUILD_TAG"]) | ||
| "entry"("key" to "buildUrl", "value" to env["BUILD_URL"]) | ||
| "entry"("key" to "jobName", "value" to env["JOB_NAME"]) | ||
| "entry"("key" to "gitBranch", "value" to convertGitBranch(env["GIT_BRANCH"])) | ||
| "entry"("key" to "gitCommit", "value" to env["GIT_COMMIT"]) | ||
| "entry"("key" to "displayVersion", "value" to version) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.jar { | ||
| dependsOn(createVersionInfoFile) | ||
| } | ||
|
|
||
| val runInteractiveTest = tasks.register<JavaExec>("runInteractiveTest") { | ||
| dependsOn(tasks.named("testClasses")) | ||
| mainClass.set("org.terasology.crashreporter.InteractiveTestCases") | ||
| classpath = files(sourceSets.test.get().runtimeClasspath) | ||
| args = listOf("setupForExtraLongMessageException", "src/test/resources/lengthy_logfile.log", "en-US") | ||
| } | ||
|
|
||
| // checkstyle.xml's own SuppressionFilter references ${config_loc}/suppressions.xml, Checkstyle's | ||
| // built-in "directory containing the config file" property - that's only populated correctly | ||
| // when the config is loaded from a real directory on disk, not from an in-place archive-entry | ||
| // read (which extracts each entry to its own isolated temp location, so checkstyle.xml and | ||
| // suppressions.xml never end up as real siblings). Extract the already-downloaded codeMetrics | ||
| // zip once instead, and point checkstyle/pmd at the extracted directory. | ||
| val extractCodeMetrics = tasks.register<Copy>("extractCodeMetrics") { | ||
| from(codeMetrics.map { zipTree(it) }) | ||
| into(layout.buildDirectory.dir("codeMetrics")) | ||
| } | ||
|
|
||
| tasks.withType<Checkstyle>().configureEach { | ||
| dependsOn(extractCodeMetrics) | ||
| } | ||
|
|
||
| tasks.withType<Pmd>().configureEach { | ||
| dependsOn(extractCodeMetrics) | ||
| } | ||
|
|
||
| checkstyle { | ||
| isIgnoreFailures = true | ||
| configDirectory.set(layout.buildDirectory.dir("codeMetrics/checkstyle")) | ||
| } | ||
|
|
||
| pmd { | ||
| isIgnoreFailures = true | ||
| ruleSetFiles = files(layout.buildDirectory.file("codeMetrics/pmd/pmd.xml")) | ||
| ruleSets = listOf() | ||
| } | ||
|
|
||
| tasks.javadoc { | ||
| isFailOnError = false | ||
| } | ||
|
|
||
| tasks.test { | ||
| useJUnitPlatform() | ||
| // InteractiveTestCases is a manual runner (see runInteractiveTest), not an automated test - | ||
| // there are no @Test methods in this project. | ||
| failOnNoDiscoveredTests.set(false) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.