Skip to content

Commit

Permalink
cf: gracefully skip unsupport project file types, like resource packs
Browse files Browse the repository at this point in the history
  • Loading branch information
itzg committed Nov 29, 2024
1 parent f6ac245 commit db98741
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
19 changes: 12 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# 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"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
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;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,11 +728,6 @@ private Mono<PathWithInfo> processFile(InstallContext context, OutputSubdirResol
outputResult.isWorld(),
outputResult.getDir()
)
)
.switchIfEmpty(Mono.error(() -> new GenericException(
String.format("Unable to determine output location for file '%s' in '%s'",
cfFile.getDisplayName(), modInfo.getName()
)))
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package me.itzg.helpers.curseforge;

import java.nio.file.Path;
import java.util.concurrent.ConcurrentHashMap;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import me.itzg.helpers.curseforge.model.Category;
import me.itzg.helpers.curseforge.model.CurseForgeMod;
import me.itzg.helpers.errors.GenericException;
import me.itzg.helpers.files.ReactiveFileUtils;
import org.jetbrains.annotations.NotNull;
import reactor.core.publisher.Mono;

@Slf4j
public class OutputSubdirResolver {

private final CategoryInfo categoryInfo;
private final ConcurrentHashMap<String, Mono<Path>> subDirs
= new ConcurrentHashMap<>();
private final OutputPaths outputPaths;

public OutputSubdirResolver(Path outputDir, CategoryInfo categoryInfo) {
Expand All @@ -41,6 +39,9 @@ public Mono<Result> resolve(CurseForgeMod modInfo) {
final Category category = categoryInfo.contentClassIds.get(modInfo.getClassId());
// applicable category?
if (category == null) {
log.debug("Skipping output of project file '{}' (id={}) with class ID {}",
modInfo.getName(), modInfo.getId(), modInfo.getClassId()
);
return Mono.empty();
}

Expand All @@ -55,10 +56,7 @@ else if (category.getSlug().equals("worlds")) {
subDirMono = outputPaths.getWorldsDir();
}
else {
return Mono.error(
new GenericException(
String.format("Unsupported category type=%s from mod=%s", category.getSlug(), modInfo.getSlug()))
);
return Mono.empty();
}

return subDirMono
Expand Down

0 comments on commit db98741

Please sign in to comment.