Compare commits

...

17 commits

Author SHA1 Message Date
ENDERZOMBI102 de85222cbf fix(semver): Minecraft 1.20 crashing the semver parser
Minecraft doesn't use semver, and as such, sometimes it can cause problems, like in this case: `1.20` is not a valid semver version, but we must deal with it anyway, we've made the `<patch>` component optional, defaulting it to `0` if missing
2024-07-05 19:29:11 -04:00
moehreag 65ffe5a3e1 update phytotelma, fix a few bugs, exclude google libraries from mixin
All checks were successful
Publish to snapshot maven / build (push) Successful in 34s
2024-07-05 14:40:29 +02:00
Ecorous a0023d293a note to self: what is a brain
All checks were successful
Publish to snapshot maven / build (push) Successful in 42s
2024-07-04 14:44:36 -04:00
Ecorous 66a0392cbf Update Thyroxine
Some checks failed
Publish to snapshot maven / build (push) Has been cancelled
2024-07-04 14:43:52 -04:00
moehreag eb741b8b38 update thyroxine
Some checks failed
Publish to snapshot maven / build (push) Failing after 36s
2024-06-17 22:01:25 +02:00
moehreag 323ef735a6 include integrated (provided from game plugin) mod in dependency resolution
Some checks failed
Publish to snapshot maven / build (push) Failing after 2m14s
2024-06-17 21:20:14 +02:00
moehreag 58b75daa8b update thyroxine
All checks were successful
Publish to snapshot maven / build (push) Successful in 34s
2024-06-17 20:44:44 +02:00
moehreag de1c1bb744 clarify error string, update meta-update plugin
All checks were successful
Publish to snapshot maven / build (push) Successful in 37s
2024-06-17 20:35:59 +02:00
moehreag 66bd53ca71 update meta-update plugin, fix mod loading, update night-config
All checks were successful
Publish to snapshot maven / build (push) Successful in 40s
2024-06-17 18:54:06 +02:00
moehreag 0165161a9c fix null values in the provider map
All checks were successful
Publish to snapshot maven / build (push) Successful in 30s
2024-06-17 18:29:28 +02:00
Ecorous 511eb0c8b0
fix a silly - bump version
All checks were successful
Publish to snapshot maven / build (push) Successful in 34s
2024-06-17 17:19:56 +01:00
moehreag 37a08c62d5 update meta updating plugin to use updated route
Some checks failed
Publish to snapshot maven / build (push) Failing after 29s
2024-06-17 16:12:36 +02:00
moehreag c4f48e04bd update meta-update plugin
All checks were successful
Publish to snapshot maven / build (push) Successful in 31s
2024-06-17 15:39:57 +02:00
moehreag d2517c3b76 try to fix the workflow (x2)
Some checks failed
Publish to snapshot maven / build (push) Failing after 25s
2024-06-17 13:37:58 +02:00
moehreag 4ae48013f9 try to fix the workflow
Some checks failed
Publish to snapshot maven / build (push) Failing after 10s
2024-06-17 13:36:21 +02:00
moehreag bd0d3c2d47 [no-cache] clear workflow gradle cache
Some checks failed
Publish to snapshot maven / build (push) Failing after 15s
2024-06-17 13:29:50 +02:00
moehreag ab5a7c4d30 remove transitive rule for thyroxine
Some checks failed
Publish to snapshot maven / build (push) Failing after 18s
2024-06-17 13:25:46 +02:00
10 changed files with 43 additions and 22 deletions

View file

@ -19,7 +19,8 @@ jobs:
- name: Check Gradle Setup
run: |
chmod +x ./gradlew
cat ./settings.gradle.kts | sed "s/^.*:minecraft.*$//g" > settings.gradle.kts
cat ./settings.gradle.kts | sed "s/^.*:minecraft.*$//g" > settings.gradle.kts1
mv settings.gradle.kts1 settings.gradle.kts
- name: Build
run: |
./gradlew :publishMavenJavaPublicationToFrogMCSnapshotsMavenRepository \

View file

