Update buildscripts (#354)

This commit is contained in:
Serenibyss
2024-01-09 00:47:53 -06:00
committed by GitHub
parent f7651fff29
commit 8c7185f8ff
20 changed files with 796 additions and 638 deletions
+76 -25
View File
@@ -1,32 +1,83 @@
# exclude all .nopublish
/*
# include important folders ### Windows ###
# need gradle
!gradle/
!gradlew
!gradlew.bat
!build.gradle
!gradle.properties
!settings.gradle
!.travis.yml
# include markdowns thumbs.db
!README.md *.db
!LICENSE
# include sourcecode ### Java ###
!src/
# include git important files *.class
!.gitmodules
!.gitignore
# code format to reduce noise in git commits # Mobile Tools for Java (J2ME)
!codeformat/ .mtj.tmp/
# Github specific files and directories # Package Files #
!.github/ *.war
*.ear
*.txt
# Explicit ignores # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
Thumbs.db hs_err_pid*
### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
/eclipse
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
### Intellij IDEA ###
*.iml
*.ipr
*.iws
.idea/
.idea_modules/
/classes/
/out/
/build/
# Linux
*~
run/
logs/
-33
View File
@@ -1,33 +0,0 @@
sudo: required
dist: trusty
language: java
jdk:
- oraclejdk8
- openjdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json.etag
- rm -fr $HOME/.gradle/caches/minecraft/deobfedDeps
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/.sonar/cache'
- '$HOME/.gradle/wrapper'
- '$HOME/.gradle/caches'
addons:
sonarcloud:
organization: "appliedenergistics"
install: "./gradlew setupCIWorkspace"
script:
- "./gradlew build"
- "./gradlew test"
- "./gradlew sonarqube"
+338 -138
View File
@@ -1,3 +1,4 @@
//version: 1704659416
/* /*
* DO NOT CHANGE THIS FILE! * DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available. * Also, you may replace this file at any time if there is an update available.
@@ -19,23 +20,24 @@ import static org.gradle.internal.logging.text.StyledTextOutput.Style
plugins { plugins {
id 'java' id 'java'
id 'java-library' id 'java-library'
id 'base'
id 'eclipse' id 'eclipse'
id 'maven-publish' id 'maven-publish'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7' id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.19' id 'com.gtnewhorizons.retrofuturagradle' version '1.3.25'
id 'net.darkhax.curseforgegradle' version '1.0.14' apply false id 'net.darkhax.curseforgegradle' version '1.1.17' apply false
id 'com.modrinth.minotaur' version '2.8.0' apply false id 'com.modrinth.minotaur' version '2.8.6' apply false
id 'com.diffplug.spotless' version '6.13.0' apply false id 'com.diffplug.spotless' version '6.13.0' apply false
id 'com.palantir.git-version' version '3.0.0' apply false id 'com.palantir.git-version' version '3.0.0' apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
} id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false
if (verifySettingsGradle()) { id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
throw new GradleException("Settings has been updated, please re-run task.")
} }
def out = services.get(StyledTextOutputFactory).create('an-output') def out = services.get(StyledTextOutputFactory).create('an-output')
// Project properties // Project properties
// Required properties: we don't know how to handle these being missing gracefully // Required properties: we don't know how to handle these being missing gracefully
@@ -50,31 +52,72 @@ checkPropertyExists("mixinsPackage")
checkPropertyExists("coreModClass") checkPropertyExists("coreModClass")
checkPropertyExists("containsMixinsAndOrCoreModOnly") checkPropertyExists("containsMixinsAndOrCoreModOnly")
// Optional properties: we can assume some default behavior if these are missing
propertyDefaultIfUnset("modVersion", "")
propertyDefaultIfUnset("includeMCVersionJar", false)
propertyDefaultIfUnset("autoUpdateBuildScript", false)
propertyDefaultIfUnset("modArchivesBaseName", project.modId)
propertyDefaultIfUnsetWithEnvVar("developmentEnvironmentUserName", "Developer", "DEV_USERNAME")
propertyDefaultIfUnset("generateGradleTokenClass", "")
propertyDefaultIfUnset("gradleTokenModId", "")
propertyDefaultIfUnset("gradleTokenModName", "")
propertyDefaultIfUnset("gradleTokenVersion", "")
propertyDefaultIfUnset("useSrcApiPath", false)
propertyDefaultIfUnset("includeWellKnownRepositories", true)
propertyDefaultIfUnset("includeCommonDevEnvMods", true)
propertyDefaultIfUnset("noPublishedSources", false)
propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnsetWithEnvVar("enableCoreModDebug", false, "CORE_MOD_DEBUG")
propertyDefaultIfUnset("generateMixinConfig", true)
propertyDefaultIfUnset("usesShadowedDependencies", false)
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
propertyDefaultIfUnset("relocateShadowedDependencies", true)
propertyDefaultIfUnset("separateRunDirectories", false)
propertyDefaultIfUnset("versionDisplayFormat", '$MOD_NAME \u2212 $VERSION')
propertyDefaultIfUnsetWithEnvVar("modrinthProjectId", "", "MODRINTH_PROJECT_ID")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnsetWithEnvVar("curseForgeProjectId", "", "CURSEFORGE_PROJECT_ID")
propertyDefaultIfUnset("curseForgeRelations", "")
propertyDefaultIfUnsetWithEnvVar("releaseType", "release", "RELEASE_TYPE")
propertyDefaultIfUnset("generateDefaultChangelog", false)
propertyDefaultIfUnset("customMavenPublishUrl", "") propertyDefaultIfUnset("customMavenPublishUrl", "")
propertyDefaultIfUnset("mavenArtifactGroup", getDefaultArtifactGroup())
propertyDefaultIfUnset("enableModernJavaSyntax", false)
propertyDefaultIfUnset("enableSpotless", false)
propertyDefaultIfUnset("enableJUnit", false)
propertyDefaultIfUnsetWithEnvVar("deploymentDebug", false, "DEPLOYMENT_DEBUG")
// Project property assertions // Project property assertions
final String javaSourceDir = 'src/main/java/' final String javaSourceDir = 'src/main/java/'
final String scalaSourceDir = 'src/main/scala/' final String scalaSourceDir = 'src/main/scala/'
// If Kotlin is supported, add the path here final String kotlinSourceDir = 'src/main/kotlin/'
final String modGroupPath = modGroup.toString().replace('.' as char, '/' as char) final String modGroupPath = modGroup.toString().replace('.' as char, '/' as char)
final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char) final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char)
String targetPackageJava = javaSourceDir + modGroupPath String targetPackageJava = javaSourceDir + modGroupPath
String targetPackageScala = scalaSourceDir + modGroupPath String targetPackageScala = scalaSourceDir + modGroupPath
String targetPackageKotlin = kotlinSourceDir + modGroupPath
// If Kotlin is supported, add the path here if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists() && !getFile(targetPackageKotlin).exists()) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find ${targetPackageJava} or ${targetPackageScala} or ${targetPackageKotlin}")
if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists()) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find ${targetPackageJava} or ${targetPackageScala}")
} }
if (apiPackage) { if (apiPackage) {
targetPackageJava = 'src/api/java/' + modGroupPath + '/api' final String endApiPath = modGroupPath + '/' + apiPackagePath
targetPackageScala = 'src/api/java/' + modGroupPath + '/api' if (useSrcApiPath) {
if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists()) { targetPackageJava = 'src/api/java/' + endApiPath
throw new GradleException("Could not resolve \"apiPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala}") targetPackageScala = 'src/api/scala/' + endApiPath
targetPackageKotlin = 'src/api/kotlin/' + endApiPath
} else {
targetPackageJava = javaSourceDir + endApiPath
targetPackageScala = scalaSourceDir + endApiPath
targetPackageKotlin = kotlinSourceDir + endApiPath
}
if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists() && !getFile(targetPackageKotlin).exists()) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala} or ${targetPackageKotlin}")
} }
} }
@@ -96,8 +139,9 @@ if (usesMixins.toBoolean()) {
final String mixinPackagePath = mixinsPackage.toString().replaceAll('\\.', '/') final String mixinPackagePath = mixinsPackage.toString().replaceAll('\\.', '/')
targetPackageJava = javaSourceDir + modGroupPath + '/' + mixinPackagePath targetPackageJava = javaSourceDir + modGroupPath + '/' + mixinPackagePath
targetPackageScala = scalaSourceDir + modGroupPath + '/' + mixinPackagePath targetPackageScala = scalaSourceDir + modGroupPath + '/' + mixinPackagePath
if (!getFile(targetPackageJava).exists()) { targetPackageKotlin = kotlinSourceDir + modGroupPath + '/' + mixinPackagePath
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala}") if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists() && !getFile(targetPackageKotlin).exists()) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala} or ${targetPackageKotlin}")
} }
} }
@@ -106,13 +150,105 @@ if (coreModClass) {
String targetFileJava = javaSourceDir + modGroupPath + '/' + coreModPath + '.java' String targetFileJava = javaSourceDir + modGroupPath + '/' + coreModPath + '.java'
String targetFileScala = scalaSourceDir + modGroupPath + '/' + coreModPath + '.scala' String targetFileScala = scalaSourceDir + modGroupPath + '/' + coreModPath + '.scala'
String targetFileScalaJava = scalaSourceDir + modGroupPath + '/' + coreModPath + '.java' String targetFileScalaJava = scalaSourceDir + modGroupPath + '/' + coreModPath + '.java'
if (!getFile(targetFileJava).exists() && !getFile(targetFileScala).exists() && !getFile(targetFileScalaJava).exists()) { String targetFileKotlin = kotlinSourceDir + modGroupPath + '/' + coreModPath + '.kt'
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava) if (!getFile(targetFileJava).exists() && !getFile(targetFileScala).exists() && !getFile(targetFileScalaJava).exists() && !getFile(targetFileKotlin).exists()) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find ${targetFileJava} or ${targetFileScala} or ${targetFileScalaJava} or ${targetFileKotlin}")
} }
} }
// Plugin application // Plugin application
// Scala
if (getFile('src/main/scala').exists()) {
apply plugin: 'scala'
}
if (getFile('src/main/kotlin').exists()) {
apply plugin: 'org.jetbrains.kotlin.jvm'
}
// Kotlin
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
kotlin {
jvmToolchain(8)
}
def disabledKotlinTaskList = [
"kaptGenerateStubsMcLauncherKotlin",
"kaptGenerateStubsPatchedMcKotlin",
"kaptGenerateStubsInjectedTagsKotlin",
"compileMcLauncherKotlin",
"compilePatchedMcKotlin",
"compileInjectedTagsKotlin",
"kaptMcLauncherKotlin",
"kaptPatchedMcKotlin",
"kaptInjectedTagsKotlin",
"kspMcLauncherKotlin",
"kspPatchedMcKotlin",
"kspInjectedTagsKotlin",
]
tasks.configureEach { task ->
if (task.name in disabledKotlinTaskList) {
task.enabled = false
}
}
}
// Spotless
//noinspection GroovyAssignabilityCheck
project.extensions.add(com.diffplug.blowdryer.Blowdryer, 'Blowdryer', com.diffplug.blowdryer.Blowdryer) // make Blowdryer available in plugin application
if (enableSpotless.toBoolean()) {
apply plugin: 'com.diffplug.spotless'
// Spotless auto-formatter
// See https://github.com/diffplug/spotless/tree/main/plugin-gradle
// Can be locally toggled via spotless:off/spotless:on comments
spotless {
encoding 'UTF-8'
format 'misc', {
target '.gitignore'
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
java {
target 'src/main/java/**/*.java', 'src/test/java/**/*.java' // exclude api as they are not our files
def orderFile = project.file('spotless.importorder')
if (!orderFile.exists()) {
orderFile = Blowdryer.file('spotless.importorder')
}
def formatFile = project.file('spotless.eclipseformat.xml')
if (!formatFile.exists()) {
formatFile = Blowdryer.file('spotless.eclipseformat.xml')
}
toggleOffOn()
importOrderFile(orderFile)
removeUnusedImports()
endWithNewline()
//noinspection GroovyAssignabilityCheck
eclipse('4.19.0').configFile(formatFile)
}
kotlin {
target 'src/*/kotlin/**/*.kt'
toggleOffOn()
ktfmt('0.39')
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
scala {
target 'src/*/scala/**/*.scala'
scalafmt('3.7.1')
}
}
}
// Git version checking, also checking for if this is a submodule // Git version checking, also checking for if this is a submodule
if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) { if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) {
apply plugin: 'com.palantir.git-version' apply plugin: 'com.palantir.git-version'
@@ -123,6 +259,9 @@ if (usesShadowedDependencies.toBoolean()) {
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.github.johnrengelman.shadow'
} }
// Configure Java
java { java {
toolchain { toolchain {
if (enableModernJavaSyntax.toBoolean()) { if (enableModernJavaSyntax.toBoolean()) {
@@ -164,8 +303,11 @@ tasks.withType(ScalaCompile).configureEach {
// Allow others using this buildscript to have custom gradle code run // Allow others using this buildscript to have custom gradle code run
if (getFile('addon.gradle').exists()) { if (getFile('addon.gradle').exists()) {
apply from: 'addon.gradle' apply from: 'addon.gradle'
} else if (getFile('addon.gradle.kts').exists()) {
apply from: 'addon.gradle.kts'
} }
// Configure Minecraft // Configure Minecraft
// Try to gather mod version from git tags if version is not manually specified // Try to gather mod version from git tags if version is not manually specified
@@ -181,23 +323,24 @@ if (!modVersion) {
} }
} }
if (includeMCVersionJar.toBoolean()) { if (includeMCVersionJar.toBoolean()){
version = "${minecraftVersion}-${modVersion}" version = "${minecraftVersion}-${modVersion}"
} else { }
else {
version = modVersion version = modVersion
} }
group = modGroup group = modGroup
archivesBaseName = modArchivesBaseName
base {
archivesName = modArchivesBaseName
}
minecraft { minecraft {
mcVersion = minecraftVersion mcVersion = minecraftVersion
username = developmentEnvironmentUserName.toString() username = developmentEnvironmentUserName.toString()
useDependencyAccessTransformers = true useDependencyAccessTransformers = true
setMcpMappingChannel("stable")
setMcpMappingVersion("39")
// Automatic token injection with RetroFuturaGradle // Automatic token injection with RetroFuturaGradle
if (gradleTokenModId) { if (gradleTokenModId) {
injectedTags.put gradleTokenModId, modId injectedTags.put gradleTokenModId, modId
@@ -209,22 +352,30 @@ minecraft {
injectedTags.put gradleTokenVersion, modVersion injectedTags.put gradleTokenVersion, modVersion
} }
injectedTags.put("VERSION", project.version)
injectedTags.put("AEVERSION", aeversion)
injectedTags.put("AECHANNEL", aechannel)
injectedTags.put("AEBUILD", aebuild)
// JVM arguments // JVM arguments
extraRunJvmArguments.add("-ea:${modGroup}") extraRunJvmArguments.add("-ea:${modGroup}")
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
extraRunJvmArguments.addAll([ extraRunJvmArguments.addAll([
'-Dmixin.hotSwap=true', '-Dmixin.hotSwap=true',
'-Dmixin.checks.interfaces=true', '-Dmixin.checks.interfaces=true',
'-Dmixin.debug.export=true' '-Dmixin.debug.export=true'
]) ])
} }
if (coreModClass) {
extraRunJvmArguments.add("-Dfml.coreMods.load=${modGroup}.${coreModClass}") if (enableCoreModDebug.toBoolean()) {
extraRunJvmArguments.addAll([
'-Dlegacy.debugClassLoading=true',
'-Dlegacy.debugClassLoadingFiner=true',
'-Dlegacy.debugClassLoadingSave=true'
])
}
}
if (coreModClass) {
for (runTask in ['runClient', 'runServer']) {
tasks.named(runTask).configure {
extraJvmArgs.add("-Dfml.coreMods.load=${modGroup}.${coreModClass}")
}
} }
} }
@@ -236,17 +387,6 @@ tasks.named('processIdeaSettings').configure {
dependsOn('injectTags') dependsOn('injectTags')
} }
tasks.register("generateMcModInfo") {
}
tasks.register("generatePackMcMeta") {
}
tasks.named('processIdeaSettings').configure {
dependsOn('injectTags')
}
// Repositories // Repositories
@@ -263,46 +403,63 @@ repositories.configureEach { repo ->
// Allow adding custom repositories to the buildscript // Allow adding custom repositories to the buildscript
if (getFile('repositories.gradle').exists()) { if (getFile('repositories.gradle').exists()) {
apply from: 'repositories.gradle' apply from: 'repositories.gradle'
} else if (getFile('repositories.gradle.kts').exists()) {
apply from: 'repositories.gradle.kts'
} }
repositories { repositories {
exclusiveContent { if (includeWellKnownRepositories.toBoolean() || includeCommonDevEnvMods.toBoolean()) {
forRepository { exclusiveContent {
//noinspection ForeignDelegate forRepository {
maven { //noinspection ForeignDelegate
name = 'Curse Maven' maven {
url = 'https://www.cursemaven.com' name = 'Curse Maven'
url = 'https://www.cursemaven.com'
// url = 'https://beta.cursemaven.com'
}
}
filter {
includeGroup 'curse.maven'
} }
} }
filter { exclusiveContent {
includeGroup 'curse.maven' forRepository {
} //noinspection ForeignDelegate
} maven {
exclusiveContent { name = 'Modrinth'
forRepository { url = 'https://api.modrinth.com/maven'
//noinspection ForeignDelegate }
maven { }
name = 'Modrinth' filter {
url = 'https://api.modrinth.com/maven' includeGroup 'maven.modrinth'
} }
} }
filter { maven {
includeGroup 'maven.modrinth' name 'Cleanroom Maven'
url 'https://maven.cleanroommc.com'
}
maven {
name 'BlameJared Maven'
url 'https://maven.blamejared.com'
}
maven {
name 'GTNH Maven'
url 'https://nexus.gtnewhorizons.com/repository/public/'
} }
} }
maven { if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
name 'Cleanroom Maven' // need to add this here even if we did not above
url 'https://maven.cleanroommc.com' if (!includeWellKnownRepositories.toBoolean()) {
maven {
name 'Cleanroom Maven'
url 'https://maven.cleanroommc.com'
}
}
} }
maven { mavenLocal() // Must be last for caching to work
name 'BlameJared Maven'
url 'https://maven.blamejared.com'
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
} }
// Dependencies // Dependencies
// Configure dependency configurations // Configure dependency configurations
@@ -318,32 +475,31 @@ configurations {
} }
} }
String mixinProviderSpec = 'zone.rong:mixinbooter:8.9'
dependencies { dependencies {
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { if (usesMixins.toBoolean()) {
implementation 'zone.rong:mixinbooter:7.0'
String mixin = 'org.spongepowered:mixin:0.8.3'
if (usesMixins.toBoolean()) {
mixin = modUtils.enableMixins(mixin, "mixins.${modId}.refmap.json")
}
api(mixin) {
transitive = false
}
annotationProcessor(mixin) {
transitive = false
}
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2' annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
// should use 24.1.1 but 30.0+ has a vulnerability fix // should use 24.1.1 but 30.0+ has a vulnerability fix
annotationProcessor 'com.google.guava:guava:30.0-jre' annotationProcessor 'com.google.guava:guava:30.0-jre'
// should use 2.8.6 but 2.8.9+ has a vulnerability fix // should use 2.8.6 but 2.8.9+ has a vulnerability fix
annotationProcessor 'com.google.code.gson:gson:2.8.9' annotationProcessor 'com.google.code.gson:gson:2.8.9'
mixinProviderSpec = modUtils.enableMixins(mixinProviderSpec, "mixins.${modId}.refmap.json")
api (mixinProviderSpec) {
transitive = false
}
annotationProcessor(mixinProviderSpec) {
transitive = false
}
} else if (forceEnableMixins.toBoolean()) {
runtimeOnly(mixinProviderSpec)
} }
if (enableJUnit.toBoolean()) { if (enableJUnit.toBoolean()) {
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1'
testImplementation 'org.hamcrest:hamcrest:2.2' testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
} }
if (enableModernJavaSyntax.toBoolean()) { if (enableModernJavaSyntax.toBoolean()) {
@@ -364,8 +520,11 @@ dependencies {
testCompileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0" testCompileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0"
} }
compileOnlyApi 'org.jetbrains:annotations:23.0.0' compileOnlyApi 'org.jetbrains:annotations:24.1.0'
annotationProcessor 'org.jetbrains:annotations:23.0.0' annotationProcessor 'org.jetbrains:annotations:24.1.0'
patchedMinecraft('net.minecraft:launchwrapper:1.17.2') {
transitive = false
}
if (includeCommonDevEnvMods.toBoolean()) { if (includeCommonDevEnvMods.toBoolean()) {
implementation 'mezz.jei:jei_1.12.2:4.16.1.302' implementation 'mezz.jei:jei_1.12.2:4.16.1.302'
@@ -374,11 +533,20 @@ dependencies {
} }
} }
if (getFile('gradle/scripts/dependencies.gradle').exists()) { pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
apply from: 'gradle/scripts/dependencies.gradle' if (usesMixins.toBoolean()) {
dependencies {
kapt(mixinProviderSpec)
}
}
}
if (getFile('dependencies.gradle').exists()) {
apply from: 'dependencies.gradle'
} else if (getFile('dependencies.gradle.kts').exists()) {
apply from: 'dependencies.gradle.kts'
} }
apply from: 'gradle/scripts/optional.gradle'
// Test configuration // Test configuration
@@ -412,6 +580,7 @@ test {
} }
} }
// Resource processing and jar building // Resource processing and jar building
processResources { processResources {
@@ -464,20 +633,20 @@ tasks.register('generateAssets') {
mcmodInfoFile.text = """[{ mcmodInfoFile.text = """[{
"modid": "\${modid}", "modid": "\${modid}",
"name": "\${modname}", "name": "\${modname}",
"description": "A Mod about Matter, Energy and using them to conquer the world..", "description": "An example mod for Minecraft 1.12.2 with Forge",
"version": "\${version}", "version": "\${version}",
"mcversion": "\${mcversion}", "mcversion": "\${mcversion}",
"logoFile": "assets/appliedenergistics2/meta/logo.png", "logoFile": "",
"url": "https://github.com/PrototypeTrousers/Applied-Energistics-2", "url": "",
"authorList": ["AlgorithmX2"], "authorList": [],
"credits": "AlgorithmX2", "credits": "",
"dependencies": [] "dependencies": []
}] }]
""" """
} }
// mixins.{modid}.json // mixins.{modid}.json
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean() && generateMixinConfig.toBoolean()) {
def mixinConfigFile = getFile("src/main/resources/mixins.${modId}.json") def mixinConfigFile = getFile("src/main/resources/mixins.${modId}.json")
if (!mixinConfigFile.exists()) { if (!mixinConfigFile.exists()) {
def mixinConfigRefmap = "mixins.${modId}.refmap.json" def mixinConfigRefmap = "mixins.${modId}.refmap.json"
@@ -514,26 +683,49 @@ jar {
} }
} }
from sourceSets.api.output if (useSrcApiPath && apiPackage) {
dependsOn apiClasses from sourceSets.api.output
dependsOn apiClasses
// specify which files are really included, can control which APIs should be in include "${modGroupPath}/**"
include "appeng/**" include "assets/**"
include "assets/**" include "mcmod.info"
include "mcmod.info" include "pack.mcmeta"
include "pack.mcmeta" if (accessTransformersFile) {
include "META-INF/appliedenergistics2_at.cfg" include "META-INF/${accessTransformersFile}"
}
}
}
// Configure default run tasks
if (separateRunDirectories.toBoolean()) {
runClient {
workingDir = file('run/client')
}
runServer {
workingDir = file('run/server')
}
} }
// Create API library jar // Create API library jar
tasks.register('apiJar', Jar) { tasks.register('apiJar', Jar) {
archiveClassifier.set 'api' archiveClassifier.set 'api'
from(sourceSets.api.java) { if (useSrcApiPath) {
include "${modGroupPath}/${apiPackagePath}/**" from(sourceSets.api.java) {
} include "${modGroupPath}/${apiPackagePath}/**"
}
from(sourceSets.api.output) {
include "${modGroupPath}/${apiPackagePath}/**"
}
} else {
from(sourceSets.main.java) {
include "${modGroupPath}/${apiPackagePath}/**"
}
from(sourceSets.api.output) { from(sourceSets.main.output) {
include "${modGroupPath}/${apiPackagePath}/**" include "${modGroupPath}/${apiPackagePath}/**"
}
} }
} }
@@ -566,7 +758,7 @@ if (usesShadowedDependencies.toBoolean()) {
finalizedBy(tasks.shadowJar) finalizedBy(tasks.shadowJar)
} }
tasks.named('reobfJar', ReobfuscatedJar) { tasks.named('reobfJar', ReobfuscatedJar) {
inputJar.set(tasks.named('shadowJar', ShadowJar).flatMap({ it.archiveFile })) inputJar.set(tasks.named('shadowJar', ShadowJar).flatMap({it.archiveFile}))
} }
AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.findByName('java') AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.findByName('java')
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
@@ -701,7 +893,7 @@ tasks.register('generateChangelog') {
.collect { ['--', it] }).flatten()) .collect { ['--', it] }).flatten())
if (changelog) { if (changelog) {
changelog = "Changes since ${lastTag}:\n${{ ("\n" + changelog).replaceAll("\n", "\n* ") }}" changelog = "Changes since ${lastTag}:\n${{("\n" + changelog).replaceAll("\n", "\n* ")}}"
} }
def f = getFile('build/changelog.md') def f = getFile('build/changelog.md')
changelog = changelog ?: 'There have been no changes.' changelog = changelog ?: 'There have been no changes.'
@@ -727,7 +919,7 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
def changelogFile = getChangelog() def changelogFile = getChangelog()
def changelogRaw = changelogFile.exists() ? changelogFile.getText('UTF-8') : "" def changelogRaw = changelogFile.exists() ? changelogFile.getText('UTF-8') : ""
mainFile.displayName = "${modName}: ${modVersion}" mainFile.displayName = versionDisplayFormat.replace('$MOD_NAME', modName).replace('$VERSION', modVersion)
mainFile.releaseType = getReleaseType() mainFile.releaseType = getReleaseType()
mainFile.changelog = changelogRaw mainFile.changelog = changelogRaw
mainFile.changelogType = 'markdown' mainFile.changelogType = 'markdown'
@@ -743,6 +935,12 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
} }
String[] parts = dep.split(':') String[] parts = dep.split(':')
String type = parts[0], slug = parts[1] String type = parts[0], slug = parts[1]
def types = [
'req' : 'requiredDependency', 'required': 'requiredDependency',
'opt' : 'optionalDependency', 'optional': 'optionalDependency',
'embed' : 'embeddedLibrary', 'embedded': 'embeddedLibrary',
'incomp': 'incompatible', 'fail' : 'incompatible']
if (types.containsKey(type)) type = types[type]
if (!(type in ['requiredDependency', 'embeddedLibrary', 'optionalDependency', 'tool', 'incompatible'])) { if (!(type in ['requiredDependency', 'embeddedLibrary', 'optionalDependency', 'tool', 'incompatible'])) {
throw new Exception('Invalid Curseforge dependency type: ' + type) throw new Exception('Invalid Curseforge dependency type: ' + type)
} }
@@ -767,6 +965,7 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
modrinth { modrinth {
token = modrinthApiKey.getOrElse('debug_token') token = modrinthApiKey.getOrElse('debug_token')
projectId = modrinthProjectId projectId = modrinthProjectId
versionName = versionDisplayFormat.replace('$MOD_NAME', modName).replace('$VERSION', modVersion)
changelog = changelogFile.exists() ? changelogFile.getText('UTF-8') : "" changelog = changelogFile.exists() ? changelogFile.getText('UTF-8') : ""
versionType = getReleaseType() versionType = getReleaseType()
versionNumber = modVersion versionNumber = modVersion
@@ -784,7 +983,7 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
} }
String[] parts = dep.split(':') String[] parts = dep.split(':')
String[] qual = parts[0].split('-') String[] qual = parts[0].split('-')
addModrinthDep(qual[0], qual[1], parts[1]) addModrinthDep(qual[0], qual.length > 1 ? qual[1] : 'project', parts[1])
} }
} }
tasks.modrinth.dependsOn(build) tasks.modrinth.dependsOn(build)
@@ -793,9 +992,17 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
def addModrinthDep(String scope, String type, String name) { def addModrinthDep(String scope, String type, String name) {
com.modrinth.minotaur.dependencies.Dependency dep com.modrinth.minotaur.dependencies.Dependency dep
def types = [
'req' : 'required',
'opt' : 'optional',
'embed' : 'embedded',
'incomp': 'incompatible', 'fail': 'incompatible']
if (types.containsKey(scope)) scope = types[scope]
if (!(scope in ['required', 'optional', 'incompatible', 'embedded'])) { if (!(scope in ['required', 'optional', 'incompatible', 'embedded'])) {
throw new Exception('Invalid modrinth dependency scope: ' + scope) throw new Exception('Invalid modrinth dependency scope: ' + scope)
} }
types = ['proj': 'project', '': 'project', 'p': 'project', 'ver': 'version', 'v': 'version']
if (types.containsKey(type)) type = types[type]
switch (type) { switch (type) {
case 'project': case 'project':
dep = new ModDependency(name, scope) dep = new ModDependency(name, scope)
@@ -823,8 +1030,8 @@ if (customMavenPublishUrl) {
} }
// providers is not available here, use System for getting env vars // providers is not available here, use System for getting env vars
groupId = System.getenv('ARTIFACT_GROUP_ID') ?: project.group groupId = System.getenv('ARTIFACT_GROUP_ID') ?: project.mavenArtifactGroup
artifactId = System.getenv('ARTIFACT_ID') ?: project.name artifactId = System.getenv('ARTIFACT_ID') ?: project.modArchivesBaseName
version = System.getenv('RELEASE_VERSION') ?: publishedVersion version = System.getenv('RELEASE_VERSION') ?: publishedVersion
} }
} }
@@ -862,7 +1069,6 @@ def getReleaseType() {
* Next, if 'generateDefaultChangelog' option is enabled, use that. * Next, if 'generateDefaultChangelog' option is enabled, use that.
* Otherwise, try to use a CHANGELOG.md file at root directory. * Otherwise, try to use a CHANGELOG.md file at root directory.
*/ */
def getChangelog() { def getChangelog() {
def final changelogEnv = providers.environmentVariable('CHANGELOG_LOCATION') def final changelogEnv = providers.environmentVariable('CHANGELOG_LOCATION')
if (changelogEnv.isPresent()) { if (changelogEnv.isPresent()) {
@@ -877,7 +1083,7 @@ def getChangelog() {
// Buildscript updating // Buildscript updating
def buildscriptGradleVersion = '8.1.1' def buildscriptGradleVersion = '8.5'
tasks.named('wrapper', Wrapper).configure { tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion gradleVersion = buildscriptGradleVersion
@@ -912,29 +1118,18 @@ static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/build.gradle") new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/build.gradle")
} }
static URL exampleSettingsGradleUrl() { static URL availableSettingsGradleUrl() {
new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/settings.gradle") new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/settings.gradle")
} }
boolean verifySettingsGradle() {
def settingsFile = getFile("settings.gradle")
if (!settingsFile.exists()) {
println("Downloading default settings.gradle")
exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
return true
}
return false
}
boolean performBuildScriptUpdate() { boolean performBuildScriptUpdate() {
if (isNewBuildScriptVersionAvailable()) { if (isNewBuildScriptVersionAvailable()) {
def buildscriptFile = getFile("build.gradle") def buildscriptFile = getFile("build.gradle")
def settingsFile = getFile("settings.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
availableSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
def out = services.get(StyledTextOutputFactory).create('buildscript-update-output') def out = services.get(StyledTextOutputFactory).create('buildscript-update-output')
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
if (verifySettingsGradle()) {
throw new GradleException("Settings has been updated, please re-run task.")
}
return true return true
} }
return false return false
@@ -981,6 +1176,11 @@ tasks.register('faq') {
// Helpers // Helpers
def getDefaultArtifactGroup() {
def lastIndex = project.modGroup.lastIndexOf('.')
return lastIndex < 0 ? project.modGroup : project.modGroup.substring(0, lastIndex)
}
def getFile(String relativePath) { def getFile(String relativePath) {
return new File(projectDir, relativePath) return new File(projectDir, relativePath)
} }
@@ -1024,4 +1224,4 @@ def getLastTag() {
def githubTag = providers.environmentVariable('GITHUB_TAG') def githubTag = providers.environmentVariable('GITHUB_TAG')
return runShell('git describe --abbrev=0 --tags ' + return runShell('git describe --abbrev=0 --tags ' +
(githubTag.isPresent() ? runShell('git rev-list --tags --skip=1 --max-count=1') : '')) (githubTag.isPresent() ? runShell('git rev-list --tags --skip=1 --max-count=1') : ''))
} }
+52
View File
@@ -0,0 +1,52 @@
//file:noinspection DependencyNotationArgument
// TODO remove when fixed in RFG ^
/*
* Add your dependencies here. Common configurations:
* - implementation("group:name:version:classifier"): if you need this for internal implementation details of the mod.
* Available at compiletime and runtime for your environment.
*
* - compileOnlyApi("g:n:v:c"): if you need this for internal implementation details of the mod.
* Available at compiletime but not runtime for your environment.
*
* - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry
*
* - testCONFIG("g:n:v:c"): replace CONFIG by one of the above, same as above but for the test sources instead of main
*
* You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed.
*
* To add a mod with CurseMaven, replace '("g:n:v:c")' in the above with 'rfg.deobf("curse.maven:project_slug-project_id:file_id")'
* Example: implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4527757")
*
* To shadow a dependency, use 'shadowImplementation'. For more info, see https://github.com/GregTechCEu/Buildscripts/blob/master/docs/shadow.md
*
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
// Mods always in-game
implementation rfg.deobf("curse.maven:gregtechceu-557242:4429261") // GTCEu
implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // CCL 3.2.3.358
implementation rfg.deobf("curse.maven:baubles-227083:2518667") // Baubles
implementation rfg.deobf("curse.maven:industrial-craft-242638:2547175") // IC2
implementation rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry
// Mods only in code by default
compileOnly "curse.maven:chisel-235279:2915375"
compileOnly "curse.maven:hwyla-253449:2568751"
compileOnly "curse.maven:recipe-stages-280554:3405072"
compileOnly "curse.maven:item-stages-280316:2696769"
compileOnly "curse.maven:game-stages-268655:2951844"
compileOnly "net.darkhax.tesla:Tesla-1.12.2:1.0.63"
compileOnly "curse.maven:CoFHCore-69162:2920433"
compileOnly "CraftTweaker2:CraftTweaker2-API:4.1.20.684"
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
compileOnly rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31
compileOnly rfg.deobf("curse.maven:actually-additions-228404:3117927") // ActuallyAdditions r152
}
minecraft {
injectedTags.put('AEVERSION', aeversion)
injectedTags.put('AECHANNEL', aechannel)
injectedTags.put('AEBUILD', aebuild)
}
+109 -73
View File
@@ -1,148 +1,184 @@
modName = AE2 Unofficial Extended Life
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = appliedenergistics2
modGroup = appeng
# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion = rv6-stable-7-extended_life-v0.55.29
# AE2 Specific Version Settings
aeversion=rv6 aeversion=rv6
aechannel=stable aechannel=stable
aebuild=7 aebuild=7
aegroup=appeng
aebasename=appliedenergistics2
#########################################################
# Versions #
#########################################################
minecraft_version=1.12.2
mcp_mappings=snapshot_20171003
forge_version=14.23.5.2847
#########################################################
# Installable #
#########################################################
hwyla_version=1.8.26-B41_1.12.2
#########################################################
# Provided APIs #
#########################################################
jei_version=4.16.1.302
tesla_version=1.0.63
ic2_version=2.8.73-ex112
top_version=1.12-1.4.23-16
crafttweaker_version=4.1.20.684
ctm_version=MC1.12.2-0.3.1.16
forestry_version=5.8.2.387
#########################################################
# Deployment #
#########################################################
website_version=1.12.2
curse_versions=1.12.2
mapping_channel=snapshot
mapping_version=20171003
# Run Configurations
minecraft_username=Developer
extra_jvm_args=
modName=AE2 Unofficial Extended Life
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId=appliedenergistics2
modGroup=appeng
# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion=rv6-stable-7-extended_life-v0.55.29
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version) # Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar=false includeMCVersionJar = false
# The name of your jar when you produce builds, not including any versioning info # The name of your jar when you produce builds, not including any versioning info
modArchivesBaseName=appliedenergistics2 modArchivesBaseName = appliedenergistics2
# Will update your build.gradle automatically whenever an update is available # Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript=false autoUpdateBuildScript = false
minecraftVersion=1.12.2
minecraftVersion = 1.12.2
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you # Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod: # restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name # Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty # Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
# Alternatively this can be set with the 'DEV_USERNAME' environment variable. # Alternatively this can be set with the 'DEV_USERNAME' environment variable.
developmentEnvironmentUserName=Developer developmentEnvironmentUserName = Developer
# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8. # Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works. # See https://github.com/bsideup/jabel for details on how this works.
# Using this requires that you use a Java 17 JDK for development. # Using this requires that you use a Java 17 JDK for development.
enableModernJavaSyntax=true enableModernJavaSyntax = true
# Generate a class with String fields for the mod id, name and version named with the fields below # Generate a class with String fields for the mod id, name and version named with the fields below
generateGradleTokenClass=appeng.Tags generateGradleTokenClass = appeng.Tags
gradleTokenModId= gradleTokenModId = MODID
gradleTokenModName= gradleTokenModName = MODNAME
gradleTokenVersion=VERSION gradleTokenVersion = VERSION
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty. # leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api # Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage=api apiPackage = api
# If you want to keep your API code in src/api instead of src/main
useSrcApiPath = true
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/ # Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/
# There can be multiple files in a comma-separated list. # There can be multiple files in a comma-separated list.
# Example value: mymodid_at.cfg,jei_at.cfg # Example value: mymodid_at.cfg,jei_at.cfg
accessTransformersFile=appliedenergistics2_at.cfg accessTransformersFile = appliedenergistics2_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins=false usesMixins = false
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage= mixinsPackage =
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
generateMixinConfig = false
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin # Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass=core.AE2ELCore coreModClass = core.AE2ELCore
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that # If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that
# there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false! # there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly=false containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. # Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins=false forceEnableMixins = false
# Outputs pre-transformed and post-transformed loaded classes to run/CLASSLOADER_TEMP. Can be used in combination with
# diff to see exactly what your ASM or Mixins are changing in the target file.
# Optionally can be specified with the 'CORE_MOD_DEBUG' env var. Will output a lot of files!
enableCoreModDebug = false
# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories # Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
includeWellKnownRepositories=true includeWellKnownRepositories = true
# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will # Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will
# be available at compiletime and runtime for your mod (in-game and in-code). # be available at compiletime and runtime for your mod (in-game and in-code).
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods # Overrides the above setting to be always true, as these repositories are needed to fetch the mods
includeCommonDevEnvMods=true includeCommonDevEnvMods = true
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your # If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required. # responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies=false usesShadowedDependencies = false
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access # If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable. # their own classes, making the minimization unreliable.
minimizeShadowedDependencies=true minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes. # If disabled, won't rename the shadowed classes.
relocateShadowedDependencies=true relocateShadowedDependencies = true
# Separate run directories into "run/client" for runClient task, and "run/server" for runServer task.
# Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/"
separateRunDirectories = false
# The display name format of versions published to Curse and Modrinth. $MOD_NAME and $VERSION are available variables.
# Default: $MOD_NAME \u2212 $VERSION. \u2212 is the minus character which looks much better than the hyphen minus on Curse.
versionDisplayFormat = $MOD_NAME \u2212 $VERSION
# Publishing to modrinth requires you to set the MODRINTH_API_KEY environment variable to your current modrinth API token. # Publishing to modrinth requires you to set the MODRINTH_API_KEY environment variable to your current modrinth API token.
# The project's ID on Modrinth. Can be either the slug or the ID. # The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish on Modrinth. # Leave this empty if you don't want to publish on Modrinth.
# Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable. # Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable.
modrinthProjectId= modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth. # The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;... # Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded], # Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version], # type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod. # and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:jei;optional-project:top;incompatible-project:gregtech # Example: required-project:jei;optional-project:top;incompatible-project:gregtech
modrinthRelations= modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_API_KEY environment variable to one of your CurseForge API tokens. # Publishing to CurseForge requires you to set the CURSEFORGE_API_KEY environment variable to one of your CurseForge API tokens.
# The project's numeric ID on CurseForge. You can find this in the About Project box. # The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge. # Leave this empty if you don't want to publish on CurseForge.
# Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable. # Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable.
curseForgeProjectId= curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge. # The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;... # Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], # Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod. # and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft # Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
curseForgeRelations= curseForgeRelations =
# This project's release type on CurseForge and/or Modrinth # This project's release type on CurseForge and/or Modrinth
# Alternatively this can be set with the 'RELEASE_TYPE' environment variable.
# Allowed types: release, beta, alpha # Allowed types: release, beta, alpha
releaseType=beta releaseType = release
# Generate a default changelog for releases. Requires git to be installed, as it uses it to generate a changelog of # Generate a default changelog for releases. Requires git to be installed, as it uses it to generate a changelog of
# commits since the last tagged release. # commits since the last tagged release.
generateDefaultChangelog=false generateDefaultChangelog = false
# Prevent the source code from being published # Prevent the source code from being published
noPublishedSources=false noPublishedSources = false
# Publish to a custom maven location. Follows a few rules:
# Group ID can be set with the 'ARTIFACT_GROUP_ID' environment variable, default to 'project.group'
# Artifact ID can be set with the 'ARTIFACT_ID' environment variable, default to 'project.name'
# Version can be set with the 'RELEASE_VERSION' environment variable, default to 'modVersion'
# For maven credentials:
# Username is set with the 'MAVEN_USER' environment variable, default to "NONE"
# Password is set with the 'MAVEN_PASSWORD' environment variable, default to "NONE"
customMavenPublishUrl =
# The group for maven artifacts. Defaults to the 'project.modGroup' until the last '.' (if any).
# So 'mymod' becomes 'mymod' and 'com.myname.mymodid' 'becomes com.myname'
mavenArtifactGroup =
# Enable spotless checks # Enable spotless checks
# Enforces code formatting on your source code # Enforces code formatting on your source code
# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless # By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless
# to format your code. However, you can create your own version of these files and place them in your project's # to format your code. However, you can create your own version of these files and place them in your project's
# root directory to apply your own formatting options instead. # root directory to apply your own formatting options instead.
enableSpotless=false enableSpotless = false
# Enable JUnit testing platform used for testing your code. # Enable JUnit testing platform used for testing your code.
# Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/ # Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/
enableJUnit=true enableJUnit = true
# Deployment debug setting # Deployment debug setting
# Uncomment this to test deployments to CurseForge and Modrinth # Uncomment this to test deployments to CurseForge and Modrinth
# Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable. # Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable.
deploymentDebug=false deploymentDebug = false
# Gradle Settings # Gradle Settings
# Effectively applies the '--stacktrace' flag by default # Effectively applies the '--stacktrace' flag by default
org.gradle.logging.stacktrace=all org.gradle.logging.stacktrace = all
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. # Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process. # This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G org.gradle.jvmargs = -Xmx3G
-116
View File
@@ -1,116 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
repositories {
mavenLocal()
maven {
url "https://cursemaven.com"
}
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
maven {
name "Mobius"
url "http://mobiusstrip.eu/maven"
}
maven {
name = "JEI repo"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name "Ellpeck"
url "https://maven.ellpeck.de"
}
maven {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven { // TheOneProbe
name 'tterrag maven'
url "http://maven.tterrag.com/"
}
maven { // McJtyLib
name 'mcjty'
url "http://maven.k-4u.nl/"
}
maven { // CraftTweaker
name 'jared maven'
url "http://maven.blamejared.com/"
}
//maven { // modmaven, maven proxy
// name 'modmaven'
// url "https://modmaven.k-4u.nl/"
//}
}
configurations {
mods
}
dependencies {
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
// installable runtime dependencies
implementation rfg.deobf("curse.maven:gregtechceu-557242:4429261")
compileOnly "curse.maven:chisel-235279:2915375"
implementation rfg.deobf("curse.maven:baubles-227083:2518667")
//mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
mods "curse.maven:hwyla-253449:2568751"
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
// compile against provided APIs
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
compileOnly "curse.maven:hwyla-253449:2568751"
//Code chicken lib, GTCE dependency
implementation rfg.deobf("curse.maven:CCL-242818:2779848")
compileOnly "curse.maven:recipe-stages-280554:3405072"
compileOnly "curse.maven:item-stages-280316:2696769"
compileOnly "curse.maven:game-stages-268655:2951844"
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
//compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
implementation rfg.deobf("curse.maven:industrial-craft-242638:2547175")
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
compileOnly "curse.maven:CoFHCore-69162:2920433"
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
implementation rfg.deobf("curse.maven:forestry-59751:2684780")
// at runtime, use the full JEI jar
runtimeOnly "mezz.jei:jei_${minecraft_version}:${jei_version}"
// unit test dependencies
testImplementation "junit:junit:4.12"
}
-54
View File
@@ -1,54 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
// HWYLA
tasks.register('installHwyla', Copy) {
dependsOn "deinstallHwyla"
from { configurations.mods }
include "**/*Hwyla*.jar"
into file("/run/mods")
}
tasks.register('deinstallHwyla', Delete) {
delete fileTree(dir: "/run/mods", include: "*Hwyla*.jar")
}
// IC2
tasks.register('installIC2', Copy) {
dependsOn "deinstallIC2"
from { configurations.mods }
include "**/*industrialcraft-2*.jar"
into file("/run/mods")
}
tasks.register('deinstallIC2', Delete) {
delete fileTree(dir: "/run/mods", include: "*industrialcraft-2*.jar")
}
// TOP
tasks.register('installTop', Copy) {
dependsOn["deinstallTop"]
from { configurations.mods }
include "**/*TheOneProbe*.jar"
into file("/run/mods")
}
tasks.register('deinstallTop', Delete) {
delete fileTree(dir: "/run/mods", include: "*TheOneProbe*.jar")
}
+2 -1
View File
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+8 -4
View File
@@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -133,10 +130,13 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
@@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
Vendored
+32 -24
View File
@@ -1,4 +1,20 @@
@if "%DEBUG%" == "" @echo off @rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@@ -9,19 +25,23 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS= set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,38 +65,26 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal
+9 -5
View File
@@ -3,9 +3,7 @@ pluginManagement {
maven { maven {
// RetroFuturaGradle // RetroFuturaGradle
name 'GTNH Maven' name 'GTNH Maven'
//noinspection HttpUrlsUsage url 'https://nexus.gtnewhorizons.com/repository/public/'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol = true
//noinspection GroovyAssignabilityCheck //noinspection GroovyAssignabilityCheck
mavenContent { mavenContent {
includeGroup 'com.gtnewhorizons' includeGroup 'com.gtnewhorizons'
@@ -19,8 +17,14 @@ pluginManagement {
} }
plugins { plugins {
id 'com.diffplug.blowdryerSetup' version '1.7.0'
// Automatic toolchain provisioning // Automatic toolchain provisioning
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
} }
rootProject.name = rootProject.projectDir.getName() blowdryerSetup {
repoSubfolder 'spotless'
github 'GregTechCEu/Buildscripts', 'tag', 'v1.0.7'
}
rootProject.name = rootProject.projectDir.getName()
@@ -19,9 +19,10 @@
package appeng.core.worlddata; package appeng.core.worlddata;
import org.junit.Assert; import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
/** /**
* Tests for {@link MeteorDataNameEncoder} * Tests for {@link MeteorDataNameEncoder}
@@ -51,7 +52,7 @@ public class MeteorDataNameEncoderTest
final String expected = WITHOUT_EXPECTED; final String expected = WITHOUT_EXPECTED;
final String actual = this.encoderWithZeroShifting.encode( WITHOUT_DIMENSION, WITHOUT_CHUNK_X, WITHOUT_CHUNK_Z ); final String actual = this.encoderWithZeroShifting.encode( WITHOUT_DIMENSION, WITHOUT_CHUNK_X, WITHOUT_CHUNK_Z );
Assert.assertEquals( expected, actual ); assertThat( expected, is(actual) );
} }
@Test @Test
@@ -60,6 +61,6 @@ public class MeteorDataNameEncoderTest
final String expected = WITH_EXPECTED; final String expected = WITH_EXPECTED;
final String actual = this.encoderWithFourShifting.encode( WITH_DIMENSION, WITH_CHUNK_X, WITH_CHUNK_Z ); final String actual = this.encoderWithFourShifting.encode( WITH_DIMENSION, WITH_CHUNK_X, WITH_CHUNK_Z );
Assert.assertEquals( expected, actual ); assertThat( expected, is(actual) );
} }
} }
@@ -2,10 +2,11 @@
package appeng.core.worlddata; package appeng.core.worlddata;
import org.junit.Assert;
import org.junit.Test;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
public class SpatialDimensionManagerTest public class SpatialDimensionManagerTest
@@ -45,31 +46,31 @@ public class SpatialDimensionManagerTest
{ {
SpatialDimensionManager manager = new SpatialDimensionManager( null ); SpatialDimensionManager manager = new SpatialDimensionManager( null );
Assert.assertEquals( ID_1, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_1, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_2, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_2, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_3, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_3, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_4, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_4, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_5, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_5, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_6, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_6, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_7, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_7, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_8, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_8, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_9, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_9, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_A, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_A, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_B, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_B, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( ID_C, manager.createNewCellDimension( CONTENT, -1 ) ); assertThat( ID_C, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( POS_1, manager.getCellDimensionOrigin( ID_1 ) ); assertThat( POS_1, is(manager.getCellDimensionOrigin( ID_1 ) ) );
Assert.assertEquals( POS_2, manager.getCellDimensionOrigin( ID_2 ) ); assertThat( POS_2, is(manager.getCellDimensionOrigin( ID_2 ) ) );
Assert.assertEquals( POS_3, manager.getCellDimensionOrigin( ID_3 ) ); assertThat( POS_3, is(manager.getCellDimensionOrigin( ID_3 ) ) );
Assert.assertEquals( POS_4, manager.getCellDimensionOrigin( ID_4 ) ); assertThat( POS_4, is(manager.getCellDimensionOrigin( ID_4 ) ) );
Assert.assertEquals( POS_5, manager.getCellDimensionOrigin( ID_5 ) ); assertThat( POS_5, is(manager.getCellDimensionOrigin( ID_5 ) ) );
Assert.assertEquals( POS_6, manager.getCellDimensionOrigin( ID_6 ) ); assertThat( POS_6, is(manager.getCellDimensionOrigin( ID_6 ) ) );
Assert.assertEquals( POS_7, manager.getCellDimensionOrigin( ID_7 ) ); assertThat( POS_7, is(manager.getCellDimensionOrigin( ID_7 ) ) );
Assert.assertEquals( POS_8, manager.getCellDimensionOrigin( ID_8 ) ); assertThat( POS_8, is(manager.getCellDimensionOrigin( ID_8 ) ) );
Assert.assertEquals( POS_9, manager.getCellDimensionOrigin( ID_9 ) ); assertThat( POS_9, is(manager.getCellDimensionOrigin( ID_9 ) ) );
Assert.assertEquals( POS_A, manager.getCellDimensionOrigin( ID_A ) ); assertThat( POS_A, is(manager.getCellDimensionOrigin( ID_A ) ) );
Assert.assertEquals( POS_B, manager.getCellDimensionOrigin( ID_B ) ); assertThat( POS_B, is(manager.getCellDimensionOrigin( ID_B ) ) );
Assert.assertEquals( POS_C, manager.getCellDimensionOrigin( ID_C ) ); assertThat( POS_C, is(manager.getCellDimensionOrigin( ID_C ) ) );
} }
} }
@@ -19,9 +19,10 @@
package appeng.services.version; package appeng.services.version;
import org.junit.Assert; import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
/** /**
* @author thatsIch * @author thatsIch
@@ -46,20 +47,20 @@ public class ModVersionFetcherTest
} }
@Test @Test
public void testInDev() throws Exception public void testInDev()
{ {
Assert.assertEquals( this.indev.get(), new DoNotCheckVersion() ); assertThat( this.indev.get(), is( new DoNotCheckVersion() ) );
} }
@Test @Test
public void testPR() throws Exception public void testPR()
{ {
Assert.assertEquals( this.pullRequest.get(), new DoNotCheckVersion() ); assertThat( this.pullRequest.get(), is( new DoNotCheckVersion() ) );
} }
@Test @Test
public void testWorking() throws Exception public void testWorking()
{ {
Assert.assertEquals( this.working.get(), new DefaultVersion( 2, Channel.Beta, 8 ) ); assertThat( this.working.get(), is( new DefaultVersion( 2, Channel.Beta, 8) ) );
} }
} }
@@ -19,18 +19,17 @@
package appeng.services.version; package appeng.services.version;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import appeng.services.version.exceptions.InvalidBuildException; import appeng.services.version.exceptions.InvalidBuildException;
import appeng.services.version.exceptions.InvalidChannelException; import appeng.services.version.exceptions.InvalidChannelException;
import appeng.services.version.exceptions.InvalidRevisionException; import appeng.services.version.exceptions.InvalidRevisionException;
import appeng.services.version.exceptions.InvalidVersionException; import appeng.services.version.exceptions.InvalidVersionException;
import appeng.services.version.exceptions.MissingSeparatorException; import appeng.services.version.exceptions.MissingSeparatorException;
import appeng.services.version.exceptions.VersionCheckerException; import appeng.services.version.exceptions.VersionCheckerException;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
/** /**
@@ -63,66 +62,66 @@ public final class VersionParserTest
{ {
final Version version = this.parser.parse( GITHUB_VERSION ); final Version version = this.parser.parse( GITHUB_VERSION );
assertEquals( version, version ); assertThat( version, is( version ) );
} }
@Test @Test
public void testParseGitHub() throws VersionCheckerException public void testParseGitHub() throws VersionCheckerException
{ {
assertTrue( this.parser.parse( GITHUB_VERSION ).equals( VERSION ) ); assertThat( this.parser.parse( GITHUB_VERSION ), is( VERSION ) );
} }
@Test( expected = InvalidRevisionException.class ) @Test
public void parseGH_InvalidRevision() throws VersionCheckerException public void parseGH_InvalidRevision()
{ {
assertFalse( this.parser.parse( GITHUB_INVALID_REVISION ).equals( VERSION ) ); assertThrows( InvalidRevisionException.class, () -> this.parser.parse( GITHUB_INVALID_REVISION ));
} }
@Test( expected = InvalidChannelException.class ) @Test
public void parseGH_InvalidChannel() throws VersionCheckerException public void parseGH_InvalidChannel()
{ {
assertFalse( this.parser.parse( GITHUB_INVALID_CHANNEL ).equals( VERSION ) ); assertThrows( InvalidChannelException.class, () -> this.parser.parse( GITHUB_INVALID_CHANNEL ) );
} }
@Test( expected = InvalidBuildException.class ) @Test
public void parseGH_InvalidBuild() throws VersionCheckerException public void parseGH_InvalidBuild()
{ {
assertFalse( this.parser.parse( GITHUB_INVALID_BUILD ).equals( VERSION ) ); assertThrows( InvalidBuildException.class, () -> this.parser.parse( GITHUB_INVALID_BUILD ) );
} }
@Test @Test
public void testParseMod() throws VersionCheckerException public void testParseMod() throws VersionCheckerException
{ {
assertTrue( this.parser.parse( MOD_VERSION ).equals( VERSION ) ); assertThat( this.parser.parse( MOD_VERSION ), is( VERSION ) );
} }
@Test( expected = InvalidRevisionException.class ) @Test
public void parseMod_InvalidRevision() throws VersionCheckerException public void parseMod_InvalidRevision()
{ {
assertFalse( this.parser.parse( MOD_INVALID_REVISION ).equals( VERSION ) ); assertThrows( InvalidRevisionException.class, () -> this.parser.parse( MOD_INVALID_REVISION ) );
} }
@Test( expected = InvalidChannelException.class ) @Test
public void parseMod_InvalidChannel() throws VersionCheckerException public void parseMod_InvalidChannel()
{ {
assertFalse( this.parser.parse( MOD_INVALID_CHANNEL ).equals( VERSION ) ); assertThrows( InvalidChannelException.class, () -> this.parser.parse( MOD_INVALID_CHANNEL ) );
} }
@Test( expected = InvalidBuildException.class ) @Test
public void parseMod_InvalidBuild() throws VersionCheckerException public void parseMod_InvalidBuild()
{ {
assertFalse( this.parser.parse( MOD_INVALID_BUILD ).equals( VERSION ) ); assertThrows( InvalidBuildException.class, () -> this.parser.parse( MOD_INVALID_BUILD ) );
} }
@Test( expected = MissingSeparatorException.class ) @Test
public void parseGeneric_MissingSeparator() throws VersionCheckerException public void parseGeneric_MissingSeparator()
{ {
assertFalse( this.parser.parse( GENERIC_MISSING_SEPARATOR ).equals( VERSION ) ); assertThrows( MissingSeparatorException.class, () -> this.parser.parse( GENERIC_MISSING_SEPARATOR ) );
} }
@Test( expected = InvalidVersionException.class ) @Test
public void parseGeneric_InvalidVersion() throws VersionCheckerException public void parseGeneric_InvalidVersion()
{ {
assertFalse( this.parser.parse( GENERIC_INVALID_VERSION ).equals( VERSION ) ); assertThrows( InvalidVersionException.class, () -> this.parser.parse( GENERIC_INVALID_VERSION ) );
} }
} }
@@ -19,8 +19,10 @@
package appeng.services.version; package appeng.services.version;
import org.junit.Assert; import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
/** /**
@@ -43,77 +45,77 @@ public final class VersionTest
@Test @Test
public void testDevBuild() public void testDevBuild()
{ {
Assert.assertEquals( DO_NOT_CHECK_VERSION.formatted(), "dev build" ); assertThat( DO_NOT_CHECK_VERSION.formatted(), is( "dev build" ) );
} }
@Test @Test
public void testMissingBuild() public void testMissingBuild()
{ {
Assert.assertEquals( MISSING_VERSION.formatted(), "missing" ); assertThat( MISSING_VERSION.formatted(), is ( "missing" ) );
} }
@Test @Test
public void compareVersionToDoNotCheck() public void compareVersionToDoNotCheck()
{ {
Assert.assertFalse( DEFAULT_VERSION_RV2_ALPHA_8.isNewerAs( DO_NOT_CHECK_VERSION ) ); assertThat( DEFAULT_VERSION_RV2_ALPHA_8.isNewerAs( DO_NOT_CHECK_VERSION ), is( false ) );
Assert.assertTrue( DO_NOT_CHECK_VERSION.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ) ); assertThat( DO_NOT_CHECK_VERSION.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ), is( true ) );
} }
@Test @Test
public void compareVersionToMissingVersion() public void compareVersionToMissingVersion()
{ {
Assert.assertTrue( DEFAULT_VERSION_RV2_ALPHA_8.isNewerAs( MISSING_VERSION ) ); assertThat( DEFAULT_VERSION_RV2_ALPHA_8.isNewerAs( MISSING_VERSION ), is( true ) );
Assert.assertFalse( MISSING_VERSION.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ) ); assertThat( MISSING_VERSION.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ), is( false ) );
} }
@Test @Test
public void compareTwoDefaultVersions() public void compareTwoDefaultVersions()
{ {
Assert.assertTrue( DEFAULT_VERSION_RV2_BETA_8.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ) ); assertThat( DEFAULT_VERSION_RV2_BETA_8.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ), is( true ) );
Assert.assertTrue( DEFAULT_VERSION_RV4_ALPHA_1.isNewerAs( DEFAULT_VERSION_RV3_BETA_8 ) ); assertThat( DEFAULT_VERSION_RV4_ALPHA_1.isNewerAs( DEFAULT_VERSION_RV3_BETA_8 ), is( true ) );
Assert.assertTrue( DEFAULT_VERSION_RV2_BETA_9.isNewerAs( DEFAULT_VERSION_RV2_BETA_8 ) ); assertThat( DEFAULT_VERSION_RV2_BETA_9.isNewerAs( DEFAULT_VERSION_RV2_BETA_8 ), is( true ) );
} }
@Test @Test
public void testEqualsNonVersion() public void testEqualsNonVersion()
{ {
Assert.assertFalse( DEFAULT_VERSION_RV2_ALPHA_8.equals( new Object() ) ); assertThat( DEFAULT_VERSION_RV2_ALPHA_8, is( not( equalTo( new Object() ) ) ) );
} }
@Test @Test
public void testEqualsUnequalBuild() public void testEqualsUnequalBuild()
{ {
Assert.assertFalse( DEFAULT_VERSION_RV2_BETA_8.equals( DEFAULT_VERSION_RV2_BETA_9 ) ); assertThat( DEFAULT_VERSION_RV2_BETA_8, is( not( equalTo( DEFAULT_VERSION_RV2_BETA_9 ) ) ) );
} }
@Test @Test
public void testEqualsUnequalChannel() public void testEqualsUnequalChannel()
{ {
Assert.assertFalse( DEFAULT_VERSION_RV2_BETA_8.equals( DEFAULT_VERSION_RV2_ALPHA_8 ) ); assertThat( DEFAULT_VERSION_RV2_BETA_8, is( not( equalTo( DEFAULT_VERSION_RV2_ALPHA_8 ) ) ) );
} }
@Test @Test
public void testEqualsUnequalRevision() public void testEqualsUnequalRevision()
{ {
Assert.assertFalse( DEFAULT_VERSION_RV2_BETA_8.equals( DEFAULT_VERSION_RV3_BETA_8 ) ); assertThat( DEFAULT_VERSION_RV2_BETA_8, is( not( equalTo( DEFAULT_VERSION_RV3_BETA_8 ) ) ) );
} }
@Test @Test
public void testUnequalHash() public void testUnequalHash()
{ {
Assert.assertNotEquals( DEFAULT_VERSION_RV2_BETA_8.hashCode(), DEFAULT_VERSION_RV2_ALPHA_8.hashCode() ); assertThat( DEFAULT_VERSION_RV2_BETA_8.hashCode(), is( not( equalTo( DEFAULT_VERSION_RV2_ALPHA_8.hashCode() ) ) ) );
} }
@Test @Test
public void testToString() public void testToString()
{ {
Assert.assertEquals( DEFAULT_VERSION_RV2_BETA_8.toString(), "Version{revision=2, channel=Beta, build=8}" ); assertThat( DEFAULT_VERSION_RV2_BETA_8.toString(), is( "Version{revision=2, channel=Beta, build=8}" ) );
} }
@Test @Test
public void testFormatted() public void testFormatted()
{ {
Assert.assertEquals( DEFAULT_VERSION_RV2_BETA_8.formatted(), "rv2-beta-8" ); assertThat( DEFAULT_VERSION_RV2_BETA_8.formatted(), is( "rv2-beta-8" ) );
} }
} }
@@ -2,9 +2,11 @@
package appeng.util; package appeng.util;
import static org.junit.Assert.assertEquals; import org.junit.jupiter.api.Test;
import org.junit.Test; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
/* /*
@@ -72,75 +74,75 @@ public final class SlimReadableNumberConverterTest
private final ISlimReadableNumberConverter converter = ReadableNumberConverter.INSTANCE; private final ISlimReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
@Test( expected = AssertionError.class ) @Test
public void testConvertNeg999999() public void testConvertNeg999999()
{ {
assertEquals( RESULT_NEG_999999, this.converter.toSlimReadableForm( NUMBER_NEG_999999 ) ); assertThrows(AssertionError.class, () -> this.converter.toSlimReadableForm( NUMBER_NEG_999999 ) );
} }
@Test( expected = AssertionError.class ) @Test
public void testConvertNeg9999() public void testConvertNeg9999()
{ {
assertEquals( RESULT_NEG_9999, this.converter.toSlimReadableForm( NUMBER_NEG_9999 ) ); assertThrows(AssertionError.class, () -> this.converter.toSlimReadableForm( NUMBER_NEG_9999 ) );
} }
@Test( expected = AssertionError.class ) @Test
public void testConvertNeg999() public void testConvertNeg999()
{ {
assertEquals( RESULT_NEG_999, this.converter.toSlimReadableForm( NUMBER_NEG_999 ) ); assertThrows(AssertionError.class, () -> this.converter.toSlimReadableForm( NUMBER_NEG_999 ) );
} }
@Test @Test
public void testConvert0() public void testConvert0()
{ {
assertEquals( RESULT_0, this.converter.toSlimReadableForm( NUMBER_0 ) ); assertThat( RESULT_0, is( this.converter.toSlimReadableForm( NUMBER_0 ) ) );
} }
@Test @Test
public void testConvert999() public void testConvert999()
{ {
assertEquals( RESULT_999, this.converter.toSlimReadableForm( NUMBER_999 ) ); assertThat( RESULT_999, is( this.converter.toSlimReadableForm( NUMBER_999 ) ) );
} }
@Test @Test
public void testConvert9999() public void testConvert9999()
{ {
assertEquals( RESULT_9999, this.converter.toSlimReadableForm( NUMBER_9999 ) ); assertThat( RESULT_9999, is( this.converter.toSlimReadableForm( NUMBER_9999 ) ) );
} }
@Test @Test
public void testConvert10000() public void testConvert10000()
{ {
assertEquals( RESULT_10000, this.converter.toSlimReadableForm( NUMBER_10000 ) ); assertThat( RESULT_10000, is( this.converter.toSlimReadableForm( NUMBER_10000 ) ) );
} }
@Test @Test
public void testConvert10500() public void testConvert10500()
{ {
assertEquals( RESULT_10500, this.converter.toSlimReadableForm( NUMBER_10500 ) ); assertThat( RESULT_10500, is( this.converter.toSlimReadableForm( NUMBER_10500 ) ) );
} }
@Test @Test
public void testConvert155555() public void testConvert155555()
{ {
assertEquals( RESULT_155555, this.converter.toSlimReadableForm( NUMBER_155555 ) ); assertThat( RESULT_155555, is( this.converter.toSlimReadableForm( NUMBER_155555 ) ) );
} }
@Test @Test
public void testConvert9999999() public void testConvert9999999()
{ {
assertEquals( RESULT_9999999, this.converter.toSlimReadableForm( NUMBER_9999999 ) ); assertThat( RESULT_9999999, is( this.converter.toSlimReadableForm( NUMBER_9999999 ) ) );
} }
@Test @Test
public void testConvert10000000() public void testConvert10000000()
{ {
assertEquals( RESULT_10000000, this.converter.toSlimReadableForm( NUMBER_10000000 ) ); assertThat( RESULT_10000000, is( this.converter.toSlimReadableForm( NUMBER_10000000 ) ) );
} }
@Test @Test
public void testConvert155555555() public void testConvert155555555()
{ {
assertEquals( RESULT_155555555, this.converter.toSlimReadableForm( NUMBER_155555555 ) ); assertThat( RESULT_155555555, is( this.converter.toSlimReadableForm( NUMBER_155555555 ) ) );
} }
} }
@@ -19,10 +19,10 @@
package appeng.util; package appeng.util;
import static org.junit.Assert.assertFalse; import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertTrue;
import org.junit.Test; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
/** /**
@@ -44,18 +44,18 @@ public final class UUIDMatcherTest
@Test @Test
public void testUUID_shouldPass() public void testUUID_shouldPass()
{ {
assertTrue( this.matcher.isUUID( IS_UUID ) ); assertThat( this.matcher.isUUID( IS_UUID ), is( true ) );
} }
@Test @Test
public void testNoUUD_shouldPass() public void testNoUUD_shouldPass()
{ {
assertFalse( this.matcher.isUUID( NO_UUID ) ); assertThat( this.matcher.isUUID( NO_UUID ), is( false ) );
} }
@Test @Test
public void testInvalidUUID_shouldPass() public void testInvalidUUID_shouldPass()
{ {
assertFalse( this.matcher.isUUID( INVALID_UUID ) ); assertThat( this.matcher.isUUID( INVALID_UUID ), is( false ) );
} }
} }
@@ -19,9 +19,11 @@
package appeng.util; package appeng.util;
import static org.junit.Assert.assertEquals; import org.junit.jupiter.api.Test;
import org.junit.Test; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
/** /**
@@ -71,75 +73,75 @@ public final class WideReadableNumberConverterTest
private final IWideReadableNumberConverter converter = ReadableNumberConverter.INSTANCE; private final IWideReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
@Test( expected = AssertionError.class ) @Test
public void testConvertNeg999999() public void testConvertNeg999999()
{ {
assertEquals( RESULT_NEG_999999, this.converter.toWideReadableForm( NUMBER_NEG_999999 ) ); assertThrows( AssertionError.class, () -> this.converter.toWideReadableForm( NUMBER_NEG_999999 ) );
} }
@Test( expected = AssertionError.class ) @Test
public void testConvertNeg9999() public void testConvertNeg9999()
{ {
assertEquals( RESULT_NEG_9999, this.converter.toWideReadableForm( NUMBER_NEG_9999 ) ); assertThrows( AssertionError.class, () -> this.converter.toWideReadableForm( NUMBER_NEG_9999 ) );
} }
@Test( expected = AssertionError.class ) @Test
public void testConvertNeg999() public void testConvertNeg999()
{ {
assertEquals( RESULT_NEG_999, this.converter.toWideReadableForm( NUMBER_NEG_999 ) ); assertThrows( AssertionError.class, () -> this.converter.toWideReadableForm( NUMBER_NEG_999 ) );
} }
@Test @Test
public void testConvert0() public void testConvert0()
{ {
assertEquals( RESULT_0, this.converter.toWideReadableForm( NUMBER_0 ) ); assertThat( RESULT_0, is( this.converter.toWideReadableForm( NUMBER_0 ) ) );
} }
@Test @Test
public void testConvert999() public void testConvert999()
{ {
assertEquals( RESULT_999, this.converter.toWideReadableForm( NUMBER_999 ) ); assertThat( RESULT_999, is( this.converter.toWideReadableForm( NUMBER_999 ) ) );
} }
@Test @Test
public void testConvert9999() public void testConvert9999()
{ {
assertEquals( RESULT_9999, this.converter.toWideReadableForm( NUMBER_9999 ) ); assertThat( RESULT_9999, is( this.converter.toWideReadableForm( NUMBER_9999 ) ) );
} }
@Test @Test
public void testConvert10000() public void testConvert10000()
{ {
assertEquals( RESULT_10000, this.converter.toWideReadableForm( NUMBER_10000 ) ); assertThat( RESULT_10000, is( this.converter.toWideReadableForm( NUMBER_10000 ) ) );
} }
@Test @Test
public void testConvert10500() public void testConvert10500()
{ {
assertEquals( RESULT_10500, this.converter.toWideReadableForm( NUMBER_10500 ) ); assertThat( RESULT_10500, is( this.converter.toWideReadableForm( NUMBER_10500 ) ) );
} }
@Test @Test
public void testConvert155555() public void testConvert155555()
{ {
assertEquals( RESULT_155555, this.converter.toWideReadableForm( NUMBER_155555 ) ); assertThat( RESULT_155555, is( this.converter.toWideReadableForm( NUMBER_155555 ) ) );
} }
@Test @Test
public void testConvert9999999() public void testConvert9999999()
{ {
assertEquals( RESULT_9999999, this.converter.toWideReadableForm( NUMBER_9999999 ) ); assertThat( RESULT_9999999, is( this.converter.toWideReadableForm( NUMBER_9999999 ) ) );
} }
@Test @Test
public void testConvert10000000() public void testConvert10000000()
{ {
assertEquals( RESULT_10000000, this.converter.toWideReadableForm( NUMBER_10000000 ) ); assertThat( RESULT_10000000, is( this.converter.toWideReadableForm( NUMBER_10000000 ) ) );
} }
@Test @Test
public void testConvert155555555() public void testConvert155555555()
{ {
assertEquals( RESULT_155555555, this.converter.toWideReadableForm( NUMBER_155555555 ) ); assertThat( RESULT_155555555, is( this.converter.toWideReadableForm( NUMBER_155555555 ) ) );
} }
} }
@@ -18,13 +18,11 @@
package appeng.util.helpers; package appeng.util.helpers;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
public class P2PHelperTest public class P2PHelperTest
@@ -50,17 +48,17 @@ public class P2PHelperTest
@Test @Test
public void testToColors() public void testToColors()
{ {
assertArrayEquals( WHITE_COLORS, this.unitUnderTest.toColors( WHITE_FREQUENCY ) ); assertThat( WHITE_COLORS, is( this.unitUnderTest.toColors( WHITE_FREQUENCY ) ) );
assertArrayEquals( BLACK_COLORS, this.unitUnderTest.toColors( BLACK_FREQUENCY ) ); assertThat( BLACK_COLORS, is( this.unitUnderTest.toColors( BLACK_FREQUENCY ) ) );
assertArrayEquals( MULTI_COLORS, this.unitUnderTest.toColors( MULTI_FREQUENCY ) ); assertThat( MULTI_COLORS, is( this.unitUnderTest.toColors( MULTI_FREQUENCY ) ) );
} }
@Test @Test
public void testFromColors() public void testFromColors()
{ {
assertEquals( WHITE_FREQUENCY, this.unitUnderTest.fromColors( WHITE_COLORS ) ); assertThat( WHITE_FREQUENCY, is( this.unitUnderTest.fromColors( WHITE_COLORS ) ) );
assertEquals( BLACK_FREQUENCY, this.unitUnderTest.fromColors( BLACK_COLORS ) ); assertThat( BLACK_FREQUENCY, is( this.unitUnderTest.fromColors( BLACK_COLORS ) ) );
assertEquals( MULTI_FREQUENCY, this.unitUnderTest.fromColors( MULTI_COLORS ) ); assertThat( MULTI_FREQUENCY, is( this.unitUnderTest.fromColors( MULTI_COLORS ) ) );
} }
@Test @Test
@@ -68,40 +66,39 @@ public class P2PHelperTest
{ {
for( short i = Short.MIN_VALUE; i < Short.MAX_VALUE; i++ ) for( short i = Short.MIN_VALUE; i < Short.MAX_VALUE; i++ )
{ {
assertEquals( i, this.unitUnderTest.fromColors( this.unitUnderTest.toColors( i ) ) ); assertThat( i, is( this.unitUnderTest.fromColors( this.unitUnderTest.toColors( i ) ) ));
} }
} }
@Test @Test
public void testToHexDigit() public void testToHexDigit()
{ {
assertEquals( "0", this.unitUnderTest.toHexDigit( AEColor.WHITE ) ); assertThat( "0", is( this.unitUnderTest.toHexDigit( AEColor.WHITE ) ) );
assertEquals( "1", this.unitUnderTest.toHexDigit( AEColor.ORANGE ) ); assertThat( "1", is( this.unitUnderTest.toHexDigit( AEColor.ORANGE ) ) );
assertEquals( "2", this.unitUnderTest.toHexDigit( AEColor.MAGENTA ) ); assertThat( "2", is( this.unitUnderTest.toHexDigit( AEColor.MAGENTA ) ) );
assertEquals( "3", this.unitUnderTest.toHexDigit( AEColor.LIGHT_BLUE ) ); assertThat( "3", is( this.unitUnderTest.toHexDigit( AEColor.LIGHT_BLUE ) ) );
assertEquals( "4", this.unitUnderTest.toHexDigit( AEColor.YELLOW ) ); assertThat( "4", is( this.unitUnderTest.toHexDigit( AEColor.YELLOW ) ) );
assertEquals( "5", this.unitUnderTest.toHexDigit( AEColor.LIME ) ); assertThat( "5", is( this.unitUnderTest.toHexDigit( AEColor.LIME ) ) );
assertEquals( "6", this.unitUnderTest.toHexDigit( AEColor.PINK ) ); assertThat( "6", is( this.unitUnderTest.toHexDigit( AEColor.PINK ) ) );
assertEquals( "7", this.unitUnderTest.toHexDigit( AEColor.GRAY ) ); assertThat( "7", is( this.unitUnderTest.toHexDigit( AEColor.GRAY ) ) );
assertEquals( "8", this.unitUnderTest.toHexDigit( AEColor.LIGHT_GRAY ) ); assertThat( "8", is( this.unitUnderTest.toHexDigit( AEColor.LIGHT_GRAY ) ) );
assertEquals( "9", this.unitUnderTest.toHexDigit( AEColor.CYAN ) ); assertThat( "9", is( this.unitUnderTest.toHexDigit( AEColor.CYAN ) ) );
assertEquals( "A", this.unitUnderTest.toHexDigit( AEColor.PURPLE ) ); assertThat( "A", is( this.unitUnderTest.toHexDigit( AEColor.PURPLE ) ) );
assertEquals( "B", this.unitUnderTest.toHexDigit( AEColor.BLUE ) ); assertThat( "B", is( this.unitUnderTest.toHexDigit( AEColor.BLUE ) ) );
assertEquals( "C", this.unitUnderTest.toHexDigit( AEColor.BROWN ) ); assertThat( "C", is( this.unitUnderTest.toHexDigit( AEColor.BROWN ) ) );
assertEquals( "D", this.unitUnderTest.toHexDigit( AEColor.GREEN ) ); assertThat( "D", is( this.unitUnderTest.toHexDigit( AEColor.GREEN ) ) );
assertEquals( "E", this.unitUnderTest.toHexDigit( AEColor.RED ) ); assertThat( "E", is( this.unitUnderTest.toHexDigit( AEColor.RED ) ) );
assertEquals( "F", this.unitUnderTest.toHexDigit( AEColor.BLACK ) ); assertThat( "F", is( this.unitUnderTest.toHexDigit( AEColor.BLACK ) ) );
} }
@Test @Test
public void testToHexString() public void testToHexString()
{ {
assertEquals( HEX_WHITE_FREQUENCY, this.unitUnderTest.toHexString( WHITE_FREQUENCY ) ); assertThat( HEX_WHITE_FREQUENCY, is( this.unitUnderTest.toHexString( WHITE_FREQUENCY ) ) );
assertEquals( HEX_BLACK_FREQUENCY, this.unitUnderTest.toHexString( BLACK_FREQUENCY ) ); assertThat( HEX_BLACK_FREQUENCY, is( this.unitUnderTest.toHexString( BLACK_FREQUENCY ) ) );
assertEquals( HEX_MULTI_FREQUENCY, this.unitUnderTest.toHexString( MULTI_FREQUENCY ) ); assertThat( HEX_MULTI_FREQUENCY, is( this.unitUnderTest.toHexString( MULTI_FREQUENCY ) ) );
assertEquals( HEX_MIN_FREQUENCY, this.unitUnderTest.toHexString( Short.MIN_VALUE ) ); assertThat( HEX_MIN_FREQUENCY, is( this.unitUnderTest.toHexString( Short.MIN_VALUE ) ) );
assertEquals( HEX_MAX_FREQUENCY, this.unitUnderTest.toHexString( Short.MAX_VALUE ) ); assertThat( HEX_MAX_FREQUENCY, is( this.unitUnderTest.toHexString( Short.MAX_VALUE ) ) );
} }
} }