From 9e94b1944d9b2c41971c39465710deca14c2590f Mon Sep 17 00:00:00 2001 From: Michael Pollind Date: Sun, 4 Apr 2021 23:38:00 -0700 Subject: [PATCH 1/9] chore: upgrade gradle and rework build --- build.gradle | 76 ++++---------- gestalt-asset-core/build.gradle | 56 +++------- gestalt-di/build.gradle | 39 +------ gestalt-entity-system/build.gradle | 73 +++---------- gestalt-es-perf/build.gradle | 45 +------- gestalt-inject-java/build.gradle | 44 +------- gestalt-inject/build.gradle | 45 +------- gestalt-module/build.gradle | 42 +------- gestalt-util/build.gradle | 47 +-------- gradle.properties | 10 -- gradle/common.gradle | 124 +++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- testpack/moduleA/build.gradle | 17 ++++ testpack/moduleB/build.gradle | 15 +++ testpack/moduleC/build.gradle | 16 +++ testpack/moduleD/build.gradle | 15 +++ testpack/moduleF/build.gradle | 16 +++ testpack/testpack-api/build.gradle | 15 +++ 18 files changed, 279 insertions(+), 418 deletions(-) delete mode 100644 gradle.properties create mode 100644 gradle/common.gradle diff --git a/build.gradle b/build.gradle index 1a6e65fd..b0bf378b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,66 +1,24 @@ -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ -buildscript { - repositories { - google() - mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() - maven { - url 'https://heisluft.de/maven' - } - maven { - url "http://artifactory.terasology.org/artifactory/libs-release-local" - } - - } - dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } - ext { - // Android version support - android_annotation_version = "28.0.0" - - // Standard Utility - guava_version = "27.0.1-android" - slf4j_version = "1.7.25" - gson_version = "2.8.5" - jcip_annotation_version = "1.0" - - // Testing - junit_version = "4.12" - logback_version = "1.2.3" - mockito_version = "1.10.19" - } +plugins { + id 'idea' } -allprojects { - repositories { - google() - mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() - maven { - url "http://artifactory.terasology.org/artifactory/libs-release-local" - } - maven { - url 'https://heisluft.de/maven' - } - } -} +ext { + // Overall version number for NUI's various elements + gestaltVersion = "8.0.0-SNAPSHOT" -// Library and distribution config -description = 'A set of libraries providing core capabilities for games and game engines' + // Android version support + android_annotation_version = "28.0.0" -task clean(type: Delete) { - delete rootProject.buildDir -} + // Standard Utility + guava_version = "27.0.1-android" + slf4j_version = "1.7.25" + gson_version = "2.8.5" + jcip_annotation_version = "1.0" + // Testing + junit_version = "4.12" + logback_version = "1.2.3" + mockito_version = "1.10.19" +} diff --git a/gestalt-asset-core/build.gradle b/gestalt-asset-core/build.gradle index 5279eeab..658c4790 100644 --- a/gestalt-asset-core/build.gradle +++ b/gestalt-asset-core/build.gradle @@ -24,13 +24,21 @@ apply plugin: 'java-library' apply plugin: 'maven-publish' +apply from: "$rootDir/gradle/common.gradle" + +repositories { + maven { + url 'https://heisluft.de/maven' + } +} + // Primary dependencies definition dependencies { implementation project(":gestalt-util") implementation project(":gestalt-module") implementation project(":gestalt-inject") annotationProcessor project(":gestalt-inject-java") - + implementation "com.google.guava:guava:$guava_version" implementation "org.slf4j:slf4j-api:$slf4j_version" @@ -38,13 +46,12 @@ dependencies { api "net.jcip:jcip-annotations:$jcip_annotation_version" testAnnotationProcessor project(":gestalt-inject-java") - testImplementation "junit:junit:$junit_version" + testRuntime("junit:junit:$junit_version") testImplementation "ch.qos.logback:logback-classic:$logback_version" testImplementation "org.mockito:mockito-core:$mockito_version" } - compileJava { inputs.files sourceSets.main.resources.srcDirs options.compilerArgs = ["-Aresource=${sourceSets.main.resources.srcDirs.join(File.pathSeparator)}"] @@ -54,47 +61,8 @@ compileTestJava { options.compilerArgs = ["-Aresource=${sourceSets.test.resources.srcDirs.join(File.pathSeparator)}"] } - -description = 'Provides support for assets - binary resources that can be loaded from modules or procedurally generated at runtime.' - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - - -/*** - * Publishing - ***/ - -task sourceJar(type: Jar, dependsOn: classes) { - classifier 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir +test { + useJUnitPlatform() } -publishing { - repositories { - maven { - credentials { - username project.gestaltMavenRepoUsername - password project.gestaltMavenRepoPassword - } - name 'TerasologyTestRepo' - url project.version.endsWith('SNAPSHOT') ? project.snapshotPublishRepo : project.releasePublishRepo - } - } - publications { - mavenAssetCore(MavenPublication) { - artifactId = project.name - version = project.version - - from components.java - artifact sourceJar - artifact javadocJar - } - } -} diff --git a/gestalt-di/build.gradle b/gestalt-di/build.gradle index 920baed7..fcb390fe 100644 --- a/gestalt-di/build.gradle +++ b/gestalt-di/build.gradle @@ -1,6 +1,8 @@ apply plugin: 'java-library' apply plugin: 'maven-publish' +apply from: "$rootDir/gradle/common.gradle" + sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -39,40 +41,3 @@ gatherJarModules { test.dependsOn gatherJarModules -/*** - * Publishing - ***/ - -task sourceJar(type: Jar, dependsOn: classes) { - classifier 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -publishing { - repositories { - maven { - credentials { - username project.gestaltMavenRepoUsername - password project.gestaltMavenRepoPassword - } - name 'TerasologyTestRepo' - url project.version.endsWith('SNAPSHOT') ? project.snapshotPublishRepo : project.releasePublishRepo - } - } - publications { - mavenAssetCore(MavenPublication) { - artifactId = project.name - version = project.version - - from components.java - - artifact sourceJar - artifact javadocJar - } - } -} diff --git a/gestalt-entity-system/build.gradle b/gestalt-entity-system/build.gradle index f715b796..fba305fe 100644 --- a/gestalt-entity-system/build.gradle +++ b/gestalt-entity-system/build.gradle @@ -21,8 +21,22 @@ * - View tasks for this project: $ gradlew tasks */ -apply plugin: 'java-library' -apply plugin: 'maven-publish' +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.8" + } +} + + +plugins { + id 'java-library' + id 'maven-publish' +} + +apply from: "$rootDir/gradle/common.gradle" // Primary dependencies definition dependencies { @@ -54,58 +68,3 @@ compileTestJava { options.compilerArgs = ["-Aresource=${sourceSets.test.resources.srcDirs.join(File.pathSeparator)}"] } - -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.8" - } -} - -description = 'A threadsafe entity system implementation. ' + - 'An entity system is a component based data model.' - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - - -/*** - * Publishing - ***/ - -task sourceJar(type: Jar, dependsOn: classes) { - classifier 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -publishing { - repositories { - maven { - credentials { - username project.gestaltMavenRepoUsername - password project.gestaltMavenRepoPassword - } - name 'TerasologyTestRepo' - url project.version.endsWith('SNAPSHOT') ? project.snapshotPublishRepo : project.releasePublishRepo - } - } - publications { - mavenEs(MavenPublication) { - artifactId = project.name - version = project.version - - from components.java - - artifact sourceJar - artifact javadocJar - } - } -} - diff --git a/gestalt-es-perf/build.gradle b/gestalt-es-perf/build.gradle index fc7b561c..cd1550f9 100644 --- a/gestalt-es-perf/build.gradle +++ b/gestalt-es-perf/build.gradle @@ -24,6 +24,9 @@ apply plugin: 'java-library' apply plugin: 'maven-publish' +apply from: "$rootDir/gradle/common.gradle" + + // Primary dependencies definition dependencies { implementation project(":gestalt-util") @@ -35,7 +38,7 @@ dependencies { implementation "org.slf4j:slf4j-api:$slf4j_version" implementation "com.android.support:support-annotations:$android_annotation_version" implementation "net.jcip:jcip-annotations:$jcip_annotation_version" - + testImplementation "junit:junit:$junit_version" testImplementation "ch.qos.logback:logback-classic:$logback_version" testImplementation "org.mockito:mockito-core:$mockito_version" @@ -60,43 +63,3 @@ gatherJarModules { } test.dependsOn gatherModules - -/*** - * Publishing - ***/ - -task sourceJar(type: Jar, dependsOn: classes) { - classifier 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -publishing { - repositories { - maven { - credentials { - username project.gestaltMavenRepoUsername - password project.gestaltMavenRepoPassword - } - name 'TerasologyTestRepo' - url project.version.endsWith('SNAPSHOT') ? project.snapshotPublishRepo : project.releasePublishRepo - } - } - publications { - mavenEsPerf(MavenPublication) { - artifactId = project.name - version = project.version - - from components.java - - artifact sourceJar - artifact javadocJar - } - } -} - - diff --git a/gestalt-inject-java/build.gradle b/gestalt-inject-java/build.gradle index 39b6391d..e11b4d28 100644 --- a/gestalt-inject-java/build.gradle +++ b/gestalt-inject-java/build.gradle @@ -24,6 +24,9 @@ apply plugin: 'java-library' apply plugin: 'maven-publish' +apply from: "$rootDir/gradle/common.gradle" + + repositories { maven { url = 'https://heisluft.tk/maven/' @@ -51,45 +54,4 @@ dependencies { implementation 'com.squareup:javapoet:1.12.0' implementation group: 'javax.inject', name: 'javax.inject', version: '1' implementation project(":gestalt-inject"); - -} - - -/*** - * Publishing - ***/ - -task sourceJar(type: Jar, dependsOn: classes) { - classifier 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -publishing { - repositories { - maven { - credentials { - username project.gestaltMavenRepoUsername - password project.gestaltMavenRepoPassword - } - name 'TerasologyTestRepo' - url project.version.endsWith('SNAPSHOT') ? project.snapshotPublishRepo : project.releasePublishRepo - } - } - publications { - mavenAssetCore(MavenPublication) { - artifactId = project.name - version = project.version - - from components.java - - artifact sourceJar - artifact javadocJar - } - } } - diff --git a/gestalt-inject/build.gradle b/gestalt-inject/build.gradle index 7cbf5d34..22f46f51 100644 --- a/gestalt-inject/build.gradle +++ b/gestalt-inject/build.gradle @@ -1,8 +1,7 @@ apply plugin: 'java-library' apply plugin: 'maven-publish' -repositories { -} +apply from: "$rootDir/gradle/common.gradle" // Primary dependencies definition dependencies { @@ -10,45 +9,3 @@ dependencies { implementation "org.slf4j:slf4j-api:$slf4j_version" implementation "com.google.guava:guava:$guava_version" } - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - - -/*** - * Publishing - ***/ - -task sourceJar(type: Jar, dependsOn: classes) { - classifier 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -publishing { - repositories { - maven { - credentials { - username project.gestaltMavenRepoUsername - password project.gestaltMavenRepoPassword - } - name 'TerasologyTestRepo' - url project.version.endsWith('SNAPSHOT') ? project.snapshotPublishRepo : project.releasePublishRepo - } - } - publications { - mavenAssetCore(MavenPublication) { - artifactId = project.name - version = project.version - - from components.java - - artifact sourceJar - artifact javadocJar - } - } -} diff --git a/gestalt-module/build.gradle b/gestalt-module/build.gradle index ea4975a8..d3a2ea2f 100644 --- a/gestalt-module/build.gradle +++ b/gestalt-module/build.gradle @@ -24,6 +24,9 @@ apply plugin: 'java-library' apply plugin: 'maven-publish' +apply from: "$rootDir/gradle/common.gradle" + + repositories { maven { url = 'https://heisluft.de/maven/' @@ -98,42 +101,3 @@ gatherJarModules { } test.dependsOn gatherModules - -/*** - * Publishing - ***/ - -task sourceJar(type: Jar, dependsOn: classes) { - classifier 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -publishing { - repositories { - maven { - credentials { - username project.gestaltMavenRepoUsername - password project.gestaltMavenRepoPassword - } - name 'TerasologyTestRepo' - url project.version.endsWith('SNAPSHOT') ? project.snapshotPublishRepo : project.releasePublishRepo - } - } - publications { - mavenModule(MavenPublication) { - artifactId = project.name - version = project.version - - from components.java - - artifact sourceJar - artifact javadocJar - } - } -} - diff --git a/gestalt-util/build.gradle b/gestalt-util/build.gradle index c9e52e69..03e981f6 100644 --- a/gestalt-util/build.gradle +++ b/gestalt-util/build.gradle @@ -24,6 +24,8 @@ apply plugin: 'java-library' apply plugin: 'maven-publish' +apply from: "$rootDir/gradle/common.gradle" + // Primary dependencies definition dependencies { implementation "com.google.guava:guava:$guava_version" @@ -36,48 +38,3 @@ dependencies { testImplementation "ch.qos.logback:logback-classic:$logback_version" testImplementation "org.mockito:mockito-core:$mockito_version" } - -// Library and distribution config -description = 'Common utility classes' - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -/*** - * Publishing - ***/ - -task sourceJar(type: Jar, dependsOn: classes) { - classifier 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -publishing { - repositories { - maven { - credentials { - username project.gestaltMavenRepoUsername - password project.gestaltMavenRepoPassword - } - name 'TerasologyTestRepo' - url project.version.endsWith('SNAPSHOT') ? project.snapshotPublishRepo : project.releasePublishRepo - } - } - publications { - mavenUtil(MavenPublication) { - artifactId = project.name - version = project.version - - from components.java - - artifact sourceJar - artifact javadocJar - } - } -} - diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index a861bbc1..00000000 --- a/gradle.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.gradle.jvmargs=-Xmx1536m -group=org.terasology.gestalt -version=7.0.7-SNAPSHOT -# Where to publish artifacts, if not to the default snapshot/release repos -# Publishing a snapshot to a release-only repo will get an intended but quirky HTTP 409 Conflict error as of Nov 2014 -snapshotPublishRepo=http://artifactory.terasology.org/artifactory/libs-snapshot-local -releasePublishRepo=http://artifactory.terasology.org/artifactory/libs-release-local -# Override these values in ~/.gradle/gradle.properties -gestaltMavenRepoUsername= -gestaltMavenRepoPassword= diff --git a/gradle/common.gradle b/gradle/common.gradle new file mode 100644 index 00000000..8524e96d --- /dev/null +++ b/gradle/common.gradle @@ -0,0 +1,124 @@ +java { + withSourcesJar() + withJavadocJar() + + sourceCompatibility(JavaVersion.VERSION_1_8) + targetCompatibility(JavaVersion.VERSION_1_8) +} + +// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on +repositories { + // For development so you can publish binaries locally and have them grabbed from there + mavenLocal() + + // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + mavenCentral() + // org.jetbrains.trove4j:trove4j + gradlePluginPortal() + + // Used for gestalt 7 - Android annotations + google() + + + maven { + url 'https://heisluft.de/maven' + } + + // Terasology Artifactory instance for libs not readily available elsewhere plus our own libs + maven { + def repoViaEnv = System.getenv()["RESOLUTION_REPO"] + if (rootProject.hasProperty("alternativeResolutionRepo")) { + // If the user supplies an alternative repo via gradle.properties then use that + name "from alternativeResolutionRepo property" + url alternativeResolutionRepo + } else if (repoViaEnv != null && repoViaEnv != "") { + name "from \$RESOLUTION_REPO" + url = repoViaEnv + } else { + // Our default is the main virtual repo containing everything except repos for testing Artifactory itself + name "Terasology Artifactory" + url "http://artifactory.terasology.org/artifactory/virtual-repo-live" + allowInsecureProtocol true // 😱 + } + } + + maven { + name "snowplow (pre-0.9)" + url "http://maven.snplow.com/releases" + allowInsecureProtocol true // 😱 + } +} + +// 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' +} + +// In theory all Javadoc should be good and fixed, but it might be a bit much to entirely fail a build over. For now at least ... +// Note: In IntelliJ 2020.1+ running a javadoc Gradle task may still *look* alarming in the UI, but errors should be ignored +javadoc { + failOnError = false +} + +group = 'org.terasology.gestalt' +version = gestaltVersion + +publishing { + publications { + "$project.name"(MavenPublication) { + // Without this we get a .pom with no dependencies + from components.java + + repositories { + maven { + name = 'TerasologyOrg' + allowInsecureProtocol true // 😱 - no https on our Artifactory yet + + if (rootProject.hasProperty("publishRepo")) { + // This first option is good for local testing, you can set a full explicit target repo in gradle.properties + url = "http://artifactory.terasology.org/artifactory/$publishRepo" + + logger.info("Changing PUBLISH repoKey set via Gradle property to {}", publishRepo) + } else { + // Support override from the environment to use a different target publish org + String deducedPublishRepo = System.getenv()["PUBLISH_ORG"] + if (deducedPublishRepo == null || deducedPublishRepo == "") { + // If not then default + deducedPublishRepo = "libs" + } + + // Base final publish repo on whether we're building a snapshot or a release + if (project.version.endsWith('SNAPSHOT')) { + deducedPublishRepo += "-snapshot-local" + } else { + deducedPublishRepo += "-release-local" + } + + logger.info("The final deduced publish repo is {}", deducedPublishRepo) + url = "http://artifactory.terasology.org/artifactory/$deducedPublishRepo" + } + + if (rootProject.hasProperty("mavenUser") && rootProject.hasProperty("mavenPass")) { + credentials { + username = "$mavenUser" + password = "$mavenPass" + } + authentication { + basic(BasicAuthentication) + } + } + } + } + } + } +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e04263a8..141bd3ca 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip diff --git a/testpack/moduleA/build.gradle b/testpack/moduleA/build.gradle index dae839b7..e8b927b5 100644 --- a/testpack/moduleA/build.gradle +++ b/testpack/moduleA/build.gradle @@ -22,6 +22,23 @@ */ apply plugin: 'java' + +// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on +repositories { + + // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + mavenCentral() + // org.jetbrains.trove4j:trove4j + gradlePluginPortal() + // Used for gestalt 7 - Android annotations + google() + + maven { + url 'https://heisluft.de/maven' + } +} + + jar { version = '' } diff --git a/testpack/moduleB/build.gradle b/testpack/moduleB/build.gradle index dae839b7..9bf2ae9d 100644 --- a/testpack/moduleB/build.gradle +++ b/testpack/moduleB/build.gradle @@ -22,6 +22,21 @@ */ apply plugin: 'java' + +// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on +repositories { + + // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + mavenCentral() + // org.jetbrains.trove4j:trove4j + gradlePluginPortal() + // Used for gestalt 7 - Android annotations + google() + + maven { + url 'https://heisluft.de/maven' + } +} jar { version = '' } diff --git a/testpack/moduleC/build.gradle b/testpack/moduleC/build.gradle index 1b5fa952..57db0387 100644 --- a/testpack/moduleC/build.gradle +++ b/testpack/moduleC/build.gradle @@ -23,6 +23,22 @@ apply plugin: 'java' + +// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on +repositories { + + // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + mavenCentral() + // org.jetbrains.trove4j:trove4j + gradlePluginPortal() + // Used for gestalt 7 - Android annotations + google() + + maven { + url 'https://heisluft.de/maven' + } +} + jar { version = '' } diff --git a/testpack/moduleD/build.gradle b/testpack/moduleD/build.gradle index 1b5fa952..ff4ee1c2 100644 --- a/testpack/moduleD/build.gradle +++ b/testpack/moduleD/build.gradle @@ -23,6 +23,21 @@ apply plugin: 'java' +// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on +repositories { + + // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + mavenCentral() + // org.jetbrains.trove4j:trove4j + gradlePluginPortal() + // Used for gestalt 7 - Android annotations + google() + + maven { + url 'https://heisluft.de/maven' + } +} + jar { version = '' } diff --git a/testpack/moduleF/build.gradle b/testpack/moduleF/build.gradle index f48dddb3..8500c571 100644 --- a/testpack/moduleF/build.gradle +++ b/testpack/moduleF/build.gradle @@ -1,6 +1,22 @@ apply plugin: 'java' +// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on +repositories { + + // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + mavenCentral() + // org.jetbrains.trove4j:trove4j + gradlePluginPortal() + // Used for gestalt 7 - Android annotations + google() + + maven { + url 'https://heisluft.de/maven' + } +} + + jar { version = '' } diff --git a/testpack/testpack-api/build.gradle b/testpack/testpack-api/build.gradle index 03afc8c4..c67cc7fe 100644 --- a/testpack/testpack-api/build.gradle +++ b/testpack/testpack-api/build.gradle @@ -23,6 +23,21 @@ apply plugin: 'java' +// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on +repositories { + + // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + mavenCentral() + // org.jetbrains.trove4j:trove4j + gradlePluginPortal() + // Used for gestalt 7 - Android annotations + google() + maven { + url 'https://heisluft.de/maven' + } +} + + dependencies { annotationProcessor project(":gestalt-inject-java") implementation project(":gestalt-inject") From 378909f1389ccda6cc3c20d6d0316f961d05b963 Mon Sep 17 00:00:00 2001 From: DarkWeird Date: Mon, 5 Apr 2021 10:09:35 +0300 Subject: [PATCH 2/9] fix(gradle-test): return junit 4 as test runner. --- gestalt-asset-core/build.gradle | 8 +------- gradle/common.gradle | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/gestalt-asset-core/build.gradle b/gestalt-asset-core/build.gradle index 658c4790..c05f0cd5 100644 --- a/gestalt-asset-core/build.gradle +++ b/gestalt-asset-core/build.gradle @@ -46,10 +46,9 @@ dependencies { api "net.jcip:jcip-annotations:$jcip_annotation_version" testAnnotationProcessor project(":gestalt-inject-java") - testRuntime("junit:junit:$junit_version") + testImplementation "junit:junit:$junit_version" testImplementation "ch.qos.logback:logback-classic:$logback_version" testImplementation "org.mockito:mockito-core:$mockito_version" - } compileJava { @@ -61,8 +60,3 @@ compileTestJava { options.compilerArgs = ["-Aresource=${sourceSets.test.resources.srcDirs.join(File.pathSeparator)}"] } -test { - useJUnitPlatform() -} - - diff --git a/gradle/common.gradle b/gradle/common.gradle index 8524e96d..62d5f132 100644 --- a/gradle/common.gradle +++ b/gradle/common.gradle @@ -51,7 +51,7 @@ repositories { // Extra details provided for unit tests test { - useJUnitPlatform() + useJUnit() // ignoreFailures: Specifies whether the build should break when the verifications performed by this task fail. ignoreFailures = true From 6548617b06d0590de4d829dd95fabf699c4fd27a Mon Sep 17 00:00:00 2001 From: Michael Pollind Date: Mon, 5 Apr 2021 20:35:42 -0700 Subject: [PATCH 3/9] add Jenkinsfile --- Jenkinsfile | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..d42df872 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,42 @@ +pipeline { + agent { + label "light-java" + } + stages { + stage('Build') { + steps { + sh './gradlew --info --console=plain jar' + } + } + stage('Analytics') { + steps { + sh './gradlew --info --console=plain javadoc check' + } + } + stage('Publish') { + when { + anyOf { + branch 'master' + branch pattern: "release/v\\d+.x", comparator: "REGEXP" + } + } + steps { + withCredentials([usernamePassword(credentialsId: 'artifactory-gooey', usernameVariable: 'artifactoryUser', passwordVariable: 'artifactoryPass')]) { + sh './gradlew --info --console=plain -Dorg.gradle.internal.publish.checksums.insecure=true publish -PmavenUser=${artifactoryUser} -PmavenPass=${artifactoryPass}' + } + } + } + stage('Record') { + steps { + junit testResults: '**/build/test-results/test/*.xml', allowEmptyResults: true + recordIssues tool: javaDoc() + //Note: Javadoc archiver only works for one directory :-( + step([$class: 'JavadocArchiver', javadocDir: 'nui/build/docs/javadoc', keepAll: false]) + //recordIssues tool: checkStyle(pattern: '**/build/reports/checkstyle/*.xml') + //recordIssues tool: spotBugs(pattern: '**/build/reports/spotbugs/main/*.xml', useRankAsPriority: true) + //recordIssues tool: pmdParser(pattern: '**/build/reports/pmd/*.xml') + recordIssues tool: taskScanner(includePattern: '**/*.java,**/*.groovy,**/*.gradle', lowTags: 'WIBNIF', normalTags: 'TODO', highTags: 'ASAP') + } + } + } +} From 931658bfe3183ed065440da08cea1786272cbd9b Mon Sep 17 00:00:00 2001 From: Michael Pollind Date: Mon, 5 Apr 2021 20:48:11 -0700 Subject: [PATCH 4/9] remove javadocs --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d42df872..9edf3cb6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ pipeline { junit testResults: '**/build/test-results/test/*.xml', allowEmptyResults: true recordIssues tool: javaDoc() //Note: Javadoc archiver only works for one directory :-( - step([$class: 'JavadocArchiver', javadocDir: 'nui/build/docs/javadoc', keepAll: false]) + //step([$class: 'JavadocArchiver', javadocDir: 'gestalt/build/docs/javadoc', keepAll: false]) //recordIssues tool: checkStyle(pattern: '**/build/reports/checkstyle/*.xml') //recordIssues tool: spotBugs(pattern: '**/build/reports/spotbugs/main/*.xml', useRankAsPriority: true) //recordIssues tool: pmdParser(pattern: '**/build/reports/pmd/*.xml') From 44ccfa0ea28cf30f5aecdb534cc22be80077b48f Mon Sep 17 00:00:00 2001 From: Cervator Date: Sun, 25 Apr 2021 11:35:18 -0500 Subject: [PATCH 5/9] logistics: Further adjustments for renewed release management including Android --- .gitignore | 2 + Jenkinsfile | 2 +- build.gradle | 33 +++++++++++++++- gestalt-android-testbed/build.gradle | 12 ++++++ gestalt-android/build.gradle | 58 +++++++++++++++++++++++++--- gestalt-asset-core/build.gradle | 34 +--------------- gestalt-di/build.gradle | 12 +----- gestalt-entity-system/build.gradle | 33 ++-------------- gestalt-es-perf/build.gradle | 32 +-------------- gestalt-inject-java/build.gradle | 38 +----------------- gestalt-inject/build.gradle | 5 +-- gestalt-module/build.gradle | 38 +----------------- gestalt-util/build.gradle | 28 +------------- gradle/common.gradle | 47 ++-------------------- testpack/moduleA/build.gradle | 13 +------ testpack/moduleB/build.gradle | 13 +------ testpack/moduleC/build.gradle | 13 +------ testpack/moduleD/build.gradle | 12 +----- testpack/moduleF/build.gradle | 5 +-- testpack/testpack-api/build.gradle | 13 +------ 20 files changed, 127 insertions(+), 316 deletions(-) diff --git a/.gitignore b/.gitignore index f58e14e5..9df65bcf 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,8 @@ hs_err_pid* /.gradle/ build/ local.properties +gradle.properties +# TODO: Last one is probably not a great pattern, may remove again - keeps user/pass bits from getting checked in, but they should probably live elsewhere # Ignore IntelliJ out/ diff --git a/Jenkinsfile b/Jenkinsfile index 9edf3cb6..399e89ac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { stage('Publish') { when { anyOf { - branch 'master' + branch 'develop' branch pattern: "release/v\\d+.x", comparator: "REGEXP" } } diff --git a/build.gradle b/build.gradle index b0bf378b..c40dc22c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,9 @@ - plugins { id 'idea' } ext { - // Overall version number for NUI's various elements + // Overall version number for Gestalt's various elements gestaltVersion = "8.0.0-SNAPSHOT" // Android version support @@ -22,3 +21,33 @@ ext { mockito_version = "1.10.19" } +allprojects { + repositories { + google() + mavenCentral() + // org.jetbrains.trove4j:trove4j + gradlePluginPortal() + + // Terasology Artifactory instance for libs not readily available elsewhere plus our own libs + maven { + def repoViaEnv = System.getenv()["RESOLUTION_REPO"] + if (rootProject.hasProperty("alternativeResolutionRepo")) { + // If the user supplies an alternative repo via gradle.properties then use that + name "from alternativeResolutionRepo property" + url alternativeResolutionRepo + } else if (repoViaEnv != null && repoViaEnv != "") { + name "from \$RESOLUTION_REPO" + url = repoViaEnv + } else { + // Our default is the main virtual repo containing everything except repos for testing Artifactory itself + name "Terasology Artifactory" + url "http://artifactory.terasology.org/artifactory/virtual-repo-live" + allowInsecureProtocol true // 😱 + } + } + + maven { + url 'https://heisluft.de/maven' + } + } +} diff --git a/gestalt-android-testbed/build.gradle b/gestalt-android-testbed/build.gradle index 701acc5e..a8dcd725 100644 --- a/gestalt-android-testbed/build.gradle +++ b/gestalt-android-testbed/build.gradle @@ -13,6 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +buildscript { + repositories { + mavenLocal() + mavenCentral() + + // Needed for the Android Gradle Plugin to work + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:4.1.3' + } +} apply plugin: 'com.android.application' apply plugin: 'project-report' diff --git a/gestalt-android/build.gradle b/gestalt-android/build.gradle index 2be77008..ad683e2d 100644 --- a/gestalt-android/build.gradle +++ b/gestalt-android/build.gradle @@ -14,6 +14,19 @@ * limitations under the License. */ +buildscript { + repositories { + mavenLocal() + mavenCentral() + + // Needed for the Android Gradle Plugin to work + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:4.1.3' + } +} + apply plugin: 'com.android.library' apply plugin: 'maven-publish' @@ -80,16 +93,49 @@ task androidSourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs } +group = 'org.terasology.gestalt' +version = gestaltVersion + project.afterEvaluate { publishing { repositories { maven { - credentials { - username project.gestaltMavenRepoUsername - password project.gestaltMavenRepoPassword + name = 'TerasologyOrg' + allowInsecureProtocol true // 😱 - no https on our Artifactory yet + + if (rootProject.hasProperty("publishRepo")) { + // This first option is good for local testing, you can set a full explicit target repo in gradle.properties + url = "http://artifactory.terasology.org/artifactory/$publishRepo" + + logger.info("Changing PUBLISH repoKey set via Gradle property to {}", publishRepo) + } else { + // Support override from the environment to use a different target publish org + String deducedPublishRepo = System.getenv()["PUBLISH_ORG"] + if (deducedPublishRepo == null || deducedPublishRepo == "") { + // If not then default + deducedPublishRepo = "libs" + } + + // Base final publish repo on whether we're building a snapshot or a release + if (project.version.endsWith('SNAPSHOT')) { + deducedPublishRepo += "-snapshot-local" + } else { + deducedPublishRepo += "-release-local" + } + + logger.info("The final deduced publish repo is {}", deducedPublishRepo) + url = "http://artifactory.terasology.org/artifactory/$deducedPublishRepo" + } + + if (rootProject.hasProperty("mavenUser") && rootProject.hasProperty("mavenPass")) { + credentials { + username = "$mavenUser" + password = "$mavenPass" + } + authentication { + basic(BasicAuthentication) + } } - name 'TerasologyTestRepo' - url project.version.endsWith('SNAPSHOT') ? project.snapshotPublishRepo : project.releasePublishRepo } } publications { @@ -139,4 +185,4 @@ project.afterEvaluate { } } } -} \ No newline at end of file +} diff --git a/gestalt-asset-core/build.gradle b/gestalt-asset-core/build.gradle index c05f0cd5..32ca9ae4 100644 --- a/gestalt-asset-core/build.gradle +++ b/gestalt-asset-core/build.gradle @@ -1,37 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ - -apply plugin: 'java-library' -apply plugin: 'maven-publish' - +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply from: "$rootDir/gradle/common.gradle" -repositories { - maven { - url 'https://heisluft.de/maven' - } -} - // Primary dependencies definition dependencies { implementation project(":gestalt-util") diff --git a/gestalt-di/build.gradle b/gestalt-di/build.gradle index fcb390fe..d3bddf52 100644 --- a/gestalt-di/build.gradle +++ b/gestalt-di/build.gradle @@ -1,11 +1,7 @@ -apply plugin: 'java-library' -apply plugin: 'maven-publish' - +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply from: "$rootDir/gradle/common.gradle" -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - task gatherJarModules(dependsOn: [':testpack:moduleA:jar', ':testpack:moduleB:jar', ':testpack:moduleC:jar', ':testpack:moduleD:jar'], type: Copy) // Primary dependencies definition @@ -26,8 +22,6 @@ dependencies { } - - gatherJarModules { from '../testpack/moduleA/build/libs/' from '../testpack/moduleB/build/libs/' @@ -39,5 +33,3 @@ gatherJarModules { } test.dependsOn gatherJarModules - - diff --git a/gestalt-entity-system/build.gradle b/gestalt-entity-system/build.gradle index fba305fe..ffc2d210 100644 --- a/gestalt-entity-system/build.gradle +++ b/gestalt-entity-system/build.gradle @@ -1,26 +1,6 @@ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 /* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ - buildscript { repositories { mavenCentral() @@ -29,13 +9,7 @@ buildscript { classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.8" } } - - -plugins { - id 'java-library' - id 'maven-publish' -} - +*/ apply from: "$rootDir/gradle/common.gradle" // Primary dependencies definition @@ -67,4 +41,3 @@ compileTestJava { inputs.files sourceSets.test.resources.srcDirs options.compilerArgs = ["-Aresource=${sourceSets.test.resources.srcDirs.join(File.pathSeparator)}"] } - diff --git a/gestalt-es-perf/build.gradle b/gestalt-es-perf/build.gradle index cd1550f9..d10a6388 100644 --- a/gestalt-es-perf/build.gradle +++ b/gestalt-es-perf/build.gradle @@ -1,32 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ - -apply plugin: 'java-library' -apply plugin: 'maven-publish' - +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply from: "$rootDir/gradle/common.gradle" - // Primary dependencies definition dependencies { implementation project(":gestalt-util") @@ -46,9 +21,6 @@ dependencies { description = 'High performance access methods to replace the use of reflections in gestalt-entity-system. Can be used in Java 7+ and Android API 26+.' -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - /*** * Testpack inclusion */ diff --git a/gestalt-inject-java/build.gradle b/gestalt-inject-java/build.gradle index e11b4d28..5e90d2ee 100644 --- a/gestalt-inject-java/build.gradle +++ b/gestalt-inject-java/build.gradle @@ -1,41 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ - -apply plugin: 'java-library' -apply plugin: 'maven-publish' - +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply from: "$rootDir/gradle/common.gradle" - -repositories { - maven { - url = 'https://heisluft.tk/maven/' - } -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - // Primary dependencies definition dependencies { implementation project(":gestalt-util") diff --git a/gestalt-inject/build.gradle b/gestalt-inject/build.gradle index 22f46f51..70338303 100644 --- a/gestalt-inject/build.gradle +++ b/gestalt-inject/build.gradle @@ -1,6 +1,5 @@ -apply plugin: 'java-library' -apply plugin: 'maven-publish' - +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply from: "$rootDir/gradle/common.gradle" // Primary dependencies definition diff --git a/gestalt-module/build.gradle b/gestalt-module/build.gradle index d3a2ea2f..2cc80fb7 100644 --- a/gestalt-module/build.gradle +++ b/gestalt-module/build.gradle @@ -1,38 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ - -apply plugin: 'java-library' -apply plugin: 'maven-publish' - +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply from: "$rootDir/gradle/common.gradle" - -repositories { - maven { - url = 'https://heisluft.de/maven/' - } -} - // Primary dependencies definition dependencies { implementation "org.javassist:javassist:3.27.0-GA" // TODO REMOVE this. replaces with gestalt's di generator. ( used by ByteCodeInjector) @@ -69,9 +38,6 @@ compileTestJava { // Library and distribution config description = 'Provides support for modules - java libraries that can be activated at runtime and run in a sandboxed environment' -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - task gatherJarModules(dependsOn: [':testpack:moduleA:jar', ':testpack:moduleB:jar', ':testpack:moduleC:jar', ':testpack:moduleD:jar'], type: Copy) task createModuleE(dependsOn: [':gestalt-module:copyModuleEInfo', ':gestalt-module:copyModuleELibs']) task copyModuleELibs(dependsOn: [':testpack:moduleA:jar', ':testpack:moduleD:jar'], type: Copy) diff --git a/gestalt-util/build.gradle b/gestalt-util/build.gradle index 03e981f6..4dd9e0e7 100644 --- a/gestalt-util/build.gradle +++ b/gestalt-util/build.gradle @@ -1,29 +1,5 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ - -apply plugin: 'java-library' -apply plugin: 'maven-publish' - +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply from: "$rootDir/gradle/common.gradle" // Primary dependencies definition diff --git a/gradle/common.gradle b/gradle/common.gradle index 62d5f132..6fbf6bd9 100644 --- a/gradle/common.gradle +++ b/gradle/common.gradle @@ -1,3 +1,7 @@ +// Most typical common config, but not quite global +apply plugin: 'java-library' +apply plugin: 'maven-publish' + java { withSourcesJar() withJavadocJar() @@ -6,49 +10,6 @@ java { targetCompatibility(JavaVersion.VERSION_1_8) } -// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on -repositories { - // For development so you can publish binaries locally and have them grabbed from there - mavenLocal() - - // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case - mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() - - // Used for gestalt 7 - Android annotations - google() - - - maven { - url 'https://heisluft.de/maven' - } - - // Terasology Artifactory instance for libs not readily available elsewhere plus our own libs - maven { - def repoViaEnv = System.getenv()["RESOLUTION_REPO"] - if (rootProject.hasProperty("alternativeResolutionRepo")) { - // If the user supplies an alternative repo via gradle.properties then use that - name "from alternativeResolutionRepo property" - url alternativeResolutionRepo - } else if (repoViaEnv != null && repoViaEnv != "") { - name "from \$RESOLUTION_REPO" - url = repoViaEnv - } else { - // Our default is the main virtual repo containing everything except repos for testing Artifactory itself - name "Terasology Artifactory" - url "http://artifactory.terasology.org/artifactory/virtual-repo-live" - allowInsecureProtocol true // 😱 - } - } - - maven { - name "snowplow (pre-0.9)" - url "http://maven.snplow.com/releases" - allowInsecureProtocol true // 😱 - } -} - // Extra details provided for unit tests test { useJUnit() diff --git a/testpack/moduleA/build.gradle b/testpack/moduleA/build.gradle index e8b927b5..6deb123c 100644 --- a/testpack/moduleA/build.gradle +++ b/testpack/moduleA/build.gradle @@ -13,20 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ apply plugin: 'java' - -// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on repositories { - - // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + // External libs mavenCentral() // org.jetbrains.trove4j:trove4j gradlePluginPortal() @@ -38,7 +28,6 @@ repositories { } } - jar { version = '' } diff --git a/testpack/moduleB/build.gradle b/testpack/moduleB/build.gradle index 9bf2ae9d..6deb123c 100644 --- a/testpack/moduleB/build.gradle +++ b/testpack/moduleB/build.gradle @@ -13,20 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ apply plugin: 'java' - -// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on repositories { - - // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + // External libs mavenCentral() // org.jetbrains.trove4j:trove4j gradlePluginPortal() @@ -37,6 +27,7 @@ repositories { url 'https://heisluft.de/maven' } } + jar { version = '' } diff --git a/testpack/moduleC/build.gradle b/testpack/moduleC/build.gradle index 57db0387..6deb123c 100644 --- a/testpack/moduleC/build.gradle +++ b/testpack/moduleC/build.gradle @@ -13,21 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ - apply plugin: 'java' - -// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on repositories { - - // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + // External libs mavenCentral() // org.jetbrains.trove4j:trove4j gradlePluginPortal() diff --git a/testpack/moduleD/build.gradle b/testpack/moduleD/build.gradle index ff4ee1c2..6deb123c 100644 --- a/testpack/moduleD/build.gradle +++ b/testpack/moduleD/build.gradle @@ -13,20 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ - apply plugin: 'java' -// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on repositories { - - // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + // External libs mavenCentral() // org.jetbrains.trove4j:trove4j gradlePluginPortal() diff --git a/testpack/moduleF/build.gradle b/testpack/moduleF/build.gradle index 8500c571..85423406 100644 --- a/testpack/moduleF/build.gradle +++ b/testpack/moduleF/build.gradle @@ -1,10 +1,7 @@ - apply plugin: 'java' -// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on repositories { - - // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + // External libs mavenCentral() // org.jetbrains.trove4j:trove4j gradlePluginPortal() diff --git a/testpack/testpack-api/build.gradle b/testpack/testpack-api/build.gradle index c67cc7fe..e879a584 100644 --- a/testpack/testpack-api/build.gradle +++ b/testpack/testpack-api/build.gradle @@ -13,20 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/* - * This is a Gradle build file: - * - Gradle Homepage: http://gradle.org/ - * - Gradle Documentation: http://gradle.org/documentation - * - View tasks for this project: $ gradlew tasks - */ - apply plugin: 'java' -// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on repositories { - // External libs - jcenter is Bintray and is supposed to be a superset of Maven Central, but do both just in case + // External libs mavenCentral() // org.jetbrains.trove4j:trove4j gradlePluginPortal() @@ -37,10 +28,10 @@ repositories { } } - dependencies { annotationProcessor project(":gestalt-inject-java") implementation project(":gestalt-inject") } + sourceCompatibility = 1.8 targetCompatibility = 1.8 From b04fb8ca4699c1b2e4867dfa01fd3ca7f01d8c52 Mon Sep 17 00:00:00 2001 From: Cervator Date: Sun, 25 Apr 2021 14:45:58 -0500 Subject: [PATCH 6/9] logistics: Bits of cleanup --- build.gradle | 3 +-- gestalt-android-testbed/build.gradle | 18 ++--------------- gestalt-android/build.gradle | 19 ++---------------- gestalt-asset-core/build.gradle | 2 -- gestalt-di/build.gradle | 1 - gestalt-entity-system/build.gradle | 10 ---------- gradle/common.gradle | 6 ++++++ testpack/moduleA/build.gradle | 30 ++-------------------------- testpack/moduleB/build.gradle | 30 ++-------------------------- testpack/moduleC/build.gradle | 30 ++-------------------------- testpack/moduleD/build.gradle | 30 ++-------------------------- testpack/moduleF/build.gradle | 16 ++------------- testpack/testpack-api/build.gradle | 30 ++-------------------------- 13 files changed, 23 insertions(+), 202 deletions(-) diff --git a/build.gradle b/build.gradle index c40dc22c..0922323c 100644 --- a/build.gradle +++ b/build.gradle @@ -25,8 +25,6 @@ allprojects { repositories { google() mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() // Terasology Artifactory instance for libs not readily available elsewhere plus our own libs maven { @@ -46,6 +44,7 @@ allprojects { } } + // SemVer lib maven { url 'https://heisluft.de/maven' } diff --git a/gestalt-android-testbed/build.gradle b/gestalt-android-testbed/build.gradle index a8dcd725..c7bb8ac0 100644 --- a/gestalt-android-testbed/build.gradle +++ b/gestalt-android-testbed/build.gradle @@ -1,21 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 buildscript { repositories { - mavenLocal() mavenCentral() // Needed for the Android Gradle Plugin to work diff --git a/gestalt-android/build.gradle b/gestalt-android/build.gradle index ad683e2d..346a84d3 100644 --- a/gestalt-android/build.gradle +++ b/gestalt-android/build.gradle @@ -1,22 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ - +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 buildscript { repositories { - mavenLocal() mavenCentral() // Needed for the Android Gradle Plugin to work diff --git a/gestalt-asset-core/build.gradle b/gestalt-asset-core/build.gradle index 32ca9ae4..9953589a 100644 --- a/gestalt-asset-core/build.gradle +++ b/gestalt-asset-core/build.gradle @@ -9,7 +9,6 @@ dependencies { implementation project(":gestalt-inject") annotationProcessor project(":gestalt-inject-java") - implementation "com.google.guava:guava:$guava_version" implementation "org.slf4j:slf4j-api:$slf4j_version" implementation "com.android.support:support-annotations:$android_annotation_version" @@ -29,4 +28,3 @@ compileTestJava { inputs.files sourceSets.test.resources.srcDirs options.compilerArgs = ["-Aresource=${sourceSets.test.resources.srcDirs.join(File.pathSeparator)}"] } - diff --git a/gestalt-di/build.gradle b/gestalt-di/build.gradle index d3bddf52..32fb0620 100644 --- a/gestalt-di/build.gradle +++ b/gestalt-di/build.gradle @@ -19,7 +19,6 @@ dependencies { testImplementation project(":gestalt-module") testImplementation project(":testpack:testpack-api") testImplementation project(":gestalt-entity-system") - } gatherJarModules { diff --git a/gestalt-entity-system/build.gradle b/gestalt-entity-system/build.gradle index ffc2d210..d4b565f4 100644 --- a/gestalt-entity-system/build.gradle +++ b/gestalt-entity-system/build.gradle @@ -1,15 +1,5 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -/* -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.8" - } -} -*/ apply from: "$rootDir/gradle/common.gradle" // Primary dependencies definition diff --git a/gradle/common.gradle b/gradle/common.gradle index 6fbf6bd9..a96b8980 100644 --- a/gradle/common.gradle +++ b/gradle/common.gradle @@ -1,3 +1,6 @@ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + // Most typical common config, but not quite global apply plugin: 'java-library' apply plugin: 'maven-publish' @@ -16,11 +19,14 @@ test { // 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' } diff --git a/testpack/moduleA/build.gradle b/testpack/moduleA/build.gradle index 6deb123c..1fec05d8 100644 --- a/testpack/moduleA/build.gradle +++ b/testpack/moduleA/build.gradle @@ -1,33 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply plugin: 'java' -repositories { - // External libs - mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() - // Used for gestalt 7 - Android annotations - google() - - maven { - url 'https://heisluft.de/maven' - } -} - jar { version = '' } diff --git a/testpack/moduleB/build.gradle b/testpack/moduleB/build.gradle index 6deb123c..1fec05d8 100644 --- a/testpack/moduleB/build.gradle +++ b/testpack/moduleB/build.gradle @@ -1,33 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply plugin: 'java' -repositories { - // External libs - mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() - // Used for gestalt 7 - Android annotations - google() - - maven { - url 'https://heisluft.de/maven' - } -} - jar { version = '' } diff --git a/testpack/moduleC/build.gradle b/testpack/moduleC/build.gradle index 6deb123c..1fec05d8 100644 --- a/testpack/moduleC/build.gradle +++ b/testpack/moduleC/build.gradle @@ -1,33 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply plugin: 'java' -repositories { - // External libs - mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() - // Used for gestalt 7 - Android annotations - google() - - maven { - url 'https://heisluft.de/maven' - } -} - jar { version = '' } diff --git a/testpack/moduleD/build.gradle b/testpack/moduleD/build.gradle index 6deb123c..1fec05d8 100644 --- a/testpack/moduleD/build.gradle +++ b/testpack/moduleD/build.gradle @@ -1,33 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply plugin: 'java' -repositories { - // External libs - mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() - // Used for gestalt 7 - Android annotations - google() - - maven { - url 'https://heisluft.de/maven' - } -} - jar { version = '' } diff --git a/testpack/moduleF/build.gradle b/testpack/moduleF/build.gradle index 85423406..f42abae5 100644 --- a/testpack/moduleF/build.gradle +++ b/testpack/moduleF/build.gradle @@ -1,19 +1,7 @@ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply plugin: 'java' -repositories { - // External libs - mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() - // Used for gestalt 7 - Android annotations - google() - - maven { - url 'https://heisluft.de/maven' - } -} - - jar { version = '' } diff --git a/testpack/testpack-api/build.gradle b/testpack/testpack-api/build.gradle index e879a584..3f454db7 100644 --- a/testpack/testpack-api/build.gradle +++ b/testpack/testpack-api/build.gradle @@ -1,33 +1,7 @@ -/* - * Copyright 2019 MovingBlocks - * - * 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 - * - * http://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. - */ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 apply plugin: 'java' -repositories { - - // External libs - mavenCentral() - // org.jetbrains.trove4j:trove4j - gradlePluginPortal() - // Used for gestalt 7 - Android annotations - google() - maven { - url 'https://heisluft.de/maven' - } -} - dependencies { annotationProcessor project(":gestalt-inject-java") implementation project(":gestalt-inject") From 146362fc8ed0e66562cbaafeb44979d8121c9b19 Mon Sep 17 00:00:00 2001 From: Cervator Date: Sun, 25 Apr 2021 15:43:59 -0500 Subject: [PATCH 7/9] logistics: true-up for v8 from v7 Gradle & friends --- .gitignore | 2 -- build.gradle | 23 ++++++++++++++++++++--- gestalt-android-testbed/build.gradle | 12 ------------ gestalt-android/build.gradle | 15 --------------- gradle.properties | 15 +++++++++++++++ gradle/common.gradle | 3 --- 6 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 gradle.properties diff --git a/.gitignore b/.gitignore index 9df65bcf..f58e14e5 100644 --- a/.gitignore +++ b/.gitignore @@ -21,8 +21,6 @@ hs_err_pid* /.gradle/ build/ local.properties -gradle.properties -# TODO: Last one is probably not a great pattern, may remove again - keeps user/pass bits from getting checked in, but they should probably live elsewhere # Ignore IntelliJ out/ diff --git a/build.gradle b/build.gradle index 0922323c..f9d55c3f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,24 @@ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +// Only needed for the two Android modules as of April 2021 +buildscript { + repositories { + mavenCentral() + + // Needed for the Android Gradle Plugin to work + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:4.1.3' + } +} + plugins { id 'idea' } ext { - // Overall version number for Gestalt's various elements - gestaltVersion = "8.0.0-SNAPSHOT" - // Android version support android_annotation_version = "28.0.0" @@ -50,3 +63,7 @@ allprojects { } } } + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gestalt-android-testbed/build.gradle b/gestalt-android-testbed/build.gradle index c7bb8ac0..91717761 100644 --- a/gestalt-android-testbed/build.gradle +++ b/gestalt-android-testbed/build.gradle @@ -1,17 +1,5 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -buildscript { - repositories { - mavenCentral() - - // Needed for the Android Gradle Plugin to work - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' - } -} - apply plugin: 'com.android.application' apply plugin: 'project-report' diff --git a/gestalt-android/build.gradle b/gestalt-android/build.gradle index 346a84d3..07d5d0f4 100644 --- a/gestalt-android/build.gradle +++ b/gestalt-android/build.gradle @@ -1,17 +1,5 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -buildscript { - repositories { - mavenCentral() - - // Needed for the Android Gradle Plugin to work - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' - } -} - apply plugin: 'com.android.library' apply plugin: 'maven-publish' @@ -78,9 +66,6 @@ task androidSourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs } -group = 'org.terasology.gestalt' -version = gestaltVersion - project.afterEvaluate { publishing { repositories { diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..1bc16494 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,15 @@ +org.gradle.jvmargs=-Xmx1536m +group=org.terasology.gestalt +version=8.0.0-SNAPSHOT + +# Alternative resolution repo to use - this can be used to ignore "live" artifacts and only accept experimental ones. +# alternativeResolutionRepo=http://artifactory.terasology.org/artifactory/virtual-nanoware-and-remote + +#Where to publish artifacts, if not to the default snapshot/release repos +# Publishing a snapshot to a release-only repo will get an intended but quirky HTTP 409 Conflict error as of Nov 2014 +#publishRepo=nanoware-snapshot-local + +# Credentials for publishing to Artifactory. Consider setting in ~/.gradle/gradle.properties +# REMEMBER TO NOT CHECK IN ACTUAL CREDENTIAL FROM HERE! +#mavenUser= +#mavenPass= diff --git a/gradle/common.gradle b/gradle/common.gradle index a96b8980..eef1012b 100644 --- a/gradle/common.gradle +++ b/gradle/common.gradle @@ -37,9 +37,6 @@ javadoc { failOnError = false } -group = 'org.terasology.gestalt' -version = gestaltVersion - publishing { publications { "$project.name"(MavenPublication) { From 0f6c4d9f2a437e54eb13c0b9ed749179c4b88ea1 Mon Sep 17 00:00:00 2001 From: Tobias Nett Date: Sat, 12 Jun 2021 22:24:45 +0200 Subject: [PATCH 8/9] build(github): add 'labels.json' configuration This PR adds the label configuration to `.github/labels.json`, which can be used to sync labels with Financial-Times/github-label-sync Co-authored-by: jdrueckert --- .github/labels.json | 158 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 .github/labels.json diff --git a/.github/labels.json b/.github/labels.json new file mode 100644 index 00000000..c0b7e81e --- /dev/null +++ b/.github/labels.json @@ -0,0 +1,158 @@ +[ + { + "color": "FF0000", + "description": "Issue reporting or PR addressing a critical problem that blocks other efforts", + "name": "Blocker" + }, + { + "color": "ba0000", + "description": "API breaking change requiring follow-up work in dependant areas", + "name": "Breaking Change" + }, + { + "color": "f5a342", + "description": "Requests, Issues and Changes targeting gradle, groovy, Jenkins, etc.", + "name": "Category: Build/CI" + }, + { + "color": "ff7332", + "description": "Requests, Issues and Changes targeting unexpected terminations, segfaults, etc.", + "name": "Category: Crash" + }, + { + "color": "f5a342", + "description": "Requests, Issues and Changes targeting javadoc and module documentation", + "name": "Category: Doc" + }, + { + "color": "f5a342", + "description": "Requests, Issues and Changes targeting performance", + "name": "Category: Performance" + }, + { + "color": "f5a342", + "description": "Requests, Issues and Changes targeting security", + "name": "Category: Security" + }, + { + "color": "f5a342", + "description": "Requests, Issues and Changes targeting tests and quality assurance", + "name": "Category: Test/QA" + }, + { + "color": "94EC55", + "description": "Good for learners that are new to Terasology", + "name": "Good First Issue" + }, + { + "color": "AAd9d2", + "description": "Very big effort likely requiring a lot of research and work in many areas across the codebase", + "name": "Size: L" + }, + { + "color": "AAd9d2", + "description": "Medium-sized effort likely requiring some research and work in multiple areas", + "name": "Size: M" + }, + { + "color": "AAd9d2", + "description": "Small effort likely only affecting a single area and requiring little to no research", + "name": "Size: S" + }, + { + "color": "ff7d7d", + "description": "Is currently blocked by missing dependencies, pre-requisites, etc.", + "name": "Status: Blocked" + }, + { + "color": "E99695", + "description": "Requires more information by the author on the reported issue or provided changes", + "name": "Status: Needs Author Input" + }, + { + "color": "E99695", + "description": "Requires help discussing a reported issue or provided PR", + "name": "Status: Needs Discussion", + "aliases": ["help wanted"] + }, + { + "color": "E99695", + "description": "Requires to be checked for feasibility, reproducability, etc.", + "name": "Status: Needs Investigation" + }, + { + "color": "E99695", + "description": "Requires to be tested in-game", + "name": "Status: Needs Testing" + }, + { + "color": "DDDDDD", + "description": "Wasn't reviewed or continued for a while", + "name": "Status: Stale" + }, + { + "color": "3b808e", + "description": "Requests, Issues and Changes related to Android-specific features and code.", + "name": "Topic: Anddroid" + }, + { + "color": "3b808e", + "description": "Requests, Issues and Changes related to software architecture, programming patterns, etc.", + "name": "Topic: Architecture" + }, + { + "color": "3b808e", + "description": "Requests, Issues and Changes related to the asset handling library.", + "name": "Topic: Asset" + }, + { + "color": "3b808e", + "description": "Requests, Issues and Changes related to dependency injection (DI) capabilities.", + "name": "Topic: Dependency Injection" + }, + { + "color": "3b808e", + "description": "Requests, Issues and Changes related to improving stablity and reducing flakyness", + "name": "Topic: Stabilization" + }, + { + "color": "3b808e", + "description": "Requests, Issues and Changes related to the entity component system (ECS)", + "name": "Topic: Entity System", + "aliases": ["entitysystem"] + }, + { + "color": "3b808e", + "description": "Requests, Issues and Changes related to gestalt modules", + "name": "Topic: Module", + "aliases": ["gestalt-module"] + }, + { + "color": "d73a4a", + "description": "Issues reporting and PRs fixing problems", + "name": "Type: Bug", + "aliases": ["bug"] + }, + { + "color": "666666", + "description": "Request for or implementation of maintenance changes", + "name": "Type: Chore" + }, + { + "color": "0E8A16", + "description": "Request for or addition/enhancement of a feature", + "name": "Type: Improvement", + "aliases": ["enhancement"] + }, + { + "color": "66CBED", + "description": "Issue intended to help understanding something that is unclear", + "name": "Type: Question", + "aliases": ["question"] + }, + { + "color": "fbca04", + "description": "Request for or implementation of pure and automatic refactorings, e.g. renaming, to improve clarity", + "name": "Type: Refactoring" + } +] From 3a18fc6792c6916456074df17d0e10ca5bcaa961 Mon Sep 17 00:00:00 2001 From: Michael Pollind Date: Sun, 13 Jun 2021 20:44:01 -0700 Subject: [PATCH 9/9] chore: handle disposable action outside of the constructor (#118) * chore: handle disposable action outside of the constructor * make asset constructor protected --- .../org/terasology/gestalt/assets/Asset.java | 16 ++++------------ .../virtualModules/test/stubs/book/Book.java | 3 ++- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/gestalt-asset-core/src/main/java/org/terasology/gestalt/assets/Asset.java b/gestalt-asset-core/src/main/java/org/terasology/gestalt/assets/Asset.java index 3495aaa1..4f063b09 100644 --- a/gestalt-asset-core/src/main/java/org/terasology/gestalt/assets/Asset.java +++ b/gestalt-asset-core/src/main/java/org/terasology/gestalt/assets/Asset.java @@ -62,7 +62,7 @@ public abstract class Asset { * @param urn The urn identifying the asset. * @param assetType The asset type this asset belongs to. */ - public Asset(ResourceUrn urn, AssetType assetType) { + protected Asset(ResourceUrn urn, AssetType assetType) { Preconditions.checkNotNull(urn); Preconditions.checkNotNull(assetType); this.urn = urn; @@ -71,21 +71,13 @@ public Asset(ResourceUrn urn, AssetType assetType) { } /** - * The constructor for an asset. It is suggested that implementing classes provide a constructor taking both the urn, and an initial AssetData to load. - * - * @param urn The urn identifying the asset. - * @param assetType The asset type this asset belongs to. + * set a resource handler so the disposable hook can clean up resources not managed by the JVM * @param resource A resource to close when disposing this class. The resource must not have a reference to this asset - * this would prevent it being garbage collected. It must be a static inner class, or not contained in the asset class * (or an anonymous class defined in a static context). A warning will be logged if this is not the case. */ - public Asset(ResourceUrn urn, AssetType assetType, DisposableResource resource) { - Preconditions.checkNotNull(urn); - Preconditions.checkNotNull(assetType); - this.urn = urn; - this.assetType = assetType; - disposalHook.setDisposableResource(resource); - assetType.registerAsset(this, disposalHook); + protected void setDisposableResource(DisposableResource resource) { + this.disposalHook.setDisposableResource(resource); } /** diff --git a/gestalt-asset-core/src/test/java/virtualModules/test/stubs/book/Book.java b/gestalt-asset-core/src/test/java/virtualModules/test/stubs/book/Book.java index 24e27272..d42d00c0 100644 --- a/gestalt-asset-core/src/test/java/virtualModules/test/stubs/book/Book.java +++ b/gestalt-asset-core/src/test/java/virtualModules/test/stubs/book/Book.java @@ -35,7 +35,8 @@ public class Book extends Asset { private ImmutableList lines = ImmutableList.of(); public Book(ResourceUrn urn, BookData data, AssetType type) { - super(urn, type, new DisposalAction(urn)); + super(urn, type); + setDisposableResource(new DisposalAction(urn)); reload(data); }