Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into refactor/rework-tr…
Browse files Browse the repository at this point in the history
…ansaction-manager-rxjava
  • Loading branch information
keturn committed May 23, 2022
2 parents 9deee11 + 4a301c3 commit 65f38b6
Show file tree
Hide file tree
Showing 69 changed files with 2,825 additions and 588 deletions.
8 changes: 6 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ If you would like to contribute code, documentation, or other assets you can do

*When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible.*

Read on for an overview and [check the wiki for more details](https://github.com/MovingBlocks/Terasology/wiki). For questions please join us in our [forum](http://forum.terasology.org/forum/) or on `#terasology` (irc.freenode.net).
Read on for an overview and [check the wiki for more details](https://github.com/MovingBlocks/Terasology/wiki).
For questions please join us in our [forum] or [Discord].

## File an Issue

You can report bugs and feature requests to [GitHub Issues](https://github.com/MovingBlocks/Terasology/issues). As mentioned please look for a similar existing issue before submitting a new one.

For finding easy to do issues to start with look at the [Good First Issue](https://github.com/MovingBlocks/Terasology/labels/Good%20First%20Issue) issues.

We prefer questions and support requests be posted in the [forum](http://forum.terasology.org/forum).
We prefer questions and support requests be posted in the [forum] or [Discord].

__Please provide as much information as possible to help us solve problems and answer questions better!__

[forum]: https://forum.terasology.org/forum/
[Discord]: https://discord.gg/Terasology

## PR Title / Commit Message Guidelines

We try to follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) style for commit messages and pull request titles.
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pipeline {

recordIssues(skipBlames: true, enabledForFailure: true,
tools: [
spotBugs(pattern: '**/build/reports/spotbugs/main/*.xml', useRankAsPriority: true),
spotBugs(pattern: '**/build/reports/spotbugs/*.xml', useRankAsPriority: true),
pmdParser(pattern: '**/build/reports/pmd/*.xml')
])

Expand Down
7 changes: 6 additions & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 The Terasology Foundation
// Copyright 2022 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

import java.net.URI
Expand All @@ -10,6 +10,7 @@ plugins {
repositories {
mavenCentral()
google() // gestalt uses an annotation package by Google
gradlePluginPortal()

maven {
name = "Terasology Artifactory"
Expand Down Expand Up @@ -40,6 +41,10 @@ dependencies {
// for inspecting modules
implementation("org.terasology.gestalt:gestalt-module:7.1.0")

// plugins we configure
implementation("com.github.spotbugs.snom:spotbugs-gradle-plugin:4.8.0") // TODO: upgrade with gradle 7.x
implementation("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3")

api(kotlin("test"))
}

Expand Down
3 changes: 2 additions & 1 deletion build-logic/src/main/kotlin/facade.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright 2021 The Terasology Foundation
// Copyright 2022 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

import org.terasology.gradology.JAR_COLLECTION
import org.terasology.gradology.namedAttribute

plugins {
application
id("terasology-common")
}

val dirNatives: String by rootProject.extra
Expand Down
7 changes: 7 additions & 0 deletions build-logic/src/main/kotlin/terasology-common.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2022 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

plugins {
id("terasology-repositories")
id("terasology-metrics")
}
69 changes: 69 additions & 0 deletions build-logic/src/main/kotlin/terasology-metrics.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2022 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

import com.github.spotbugs.snom.SpotBugsExtension
import com.github.spotbugs.snom.SpotBugsTask

plugins {
java
checkstyle
pmd
`project-report`
id("com.github.spotbugs")
id("org.sonarqube")
}

dependencies {
"pmd"("net.sourceforge.pmd:pmd-core:6.15.0")
"pmd"("net.sourceforge.pmd:pmd-java:6.15.0")
}

tasks.withType<Test> {
useJUnitPlatform()

// ignoreFailures: Specifies whether the build should break when the verifications performed by this task fail.
ignoreFailures = true
// showStandardStreams: makes the standard streams (err and out) visible at console when running tests
testLogging.showStandardStreams = true
reports {
junitXml.isEnabled = true
}
jvmArgs("-Xms512m", "-Xmx1024m")

// Make sure the natives have been extracted, but only for multi-workspace setups (not for solo module builds)
if (project.name != project(":").name) {
dependsOn(tasks.getByPath(":extractNatives"))
}
}

// The config files here work in both a multi-project workspace (IDEs, running from source) and for solo module builds
// Solo module builds in Jenkins get a copy of the config dir from the engine harness so it still lives at root/config
// TODO: Maybe update other projects like modules to pull the zipped dependency so fewer quirks are needed in Jenkins
configure<CheckstyleExtension> {
isIgnoreFailures = false

val checkstyleDir = rootDir.resolve("config/metrics/checkstyle")
configDirectory.set(checkstyleDir)
setConfigProperties("samedir" to checkstyleDir)
}

configure<PmdExtension> {
isIgnoreFailures = true
ruleSetFiles = files(rootDir.resolve("config/metrics/pmd/pmd.xml"))
// By default, gradle uses both ruleset file AND the rulesets. Override the ruleSets to use only those from the file
ruleSets = listOf()
}

configure<SpotBugsExtension> {
// The version of the spotbugs tool https://github.com/spotbugs/spotbugs
// not necessarily the same as the version of spotbugs-gradle-plugin
toolVersion.set("4.7.0")
ignoreFailures.set(true)
excludeFilter.set(file(rootDir.resolve("config/metrics/findbugs/findbugs-exclude.xml")))
}

tasks.named<SpotBugsTask>("spotbugsMain") {
reports.register("xml") {
enabled = true
}
}
24 changes: 9 additions & 15 deletions build-logic/src/main/kotlin/terasology-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 The Terasology Foundation
// Copyright 2022 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

// Simple build file for modules - the one under the Core module is the template, will be copied as needed to modules
Expand All @@ -11,6 +11,7 @@ plugins {
`java-library`
idea
eclipse
id("terasology-common")
}

val moduleMetadata = ModuleMetadataForGradle.forProject(project)
Expand Down Expand Up @@ -144,21 +145,14 @@ tasks.register<Sync>("syncDeltas") {
into("${mainSourceSet.output.classesDirs.first()}/deltas")
}

// Instructions for packaging a jar file - is a manifest even needed for modules?
tasks.named("jar") {
// Make sure the assets directory is included
dependsOn("syncAssets")
dependsOn("syncOverrides")
dependsOn("syncDeltas")

// Jarring needs to copy module.txt and all the assets into the output
doFirst {
copy {
from("module.txt")
into(mainSourceSet.output.classesDirs.first())
}
}
tasks.register<Copy>("syncModuleInfo") {
from("module.txt")
into(mainSourceSet.output.classesDirs.first())
}

tasks.named("processResources") {
// Make sure the assets directory is included
dependsOn("syncAssets", "syncOverrides", "syncDeltas", "syncModuleInfo")
}

tasks.named<Test>("test") {
Expand Down
10 changes: 1 addition & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ buildscript {
}

dependencies {
//Spotbugs
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.0.0"

// SonarQube / Cloud scanning
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8"

// Protobuf plugin
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.16'

// Our locally included /build-logic
classpath("org.terasology.gradology:build-logic")
}
Expand All @@ -52,6 +43,7 @@ plugins {
// For the "Build and run using: Intellij IDEA | Gradle" switch
id "org.jetbrains.gradle.plugin.idea-ext" version "1.0"

id("com.google.protobuf") version "0.8.16" apply false
id("terasology-repositories")
}

Expand Down
86 changes: 0 additions & 86 deletions config/gradle/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

// Analytics
apply plugin: 'project-report'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'com.github.spotbugs'
apply plugin: 'jacoco'
apply plugin: 'org.sonarqube'

apply plugin: 'terasology-repositories'

java {
Expand All @@ -28,12 +20,6 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

dependencies {
pmd('net.sourceforge.pmd:pmd-core:6.15.0')
pmd('net.sourceforge.pmd:pmd-java:6.15.0')
// the FindBugs version is set in the configuration
}

task sourceJar(type: Jar) {
description = "Create a JAR with all sources"
from sourceSets.main.allSource
Expand All @@ -47,78 +33,6 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
}

// Extra details provided for unit tests
test {
useJUnitPlatform()

// ignoreFailures: Specifies whether the build should break when the verifications performed by this task fail.
ignoreFailures = true
// showStandardStreams: makes the standard streams (err and out) visible at console when running tests
testLogging.showStandardStreams = true
reports {
junitXml.enabled = true
}
// Arguments to include while running tests
jvmArgs '-Xms512m', '-Xmx1024m'

// Make sure the natives have been extracted, but only for multi-workspace setups (not for solo module builds)
if (project.name != project(':').name) {
dependsOn rootProject.extractNatives
}

jacoco {
excludes = ["org.terasology.protobuf.*",
"*MethodAccess","*FieldAccess"]
}
}

jacoco {
toolVersion = "0.8.5"
}

jacocoTestReport {
dependsOn test // Despite doc saying this should be automatic we need to explicitly add it anyway :-(
reports {
// Used to be exec, but that had a binary incompatibility between JaCoCo 0.7.4 and 0.7.5 and issues with some plugins
xml.enabled true
csv.enabled false
html.enabled true
}
}

// The config files here work in both a multi-project workspace (IDEs, running from source) and for solo module builds
// Solo module builds in Jenkins get a copy of the config dir from the engine harness so it still lives at root/config
// TODO: Maybe update other projects like modules to pull the zipped dependency so fewer quirks are needed in Jenkins
checkstyle {
ignoreFailures = false

def checkstyleDir = rootProject.file('config/metrics/checkstyle')
configDirectory = checkstyleDir
configProperties.samedir = checkstyleDir
}

pmd {
ignoreFailures = true
ruleSetFiles = files("$rootDir/config/metrics/pmd/pmd.xml")
// By default, gradle uses both ruleset file AND the rulesets. Override the ruleSets to use only those from the file
ruleSets = []
}

spotbugs {
toolVersion = '4.0.0'
ignoreFailures = true
excludeFilter = new File(rootDir, "config/metrics/findbugs/findbugs-exclude.xml")
}

spotbugsMain {
reports {
xml {
enabled = true
destination = file("$buildDir/reports/spotbugs/main/spotbugs.xml")
}
}
}

tasks.javadoc {
// Disable doclint messages about missing "@param" or "@return" tags.
options.addBooleanOption("Xdoclint:all,-missing", true)
Expand Down
6 changes: 5 additions & 1 deletion engine-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
plugins {
id "java-library"
id "org.jetbrains.gradle.plugin.idea-ext"
id "terasology-common"
}

// Grab all the common stuff like plugins to use, artifact repositories, code analysis config
Expand Down Expand Up @@ -57,7 +58,10 @@ dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
implementation group: 'org.codehaus.plexus', name: 'plexus-utils', version: '1.5.6'
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.15.3'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.9'
runtimeOnly('org.codehaus.janino:janino:3.1.7') {
because("logback filters")
}
runtimeOnly group: 'org.slf4j', name: 'jul-to-slf4j', version: '1.7.21'
implementation "org.terasology:reflections:0.9.12-MB"

Expand Down
Loading

0 comments on commit 65f38b6

Please sign in to comment.