@ -3,11 +3,11 @@ plugins {
`java-library`
id("io.freefair.lombok") version "8.+"
`maven-publish`
id("dev.frogmc.meta-update") version "0.0.1-alpha.3"
id("dev.frogmc.meta-update") version "0.0.1-alpha.7"
}
group = "dev.frogmc"
version = "0.0.1-alpha.2"
version = "0.0.1-alpha.14"
repositories {
maven {
@ -24,14 +24,17 @@ repositories {
}
dependencies {
implementation(libs.thyroxine){
isTransitive = false
}
implementation(libs.thyroxine)
compileOnly("org.apache.logging.log4j:log4j-slf4j2-impl:2.22.1")
compileOnly("org.apache.logging.log4j:log4j-api:2.22.1")
compileOnly("org.apache.logging.log4j:log4j-core:2.22.1")
compileOnly("com.google.code.gson:gson:2.0")
compileOnly("com.google.guava:guava:21.0") // Lowest possible version for our code
api(libs.mixin)
api(libs.mixin) {
exclude(group = "com.google.code.gson")
exclude(group = "com.google.guava")
}
api(libs.mixinextras)
api(libs.nightconfig)
api(libs.annotations)

View file

@ -1,7 +1,7 @@
[versions]
thyroxine = "0.0.1-alpha.3"
nightconfig = "3.7.2"
thyroxine = "0.0.1-alpha.6"
nightconfig = "3.7.3"
mixin = "0.14.0+mixin.0.8.6"
annotations = "24.1.0"
mixinextras = "0.3.6"
@ -16,4 +16,4 @@ mixinextras = { module = "io.github.llamalad7:mixinextras-common", version.ref =
[bundles]
[plugins]
[plugins]

View file

@ -1,6 +1,6 @@
plugins {
java
id("dev.frogmc.phytotelma") version "0.0.1-alpha.10"
id("dev.frogmc.phytotelma") version "0.0.1-alpha.15"
}
repositories {
@ -20,7 +20,9 @@ dependencies {
}
phytotelma {
minecraft("1.21", "1.20.6")
minecraft {
version = "1.21"
}
}
java {

View file

@ -148,7 +148,7 @@ public class FrogLoaderImpl implements FrogLoader {
@Override
public Optional<ModProperties> getModProperties(String id) {
return mods.values().stream().flatMap(m -> m.values().stream()).filter(m -> m.id().equals(id)).findFirst();
return mods.values().stream().map(m -> m.get(id)).filter(Objects::nonNull).findFirst();
}
private Collection<String> collectModIds() {

View file

@ -1,7 +1,9 @@
package dev.frogmc.frogloader.impl;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.stream.Stream;
import dev.frogmc.frogloader.api.FrogLoader;
import dev.frogmc.frogloader.api.mod.ModProperties;
@ -24,7 +26,7 @@ public class PluginLoader {
List<ModProvider> providers = new ArrayList<>(ServiceLoader.load(ModProvider.class).stream().map(ServiceLoader.Provider::get).toList()); // we need mutability & random access
Map<String, Collection<ModProperties>> properties = new HashMap<>();
int[] size = new int[providers.size()]; // use a separate size variable to not have to iterate over the list over and over again
int[] size = new int[]{providers.size()}; // use a separate size variable to not have to iterate over the list over and over again
for (int i = 0; i < size[0]; i++) {
ModProvider plugin = providers.get(i); // use random access to work around concurrent access (through modifications during iteration)
LOGGER.debug("Found mod provider: {}", plugin.getClass().getName());
@ -33,6 +35,7 @@ public class PluginLoader {
}
try {
LOGGER.debug("Initialising mod provider: {}", plugin.id());
Files.createDirectories(gameDir.resolve(plugin.loadDirectory()));
Collection<ModProperties> loadedMods = plugin.loadMods(Discovery.find(gameDir.resolve(plugin.loadDirectory()),
plugin::isDirectoryApplicable,
plugin::isFileApplicable),
@ -47,12 +50,14 @@ public class PluginLoader {
providers.add(provider);
size[0]++;
}));
modProviders.add(plugin);
} catch (Throwable e) {
LOGGER.error("Error during plugin initialisation: ", e);
}
}
Collection<ModProperties> flattened = properties.values().stream().flatMap(Collection::stream).toList();
Collection<ModProperties> flattened = Stream.concat(properties.values().stream().flatMap(Collection::stream),
mods.values().stream().map(Map::values).flatMap(Collection::stream)).toList();
try {
Collection<ModProperties> solved = new ModDependencyResolver(flattened).solve();
properties.forEach((s, c) -> c.retainAll(solved));
@ -61,7 +66,6 @@ public class PluginLoader {
c.forEach(p -> map.put(p.id(), p));
});
modIds.addAll(solved.stream().map(ModProperties::id).toList());
modProviders.addAll(providers);
} catch (ModDependencyResolver.UnfulfilledDependencyException e) {
LoaderGui.execUnfulfilledDep(CrashReportGenerator.writeReport(e, flattened), e, false);
} catch (ModDependencyResolver.BreakingModException e) {

View file

@ -4,6 +4,6 @@ import java.io.IOException;
public class SemVerParseException extends IOException {
public SemVerParseException(String message) {
super("Failed to parse SemVer: " + message);
super("Failed to parse SemVer: `" + message + "`");
}
}

View file

@ -35,7 +35,7 @@ public class UnfulfilledDepPage extends JScrollPane {
} else {
description.append("a Mod with id ").append(entry.dependency());
}
description.append(" with a version matching range:\n").append(entry.range().toString(" or ")).append("\nNo version is currently available.");
description.append(" with a version matching range:\n").append(entry.range().toString(" or ")).append("\nNo matching version is currently available.");
}
description.append("\nSuggested Solution: Install ")
.append(

View file

@ -15,7 +15,14 @@ public class ModUtil {
return "No mods loaded.";
}
Map<String, ModProperties> modIdMap = mods.stream().collect(Collectors.toMap(ModProperties::id, m -> m));
Map<String, ModProperties> modIdMap = new HashMap<>();
for (ModProperties p : mods) {
if (!modIdMap.containsKey(p.id()) || modIdMap.get(p.id()).version().compareTo(p.version()) < 0) {
modIdMap.put(p.id(), p);
}
}
AtomicInteger indent = new AtomicInteger(1);
Map<ModProperties, Collection<String>> parentToChildIdMap = getParentMods(mods);
Collection<String> containedIds = parentToChildIdMap.values().stream().flatMap(Collection::stream).collect(Collectors.toUnmodifiableSet());

View file

@ -9,12 +9,14 @@ import java.util.regex.Pattern;
import dev.frogmc.frogloader.api.mod.SemVer;
import dev.frogmc.frogloader.impl.SemVerParseException;
import lombok.NonNull;
import lombok.SneakyThrows;
import org.jetbrains.annotations.Nullable;
public record SemVerImpl(int major, int minor, int patch, String prerelease, String build) implements SemVer {
// Adapted from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
private static final Pattern SEMVER_PATTERN = Pattern.compile("^(?<major>0|[1-9]\\d*)\\." +
"(?<minor>0|[1-9]\\d*)\\." +
"(?<patch>0|[1-9]\\d*)" +
"(?<minor>0|[1-9]\\d*)" +
"(\\.(?<patch>0|[1-9]\\d*))?" +
"(?:-(?<prerelease>(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)" +
"(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?" +
"(?:\\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$");
@ -27,7 +29,9 @@ public record SemVerImpl(int major, int minor, int patch, String prerelease, Str
int major = Integer.parseInt(matcher.group("major"));
int minor = Integer.parseInt(matcher.group("minor"));
int patch = Integer.parseInt(matcher.group("patch"));
// minecraft treats the `patch` component as optional...
@Nullable String patchString = matcher.group("patch");
int patch = patchString == null ? 0 : Integer.parseInt(matcher.group("patch"));
String prerelease = matcher.group("prerelease");
String buildmetadata = matcher.group("buildmetadata");
return new SemVerImpl(major, minor, patch, prerelease, buildmetadata);