Skip to content
Open
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
18 changes: 17 additions & 1 deletion src/main/java/com/modrinth/minotaur/ModrinthExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
public class ModrinthExtension extends DependencyDSL {
private final AdditionalFileDSL additionalFileDsl;
private final Property<String> apiUrl, token, projectId, versionNumber, versionName, changelog, versionType, syncBodyFrom;
private final Property<String> apiUrl, token, projectId, versionNumber, versionName, changelog, versionType, syncBodyFrom, clientSide, serverSide;
private final Property<Object> legacyUploadFile;
private final RegularFileProperty file;
private final ListProperty<Object> additionalFiles;
Expand Down Expand Up @@ -70,6 +70,8 @@ public ModrinthExtension(Project project) {
debugMode = project.getObjects().property(Boolean.class).convention(false);
syncBodyFrom = project.getObjects().property(String.class);
autoAddDependsOn = project.getObjects().property(Boolean.class).convention(true);
clientSide = project.getObjects().property(String.class);
serverSide = project.getObjects().property(String.class);
}

public void additionalFiles(Action<? super AdditionalFileDSL> action) {
Expand Down Expand Up @@ -207,6 +209,20 @@ public Property<String> getSyncBodyFrom() {
return this.syncBodyFrom;
}

/**
* @return The client side environment setting (required, optional, unsupported, unknown)
*/
public Property<String> getClientSide() {
return this.clientSide;
}

/**
* @return The server side environment setting (required, optional, unsupported, unknown)
*/
public Property<String> getServerSide() {
return this.serverSide;
}

/**
* @return Whether to automatically add the `dependsOn` information for upload files
*/
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/com/modrinth/minotaur/TaskModrinthUpload.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ && getProject().getExtensions().findByName("loom") != null) {
ext.getAdditionalFileDsl().getNamedAdditionalFilesAsList().forEach(file ->
files.put(file.getFile().getAsFile(), file.getAdditionalFileType().toString()));

// Start construction of the actual request!
TemporaryCreateVersionRequest data = TemporaryCreateVersionRequest.builder()
TemporaryCreateVersionRequest.TemporaryCreateVersionRequestBuilder dataBuilder = TemporaryCreateVersionRequest.builder()
.projectId(id)
.versionNumber(versionNumber)
.name(ext.getVersionName().get())
Expand All @@ -242,12 +241,20 @@ && getProject().getExtensions().findByName("loom") != null) {
.gameVersions(ext.getGameVersions().get())
.loaders(ext.getLoaders().get())
.dependencies(dependencies)
.files(files)
.build();
.files(files);

if (ext.getClientSide().isPresent()) {
dataBuilder.clientSide(ext.getClientSide().get());
}
if (ext.getServerSide().isPresent()) {
dataBuilder.serverSide(ext.getServerSide().get());
}

TemporaryCreateVersionRequest data = dataBuilder.build();

// Return early in debug mode
if (ext.getDebugMode().get()) {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
Gson gson = new GsonBuilder().setFieldNamingPolicy(com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).setPrettyPrinting().create();
getLogger().lifecycle("Full data to be sent for upload: {}", gson.toJson(data));
getLogger().lifecycle("Minotaur debug mode is enabled. Not going to upload this version.");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ public static class TemporaryCreateVersionRequest {
/** The requested status of the project */
private ProjectStatus requestedStatus;

/** The client side environment support setting */
private String clientSide;

/** The server side environment support setting */
private String serverSide;

/** The project ID of the version */
@NonNull
private String projectId;
Expand Down