Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,27 @@ private ModPackResults processModpack(InstallContext context,
// ...does the modpack even say it's required?
.filter(ManifestFileRef::isRequired)
// ...is this mod file excluded because it is a client mod that didn't declare as such
.filter(manifestFileRef -> !excludeIncludeIds.getExcludeIds().contains(manifestFileRef.getProjectID()))
.filterWhen(manifestFileRef -> {
final int projectID = manifestFileRef.getProjectID();
final boolean exclude = excludeIncludeIds.getExcludeIds().contains(projectID);
final boolean forceInclude = excludeIncludeIds.getForceIncludeIds().contains(projectID);

log.debug("Evaluating projectId={} with exclude={} and forceInclude={}",
projectID, exclude, forceInclude
);

return Mono.just(forceInclude || !exclude)
.flatMap(proceed -> proceed ? Mono.just(true)
: context.cfApi.getModInfo(projectID)
.map(mod -> {
log.info("Excluding mod file '{}' ({}) due to configuration",
mod.getName(), mod.getSlug()
);
// and filter away
return false;
})
);
})
// ...download and possibly unzip world file
.flatMap(fileRef ->
downloadFileFromModpack(context, outputPaths,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
package me.itzg.helpers.curseforge;

import me.itzg.helpers.files.ResultsFileWriter;
import me.itzg.helpers.http.PathOrUri;
import me.itzg.helpers.http.PathOrUriConverter;
import me.itzg.helpers.http.SharedFetchArgs;
import me.itzg.helpers.json.ObjectMappers;
import picocli.CommandLine.ArgGroup;
import picocli.CommandLine.Command;
import picocli.CommandLine.ExitCode;
import picocli.CommandLine.Option;
import static me.itzg.helpers.http.Fetch.fetch;

import java.io.IOException;
import java.nio.file.Path;
Expand All @@ -18,8 +10,15 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static me.itzg.helpers.http.Fetch.fetch;
import me.itzg.helpers.files.ResultsFileWriter;
import me.itzg.helpers.http.PathOrUri;
import me.itzg.helpers.http.PathOrUriConverter;
import me.itzg.helpers.http.SharedFetchArgs;
import me.itzg.helpers.json.ObjectMappers;
import picocli.CommandLine.ArgGroup;
import picocli.CommandLine.Command;
import picocli.CommandLine.ExitCode;
import picocli.CommandLine.Option;

@Command(name = "install-curseforge", subcommands = {
SchemasCommand.class
Expand Down Expand Up @@ -90,18 +89,19 @@ static class ExcludeIncludeArgs {
+ "See README for schema.",
converter = PathOrUriConverter.class
)
PathOrUri exludeIncludeFile;
PathOrUri excludeIncludeFile;

static class Listed {
@Option(names = "--exclude-mods", paramLabel = "PROJECT_ID|SLUG",
split = "\\s+|,", splitSynopsisLabel = ",| ",
split = "\\s+|,", splitSynopsisLabel = ",|<ws>",
description = "For mods that need to be excluded from server deployments, such as those that don't label as client"
)
Set<String> excludedMods;

@Option(names = "--force-include-mods", paramLabel = "PROJECT_ID|SLUG",
split = "\\s+|,", splitSynopsisLabel = ",| ",
description = "Some mods incorrectly declare client-only support, but still need to be included in a server deploy"
split = "\\s+|,", splitSynopsisLabel = ",|<ws>",
description = "Some mods incorrectly declare client-only support, but still need to be included in a server deploy."
+ "%nThis can also be used to selectively override exclusions."
)
Set<String> forceIncludeMods;

Expand Down Expand Up @@ -194,7 +194,7 @@ public Integer call() throws Exception {

private ExcludeIncludesContent loadExcludeIncludes() throws IOException {
final ExcludeIncludesContent fromFile =
excludeIncludeArgs.exludeIncludeFile != null ? loadExcludeIncludesFile()
excludeIncludeArgs.excludeIncludeFile != null ? loadExcludeIncludesFile()
: null;

if (excludeIncludeArgs.listed != null) {
Expand Down Expand Up @@ -241,14 +241,14 @@ private Set<String> mergeSets(Set<String> s1, Set<String> s2) {
}

private ExcludeIncludesContent loadExcludeIncludesFile() throws IOException {
if (excludeIncludeArgs.exludeIncludeFile.getPath() != null) {
if (excludeIncludeArgs.excludeIncludeFile.getPath() != null) {
return ObjectMappers.defaultMapper()
.readValue(excludeIncludeArgs.exludeIncludeFile.getPath().toFile(),
.readValue(excludeIncludeArgs.excludeIncludeFile.getPath().toFile(),
ExcludeIncludesContent.class
);
}
else {
return fetch(excludeIncludeArgs.exludeIncludeFile.getUri())
return fetch(excludeIncludeArgs.excludeIncludeFile.getUri())
.toObject(ExcludeIncludesContent.class)
.acceptContentTypes(null)
.execute();
Expand Down